-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (55 loc) · 2.78 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
cmake_minimum_required(VERSION 3.2)
#We want to use the first Python version that matches the version constraint.
cmake_policy(SET CMP0094 NEW)
project(SmartBody)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/tools/cmake)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
include(GNUInstallDirs)
include(CMakeDependentOption)
#We don't provide Python though Conan (currently), since the user must have Python in their system to
# run Conan anyway. However, we might look into perhaps doing it anyways (as we then could pin the Python version).
#Another reason why we can't currently supply Python through Conan via the CPython dependency is that SmartBody uses
#boost::python for its bindings, and the Conan boost::python package is coded to only work with the system installed
#Python environment. So even if we would interact with a Conan provided CPython environment, the boost::python
#library would be bound to the system one. Which of course results in a festival of linking issues.
#Once/if the Conan provided boost::python installation uses CPython instead this might be changed.
find_package(Python3 COMPONENTS Development REQUIRED)
if (WIN32)
string(REPLACE .lib .dll PYTHON_DLL ${Python3_LIBRARIES})
install(FILES ${Python3_RUNTIME_LIBRARY_RELEASE} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
endif ()
#Gperftools should only be used when developing locally, so we don't provide this through Conan.
find_package(Gperftools 2.5)
cmake_dependent_option(GOOGLE_PROFILER "Use GPerftools for profiling." FALSE "GPERFTOOLS_FOUND" FALSE)
if (GOOGLE_PROFILER)
message(STATUS "Using GPerftools for profiling")
include_directories(${GPERFTOOLS_INCLUDE_DIRS})
link_libraries(${GPERFTOOLS_LIBRARIES})
endif ()
#Temporarily disable the boost warning messages, as they spam the output.
add_compile_definitions(BOOST_ALLOW_DEPRECATED_HEADERS)
add_compile_definitions(BOOST_BIND_GLOBAL_PLACEHOLDERS)
add_compile_definitions(BOOST_NO_AUTO_PTR)
if (WIN32)
#Pinocchio uses the old "hashmap" headers, which MSVC reports as an error. Make it stop.
add_compile_definitions(_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS)
#We need to define PINOCCHIO_EXPORTS since we inherit from some Pinocchio classes.
add_compile_definitions(PINOCCHIO_EXPORTS)
endif ()
#We need to load plugins
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#TODO: upgrade code to handle newer version of Ogre.
option(BUILD_OGRE "Build OGRE renderer." FALSE)
if (BUILD_OGRE)
MESSAGE(STATUS "OGRE renderer will be built.")
else ()
MESSAGE(STATUS "OGRE renderer will not be built.")
endif (BUILD_OGRE)
set(BUILD_FESTIVAL FALSE)
# uses the Assimp asset importer
#set(SB_NO_ASSIMP TRUE)
add_subdirectory(external)
add_subdirectory(libs)
#Install all data
install(DIRECTORY data DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/smartbody)