summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey C. Ollie <jeff@ocjtech.us>2008-09-12 11:37:17 -0500
committerJeffrey C. Ollie <jeff@ocjtech.us>2008-09-12 11:37:17 -0500
commit5bc318700126fe2322a0c6e6936ff6b9ccaae314 (patch)
tree9707b84189e0e11cc132048b5ebcfe9191a89060
parent61bc227dd4dc3a58a5b0ce3b3c8b0fc0a7bd8801 (diff)
downloadlibresample-5bc318700126fe2322a0c6e6936ff6b9ccaae314.tar.gz
libresample-5bc318700126fe2322a0c6e6936ff6b9ccaae314.tar.xz
libresample-5bc318700126fe2322a0c6e6936ff6b9ccaae314.zip
Build test executables and enable testing.
-rw-r--r--CMakeLists.txt26
1 files changed, 25 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27fb949..cbb92bb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 2.6)
project(libresample)
+enable_testing()
include(CheckIncludeFiles)
include(CheckTypeSize)
+include(FindPkgConfig)
check_type_size("void *" POINTER_SIZE)
@@ -16,10 +18,32 @@ endif(${POINTER_SIZE} EQUAL 8)
check_include_files(inttypes.h HAVE_INTTYPES_H)
+find_library(HAVE_LIBM m)
+
+pkg_check_modules(SNDFILE sndfile)
+pkg_check_modules(SAMPLERATE samplerate)
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configtemplate.h ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
add_library(resample SHARED src/filterkit.c src/resample.c src/resamplesubs.c)
set_target_properties(resample PROPERTIES VERSION 1.0 SOVERSION 1)
-
install(TARGETS resample LIBRARY DESTINATION ${LIBDIR})
install(FILES include/libresample.h DESTINATION include)
+
+add_executable(testresample tests/testresample.c)
+target_link_libraries(testresample resample m)
+add_test(testresample testresample)
+
+if(SNDFILE_FOUND)
+ add_executable(resample-sndfile tests/resample-sndfile.c)
+ target_link_libraries(resample-sndfile resample m)
+ set_target_properties(resample-sndfile PROPERTIES COMPILE_FLAGS "${SNDFILE_CFLAGS}" LINK_FLAGS "${SNDFILE_LDFLAGS}")
+ install(TARGETS resample-sndfile RUNTIME DESTINATION bin)
+endif(SNDFILE_FOUND)
+
+if(SAMPLERATE_FOUND)
+ add_executable(compareresample tests/compareresample.c)
+ target_link_libraries(compareresample resample m)
+ set_target_properties(compareresample PROPERTIES COMPILE_FLAGS "${SAMPLERATE_CFLAGS}" LINK_FLAGS "${SAMPLERATE_LDFLAGS}")
+ add_test(compareresample compareresample)
+endif(SAMPLERATE_FOUND)