Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split SSE cmake option. Use more descriptive names. #191

Merged
merged 6 commits into from
Nov 21, 2016
Merged
Changes from 1 commit
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
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,32 @@ else()
endif()

# Whether to enable SSE
option(FCL_USE_SSE "Whether FCL should SSE instructions" ON)
option(FCL_USE_X64_SSE "Whether FCL should x64 SSE instructions" ON)
if (FCL_USE_X64_SSE)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -msse -msse2 -msse3 -mssse3")
elseif(MSVC)
add_definitions(/arch:SSE2)
endif()
endif()

option(FCL_USE_HOST_CUSTOM_CFLAGS "Whether FCL should use cflags from the host used to compile" OFF)
if (FCL_USE_HOST_CUSTOM_CFLAGS)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
else()
message(WARNING "FCL_USE_HOST_CUSTOM_CFLAGS is only supported in Linux. No effect.")
endif()
endif()

# DEPRECATED: old cmake option. Not strictly correct from the semantic point of view
# it was activating march=native, not only SSE
option(FCL_USE_SSE "(deprecated) Whether FCL should SSE instructions" OFF)
if(FCL_USE_SSE)
set(FCL_HAVE_SSE TRUE)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(DEPRECATION "FCL_USE_SSE is deprecated please use: FCL_USE_X64_SSE or FCL_USE_HOST_CUSTOM_CFLAGS. "
Copy link
Member

@jslee02 jslee02 Nov 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEPRECATION is not supported by CMake 2.8.12, which is the current minimum required CMake version of FCL. If I'm correct, FCL supports that version in order to support trusty.

In CMake 2.8.12, DEPRECATION will not cause any problem, but the message will be printed as DEPRECATIONFCL_USE_SSE is deprecated ... (no space after DEPRECATION). I would suggest we just use WARNING instead or use DEPRECATION only when it's supported.

"If you want to replicate the previous behaviour use FCL_USE_HOST_CUSTOM_CFLAGS")
add_definitions(-march=native)
elseif(MSVC)
add_definitions(/arch:SSE2)
Expand Down