-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
55 lines (44 loc) · 1.55 KB
/
CMakeLists.txt
File metadata and controls
55 lines (44 loc) · 1.55 KB
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
cmake_minimum_required(VERSION 3.15)
project(loop-cgal VERSION 1.0 LANGUAGES CXX)
# --- Optional vcpkg integration ---
if(DEFINED ENV{VCPKG_ROOT})
message(STATUS "Using VCPKG toolchain from $ENV{VCPKG_ROOT}")
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
else()
message(STATUS "VCPKG_ROOT not defined — using system packages.")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(CGAL REQUIRED)
find_package(pybind11 REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/src)
add_library(_loop_cgal MODULE
loop_cgal/bindings.cpp
src/mesh.cpp
src/meshutils.cpp
src/globals.cpp
)
target_link_libraries(_loop_cgal PRIVATE pybind11::module CGAL::CGAL)
target_include_directories(_loop_cgal PRIVATE ${CMAKE_SOURCE_DIR}/src)
if(WIN32)
set_target_properties(_loop_cgal PROPERTIES PREFIX "" SUFFIX ".pyd")
else()
set_target_properties(_loop_cgal PROPERTIES PREFIX "" SUFFIX ".so")
endif()
# Windows: copy required DLLs from VCPKG_ROOT
if(WIN32)
install(CODE "
file(INSTALL
DESTINATION \"\${CMAKE_INSTALL_PREFIX}/loop_cgal\"
TYPE FILE
FILES
\"${VCPKG_ROOT}/packages/gmp_x64-windows/bin/gmp-10.dll\"
\"${VCPKG_ROOT}/packages/mpfr_x64-windows/bin/mpfr-6.dll\"
)
message(\"[CMake Install] Copied gmp-10.dll and mpfr-6.dll to install directory.\")
")
endif()
# Install for Python packages
install(TARGETS _loop_cgal
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/loop_cgal
)