summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-02 11:28:12 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-02 11:28:12 +0100
commite8b824dac6a2ce4d56c7d08f74f3e80bf1c01d3a (patch)
tree8d26cec4721881c7ef15ae67bd58828dbb217544
parent7098be23b924d1b96143aaaf42f7bc02cb60fe19 (diff)
downloadufodecode-e8b824dac6a2ce4d56c7d08f74f3e80bf1c01d3a.tar.gz
ufodecode-e8b824dac6a2ce4d56c7d08f74f3e80bf1c01d3a.tar.bz2
ufodecode-e8b824dac6a2ce4d56c7d08f74f3e80bf1c01d3a.tar.xz
ufodecode-e8b824dac6a2ce4d56c7d08f74f3e80bf1c01d3a.zip
Add missing CMakeLists
-rw-r--r--src/CMakeLists.txt56
-rw-r--r--test/CMakeLists.txt9
2 files changed, 65 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..8fca838
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,56 @@
+# --- 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 ${SSE_FLAGS}")
+
+add_library(ufodecode SHARED ufodecode.c)
+
+set_target_properties(ufodecode PROPERTIES
+ VERSION ${LIBUFODECODE_ABI_VERSION}
+ SOVERSION ${LIBUFODECODE_ABI_MAJOR_VERSION}
+)
+
+install(TARGETS ufodecode
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+)
+
+install(FILES
+ ufodecode.h
+ DESTINATION include
+)
+
+if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
+ set(DEBUG "1")
+endif()
+configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..aea7b7d
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,9 @@
+# --- Build test executable -------------------------------------------------
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src
+)
+
+add_executable(ipedec ipedec.c)
+target_link_libraries(ipedec ufodecode)
+
+install(TARGETS ipedec DESTINATION ${BIN_INSTALL_DIR})