-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
96 lines (82 loc) · 3.11 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
cmake_minimum_required(VERSION 3.26)
project(PhysicsBasedAnimationToolkit VERSION 0.0.10 LANGUAGES CXX)
enable_testing()
# Configuration options
option(PBAT_BUILD_PYTHON_BINDINGS "Include Python binding module" OFF)
option(PBAT_BUILD_TESTS "Build tests" ${PROJECT_IS_TOP_LEVEL})
option(PBAT_ENABLE_PROFILER
"Enable Tracy profiler client. Note that Microsoft Visual Studio users
need to disable the 'Edit And Continue' feature."
OFF)
option(PBAT_PROFILE_ON_DEMAND
"Build Tracy with TRACY_ON_DEMAND option"
OFF)
option(PBAT_USE_INTEL_MKL "Link to Intel MKL for dense and sparse linear algebra." OFF)
option(PBAT_USE_SUITESPARSE
"Link to SuiteSparse for sparse matrix decompositions. Overrides Intel MKL."
OFF)
option(PBAT_BUILD_SHARED_LIBS "Build as shared library" OFF)
option(PBAT_USE_CUDA "Link to CUDA Toolkit for GPU API" OFF)
# Global settings
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Platform specific settings
include(platform)
# Build as static or shared
if(PBAT_BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
endif()
# Unless user specified otherwise, we decide the structure of our build tree.
include(GNUInstallDirs)
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
message(VERBOSE "PBAT -- Set CMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
message(VERBOSE "PBAT -- Set CMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
message(VERBOSE "PBAT -- Set CMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
endif()
# Dependencies
# Note that this call must come after we have set BUILD_SHARED_LIBS
# in order to propagate the variable to our dependencies (i.e. Tracy).
include(dependencies)
# Sources
add_subdirectory(source)
if(PBAT_BUILD_PYTHON_BINDINGS)
add_subdirectory(bindings)
endif()
if(PBAT_BUILD_TESTS)
add_subdirectory(tests)
endif()
# Install
include(GNUInstallDirs)
set_target_properties(PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit
PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_LIBDIR}
)
install(
TARGETS
eigen
PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit
EXPORT PhysicsBasedAnimationToolkit_Targets
FILE_SET api
)
install(
EXPORT PhysicsBasedAnimationToolkit_Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PhysicsBasedAnimationToolkit
NAMESPACE PhysicsBasedAnimationToolkit::
FILE PhysicsBasedAnimationToolkit_Targets.cmake
)
include(CMakePackageConfigHelpers)
install(
FILES cmake/PhysicsBasedAnimationToolkitConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PhysicsBasedAnimationToolkit
)
write_basic_package_version_file(
PhysicsBasedAnimationToolkitConfigVersion.cmake
COMPATIBILITY ExactVersion
)