Fix release runtime package.#9118
Conversation
When the runtime path was flattened, the install locations were not updated to line up. They were also going through a really old macro that had outlived its usefulness. Just added corrected, explicit install() calls. Also fixed a typo in the build_linux_packages.sh script noticed when trying to build just one python version to test. It is now possible to test/repo this exactly as the CI does: ``` override_python_versions=cp39-cp39 packages=iree-runtime ./build_tools/python_deploy/build_linux_packages.sh pip install build_tools/python_deploy/wheelhouse/iree_runtime-0.dev0+4020b408be725b54b0266a2a9c3388b5c704ced4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl python runtime/bindings/python/tests/array_interop_test.py iree-run-module ``` Fixes iree-org#9108
| # Install tools into python_packages/iree_runtime/iree/runtime | ||
| install( | ||
| TARGETS | ||
| iree_tools_iree-benchmark-module | ||
| iree_tools_iree-benchmark-trace | ||
| iree_tools_iree-run-module | ||
| iree_tools_iree-run-trace |
There was a problem hiding this comment.
FYI I tried to shuffle around the directory include order here https://github.com/google/iree/blob/66e48077386d347cf9113d15f332c8b14fd526bd/CMakeLists.txt#L693-L701
to include runtime/ first, then tools/, but I ran into issues with this block of code (#9084 (comment))
CMake Error at runtime/bindings/python/CMakeLists.txt:196 (install):
install TARGETS given target "iree_tools_iree-benchmark-module" which does
not exist.
There was a problem hiding this comment.
Yeah: Most things in CMake don't have that problem, but unfortunately, install() targets must exist at the time of configure. Open to suggestions.
The nuclear option is: https://cmake.org/cmake/help/latest/command/cmake_language.html#deferring-calls
(could just defer these to the end of the project directory)
There was a problem hiding this comment.
My first thought was to have a section at the bottom of tools/CMakeLists.txt that would either directly set up the python installs, or include() a runtime/bindings/python/tools/CMakeLists.txt (that isn't included transitively by including runtime/) - basically deferred calls, but with code sprinkled across a few different files
There was a problem hiding this comment.
Actually, this might be an appropriate use of the nuclear option:
install(
TARGETS
iree_tools_iree-benchmark-module
iree_tools_iree-benchmark-trace
iree_tools_iree-run-module
iree_tools_iree-run-trace
${_EXTRA_INSTALL_TOOL_TARGETS}
DESTINATION "${_INSTALL_DIR}/iree/runtime"
COMPONENT "${_INSTALL_COMPONENT}"
)
Becomes:
cmake_language(DEFER DIRECTORY "${IREE_SOURCE_DIR}"
CALL install
TARGETS
iree_tools_iree-benchmark-module
iree_tools_iree-benchmark-trace
iree_tools_iree-run-module
iree_tools_iree-run-trace
${_EXTRA_INSTALL_TOOL_TARGETS}
DESTINATION "${_INSTALL_DIR}/iree/runtime"
COMPONENT "${_INSTALL_COMPONENT}"
)
The cmake_language defer stuff is relatively terrifying. Someone seems to have been compelled to turn it into an RPC primitive... but this usage isn't too bad.

When the runtime path was flattened, the install locations were not
updated to line up. They were also going through a really old macro that
had outlived its usefulness. Just added corrected, explicit install()
calls. Also fixed a typo in the build_linux_packages.sh script noticed
when trying to build just one python version to test.
It is now possible to test/repo this exactly as the CI does:
Fixes #9108