Repository navigation
[cmake] Enable building tests when cross compiling - #2354
Merged
Merged
Conversation
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.
antiagainst
force-pushed
the
cross-cmake-tests
branch
from
June 29, 2020 20:30
2c8d429 to
76938b3
Compare
ScottTodd
approved these changes
Jun 29, 2020
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`). |
Member
There was a problem hiding this comment.
Good details, but a bit worried that they are more developer-oriented (for anyone maintaining IREE's CMake macros themselves).
Member
Author
There was a problem hiding this comment.
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. |
Member
There was a problem hiding this comment.
Do we actually plan on getting the compiler (and LLVM) building for Android? Are we going to use that?
Member
Author
There was a problem hiding this comment.
Maybe. :) Not immediately for IREE; but I can envision that projects might want to reuse IREE compilers to do online conversion. :)
antiagainst
force-pushed
the
cross-cmake-tests
branch
from
June 29, 2020 23:09
89d0148 to
acb074a
Compare
This was referenced Jun 30, 2020
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.