-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
executable file
·78 lines (51 loc) · 2.14 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
################################################################################
cmake_minimum_required(VERSION 3.1)
project(polyfempy)
################################################################################
if(INPUT_THIRD_PARTY_DIR)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_THIRD_PARTY_DIR}/)
else()
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# 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)
################################################################################
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
string(REPLACE /MD /MT CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
string(REPLACE /MD /MT CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
endforeach()
endif()
################################################################################
# Setup dependencies
include(PolyfemPythonDependencies)
################################################################################
# Polyfem library
################################################################################
# polyfem
polyfem_python_download_polyfem()
add_subdirectory(${THIRD_PARTY_DIR}/polyfem)
# pybind11
polyfem_python_download_pybind11()
add_subdirectory(${THIRD_PARTY_DIR}/pybind11)
#for testing purpose
polyfem_python_download_data()
################################################################################
# Subdirectories
################################################################################
add_library(polyfempy MODULE src/binding.cpp)
target_link_libraries(polyfempy PRIVATE polyfem)
target_link_libraries(polyfempy PRIVATE pybind11::module)
set_target_properties(polyfempy PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}")