-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Fluorescence-Tools/develop
Add option to disable AVX support
- Loading branch information
Showing
6 changed files
with
31 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
# SIMD | ||
########################### | ||
IF(NOT APPLE) | ||
IF(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") | ||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/dependency) | ||
INCLUDE(simd) | ||
IF(${AVX_FOUND}) | ||
MESSAGE("BUILD WITH SIMD") | ||
ADD_DEFINITIONS(-DWITH_AVX) | ||
IF (MSVC) | ||
# https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/ | ||
# /Oi is for intrinsics | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX /Oi") | ||
ELSE(MSVC) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx -mfma") | ||
ENDIF (MSVC) | ||
ELSE(${AVX_FOUND}) | ||
UNSET(WITH_AVX) | ||
ENDIF(${AVX_FOUND}) | ||
ENDIF() | ||
ENDIF() | ||
|
||
option(WITH_AVX "Enable AVX support" OFF) | ||
|
||
if (WITH_AVX AND NOT APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/dependency) | ||
include(simd) | ||
|
||
if (${AVX_FOUND}) | ||
message("BUILD WITH SIMD") | ||
add_definitions(-DWITH_AVX) | ||
|
||
if (MSVC) | ||
# https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/ | ||
# /Oi is for intrinsics | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX /Oi") | ||
else (MSVC) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx -mfma") | ||
endif (MSVC) | ||
else (${AVX_FOUND}) | ||
unset(WITH_AVX) | ||
endif (${AVX_FOUND}) | ||
else () | ||
# AVX only on x86_64 and not on Apple | ||
message("BUILD WITHOUT SIMD") | ||
unset(WITH_AVX) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters