Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runtime] Detect and keep iree-compile up to date #7

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions runtime/cmake/quidditch_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ find_program(IREE_COMPILE_PATH iree-compile
DOC "Path to the build directory of <root>/codegen"
)
message(STATUS "Using iree-compile at ${IREE_COMPILE_PATH}")
if (IREE_COMPILE_PATH MATCHES "iree-configuration/iree/tools/iree-compile$")
string(LENGTH "/iree-configuration/iree/tools/iree-compile" length_suffix)
string(LENGTH ${IREE_COMPILE_PATH} length_path)
math(EXPR length "${length_path} - ${length_suffix}")
string(SUBSTRING ${IREE_COMPILE_PATH} 0 ${length} maybe_build_dir)
if (EXISTS "${maybe_build_dir}/CMakeCache.txt")
message(STATUS "Detected iree-compile within another cmake build")
# This makes the assumption that the other cmake build uses the same cmake
# executable.
add_custom_target(iree-keep-up-to-date
BYPRODUCTS ${IREE_COMPILE_PATH}
COMMAND ${CMAKE_COMMAND} --build ${maybe_build_dir} --target iree-compile
COMMENT "Updating iree-compile"
USES_TERMINAL
)
endif ()
endif ()

find_package(Python3 REQUIRED)
cmake_path(GET Python3_EXECUTABLE PARENT_PATH python_bin_dir)
Expand Down