@@ -9,6 +9,12 @@ if(NOT WIN32)
99 set (HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations" )
1010endif ()
1111
12+ # Specify path separator
13+ set (SYS_PATH_SEPARATOR ";" )
14+ if (UNIX )
15+ set (SYS_PATH_SEPARATOR ":" )
16+ endif ()
17+
1218# Generate combined Hunter config
1319file (READ depthai-core/cmake/Hunter/config.cmake depthai_core_hunter_config )
1420file (READ cmake/Hunter/config.cmake hunter_config )
@@ -17,8 +23,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/Hunter/config.cmake ${final_hun
1723
1824include ("cmake/HunterGate.cmake" )
1925HunterGate (
20- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320 .tar.gz"
21- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f "
26+ URL "https://github.com/cpp-pm/hunter/archive/v0.23.322 .tar.gz"
27+ SHA1 "cb0ea1f74f4a2c49a807de34885743495fccccbe "
2228 FILEPATH ${CMAKE_CURRENT_BINARY_DIR} /generated/Hunter/config.cmake # Combined config
2329)
2430
@@ -29,7 +35,7 @@ endif()
2935
3036# Pybindings project
3137set (TARGET_NAME depthai)
32- project (depthai VERSION "0 " ) # revision of bindings [depthai-core].[rev]
38+ project (depthai VERSION "1 " ) # revision of bindings [depthai-core].[rev]
3339
3440# Set default build type depending on context
3541set (default_build_type "Release" )
@@ -90,13 +96,74 @@ pybind11_add_module(${TARGET_NAME}
9096 src/DatatypeBindings.cpp
9197 src/DataQueueBindings.cpp
9298 src/pipeline/PipelineBindings.cpp
93- src/pipeline/NodeBindings.cpp
9499 src/pipeline/CommonBindings.cpp
95100 src/pipeline/AssetManagerBindings.cpp
96101 src/openvino/OpenVINOBindings.cpp
97102 src/log/LogBindings.cpp
103+
104+ src/pipeline/node/NodeBindings.cpp
105+
106+ src/pipeline/node/XLinkInBindings.cpp
107+ src/pipeline/node/XLinkOutBindings.cpp
108+ src/pipeline/node/ColorCameraBindings.cpp
109+ src/pipeline/node/MonoCameraBindings.cpp
110+ src/pipeline/node/StereoDepthBindings.cpp
111+ src/pipeline/node/NeuralNetworkBindings.cpp
112+ src/pipeline/node/VideoEncoderBindings.cpp
113+ src/pipeline/node/ImageManipBindings.cpp
114+ src/pipeline/node/SPIOutBindings.cpp
115+ src/pipeline/node/SPIInBindings.cpp
116+ src/pipeline/node/DetectionNetworkBindings.cpp
117+ src/pipeline/node/SystemLoggerBindings.cpp
118+ src/pipeline/node/ScriptBindings.cpp
119+ src/pipeline/node/SpatialLocationCalculatorBindings.cpp
120+ src/pipeline/node/SpatialDetectionNetworkBindings.cpp
121+ src/pipeline/node/ObjectTrackerBindings.cpp
122+ src/pipeline/node/IMUBindings.cpp
123+ src/pipeline/node/EdgeDetectorBindings.cpp
124+ src/pipeline/node/FeatureTrackerBindings.cpp
125+ src/pipeline/node/AprilTagBindings.cpp
126+ src/pipeline/node/DetectionParserBindings.cpp
127+
128+ src/pipeline/datatype/ADatatypeBindings.cpp
129+ src/pipeline/datatype/AprilTagConfigBindings.cpp
130+ src/pipeline/datatype/AprilTagsBindings.cpp
131+ src/pipeline/datatype/BufferBindings.cpp
132+ src/pipeline/datatype/CameraControlBindings.cpp
133+ src/pipeline/datatype/EdgeDetectorConfigBindings.cpp
134+ src/pipeline/datatype/FeatureTrackerConfigBindings.cpp
135+ src/pipeline/datatype/ImageManipConfigBindings.cpp
136+ src/pipeline/datatype/ImgDetectionsBindings.cpp
137+ src/pipeline/datatype/ImgFrameBindings.cpp
138+ src/pipeline/datatype/IMUDataBindings.cpp
139+ src/pipeline/datatype/NNDataBindings.cpp
140+ src/pipeline/datatype/SpatialImgDetectionsBindings.cpp
141+ src/pipeline/datatype/SpatialLocationCalculatorConfigBindings.cpp
142+ src/pipeline/datatype/SpatialLocationCalculatorDataBindings.cpp
143+ src/pipeline/datatype/StereoDepthConfigBindings.cpp
144+ src/pipeline/datatype/SystemInformationBindings.cpp
145+ src/pipeline/datatype/TrackedFeaturesBindings.cpp
146+ src/pipeline/datatype/TrackletsBindings.cpp
147+
98148)
99149
150+ if (WIN32 )
151+ # Copy dlls to target directory - Windows only
152+ # TARGET_RUNTIME_DLLS generator expression available since CMake 3.21
153+ if (CMAKE_VERSION VERSION_LESS "3.21" )
154+ file (GLOB depthai_dll_libraries "${HUNTER_INSTALL_PREFIX} /bin/*.dll" )
155+ else ()
156+ set (depthai_dll_libraries "$<TARGET_RUNTIME_DLLS :${TARGET_NAME} >" )
157+ endif ()
158+ add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND
159+ ${CMAKE_COMMAND} -E copy ${depthai_dll_libraries} $<TARGET_FILE_DIR :${TARGET_NAME} >
160+ COMMAND_EXPAND_LISTS
161+ )
162+
163+ # Disable "d" postfix, so python can import the library as is
164+ set_target_properties (${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "" )
165+ endif ()
166+
100167# Add stubs (pyi) generation step after building bindings
101168execute_process (COMMAND "${PYTHON_EXECUTABLE} " "-c" "from mypy import api" RESULT_VARIABLE error OUTPUT_QUIET ERROR_QUIET )
102169if (error)
@@ -108,7 +175,10 @@ else()
108175 endif ()
109176 message (STATUS "Mypy available, creating and checking stubs. Running with generate_stubs.py ${TARGET_NAME} ${bindings_directory} " )
110177 add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND
111- ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR} /generate_stubs.py" "${TARGET_NAME} " "${bindings_directory} "
178+ ${CMAKE_COMMAND} -E env
179+ # Python path (to find compiled module)
180+ "PYTHONPATH=$<TARGET_FILE_DIR :${TARGET_NAME} >${SYS_PATH_SEPARATOR} $ENV{PYTHONPATH} "
181+ ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR} /generate_stubs.py" "${TARGET_NAME} " "$<TARGET_FILE_DIR :${TARGET_NAME} >"
112182 DEPENDS "${CMAKE_CURRENT_LIST_DIR} /generate_stubs.py"
113183 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} "
114184 )
0 commit comments