Skip to content

Commit

Permalink
Add proper compile definition when XTL has been configured
Browse files Browse the repository at this point in the history
Basically so that -DENABLE_XTL_COMPLEX=On at configuration step implies
-DXSIMD_ENABLE_XTL_COMPLEX=1 for the tests.

Fix #942
  • Loading branch information
serge-sans-paille committed Oct 9, 2023
1 parent 3160fec commit b0668e4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,16 @@ target_include_directories(xsimd INTERFACE
$<BUILD_INTERFACE:${XSIMD_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)

if (ENABLE_XTL_COMPLEX)
target_compile_features(xsimd INTERFACE cxx_std_14)
else()
target_compile_features(xsimd INTERFACE cxx_std_11)
endif()

OPTION(ENABLE_XTL_COMPLEX "enables support for xcomplex defined in xtl" OFF)
OPTION(BUILD_TESTS "xsimd test suite" OFF)

if(ENABLE_XTL_COMPLEX)
find_package(xtl 0.7.0 REQUIRED)
target_compile_features(xsimd INTERFACE cxx_std_14)
target_compile_definitions(xsimd INTERFACE XSIMD_ENABLE_XTL_COMPLEX=1)
target_link_libraries(xsimd INTERFACE xtl)
else()
target_compile_features(xsimd INTERFACE cxx_std_11)
endif()

if(BUILD_TESTS)
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ else()
endif()

if(ENABLE_XTL_COMPLEX)
target_include_directories(test_xsimd PRIVATE ${xtl_INCLUDE_DIRS})
add_compile_definitions(XSIMD_ENABLE_XTL_COMPLEX=1)
target_include_directories(test_xsimd PRIVATE ${xtl_INCLUDE_DIRS})
endif()

add_test(NAME test_xsimd COMMAND test_xsimd)

if (CROSS_COMPILE_ARM)
Expand Down
5 changes: 5 additions & 0 deletions test/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT CMAKE_OSX_ARCHITECTURES)

if(ENABLE_XTL_COMPLEX)
add_compile_definitions(XSIMD_ENABLE_XTL_COMPLEX=1)
include_directories(${xtl_INCLUDE_DIRS})
endif()

add_library(test_doc_any_arch OBJECT
explicit_use_of_an_instruction_set_mean_aligned.cpp
explicit_use_of_an_instruction_set_mean_arch_independent.cpp
Expand Down

0 comments on commit b0668e4

Please sign in to comment.