-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
41 lines (32 loc) · 1.53 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
cmake_minimum_required(VERSION 3.15...3.26)
project(fTetWildWrapper)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./src/pytetwild)
if($ENV{USE_MAVX})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
endif()
# Set the path to the fTetWild project
set(fTetWild_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/fTetWild")
# Add the pybind11 submodule
set(PYBIND11_NEWPYTHON ON)
set(pybind11_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/pybind11")
add_subdirectory(${pybind11_DIR})
# Include the fTetWild project as a subdirectory
add_subdirectory(${fTetWild_DIR} EXCLUDE_FROM_ALL)
pybind11_add_module(PyfTetWildWrapper MODULE "${CMAKE_CURRENT_SOURCE_DIR}/src/FTetWildWrapper.cpp")
# Include directories from fTetWild required for the wrapper
target_include_directories(PyfTetWildWrapper PUBLIC ${fTetWild_DIR}/src)
# Link the FloatTetwild library (from fTetWild)
target_link_libraries(PyfTetWildWrapper PRIVATE FloatTetwild)
target_compile_features(PyfTetWildWrapper PUBLIC cxx_std_11)
if(WIN32)
set_target_properties(PyfTetWildWrapper PROPERTIES SUFFIX ".pyd")
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG_UPPER)
set_target_properties(PyfTetWildWrapper PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} "${CMAKE_CURRENT_SOURCE_DIR}/src/pytetwild"
LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} "${CMAKE_CURRENT_SOURCE_DIR}/src/pytetwild"
)
endforeach()
endif()
install(TARGETS PyfTetWildWrapper LIBRARY DESTINATION ./pytetwild)