Skip to content

[cmake] Enable building tests when cross compiling - #2354

Merged
antiagainst merged 2 commits into
iree-org:mainfrom
antiagainst:cross-cmake-tests
Jun 29, 2020
Merged

antiagainst merged 2 commits into
iree-org:mainfrom
antiagainst:cross-cmake-tests

Conversation

@antiagainst

Copy link
Copy Markdown
Member

This commit enables -DIREE_BUILD_TESTS=ON when invoking CMake
with a toolchain file. Now we can compile non-host-only tests
towards, e.g., ARM for Android.

This commit also enables cross-compiling iree-benchmark-module.

This commit enables -DIREE_BUILD_TESTS=ON when invoking CMake
with a toolchain file. Now we can compile non-host-only tests
towards, e.g., ARM for Android.

This commit also enables cross-compiling iree-benchmark-module.
Comment on lines +124 to +132
The tricky part is to set up target artifacts' dependencies on host executables.
Normally in CMake we define targets and `target_link_libraries` to express the
dependency relationship between targets. The optimal way is to [`export`](https://cmake.org/cmake/help/latest/command/export.html)
targets under host configuration and then [`import`](https://cmake.org/cmake/help/latest/command/add_executable.html?highlight=import#imported-executables)
into target configuration. But that is not playing well with LLVM's TableGen
configurations. LLVM's cross-compilation uses on files for dependencies. So
here we need to do the same. This results in reverting the relationship between
IREE artifact output names (e.g., `iree-translate`) and IREE package-prefixed
CMake target names (e.g., `iree_tools_iree-translate`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good details, but a bit worried that they are more developer-oriented (for anyone maintaining IREE's CMake macros themselves).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I feel we need another doc to describe the logic behind build systems. Tracked by #2111. I'll add a TODO here to move after we have such a doc.

more toolchain arguments.
* Building IREE compilers, tests, and samples for Android is not supported at
* Building IREE compilers and samples for Android is not supported at
the moment; they will be enabled soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually plan on getting the compiler (and LLVM) building for Android? Are we going to use that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. :) Not immediately for IREE; but I can envision that projects might want to reuse IREE compilers to do online conversion. :)

@antiagainst
antiagainst merged commit 0c417da into iree-org:main Jun 29, 2020
@antiagainst
antiagainst deleted the cross-cmake-tests branch June 29, 2020 23:36
This was referenced Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants