Skip to content

Commit

Permalink
Merge pull request #2416 from SergioRAgostinho/clang-native
Browse files Browse the repository at this point in the history
Export `-march=native` for Clang and prevent it from being included during cross compilation.
  • Loading branch information
taketwo authored Sep 10, 2018
2 parents 6bd7bd1 + c71d2ce commit 88a7adc
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions cmake/pcl_find_sse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@ macro(PCL_CHECK_FOR_SSE)
set(SSE_FLAGS)
set(SSE_DEFINITIONS)

# Test CLANG
#if(CMAKE_COMPILER_IS_CLANG)
# if(APPLE)
# SET(SSE_FLAGS "${SSE_FLAGS} -march=native")
# endif(APPLE)
#endif(CMAKE_COMPILER_IS_CLANG)

# Test GCC/G++
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-dumpversion"
OUTPUT_VARIABLE GCC_VERSION_STRING)
if(GCC_VERSION_STRING VERSION_GREATER 4.2 AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING)
if(NOT CMAKE_CROSSCOMPILING)
# Test GCC/G++ and CLANG
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
list(APPEND SSE_FLAGS "-march=native")
message(STATUS "Using CPU native flags for SSE optimization: ${SSE_FLAGS}")
endif()
Expand Down

0 comments on commit 88a7adc

Please sign in to comment.