Enable SSE and SSE2 by default
This commit is contained in:
parent
8b466cb207
commit
c9b01b1d69
2 changed files with 53 additions and 0 deletions
|
@ -168,6 +168,7 @@ option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite
|
|||
option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT})
|
||||
option(FG_NIGHTLY "Set to ON to mark this as a nightly build" OFF)
|
||||
option(ENABLE_DEV_WARNINGS "Set to ON to include developer-warnings" OFF)
|
||||
option(ENABLE_SIMD "Enable SSE/SSE2 support for x86 compilers" ON)
|
||||
|
||||
# additional utilities
|
||||
option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON)
|
||||
|
@ -184,6 +185,8 @@ option(ENABLE_FLITE "Set to ON to build the Flite text-to-speech module" ON
|
|||
option(ENABLE_QT "Set to ON to build the internal Qt launcher" ON)
|
||||
option(ENABLE_TRAFFIC "Set to ON to build the external traffic generator modules" ON)
|
||||
|
||||
include (DetectArch)
|
||||
|
||||
# when building an OSG with commit 15ec7e2ae7a8b983ecc44e1ce7363a9a9fa7da95
|
||||
# applied, we can use better link options
|
||||
option(OSG_FSTREAM_EXPORT_FIXED "Set to ON if the osgDB fstream export patch is applied" OFF)
|
||||
|
@ -332,9 +335,16 @@ endif(ENABLE_RTI)
|
|||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(WARNING_FLAGS_CXX "-Wall")
|
||||
set(WARNING_FLAGS_C "-Wall")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.1)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
|
||||
if(ENABLE_SIMD)
|
||||
if (X86 OR X86_64)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3 -mfpmath=sse")
|
||||
endif()
|
||||
endif()
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
|
||||
|
@ -356,6 +366,12 @@ if(WIN32)
|
|||
|
||||
if(MSVC)
|
||||
set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP")
|
||||
if(ENABLE_SIMD)
|
||||
if (X86 OR X86_64)
|
||||
set(MSVC_FLAGS "${MSVC_FLAGS} /arch:SSE /arch:SSE2 /Ox")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT OSG_FSTREAM_EXPORT_FIXED AND ${MSVC_VERSION} GREATER 1599)
|
||||
message(STATUS "For better linking performance, use OSG with fixed fstream header")
|
||||
# needed to avoid link errors on multiply-defined standard C++
|
||||
|
|
37
CMakeModules/DetectArch.cmake
Normal file
37
CMakeModules/DetectArch.cmake
Normal file
|
@ -0,0 +1,37 @@
|
|||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES amd64.*|x86_64.* OR CMAKE_GENERATOR MATCHES "Visual Studio.*Win64")
|
||||
IF(CMAKE_C_FLAGS MATCHES -m32 OR CMAKE_CXX_FLAGS MATCHES -m32)
|
||||
SET(X86 1)
|
||||
ELSE(CMAKE_C_FLAGS MATCHES -m32 OR CMAKE_CXX_FLAGS MATCHES -m32)
|
||||
SET(X86_64 1)
|
||||
ENDIF(CMAKE_C_FLAGS MATCHES -m32 OR CMAKE_CXX_FLAGS MATCHES -m32)
|
||||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.* OR WIN32)
|
||||
IF(CMAKE_C_FLAGS MATCHES -m64 OR CMAKE_CXX_FLAGS MATCHES -m64)
|
||||
SET(X86_64 1)
|
||||
ELSE(CMAKE_C_FLAGS MATCHES -m64 OR CMAKE_CXX_FLAGS MATCHES -m64)
|
||||
SET(X86 1)
|
||||
ENDIF(CMAKE_C_FLAGS MATCHES -m64 OR CMAKE_CXX_FLAGS MATCHES -m64)
|
||||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES arm.* AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
SET(ARM 1)
|
||||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES mips)
|
||||
SET(MIPS 1)
|
||||
ENDIF()
|
||||
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
# using Clang
|
||||
SET(CLANG 1)
|
||||
ELSEIF ("${CMAKE_C_COMPILER_ID}" STREQUAL "TinyCC")
|
||||
# using TinyCC
|
||||
SET(TINYCC 1)
|
||||
ELSEIF ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
# using GCC
|
||||
SET(GCC 1)
|
||||
ELSEIF ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
|
||||
# using Intel C++
|
||||
SET(INTELCC 1)
|
||||
ELSEIF ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
SET(MSVC 1)
|
||||
ELSEIF ("${CMAKE_C_COMPILER_ID}" STREQUAL "MIPSpro")
|
||||
# using SGI MIPSpro
|
||||
SET(MIPSPRO 1)
|
||||
ENDIF()
|
Loading…
Reference in a new issue