From c3bad58f0121e06ba9772758efd16433bb9e6252 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Sat, 16 Sep 2023 18:28:15 +1000 Subject: [PATCH 1/4] cpu_features: Update submodule pointer and new CMake target name - Update cpu_features to v0.9.0 - Added BUILD_EXECUTABLE for cpu_features to build list_cpu_features for github workflow tests - Added ENABLE_INSTALL to install cpu_feature for old behaviour - Renamed CpuFeature -> CpuFeatures to match new name Signed-off-by: Ashley Brighthope --- .github/workflows/run-tests.yml | 8 ++++---- CMakeLists.txt | 1 + cpu_features | 2 +- lib/CMakeLists.txt | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1b7024d1f..ce318d2a4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -44,7 +44,7 @@ jobs: env: CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - run: mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-Werror" .. + run: mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EXECUTABLE=ON .. - name: Build run: | echo "Build with $(nproc) thread(s)" @@ -150,7 +150,7 @@ jobs: run: | cd /volk cd build - cmake -DCMAKE_CXX_FLAGS="-Werror" .. + cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EXECUTABLE=ON .. echo "Build with $(nproc) thread(s)" make -j$(nproc) ./cpu_features/list_cpu_features @@ -173,7 +173,7 @@ jobs: - name: dependencies run: sudo apt install python3-mako liborc-dev - name: configure - run: mkdir build && cd build && cmake -DENABLE_STATIC_LIBS=True .. + run: mkdir build && cd build && cmake -DENABLE_STATIC_LIBS=True -DBUILD_EXECUTABLE=ON .. - name: build run: cmake --build build -j$(nproc) - name: Print info @@ -248,7 +248,7 @@ jobs: - name: dependencies run: pip3 install mako - name: configure - run: mkdir build && cd build && cmake .. + run: mkdir build && cd build && cmake -DBUILD_EXECUTABLE=ON .. - name: build run: cmake --build build --config Debug -j3 - name: Print info diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d5097fa..bbf1e2f56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ if (VOLK_CPU_FEATURES) FORCE) set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}") set(BUILD_SHARED_LIBS OFF) + set(ENABLE_INSTALL ON) add_subdirectory(cpu_features) set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}") endif() diff --git a/cpu_features b/cpu_features index 41e206e43..ba4bffa86 160000 --- a/cpu_features +++ b/cpu_features @@ -1 +1 @@ -Subproject commit 41e206e435b3c84a6fdd937dfe2a07e8ee73e611 +Subproject commit ba4bffa86cbb5456bdb34426ad22b9551278e2c0 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f2d6b7e7c..b5b165fe6 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -548,7 +548,7 @@ endif() add_library(volk SHARED $) target_link_libraries(volk PUBLIC ${volk_libraries}) if(VOLK_CPU_FEATURES) - target_link_libraries(volk PRIVATE CpuFeature::cpu_features) + target_link_libraries(volk PRIVATE CpuFeatures::cpu_features) endif() target_include_directories(volk PUBLIC $ @@ -591,7 +591,7 @@ if(ENABLE_STATIC_LIBS) add_library(volk_static STATIC $) target_link_libraries(volk_static PUBLIC ${volk_libraries}) if(VOLK_CPU_FEATURES) - target_link_libraries(volk_static PRIVATE CpuFeature::cpu_features) + target_link_libraries(volk_static PRIVATE CpuFeatures::cpu_features) endif() if(ORC_FOUND) target_link_libraries(volk_static PUBLIC ${ORC_LIBRARIES_STATIC}) From 6383ddb722da75d7e50516c6bc2562fefb35aff8 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Sat, 16 Sep 2023 18:56:22 +1000 Subject: [PATCH 2/4] cmake: Removed duplicated logic The else path can not be reached since the root CMake file aborts if CpuFeatures_FOUND if false Signed-off-by: Ashley Brighthope --- lib/CMakeLists.txt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b5b165fe6..ca39f99e2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -521,15 +521,9 @@ target_include_directories(volk_obj ) if(VOLK_CPU_FEATURES) set_source_files_properties(volk_cpu.c PROPERTIES COMPILE_DEFINITIONS "VOLK_CPU_FEATURES=1") - if(CpuFeatures_FOUND) - target_include_directories(volk_obj - PRIVATE $ - ) - else() - target_include_directories(volk_obj - PRIVATE $ - ) - endif() + target_include_directories(volk_obj + PRIVATE $ + ) endif() #Configure object target properties From 49c158144588a3b965558aff09926a4b5b5b3982 Mon Sep 17 00:00:00 2001 From: Ashley Brighthope Date: Wed, 20 Sep 2023 19:36:36 +1000 Subject: [PATCH 3/4] cmake: Do not install cpu_features with volk Signed-off-by: Ashley Brighthope --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf1e2f56..be1dd6ebc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,7 @@ if (VOLK_CPU_FEATURES) FORCE) set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}") set(BUILD_SHARED_LIBS OFF) - set(ENABLE_INSTALL ON) + set(ENABLE_INSTALL OFF) add_subdirectory(cpu_features) set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}") endif() From 492568169a38b246576c0b9e71f00e5a46481eff Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Sat, 23 Sep 2023 14:15:10 +0200 Subject: [PATCH 4/4] cmake: Link to cpu_features only in BUILD_INTERFACE This avoids issues in the static build since otherwise cmake will add cpu_features to the export set. Signed-off-by: Andrej Rode --- lib/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ca39f99e2..a27be22b4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -542,7 +542,7 @@ endif() add_library(volk SHARED $) target_link_libraries(volk PUBLIC ${volk_libraries}) if(VOLK_CPU_FEATURES) - target_link_libraries(volk PRIVATE CpuFeatures::cpu_features) + target_link_libraries(volk PRIVATE $) endif() target_include_directories(volk PUBLIC $ @@ -585,7 +585,7 @@ if(ENABLE_STATIC_LIBS) add_library(volk_static STATIC $) target_link_libraries(volk_static PUBLIC ${volk_libraries}) if(VOLK_CPU_FEATURES) - target_link_libraries(volk_static PRIVATE CpuFeatures::cpu_features) + target_link_libraries(volk_static PRIVATE $) endif() if(ORC_FOUND) target_link_libraries(volk_static PUBLIC ${ORC_LIBRARIES_STATIC})