@@ -6,29 +6,31 @@ project(rhinocore_py_bindings CXX)
66set (CMAKE_CXX_STANDARD 17)
77set (CMAKE_CXX_STANDARD_REQUIRED True )
88
9- set (RHINO3DM_PY "YES" )
10-
11- # add_compile_definitions( NANOBIND_BUILD )
12- # if (CMAKE_VERSION VERSION_LESS 3.18)
13- # set(DEV_MODULE Development)
14- # else()
15- # set(DEV_MODULE Development.Module)
16- # endif()
17- # find_package(Python 3.8 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
18-
19- # if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20- # set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
21- # set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
22- # endif()
23-
24- # add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../lib/nanobind nanobind_dir)
25- add_subdirectory (../lib/pybind11 pybind11_dir)
26-
27-
289file (GLOB bindings_SRC "../bindings/*.h" "../bindings/*.cpp" )
2910
30- # nanobind_add_module(rhinocore_py_bindings ${bindings_SRC} stdafx.cpp)
31- pybind11_add_module(rhinocore_py_bindings ${bindings_SRC} stdafx.cpp)
11+ set (RHINO3DM_PY "YES" )
12+ set (NANOBIND_BUILD "YES" )
13+
14+ if (${NANOBIND_BUILD} )
15+ add_compile_definitions ( NANOBIND )
16+ if (CMAKE_VERSION VERSION_LESS 3.18)
17+ set (DEV_MODULE Development)
18+ else ()
19+ set (DEV_MODULE Development.Module)
20+ endif ()
21+ find_package (Python 3.8 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
22+
23+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
24+ set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
25+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
26+ endif ()
27+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /../lib/nanobind nanobind_dir)
28+ nanobind_add_module(rhinocore_py_bindings ${bindings_SRC} stdafx.cpp)
29+ else ()
30+ add_subdirectory (../lib/pybind11 pybind11_dir)
31+ pybind11_add_module(rhinocore_py_bindings ${bindings_SRC} stdafx.cpp)
32+ endif ()
33+
3234
3335add_definitions (-DRHINOCORE_BINDINGS)
3436add_definitions (-DON_CMAKE_BUILD)
@@ -49,5 +51,8 @@ if (WIN32)
4951 )
5052endif ()
5153
52- # target_link_libraries(rhinocore_py_bindings PRIVATE nanobind-static)
53- target_link_libraries (rhinocore_py_bindings PRIVATE pybind11::module)
54+ if (${NANOBIND_BUILD} )
55+ target_link_libraries (rhinocore_py_bindings PRIVATE nanobind-static )
56+ else ()
57+ target_link_libraries (rhinocore_py_bindings PRIVATE pybind11::module)
58+ endif ()
0 commit comments