diff options
author | Benoit Jacob <benoitjacob@google.com> | 2021-01-21 01:04:41 +0300 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2021-01-21 01:05:04 +0300 |
commit | d65bcd7add7b5e7587355e4301c1b8ce335a877a (patch) | |
tree | e976cfe508a5cbe11dc5d8aecbedadc935ce3b00 /CMakeLists.txt | |
parent | c200f59184b6d0bda940aadfbaafa957a72f291c (diff) |
Fixes for builds in open source projects with cpuinfo and googletest deps.
- Following XNNPACK's example, in CMakeLists.txt, skip including our own
third_party/ directories if the target is already defined. This means that
IREE embedding ruy as a third_party/ dep does not need to have its
submodules checked out, ruy can use IREE's own cpuinfo and googletest.
- Switch open-source builds to using the stripped-include-paths flavor
of cpuinfo (like IREE is already using).
PiperOrigin-RevId: 352871140
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6577dd8..e0f24b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,13 +30,18 @@ include(cmake/ruy_cc_library.cmake) include(cmake/ruy_cc_binary.cmake) include(cmake/ruy_cc_test.cmake) -# Disabling cpuinfo's tests and benchmarks to prevent a copy of its -# googletest dependency getting downloaded into a 'deps' directory in the -# source tree! -set(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE) -set(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "" FORCE) -set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "" FORCE) -add_subdirectory("third_party/cpuinfo" EXCLUDE_FROM_ALL) -add_subdirectory("third_party/googletest" EXCLUDE_FROM_ALL) +if (NOT TARGET cpuinfo) + # Disabling cpuinfo's tests and benchmarks to prevent a copy of its + # googletest dependency getting downloaded into a 'deps' directory in the + # source tree! + set(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE) + set(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "" FORCE) + set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "" FORCE) + add_subdirectory("third_party/cpuinfo" EXCLUDE_FROM_ALL) +endif() + +if (NOT TARGET gtest) + add_subdirectory("third_party/googletest" EXCLUDE_FROM_ALL) +endif() ruy_add_all_subdirs() |