|
1 |
| -cmake_minimum_required(VERSION 2.8) |
| 1 | +cmake_minimum_required(VERSION 2.8.11) |
| 2 | + |
| 3 | +if(POLICY CMP0042) |
| 4 | + cmake_policy(SET CMP0042 NEW) |
| 5 | +endif() |
| 6 | + |
2 | 7 | project(libccd C)
|
3 | 8 |
|
4 |
| -set(CCD_VERSION "2.0") |
5 |
| -set(CCD_SOVERSION "2") |
6 |
| -set(PKG_DESC "Library for collision detection between convex shapes") |
| 9 | +set(CCD_VERSION_MAJOR 2) |
| 10 | +set(CCD_VERSION_MINOR 0) |
| 11 | +set(CCD_VERSION ${CCD_VERSION_MAJOR}.${CCD_VERSION_MINOR}) |
| 12 | + |
| 13 | +set(CCD_SOVERSION 2) |
7 | 14 |
|
8 | 15 | # Include GNUInstallDirs to get canonical paths
|
9 | 16 | include(GNUInstallDirs)
|
10 | 17 |
|
11 |
| -include_directories("src/") |
12 |
| - |
13 |
| -# make sure only DOUBLE or SINGLE is set; default to SINGLE |
14 |
| -if (${CCD_SINGLE}) |
15 |
| - set(CCD_DOUBLE false) |
16 |
| -else() |
17 |
| - set(CCD_SINGLE true) |
18 |
| -endif() |
19 |
| - |
20 |
| -if (${CCD_DOUBLE}) |
21 |
| - set(CCD_SINGLE false) |
22 |
| -endif() |
| 18 | +option(ENABLE_DOUBLE_PRECISION |
| 19 | + "Enable double precision computations instead of single precision" OFF) |
23 | 20 |
|
24 | 21 | # set the default build type
|
25 |
| -if (NOT CMAKE_BUILD_TYPE) |
26 |
| - set(CMAKE_BUILD_TYPE Release) |
27 |
| -endif() |
28 |
| - |
29 |
| -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/ccd/config.h.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/ccd/config.h") |
30 |
| - |
31 |
| -if(NOT WIN32) |
32 |
| - find_library(MATH m) |
33 |
| -else() |
34 |
| - set(MATH "") |
| 22 | +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
| 23 | + set(CMAKE_BUILD_TYPE Release CACHE STRING |
| 24 | + "Choose the type of build; options are Debug Release RelWithDebInfo MinSizeRel" |
| 25 | + FORCE) |
| 26 | + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY |
| 27 | + STRINGS |
| 28 | + Debug |
| 29 | + Release |
| 30 | + RelWithDebInfo |
| 31 | + MinSizeRel) |
35 | 32 | endif()
|
36 | 33 |
|
37 |
| -set(SOURCE_FILES |
38 |
| - src/ccd.c |
39 |
| - src/mpr.c |
40 |
| - src/polytope.c |
41 |
| - src/support.c |
42 |
| - src/vec3.c) |
43 |
| - |
44 |
| -add_library(ccd SHARED ${SOURCE_FILES}) |
45 |
| -set_target_properties(ccd PROPERTIES VERSION ${CCD_VERSION} SOVERSION ${CCD_SOVERSION}) |
46 |
| - |
47 |
| -target_link_libraries(ccd ${MATH}) |
48 |
| - |
49 |
| -add_library(ccd_static STATIC ${SOURCE_FILES}) |
50 |
| -set_target_properties(ccd_static PROPERTIES OUTPUT_NAME ccd) |
51 |
| -target_link_libraries(ccd_static ${MATH}) |
| 34 | +add_subdirectory(src) |
52 | 35 |
|
53 |
| -set(pkg_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/ccd.pc") |
54 |
| -configure_file("${pkg_conf_file}.in" "${pkg_conf_file}" @ONLY) |
| 36 | +set(CCD_PKGCONFIG_DESCRIPTION |
| 37 | + "Library for collision detection between convex shapes") |
| 38 | +configure_file(ccd.pc.in ccd.pc @ONLY) |
| 39 | +install(FILES "${CMAKE_BINARY_DIR}/ccd.pc" |
| 40 | + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
55 | 41 |
|
56 |
| -install(TARGETS ccd ccd_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
57 |
| - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
58 |
| -install(DIRECTORY src/ccd DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h") |
59 |
| -install(FILES "${pkg_conf_file}" DESTINATION |
60 |
| - ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT pkgconfig) |
| 42 | +install(FILES BSD-LICENSE DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/ccd") |
0 commit comments