76 lines
2.6 KiB
Diff
76 lines
2.6 KiB
Diff
diff -up ./CMakeLists.txt.ctest ./CMakeLists.txt
|
|
--- ./CMakeLists.txt.ctest 2014-06-01 20:32:22.135537791 -0400
|
|
+++ ./CMakeLists.txt 2014-06-01 20:39:59.303110922 -0400
|
|
@@ -4,6 +4,7 @@ project(libccd C)
|
|
set(CCD_VERSION "2.0")
|
|
set(CCD_SOVERSION "2")
|
|
set(PKG_DESC "Library for collision detection between convex shapes")
|
|
+set(BUILD_TESTS false cache bool "Build the test suite")
|
|
|
|
# Include GNUInstallDirs to get canonical paths
|
|
include(GNUInstallDirs)
|
|
@@ -58,3 +59,8 @@ install(TARGETS ccd ccd_static ARCHIVE D
|
|
install(DIRECTORY src/ccd DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
|
|
install(FILES "${pkg_conf_file}" DESTINATION
|
|
${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT pkgconfig)
|
|
+
|
|
+if (BUILD_TESTS)
|
|
+ enable_testing()
|
|
+ add_subdirectory(src/testsuites)
|
|
+endif (BUILD_TESTS)
|
|
diff -up ./src/testsuites/CMakeLists.txt.ctest ./src/testsuites/CMakeLists.txt
|
|
--- ./src/testsuites/CMakeLists.txt.ctest 2014-06-01 20:32:22.136537830 -0400
|
|
+++ ./src/testsuites/CMakeLists.txt 2014-06-01 20:32:22.136537830 -0400
|
|
@@ -0,0 +1,51 @@
|
|
+set(CCDTEST_ARGS "" CACHE STRING "Argments to pass to ccdtest executable")
|
|
+
|
|
+set(TEST_SOURCES
|
|
+ common.c
|
|
+ support.c
|
|
+ vec3.c
|
|
+ polytope.c
|
|
+ boxbox.c
|
|
+ spheresphere.c
|
|
+ cylcyl.c
|
|
+ boxcyl.c
|
|
+ mpr_boxbox.c
|
|
+ mpr_cylcyl.c
|
|
+ mpr_boxcyl.c)
|
|
+
|
|
+add_library(cu cu/cu.c)
|
|
+
|
|
+add_executable(ccdtest ${TEST_SOURCES} main.c)
|
|
+target_link_libraries(ccdtest ccd cu rt)
|
|
+add_definitions(-DCU_ENABLE_TIMER)
|
|
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
+add_test(NAME ccdtest
|
|
+ COMMAND ccdtest ${CCDTEST_ARGS}
|
|
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
+
|
|
+add_test(NAME ccdtest-valgrind
|
|
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
+ COMMAND valgrind -q --leak-check=full --show-reachable=yes --trace-children=yes
|
|
+ --error-limit=no
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/ccdtest ${CCDTEST_ARGS})
|
|
+
|
|
+add_test(NAME ccdtest-valgrind-gen-suppressions
|
|
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
+ COMMAND valgrind -q --leak-check=full --show-reachable=yes --trace-children=yes
|
|
+ --gen-suppressions=all --log-file=out --error-limit=no
|
|
+ ${CMAKE_CURRENT_BINARY_DIR}/ccdtest ${CCDTEST_ARGS})
|
|
+
|
|
+
|
|
+add_executable(bench bench.c support.c cu/cu.c)
|
|
+target_link_libraries(bench ccd cu rt)
|
|
+add_test(NAME bench
|
|
+ COMMAND bench)
|
|
+
|
|
+add_executable(bench2 bench2.c support.c cu/cu.c)
|
|
+target_link_libraries(bench2 ccd cu rt)
|
|
+add_test(NAME bench2
|
|
+ COMMAND bench2)
|
|
+
|
|
+add_test(NAME check-regressions
|
|
+ COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/cu/check-regressions regressions
|
|
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|