-
Notifications
You must be signed in to change notification settings - Fork 366
/
CMakeLists.txt
109 lines (92 loc) · 3.81 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
################################################################################
# general CMake and project setup
################################################################################
cmake_minimum_required(VERSION 3.1)
project(PositionBasedDynamics)
set(PROJECT_PATH ${PROJECT_SOURCE_DIR})
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-idirafter${PROJECT_SOURCE_DIR})
else()
include_directories(${PROJECT_SOURCE_DIR})
endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(${PROJECT_PATH}/CMake/Common.cmake)
if (NOT WIN32)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()
if (DEFINED PBD_EXTERNALINSTALLDIR)
set(ExternalInstallDir "${PBD_EXTERNALINSTALLDIR}" CACHE INTERNAL "External install directory")
else()
set(ExternalInstallDir "${PROJECT_BINARY_DIR}" CACHE INTERNAL "External install directory")
endif()
include(ExternalProject)
## Eigen3 is used by most of the libraries that follow
find_package(Eigen3 REQUIRED)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -idirafter${EIGEN3_INCLUDE_DIR}")
endif()
set(EXT_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(EXT_CMAKE_BUILD_TYPE "Release")
endif()
## Discregrid
if ((DEFINED Discregrid_INCLUDE_DIR) AND (DEFINED Discregrid_DEBUG_LIB) AND (DEFINED Discregrid_LIB))
message(STATUS "Using ${Discregrid_INCLUDE_DIR}")
set(Discregrid_LIBRARIES optimized ${Discregrid_LIB} debug ${Discregrid_DEBUG_LIB})
else()
ExternalProject_Add(
Ext_Discregrid
PREFIX "${CMAKE_BINARY_DIR}/extern/Discregrid"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git
GIT_TAG "4c27e1cc88be828c6ac5b8a05759ac7e01cf79e9"
INSTALL_DIR ${ExternalInstallDir}/Discregrid
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} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
)
ExternalProject_Get_Property(Ext_Discregrid INSTALL_DIR)
set(Discregrid_INCLUDE_DIR ${INSTALL_DIR}/include)
set(Discregrid_LIBRARIES optimized ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Discregrid${CMAKE_STATIC_LIBRARY_SUFFIX}
debug ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Discregrid_d${CMAKE_STATIC_LIBRARY_SUFFIX})
unset(INSTALL_DIR)
message(STATUS "Building ${Discregrid_INCLUDE_DIR}")
endif()
if (DEFINED GenericParameters_INCLUDE_DIR)
message(STATUS "Using ${GenericParameters_INCLUDE_DIR}")
else()
## GenericParameters
ExternalProject_Add(
Ext_GenericParameters
PREFIX "${ExternalInstallDir}/GenericParameters"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/GenericParameters.git
GIT_TAG "a4e2744eea526270cfe38b826440d09f66473316"
INSTALL_DIR ${ExternalInstallDir}/GenericParameters
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/GenericParameters -DGENERICPARAMETERS_NO_TESTS:BOOL=1
)
ExternalProject_Get_Property(Ext_GenericParameters INSTALL_DIR)
set(GenericParameters_INCLUDE_DIR ${INSTALL_DIR}/include)
unset(INSTALL_DIR)
endif()
add_subdirectory(PositionBasedDynamics)
add_subdirectory(Simulation)
add_subdirectory(Utils)
if (NOT PBD_LIBS_ONLY)
include(DataCopyTargets)
add_subdirectory(extern/glfw)
add_subdirectory(extern/imgui)
add_subdirectory(extern/md5)
add_subdirectory(Demos)
if (USE_PYTHON_BINDINGS)
add_subdirectory(extern/pybind)
add_subdirectory(pyPBD)
endif ()
endif()
install(DIRECTORY ./Common
DESTINATION include
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ./data
DESTINATION include
FILES_MATCHING PATTERN "*.glsl")
install(DIRECTORY ./Demos/Visualization
DESTINATION include
FILES_MATCHING PATTERN "*.h")