|
| 1 | +################################################################################ |
| 2 | +# general CMake and project setup |
| 3 | +################################################################################ |
1 | 4 | cmake_minimum_required(VERSION 3.1) |
2 | 5 |
|
3 | 6 | project(SPlishSPlasH) |
4 | 7 |
|
5 | | -set(PROJECT_PATH ${PROJECT_SOURCE_DIR}) |
6 | | -include_directories(${PROJECT_SOURCE_DIR}) |
7 | | - |
8 | 8 | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) |
9 | 9 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
10 | 10 |
|
11 | | -include(${PROJECT_PATH}/CMake/Common.cmake) |
12 | | - |
13 | | -add_definitions(-DSPH_DATA_PATH="../data") |
14 | | - |
| 11 | +include(Common) |
15 | 12 | if (NOT WIN32) |
16 | 13 | message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") |
17 | 14 | endif() |
18 | 15 |
|
19 | | -OPTION(USE_DOUBLE_PRECISION "Use double precision" ON) |
20 | | -if (USE_DOUBLE_PRECISION) |
21 | | - add_definitions( -DUSE_DOUBLE) |
22 | | -endif (USE_DOUBLE_PRECISION) |
23 | | - |
24 | | -set(ExternalInstallDir "${CMAKE_SOURCE_DIR}/extern/install" CACHE INTERNAL "") |
| 16 | +set(ExternalInstallDir "${CMAKE_BINARY_DIR}/extern/install" CACHE INTERNAL "") |
25 | 17 | set(EXT_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE INTERNAL "") |
26 | 18 | if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") |
27 | 19 | set(EXT_CMAKE_BUILD_TYPE "Release" CACHE INTERNAL "") |
28 | 20 | endif() |
29 | 21 |
|
30 | | -include(${PROJECT_PATH}/CMake/NeighborhoodSearch.cmake) |
31 | | - |
32 | | -if (WIN32) |
33 | | - subdirs( |
34 | | - extern/zlib |
35 | | - extern/partio |
36 | | - extern/MD5 |
37 | | - extern/tinyexpr |
38 | | - SPlisHSPlasH Utilities) |
39 | | -else() |
40 | | - subdirs( |
41 | | - extern/zlib |
42 | | - extern/partio |
43 | | - extern/md5 |
44 | | - extern/tinyexpr |
45 | | - SPlisHSPlasH Utilities) |
46 | | -endif() |
| 22 | +set(TOPLEVEL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}) |
| 23 | +set(SPH_DATA_PATH "\"../data\"") |
47 | 24 |
|
| 25 | +################################################################################ |
| 26 | +# foreign external libraries |
| 27 | +################################################################################ |
| 28 | +add_subdirectory(extern/zlib) |
| 29 | +add_subdirectory(extern/partio) |
| 30 | +add_subdirectory(extern/md5) |
| 31 | +add_subdirectory(extern/tinyexpr) |
48 | 32 | if (NOT SPH_LIBS_ONLY) |
49 | | - if (WIN32) |
50 | | - add_subdirectory(extern/freeglut) |
51 | | - endif() |
52 | 33 | add_subdirectory(extern/AntTweakBar) |
53 | 34 | add_subdirectory(extern/glew) |
54 | | - add_subdirectory(Simulators) |
55 | | - add_subdirectory(Tools) |
56 | | - add_subdirectory(Tests) |
| 35 | + if(WIN32) |
| 36 | + add_subdirectory(extern/freeglut) |
| 37 | + endif() |
57 | 38 | endif() |
58 | 39 |
|
59 | | -## PositionBasedDynamics |
60 | | -include(ExternalProject) |
61 | | -ExternalProject_Add( |
62 | | - Ext_PBD |
63 | | - PREFIX "${CMAKE_SOURCE_DIR}/extern/PositionBasedDynamics" |
64 | | - GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git |
65 | | - GIT_TAG "dd185b0a0479248cb0c1e98294532b55cb0d287d" |
66 | | - INSTALL_DIR ${ExternalInstallDir}/PositionBasedDynamics |
67 | | - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/PositionBasedDynamics -DPBD_NO_DEMOS:BOOL=1 -DPBD_EXTERNALINSTALLDIR:PATH=${ExternalInstallDir} -DUSE_DOUBLE_PRECISION:BOOL=${USE_DOUBLE_PRECISION} |
68 | | -) |
| 40 | +## Eigen3 is used by most of the libraries that follow |
| 41 | +find_package(Eigen3 REQUIRED) |
| 42 | + |
| 43 | +################################################################################ |
| 44 | +# own external libraries |
| 45 | +################################################################################ |
| 46 | +include(SetUpExternalProjects) |
69 | 47 |
|
70 | | -## GenericParameters |
71 | | -ExternalProject_Add( |
72 | | - Ext_GenericParameters |
73 | | - PREFIX "${CMAKE_SOURCE_DIR}/extern/GenericParameters" |
74 | | - GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/GenericParameters.git |
75 | | - GIT_TAG "b1ad669fac8d106515f6aa8514a03598d5766a36" |
76 | | - INSTALL_DIR ${ExternalInstallDir}/GenericParameters |
77 | | - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/GenericParameters -DGENERICPARAMETERS_NO_TESTS:BOOL=1 |
78 | | -) |
| 48 | +################################################################################ |
| 49 | +# internal libraries |
| 50 | +################################################################################ |
| 51 | +add_subdirectory(SPlisHSPlasH) |
| 52 | +add_subdirectory(Utilities) |
79 | 53 |
|
80 | | -## Discregrid |
81 | | -ExternalProject_Add( |
82 | | - Ext_Discregrid |
83 | | - PREFIX "${CMAKE_SOURCE_DIR}/extern/Discregrid" |
84 | | - GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git |
85 | | - GIT_TAG "c0fb5aeac4c8a83e9f37c720315f13a834409b81" |
86 | | - INSTALL_DIR ${ExternalInstallDir}/Discregrid |
87 | | - CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR} |
88 | | -) |
| 54 | +################################################################################ |
| 55 | +# executables |
| 56 | +################################################################################ |
| 57 | +if (NOT SPH_LIBS_ONLY) |
| 58 | + include(DataCopyTargets) |
| 59 | + add_subdirectory(Tools) |
| 60 | + add_subdirectory(Simulator) |
| 61 | + add_subdirectory(Tests) |
| 62 | +endif() |
0 commit comments