forked from polyfem/polyfem-python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
executable file
·66 lines (49 loc) · 1.96 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
################################################################################
# Check required CMake version
set(REQUIRED_CMAKE_VERSION "3.25.0")
cmake_minimum_required(VERSION ${REQUIRED_CMAKE_VERSION})
if(INPUT_POLYFEMPY_DATA_ROOT)
set(POLYFEMPY_DATA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_POLYFEMPY_DATA_ROOT}/")
else()
set(POLYFEMPY_DATA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/data/")
endif()
if(NOT EXISTS ${POLYFEMPY_DATA_ROOT})
file(MAKE_DIRECTORY ${POLYFEMPY_DATA_ROOT})
endif()
project(polyfempy)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
################################################################################
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/recipes/")
include(polyfem_cpm_cache)
# Color output
include(UseColors)
# Prepend function
include(PrependCurrentPath)
# Extra warnings
include(Warnings)
# Use C++11/14
include(CXXFeatures)
# Sort projects inside the solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Generate position independent code by default
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
################################################################################
# Polyfem library
################################################################################
# dependencies
include(polyfem)
include(pybind11)
include(pybind11_json)
#for testing purpose
include(polyfem_data)
################################################################################
# Subdirectories
################################################################################
pybind11_add_module(polyfempy)
add_subdirectory(src)
target_include_directories(polyfempy PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_link_libraries(polyfempy PRIVATE polyfem::polyfem pybind11::module pybind11::json)
set_target_properties(polyfempy PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}")