Adress comments
diff --git a/CMakeLists.txt b/CMakeLists.txt index b14a4dc..d46b6dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -51,7 +51,10 @@ CACHE STRING "Semicolon-separated list of HAL drivers to build, or \"all\"." FORCE) set(IREE_TARGET_BACKENDS_TO_BUILD "all" CACHE STRING "Semicolon-separated list of target backends to build, or \"all\"." FORCE) -# LINT.ThenChange(https://github.com/google/iree/tree/master/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_options) +# LINT.ThenChange( +# https://github.com/google/iree/tree/master/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_options, +# https://github.com/google/iree/tree/master/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_invoke +# ) if(${IREE_BUILD_SAMPLES} OR ${IREE_BUILD_EXPERIMENTAL}) set(IREE_BUILD_COMPILER ON CACHE BOOL "Build the IREE compiler for sample projects." FORCE) @@ -149,7 +152,9 @@ # Master configuration for the binary directory containing all artifacts # compiled for host. - set(IREE_HOST_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/host") + if(NOT IREE_HOST_BINARY_ROOT) + set(IREE_HOST_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/host" CACHE FILEPATH "directory containing host artifacts") + endif() set(IREE_HOST_BUILD_COMPILER ON) # For iree-translate set(IREE_HOST_ENABLE_LLVM ON) # For iree-tblgen
diff --git a/build_tools/cmake/iree_cross_compile.cmake b/build_tools/cmake/iree_cross_compile.cmake index 4b5e3df..2568abd 100644 --- a/build_tools/cmake/iree_cross_compile.cmake +++ b/build_tools/cmake/iree_cross_compile.cmake
@@ -20,11 +20,11 @@ # configuration means a new IREE CMake invocation with its own set of # parameters. # -# This function defines two custom target, `iree_prepare_${CONFIG_NAME}_dir` -# and `iree_configure_${CONFIG_NAME}`, to drive the creation of a directory -# for hosting the new IREE configuration and its corresponding `CMakeCache.txt` -# file, respectively. Callers can then depend on either the file or the -# target to make sure the configuration is invoked as a dependency. +# This function defines a custom target, `iree_configure_${CONFIG_NAME}`, +# to drive the generation of a new IREE configuration's `CMakeCache.txt` +# file. Callers can then depend on either the `CMakeCache.txt` file or the +# `iree_configure_${CONFIG_NAME}` target to make sure the configuration +# is invoked as a dependency. # # This function is typically useful when cross-compiling towards another # architecture. For example, when cross-compiling towards Android, we need @@ -91,7 +91,10 @@ # spaces. string(REPLACE ";" "$<SEMICOLON>" _CONFIG_HAL_DRIVERS_TO_BUILD "${IREE_HAL_DRIVERS_TO_BUILD}") string(REPLACE ";" "$<SEMICOLON>" _CONFIG_TARGET_BACKENDS_TO_BUILD "${IREE_TARGET_BACKENDS_TO_BUILD}") - # LINT.ThenChange(https://github.com/google/iree/tree/master/CMakeLists.txt:iree_options) + # LINT.ThenChange( + # https://github.com/google/iree/tree/master/CMakeLists.txt:iree_options, + # https://github.com/google/iree/tree/master/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_invoke + # ) message(STATUS "C compiler for ${CONFIG_NAME} build: ${_CONFIG_C_COMPILER}") message(STATUS "C++ compiler for ${CONFIG_NAME} build: ${_CONFIG_CXX_COMPILER}") @@ -102,6 +105,7 @@ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_C_COMPILER="${_CONFIG_C_COMPILER}" -DCMAKE_CXX_COMPILER="${_CONFIG_CXX_COMPILER}" + # LINT.IfChange(iree_cross_compile_invoke) -DIREE_ENABLE_RUNTIME_TRACING=${_CONFIG_ENABLE_RUNTIME_TRACING} -DIREE_ENABLE_MLIR=${_CONFIG_ENABLE_MLIR} -DIREE_ENABLE_EMITC=${_CONFIG_ENABLE_EMITC} @@ -112,6 +116,10 @@ -DIREE_BUILD_DEBUGGER=${_CONFIG_BUILD_DEBUGGER} -DIREE_BUILD_PYTHON_BINDINGS=${_CONFIG_BUILD_PYTHON_BINDINGS} -DIREE_BUILD_EXPERIMENTAL=${_CONFIG_BUILD_EXPERIMENTAL} + # LINT.ThenChange( + # https://github.com/google/iree/tree/master/CMakeLists.txt:iree_options, + # https://github.com/google/iree/tree/master/build_tools/cmake/iree_cross_compile.cmake:iree_cross_compile_options, + # ) -DIREE_HAL_DRIVERS_TO_BUILD="${_CONFIG_HAL_DRIVERS_TO_BUILD}" -DIREE_TARGET_BACKENDS_TO_BUILD="${_CONFIG_TARGET_BACKENDS_TO_BUILD}" WORKING_DIRECTORY ${_CONFIG_BINARY_ROOT}
diff --git a/build_tools/cmake/iree_macros.cmake b/build_tools/cmake/iree_macros.cmake index 6e4602b..7b27392 100644 --- a/build_tools/cmake/iree_macros.cmake +++ b/build_tools/cmake/iree_macros.cmake
@@ -90,9 +90,9 @@ # iree_get_executable_path # -# Gets the path to an executable in a cross-compilation-aware way. This is -# meant to be used for binaries that are used to generate source files and -# can only be built on host. +# Gets the path to an executable in a cross-compilation-aware way. This +# should be used when accessing binaries that are used as part of the build, +# such as for generating files used for later build steps. # # Paramters: # - OUTPUT_PATH_VAR: variable name for receiving the path to the built target. @@ -210,9 +210,9 @@ # iree_add_executable_dependencies # -# Adds dependency to a target in a cross-compilation-aware way. This is meant -# to be used for dependencies that are used to generate source files and can -# only be built on host. +# Adds dependency on a target in a cross-compilation-aware way. This should +# be used for depending on targets that are used as part of the build, such +# as for generating files used for later build steps. # # Parameters: # TARGET: the target to take on dependencies