forked from kaygdev/octdata4python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
56 lines (45 loc) · 1.69 KB
/
CMakeLists.txt
File metadata and controls
56 lines (45 loc) · 1.69 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
56
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(octdata4python LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
# 🔧 Match Boost build config
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
# Match Boost libs per platform and Python version
if(Python3_VERSION)
string(REPLACE "." "" PY_VER "${Python3_VERSION}")
set(BOOST_PYTHON_COMPONENT "python${PY_VER}")
else()
set(BOOST_PYTHON_COMPONENT "python")
endif()
message(STATUS "🐍 Boost.Python component resolved as: ${BOOST_PYTHON_COMPONENT}")
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
find_package(Boost COMPONENTS ${BOOST_PYTHON_COMPONENT} numpy REQUIRED)
find_package(LibOctData REQUIRED)
find_package(OpenCV REQUIRED COMPONENTS core)
add_library(${CMAKE_PROJECT_NAME} MODULE octdata4python.cpp)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".pyd")
message(STATUS "🪟 Windows detected: setting output suffix to .pyd")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wunreachable-code -Wconversion")
endif()
if(MSVC)
message(STATUS "🛠 MSVC detected: setting runtime library flags")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
message(STATUS "🐞 Debug build: using MultiThreadedDebugDLL")
endif()
endif()
target_link_libraries(octdata4python
PRIVATE
LibOctData::octdata
Boost::python
Boost::numpy
opencv_core
Python3::Module
)
install(TARGETS ${CMAKE_PROJECT_NAME} LIBRARY DESTINATION octdata4python/core)