-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
57 lines (44 loc) · 1.63 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
cmake_minimum_required(VERSION 3.15..3.27)
include(cmake/Helpers.cmake)
include(cmake/CompilerWarnings.cmake)
include(cmake/PythonEnvHelper.cmake)
include(cmake/CloudCompareVariables.cmake)
option(PLUGIN_PYTHON "Install Python Plugin" OFF)
if(PLUGIN_PYTHON)
project(PythonRuntime)
addplugin(NAME ${PROJECT_NAME})
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
ensure_pybind11_cmake_module_is_in_path()
find_package(pybind11 CONFIG REQUIRED)
option(PLUGIN_PYTHON_USE_EMBEDDED_MODULES
"Should the Python wrapper libs be embedded in the plugin" ON
)
mark_as_advanced(PLUGIN_PYTHON_USE_EMBEDDED_MODULES)
if(WIN32)
option(PLUGIN_PYTHON_COPY_ENV
"Should the content of the current python site-package be copied on install"
ON
)
mark_as_advanced(PLUGIN_PYTHON_COPY_ENV)
endif()
add_subdirectory(wrapper)
add_subdirectory(src)
if(PLUGIN_PYTHON_USE_EMBEDDED_MODULES)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_EMBEDDED_MODULES)
embed_cccorelib_in(${PROJECT_NAME})
embed_pycc_in(${PROJECT_NAME})
endif()
target_link_libraries(${PROJECT_NAME} pybind11::embed)
set_target_properties(${PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON CXX_VISIBILITY_PRESET hidden)
add_subdirectory(tests)
add_subdirectory(docs)
add_subdirectory(installer)
if(WIN32)
manage_windows_install()
elseif(UNIX AND NOT APPLE)
if(NOT PLUGIN_PYTHON_USE_EMBEDDED_MODULES)
installsharedlibrary(TARGET cccorelib)
installsharedlibrary(TARGET pycc)
endif()
endif()
endif()