1
0
Fork 0

The flag ENABLE_SIMD is now automatically carried over from SimGear. Mixed configurations between FG & SG could crash FG so this should not be allowed.

This commit is contained in:
Bertrand Coconnier 2017-02-04 20:21:19 +01:00
parent 80e45f6d9b
commit 4ab0b71fa8
2 changed files with 23 additions and 1 deletions

View file

@ -178,7 +178,6 @@ 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)
@ -358,6 +357,20 @@ else()
message(STATUS "RTI: DISABLED")
endif(ENABLE_RTI)
# Check if the flag ENABLE_SIMD was enabled during the compilation of SimGear.
# The same value has to be carried over for FlightGear to prevent crashes.
try_run(ENABLE_SIMD COMPILE_RESULT_TEST_SIMD ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/tests/test-simd-enabled.c)
if (COMPILE_RESULT_TEST_SIMD AND ENABLE_SIMD
AND NOT (ENABLE_SIMD EQUAL FAILED_TO_RUN))
set(ENABLE_SIMD ON)
message(STATUS "SSE/SSE2 support: ENABLED")
else()
set(ENABLE_SIMD OFF)
message(STATUS "SSE/SSE2 support: DISABLED")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(WARNING_FLAGS_CXX "-Wall")
set(WARNING_FLAGS_C "-Wall")

View file

@ -0,0 +1,9 @@
#include <simgear/simgear_config.h>
int main(void) {
#ifdef ENABLE_SIMD
return 1;
#else
return 0;
#endif
}