summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-01 16:00:59 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-01 16:00:59 +0100
commitcb3a933340614866f7b6a3dd0977956450a161dd (patch)
treebb386a33530c89e815c0eb4850d98d4f58bffccb /CMakeLists.txt
parent845a638d4c7183ed91b223fbd5047a9cc27b47c8 (diff)
downloadlibufodecode-cb3a933340614866f7b6a3dd0977956450a161dd.tar.gz
libufodecode-cb3a933340614866f7b6a3dd0977956450a161dd.tar.bz2
libufodecode-cb3a933340614866f7b6a3dd0977956450a161dd.tar.xz
libufodecode-cb3a933340614866f7b6a3dd0977956450a161dd.zip
Add: optional SSE intrinsics
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 28 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f519ee..f541898 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,13 +28,40 @@ if(NOT DEFINED LOCALE_INSTALL_DIR)
endif(NOT DEFINED LOCALE_INSTALL_DIR)
+# --- Look for SSE support --------------------------------------------------
+include(CheckCXXSourceRuns)
+set(SSE_FLAGS)
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_REQUIRED_FLAGS "-msse")
+ check_cxx_source_runs("
+ #include <xmmintrin.h>
+ int main()
+ {
+ __m128 a, b;
+ float vals[4] = {0};
+ a = _mm_loadu_ps(vals);
+ b = a;
+ b = _mm_add_ps(a,b);
+ _mm_storeu_ps(vals,b);
+ return 0;
+ }"
+ SSE_AVAILABLE)
+
+ set(CMAKE_REQUIRED_FLAGS)
+
+ if (SSE_AVAILABLE)
+ option(HAVE_SSE "Use SSE extensions" ON)
+ set(SSE_FLAGS "-msse")
+ endif()
+endif()
+
# --- Build library and install ---------------------------------------------
include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
)
-add_definitions("--std=c99 -Wall -O2")
+add_definitions("--std=c99 -Wall -O2 ${SSE_FLAGS}")
add_library(ipe SHARED src/libipe.c)