ref: 281469c266e990f606829996c8309301b9abc426
parent: 56f99e44bca8f43639eeff9a4db0a873ef0d2de4
parent: 43feaa9a9860f7a06e2281cead4f91e9805b3009
author: Christopher Snowhill <[email protected]>
date: Mon Jul 17 14:27:54 EDT 2017
Merge pull request #37 from akien-mga/see-optout Make SSE instructions opt-out
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,12 +10,16 @@
option(BUILD_EXAMPLES "Build example binaries" ON)
option(BUILD_ALLEGRO4 "Build Allegro4 support" ON)
+option(USE_SSE "Use SSE instructions" ON)
-set(CMAKE_C_FLAGS "-Wall -DDUMB_DECLARE_DEPRECATED -D_USE_SSE -msse -Wno-unused-variable -Wno-unused-but-set-variable")
+set(CMAKE_C_FLAGS "-Wall -DDUMB_DECLARE_DEPRECATED -Wno-unused-variable -Wno-unused-but-set-variable")
set(CMAKE_C_FLAGS_DEBUG "-ggdb -DDEBUGMODE=1 -D_DEBUG")
set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-ffast-math -g -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "-ffast-math -Os -DNDEBUG")
+if(USE_SSE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_USE_SSE -msse")
+endif()
link_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(include/)
--- a/src/helpers/resampler.c
+++ b/src/helpers/resampler.c
@@ -2,7 +2,7 @@
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
-#if (defined(_M_IX86) || defined(__i386__) || defined(_M_X64) || defined(__amd64__))
+#if defined(_USE_SSE) && (defined(_M_IX86) || defined(__i386__) || defined(_M_X64) || defined(__amd64__))
#include <xmmintrin.h>
#define RESAMPLER_SSE
#endif