Major reorganization

This commit is contained in:
2021-03-08 02:23:04 -08:00
parent d42eadcf86
commit 4d82dee240
59 changed files with 137 additions and 920 deletions

View File

@ -2,22 +2,23 @@ cmake_minimum_required(VERSION 3.17)
include(CheckIPOSupported)
include(tools/CompilerWarnings.cmake)
project(python_rgbcx)
project(rgbcx)
# Link to Pybind
find_package(Python COMPONENTS Interpreter Development REQUIRED)
add_subdirectory(extern/pybind11)
# Collect source files
file(GLOB SOURCE_FILES "src/*.cpp" "src/BC*/*.cpp")
file(GLOB HEADER_FILES "src/*.h" "src/BC*/*.h")
file(GLOB PYTHON_FILES "python/*.cpp" "python/*.h")
file(GLOB TEST_FILES "src/test/*.c" "src/test/*.cpp" "src/test/*.h")
file(GLOB SOURCE_FILES "src/rgbcx/*.cpp" "src/rgbcx/BC*/*.cpp")
file(GLOB HEADER_FILES "src/rgbcx/*.h" "src/rgbcx/BC*/*.h")
file(GLOB PYTHON_FILES "src/rgbcx/bindings/*.cpp" "src/rgbcx/bindings/*.h")
file(GLOB TEST_FILES "tests/*.cpp")
# Organize source files together for some IDEs
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_FILES} ${HEADER_FILES} ${PYTHON_FILES})
# Add python module
pybind11_add_module(python_rgbcx
pybind11_add_module(_rgbcx
${SOURCE_FILES}
${HEADER_FILES}
${PYTHON_FILES})
@ -27,11 +28,16 @@ add_executable(test_rgbcx
${HEADER_FILES}
${TEST_FILES})
target_link_libraries(test_rgbcx PRIVATE pybind11::embed)
target_compile_definitions(test_rgbcx PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME_DIRECTORY}/env/lib/python3.8/site-packages")
message("\"${CMAKE_HOME_DIRECTORY}/env/lib/python3.8/site-packages\"")
# Set module features, like C/C++ standards
target_compile_features(python_rgbcx PUBLIC cxx_std_20 c_std_11)
target_compile_features(_rgbcx PUBLIC cxx_std_20 c_std_11)
target_compile_features(test_rgbcx PUBLIC cxx_std_20 c_std_11)
set_project_warnings(python_rgbcx)
set_project_warnings(_rgbcx)
set_project_warnings(test_rgbcx)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")