Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,20 @@ option( BUILD_SHARED_LIBS "Build shared SPERR library" ON )
option( BUILD_UNIT_TESTS "Build unit tests using GoogleTest" ON )
option( BUILD_CLI_UTILITIES "Build a set of command line utilities" ON )
option( USE_OMP "Use OpenMP parallelization on 3D volumes" OFF )
option( ENABLE_AVX2 "Enable AVX2 instruction set compilation" ON )
option( SPERR_PREFER_RPATH "Set RPATH; this can fight with package managers so turn off when building for them" ON )

#
# AVX2 auto-detection: default ON for x86, OFF otherwise.
#
if(NOT DEFINED ENABLE_AVX2)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i[3-9]86")
option( ENABLE_AVX2 "Enable AVX2 instruction set compilation" ON )
else()
option( ENABLE_AVX2 "Enable AVX2 instruction set compilation" OFF )
endif()
else()
option( ENABLE_AVX2 "Enable AVX2 instruction set compilation" ${ENABLE_AVX2} )
endif()
mark_as_advanced(FORCE SPERR_PREFER_RPATH)

if(USE_OMP)
Expand Down
4 changes: 0 additions & 4 deletions src/sperr_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#include <bit>
#endif

#ifdef __AVX2__
#include <immintrin.h>
#endif

#ifdef USE_OMP
#include <omp.h>
#endif
Expand Down
6 changes: 0 additions & 6 deletions test_scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
add_executable( sperr_helper sperr_helper_unit_test.cpp )
target_link_libraries( sperr_helper PUBLIC SPERR GTest::gtest_main )

if(ENABLE_AVX2)
target_compile_options(sperr_helper PRIVATE
"$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>"
"$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-mavx2;-mfma>")
endif()

add_executable( bitstream bitstream_unit_test.cpp )
target_link_libraries( bitstream PUBLIC SPERR GTest::gtest_main )

Expand Down
Loading