Rollup of fixes for MSVC and CMake build.
With these changes iree-translate can build with Clang and MSVC through CMake!
There's still some cleanup required for ALWAYSLINK in the CMake rules however this is enough to at least verify we can build and start setting up CI.
Progress on issue #6.
PiperOrigin-RevId: 272693901
diff --git a/build_tools/cmake/iree_tablegen_library.cmake b/build_tools/cmake/iree_tablegen_library.cmake
index 2e0a862..705e214 100644
--- a/build_tools/cmake/iree_tablegen_library.cmake
+++ b/build_tools/cmake/iree_tablegen_library.cmake
@@ -19,28 +19,28 @@
# Runs iree-tablegen to produce some artifacts.
function(iree_tablegen_library)
cmake_parse_arguments(
- IREE_TBLGEN_LIB
+ _RULE
"TESTONLY"
"NAME"
"SRCS;OUTS"
${ARGN}
)
- if(NOT IREE_TBLGEN_LIB_TESTONLY OR IREE_BUILD_TESTS)
+ if(NOT _RULE_TESTONLY OR IREE_BUILD_TESTS)
# Prefix the library with the package name, so we get: iree_package_name
iree_package_name(_PACKAGE_NAME)
- set(_NAME "${_PACKAGE_NAME}_${IREE_TBLGEN_LIB_NAME}")
+ set(_NAME "${_PACKAGE_NAME}_${_RULE_NAME}")
- set(LLVM_TARGET_DEFINITIONS ${IREE_TBLGEN_LIB_SRCS})
+ set(LLVM_TARGET_DEFINITIONS ${_RULE_SRCS})
set(_INCLUDE_DIRS ${IREE_COMMON_INCLUDE_DIRS})
list(APPEND _INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
list(TRANSFORM _INCLUDE_DIRS PREPEND "-I")
set(_OUTPUTS)
- while(IREE_TBLGEN_LIB_OUTS)
- list(GET IREE_TBLGEN_LIB_OUTS 0 _COMMAND)
- list(REMOVE_AT IREE_TBLGEN_LIB_OUTS 0)
- list(GET IREE_TBLGEN_LIB_OUTS 0 _FILE)
- list(REMOVE_AT IREE_TBLGEN_LIB_OUTS 0)
+ while(_RULE_OUTS)
+ list(GET _RULE_OUTS 0 _COMMAND)
+ list(REMOVE_AT _RULE_OUTS 0)
+ list(GET _RULE_OUTS 0 _FILE)
+ list(REMOVE_AT _RULE_OUTS 0)
tablegen(MLIR ${_FILE} ${_COMMAND} ${_INCLUDE_DIRS})
list(APPEND _OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${_FILE})
endwhile()
@@ -52,6 +52,6 @@
# Alias the iree_package_name library to iree::package::name.
iree_package_ns(_PACKAGE_NS)
- add_library(${_PACKAGE_NS}::${IREE_TBLGEN_LIB_NAME} ALIAS ${_NAME})
+ add_library(${_PACKAGE_NS}::${_RULE_NAME} ALIAS ${_NAME})
endif()
endfunction()