|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index ea1da5e..0a6f096 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -100,7 +100,7 @@ if (BUILD_PYTHON_INTERFACE OR BUILD_MATLAB_INTERFACE) |
| 6 | + include(FetchContent) |
| 7 | + FetchContent_Declare( |
| 8 | + cpu_features |
| 9 | +- URL https://github.com/google/cpu_features/archive/refs/tags/v0.9.0.zip |
| 10 | ++ DOWNLOAD_COMMAND true |
| 11 | + ) |
| 12 | + set(BUILD_SHARED_LIBS_COPY ${BUILD_SHARED_LIBS}) |
| 13 | + set(BUILD_SHARED_LIBS OFF) |
| 14 | +diff --git a/interfaces/c/tests/CMakeLists.txt b/interfaces/c/tests/CMakeLists.txt |
| 15 | +index 010f038..c8f9ec4 100644 |
| 16 | +--- a/interfaces/c/tests/CMakeLists.txt |
| 17 | ++++ b/interfaces/c/tests/CMakeLists.txt |
| 18 | +@@ -13,18 +13,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") |
| 19 | + endif() |
| 20 | + |
| 21 | + # Google Test |
| 22 | +-include(FetchContent) |
| 23 | +-FetchContent_Declare( |
| 24 | +- googletest |
| 25 | +- URL https://github.com/google/googletest/archive/86add13493e5c881d7e4ba77fb91c1f57752b3a4.zip |
| 26 | +-) |
| 27 | +-# For Windows: Prevent overriding the parent project's compiler/linker settings |
| 28 | +-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 29 | +-FetchContent_GetProperties(googletest) |
| 30 | +-if(NOT googletest_POPULATED) |
| 31 | +- FetchContent_Populate(googletest) |
| 32 | +- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) |
| 33 | +-endif() |
| 34 | ++# Use find_package to use the gtest package provided by Nix |
| 35 | ++find_package(GTest REQUIRED) |
| 36 | + |
| 37 | + enable_testing() |
| 38 | + |
| 39 | +diff --git a/interfaces/python/CMakeLists.txt b/interfaces/python/CMakeLists.txt |
| 40 | +index f7415dc..885aeff 100644 |
| 41 | +--- a/interfaces/python/CMakeLists.txt |
| 42 | ++++ b/interfaces/python/CMakeLists.txt |
| 43 | +@@ -14,19 +14,7 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") |
| 44 | + endif() |
| 45 | + |
| 46 | + # Find pybind11 |
| 47 | +-include(FetchContent) |
| 48 | +-FetchContent_Declare( |
| 49 | +- pybind11 |
| 50 | +- URL https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.zip |
| 51 | +-) |
| 52 | +-FetchContent_MakeAvailable(pybind11) |
| 53 | +- |
| 54 | +-# detect arm64 cross compilation on macOS |
| 55 | +-if(DEFINED ENV{_PYTHON_HOST_PLATFORM}) |
| 56 | +- if($ENV{_PYTHON_HOST_PLATFORM} MATCHES "arm64") |
| 57 | +- set(CMAKE_SYSTEM_PROCESSOR "arm64") |
| 58 | +- endif() |
| 59 | +-endif() |
| 60 | ++find_package(pybind11 REQUIRED) |
| 61 | + |
| 62 | + # add instruction set detection on x86/amd64 |
| 63 | + pybind11_add_module(instruction_set src/instruction_set.cpp) |
| 64 | +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt |
| 65 | +index d11bd37..2275a62 100644 |
| 66 | +--- a/tests/CMakeLists.txt |
| 67 | ++++ b/tests/CMakeLists.txt |
| 68 | +@@ -14,18 +14,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") |
| 69 | + endif() |
| 70 | + |
| 71 | + # Google Test |
| 72 | +-include(FetchContent) |
| 73 | +-FetchContent_Declare( |
| 74 | +- googletest |
| 75 | +- URL https://github.com/google/googletest/archive/86add13493e5c881d7e4ba77fb91c1f57752b3a4.zip |
| 76 | +-) |
| 77 | +-# For Windows: Prevent overriding the parent project's compiler/linker settings |
| 78 | +-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 79 | +-FetchContent_GetProperties(googletest) |
| 80 | +-if(NOT googletest_POPULATED) |
| 81 | +- FetchContent_Populate(googletest) |
| 82 | +- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) |
| 83 | +-endif() |
| 84 | ++# Use find_package to use the gtest package provided by Nix |
| 85 | ++find_package(GTest REQUIRED) |
| 86 | + |
| 87 | + enable_testing() |
| 88 | + |
0 commit comments