Skip to content
Snippets Groups Projects
Commit f030bead authored by Lars Bilke's avatar Lars Bilke
Browse files

Added CMake option OGS_CPU_ARCHITECTURE which defaults to native.

parent e420eb2c
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ list(APPEND CMAKE_PREFIX_PATH ...@@ -23,6 +23,7 @@ list(APPEND CMAKE_PREFIX_PATH
option(OGS_NO_BOOST_DOWNLOAD "Always use the system installed Boost?" OFF) option(OGS_NO_BOOST_DOWNLOAD "Always use the system installed Boost?" OFF)
set(CMAKE_LIBRARY_SEARCH_PATH "" CACHE PATH set(CMAKE_LIBRARY_SEARCH_PATH "" CACHE PATH
"Additional library installation path, e.g. /opt/local or C:/libs") "Additional library installation path, e.g. /opt/local or C:/libs")
set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, defaults to native.")
### CMake includes ### ### CMake includes ###
include(scripts/cmake/CheckTypeSizes.cmake) include(scripts/cmake/CheckTypeSizes.cmake)
......
...@@ -33,11 +33,7 @@ if(COMPILER_IS_GCC) ...@@ -33,11 +33,7 @@ if(COMPILER_IS_GCC)
endif() endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Set GCC release flags") message(STATUS "Set GCC release flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -DNDEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=${OGS_CPU_ARCHITECTURE} -DNDEBUG")
# Disable -march=native on mac or Ninja generator
if(NOT APPLE AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
else() else()
# Enable assertions in STL in debug mode. # Enable assertions in STL in debug mode.
if (NOT STL_NO_DEBUG) if (NOT STL_NO_DEBUG)
...@@ -52,7 +48,7 @@ if(COMPILER_IS_CLANG) ...@@ -52,7 +48,7 @@ if(COMPILER_IS_CLANG)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.3") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.3")
message(FATAL_ERROR "Aborting: Clang 3.3 is required! Found version ${CMAKE_CXX_COMPILER_VERSION}") message(FATAL_ERROR "Aborting: Clang 3.3 is required! Found version ${CMAKE_CXX_COMPILER_VERSION}")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-c++98-compat-pedantic -march=native") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-c++98-compat-pedantic -march=${OGS_CPU_ARCHITECTURE}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Enable assertions in STL in debug mode. # Enable assertions in STL in debug mode.
if (NOT STL_NO_DEBUG) if (NOT STL_NO_DEBUG)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment