CMake: Add a flag to explicitly disable SSE/SSE2 intrinsics
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 15 Oct 2014 08:53:12 +0000 (14:53 +0600)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 15 Oct 2014 08:53:12 +0000 (14:53 +0600)
The flag is called WITH_CPU_SSE, it is ON by default so no one should
be affected by the change really.

This should hopefully fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763755

CMakeLists.txt
build_files/cmake/macros.cmake

index 63dae8993665b752ab4d25704369fbd9344e3146..91a8a0420d2857edfddd9dbc36002df90d498a33 100644 (file)
@@ -273,6 +273,8 @@ option(WITH_PYTHON_INSTALL       "Copy system python into the blender install fo
 option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module")
 mark_as_advanced(PYTHON_NUMPY_PATH)
+option(WITH_CPU_SSE              "Enable SIMD instruction if they're detected on the host machine" ON)
+mark_as_advanced(WITH_CPU_SSE)
 
 if(UNIX AND NOT APPLE)
        option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
@@ -568,7 +570,13 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
        set(WITH_GHOST_XDND    OFF)
 endif()
 
-TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
+if(WITH_CPU_SSE)
+       TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
+else()
+       message(STATUS "SSE and SSE2 optimizations are DISABLED!")
+       set(COMPILER_SSE_FLAG)
+       set(COMPILER_SSE2_FLAG)
+endif()
 
 TEST_STDBOOL_SUPPORT()
 if(HAVE_STDBOOL_H)
index b42e62e719c68d2efaaf032ede1bd52cb1a79656..70109cb53553715bddbc8009f2766422cb805fad 100644 (file)
@@ -722,6 +722,8 @@ macro(TEST_SSE_SUPPORT
 endmacro()
 
 macro(TEST_STDBOOL_SUPPORT)
+       include(CheckCSourceRuns)
+
        # This program will compile correctly if and only if
        # this C compiler supports C99 stdbool.
        check_c_source_runs("