| 1 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 |
index 36f6563..19c83eb 100644 |
| 3 |
--- a/CMakeLists.txt |
| 4 |
+++ b/CMakeLists.txt |
| 5 |
@@ -272,86 +272,12 @@ if(G2O_BUILD_EXAMPLES) |
| 6 |
message(STATUS "Compiling g2o examples") |
| 7 |
endif(G2O_BUILD_EXAMPLES) |
| 8 |
|
| 9 |
option(G2O_FAST_MATH "Enable fast math operations" OFF) |
| 10 |
option(G2O_NO_IMPLICIT_OWNERSHIP_OF_OBJECTS "Disables memory management in the graph types, this requires the callers to manager the memory of edges and nodes" OFF) |
| 11 |
|
| 12 |
-# Start of SSE* autodetect code |
| 13 |
-# (borrowed from MRPT CMake scripts, BSD) |
| 14 |
-option(DO_SSE_AUTODETECT "Enable autodetection of SSE* CPU sets and enable their use in optimized code" ON) |
| 15 |
-if(NOT EXISTS "/proc/cpuinfo") |
| 16 |
- set(DO_SSE_AUTODETECT OFF) |
| 17 |
-endif() |
| 18 |
-if (DO_SSE_AUTODETECT) |
| 19 |
- file(READ "/proc/cpuinfo" G2O_CPU_INFO) |
| 20 |
-endif() |
| 21 |
- |
| 22 |
-# Macro for each SSE* var: Invoke with name in uppercase: |
| 23 |
-macro(DEFINE_SSE_VAR _setname) |
| 24 |
- string(TOLOWER ${_setname} _set) |
| 25 |
- if (DO_SSE_AUTODETECT) |
| 26 |
- # Automatic detection: |
| 27 |
- set(CMAKE_G2O_HAS_${_setname} 0) |
| 28 |
- if (${G2O_CPU_INFO} MATCHES ".*${_set}.*") |
| 29 |
- set(CMAKE_G2O_HAS_${_setname} 1) |
| 30 |
- endif() |
| 31 |
- else (DO_SSE_AUTODETECT) |
| 32 |
- # Manual: |
| 33 |
- option("DISABLE_${_setname}" "Forces compilation WITHOUT ${_setname} extensions" OFF) |
| 34 |
- mark_as_advanced("DISABLE_${_setname}") |
| 35 |
- set(CMAKE_G2O_HAS_${_setname} 0) |
| 36 |
- if (NOT DISABLE_${_setname}) |
| 37 |
- set(CMAKE_G2O_HAS_${_setname} 1) |
| 38 |
- endif (NOT DISABLE_${_setname}) |
| 39 |
- endif (DO_SSE_AUTODETECT) |
| 40 |
-endmacro(DEFINE_SSE_VAR) |
| 41 |
- |
| 42 |
-# SSE optimizations: |
| 43 |
-DEFINE_SSE_VAR(SSE2) |
| 44 |
-DEFINE_SSE_VAR(SSE3) |
| 45 |
-DEFINE_SSE_VAR(SSE4_1) |
| 46 |
-DEFINE_SSE_VAR(SSE4_2) |
| 47 |
-DEFINE_SSE_VAR(SSE4_A) |
| 48 |
- |
| 49 |
-include(CheckCXXCompilerFlag) |
| 50 |
- |
| 51 |
-macro(CHECK_AND_ADD_COMPILE_OPTION _option _option_name) |
| 52 |
- if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") |
| 53 |
- check_cxx_compiler_flag("-Werror=unused-command-line-argument ${_option}" ${_option_name}_AVAILABLE) |
| 54 |
- else() |
| 55 |
- check_cxx_compiler_flag(${_option} ${_option_name}_AVAILABLE) |
| 56 |
- endif() |
| 57 |
- if(${_option_name}_AVAILABLE) |
| 58 |
- add_compile_options(${_option}) |
| 59 |
- endif() |
| 60 |
-endmacro() |
| 61 |
- |
| 62 |
-# Add build flags for clang AND GCC |
| 63 |
-if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR CMAKE_COMPILER_IS_GNUCXX) |
| 64 |
- # SSE2? |
| 65 |
- if (CMAKE_G2O_HAS_SSE2) |
| 66 |
- CHECK_AND_ADD_COMPILE_OPTION(-msse2 SSE2) |
| 67 |
- endif() |
| 68 |
- # SSE3? |
| 69 |
- if (CMAKE_G2O_HAS_SSE3) |
| 70 |
- CHECK_AND_ADD_COMPILE_OPTION(-msse3 SSE3) |
| 71 |
- CHECK_AND_ADD_COMPILE_OPTION(-mssse3 SSSE3) |
| 72 |
- endif() |
| 73 |
- # SSE4*? |
| 74 |
- if (CMAKE_G2O_HAS_SSE4_1) |
| 75 |
- CHECK_AND_ADD_COMPILE_OPTION(-msse4.1 SSE41) |
| 76 |
- endif() |
| 77 |
- if (CMAKE_G2O_HAS_SSE4_2) |
| 78 |
- CHECK_AND_ADD_COMPILE_OPTION(-msse4.2 SSE42) |
| 79 |
- endif() |
| 80 |
- if (CMAKE_G2O_HAS_SSE4_A) |
| 81 |
- CHECK_AND_ADD_COMPILE_OPTION(-msse4a SSE4a) |
| 82 |
- endif() |
| 83 |
-endif() |
| 84 |
-# End of of SSE* autodetect code ------- |
| 85 |
- |
| 86 |
# code coverage |
| 87 |
option(BUILD_CODE_COVERAGE "Enable coverage reporting" OFF) |
| 88 |
if(BUILD_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") |
| 89 |
message(STATUS "Enabling coverage compiler flags") |
| 90 |
set(g2o_C_FLAGS "${g2o_C_FLAGS} --coverage") |
| 91 |
set(g2o_CXX_FLAGS "${g2o_CXX_FLAGS} --coverage") |