Merge pull request #2 from astron-rd/add-cmake-option-prefix

Add TRIGDX prefix to CMake configurable options
This commit is contained in:
Wiebe van Breukelen
2025-08-12 10:10:55 +02:00
committed by GitHub
4 changed files with 13 additions and 13 deletions

View File

@@ -4,9 +4,9 @@ project(trigdx LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(USE_MKL "Enable Intel MKL backend" OFF)
option(USE_GPU "Enable GPU backend" OFF)
option(USE_XSIMD "Enable XSIMD backend" OFF)
option(TRIGDX_USE_MKL "Enable Intel MKL backend" OFF)
option(TRIGDX_USE_GPU "Enable GPU backend" OFF)
option(TRIGDX_USE_XSIMD "Enable XSIMD backend" OFF)
include_directories(${PROJECT_SOURCE_DIR}/include)

View File

@@ -7,17 +7,17 @@ target_link_libraries(benchmark_lookup PRIVATE trigdx)
add_executable(benchmark_lookup_avx benchmark_lookup_avx.cpp)
target_link_libraries(benchmark_lookup_avx PRIVATE trigdx)
if(USE_MKL)
if(TRIGDX_USE_MKL)
add_executable(benchmark_mkl benchmark_mkl.cpp)
target_link_libraries(benchmark_mkl PRIVATE trigdx)
endif()
if(USE_GPU)
if(TRIGDX_USE_GPU)
add_executable(benchmark_gpu benchmark_gpu.cpp)
target_link_libraries(benchmark_gpu PRIVATE trigdx gpu)
endif()
if(USE_XSIMD)
if(TRIGDX_USE_XSIMD)
add_executable(benchmark_lookup_xsimd benchmark_lookup_xsimd.cpp)
target_link_libraries(benchmark_lookup_xsimd PRIVATE trigdx)
endif()

View File

@@ -4,13 +4,13 @@ target_include_directories(trigdx PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_compile_options(trigdx PRIVATE -O3 -march=native)
if(USE_MKL)
if(TRIGDX_USE_MKL)
find_package(MKL REQUIRED)
target_sources(trigdx PRIVATE mkl.cpp)
target_link_libraries(trigdx PRIVATE MKL::MKL)
endif()
if(USE_GPU)
if(TRIGDX_USE_GPU)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
add_library(gpu SHARED gpu/gpu.cu)
@@ -19,7 +19,7 @@ if(USE_GPU)
target_link_libraries(trigdx PRIVATE gpu)
endif()
if(USE_XSIMD)
if(TRIGDX_USE_XSIMD)
find_package(xsimd REQUIRED)
target_sources(trigdx PRIVATE lookup_xsimd.cpp)
target_link_libraries(trigdx PRIVATE xsimd)

View File

@@ -15,7 +15,7 @@ add_executable(test_lookup_avx test_lookup_avx.cpp)
target_link_libraries(test_lookup_avx PRIVATE trigdx Catch2::Catch2WithMain)
# MKL backend test
if(USE_MKL)
if(TRIGDX_USE_MKL)
add_executable(test_mkl test_mkl.cpp)
target_link_libraries(test_mkl PRIVATE trigdx Catch2::Catch2WithMain)
endif()
@@ -23,17 +23,17 @@ endif()
include(CTest)
add_test(NAME test_lookup COMMAND test_lookup)
if(USE_MKL)
if(TRIGDX_USE_MKL)
add_test(NAME test_mkl COMMAND test_mkl)
endif()
if(USE_GPU)
if(TRIGDX_USE_GPU)
add_executable(test_gpu test_gpu.cpp)
target_link_libraries(test_gpu PRIVATE trigdx Catch2::Catch2WithMain)
add_test(NAME test_gpu COMMAND test_gpu)
endif()
if(USE_XSIMD)
if(TRIGDX_USE_XSIMD)
add_executable(test_lookup_xsimd test_lookup_xsimd.cpp)
target_link_libraries(test_lookup_xsimd PRIVATE trigdx Catch2::Catch2WithMain)
add_test(NAME test_lookup_xsimd COMMAND test_lookup_xsimd)