Refactor CMake configuration: separate RPT core library into its own CMakeLists.txt and streamline SWIG integration
This commit is contained in:
@ -12,5 +12,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
# Add the SWIG subdirectory
|
# Add subdirectories
|
||||||
|
add_subdirectory(rpt)
|
||||||
add_subdirectory(swig)
|
add_subdirectory(swig)
|
||||||
|
|||||||
24
rpt/CMakeLists.txt
Normal file
24
rpt/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# RPT Core Library
|
||||||
|
|
||||||
|
set(RPT_SOURCES
|
||||||
|
camera.cpp
|
||||||
|
interface.cpp
|
||||||
|
triangulator.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(rpt_core STATIC ${RPT_SOURCES})
|
||||||
|
|
||||||
|
target_include_directories(rpt_core PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(rpt_core PRIVATE
|
||||||
|
-fPIC
|
||||||
|
-march=native
|
||||||
|
-Wall
|
||||||
|
)
|
||||||
|
|
||||||
|
# Release mode optimizations
|
||||||
|
target_compile_options(rpt_core PRIVATE
|
||||||
|
$<$<CONFIG:Release>:-O3;-flto=auto>
|
||||||
|
)
|
||||||
@ -7,19 +7,11 @@ find_package(Python3 REQUIRED COMPONENTS Development)
|
|||||||
# Include SWIG macros
|
# Include SWIG macros
|
||||||
include(UseSWIG)
|
include(UseSWIG)
|
||||||
|
|
||||||
# Compiler flags (matching original Makefile)
|
# Compiler flags for SWIG wrapper
|
||||||
set(RPT_COMPILE_FLAGS -fPIC -O3 -march=native -Wall -flto=auto)
|
set(RPT_COMPILE_FLAGS -fPIC -march=native -Wall)
|
||||||
|
|
||||||
# Create static library from rpt sources
|
# Release mode optimizations
|
||||||
set(RPT_SOURCES
|
list(APPEND RPT_COMPILE_FLAGS $<$<CONFIG:Release>:-O3;-flto=auto>)
|
||||||
${CMAKE_SOURCE_DIR}/rpt/camera.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/rpt/interface.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/rpt/triangulator.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(rpt_core STATIC ${RPT_SOURCES})
|
|
||||||
target_include_directories(rpt_core PUBLIC ${CMAKE_SOURCE_DIR}/rpt)
|
|
||||||
target_compile_options(rpt_core PRIVATE ${RPT_COMPILE_FLAGS})
|
|
||||||
|
|
||||||
# SWIG interface
|
# SWIG interface
|
||||||
set_property(SOURCE rpt.i PROPERTY CPLUSPLUS ON)
|
set_property(SOURCE rpt.i PROPERTY CPLUSPLUS ON)
|
||||||
@ -47,6 +39,5 @@ set_target_properties(rpt PROPERTIES
|
|||||||
|
|
||||||
# Ensure SWIG can find headers
|
# Ensure SWIG can find headers
|
||||||
target_include_directories(rpt PRIVATE
|
target_include_directories(rpt PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/rpt
|
|
||||||
${Python3_INCLUDE_DIRS}
|
${Python3_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user