forked from luxonis/depthai-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
1300 lines (1118 loc) · 47.8 KB
/
CMakeLists.txt
File metadata and controls
1300 lines (1118 loc) · 47.8 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cmake_minimum_required(VERSION 3.20)
include(cmake/depthaiOptions.cmake)
if(WIN32)
add_compile_options(/MP)
add_compile_options(/Ob2) # perform more aggresive function inlining to reduce the number of exported symbols, adopted from https://github.com/tensorflow/tensorflow/pull/10962
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Postfix for debug libraries" FORCE)
endif()
find_program(CCACHE_PROGRAM ccache)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5) # Support for CMake 4
if(CCACHE_PROGRAM)
message(STATUS "Using ccache: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()
# CMP0074 dictates that find_package searches environment variable "[packageName]_ROOT" along with regular variable [packageName]_ROOT
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # Only introduced in 3.12
endif()
if(POLICY CMP0028)
cmake_policy(SET CMP0028 NEW)
endif()
if(DEPTHAI_BOOTSTRAP_VCPKG)
message(STATUS "Including vcpkg.cmake")
include(cmake/vcpkg.cmake)
include(cmake/depthaiVcpkgFeatures.cmake)
else()
message(STATUS "DEPTHAI_BOOTSTRAP_VCPKG is OFF")
endif()
# Minimal supported macOS SDK version for both arm64 and x86_64
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
# Set type to canonicalize relative paths for user-provided toolchain
set(CMAKE_TOOLCHAIN_FILE "" CACHE FILEPATH "CMake toolchain path")
# Create a custom toolchain to pass certain options to dependencies
set(gen_toolchain "${CMAKE_CURRENT_BINARY_DIR}/generated/toolchain.cmake")
if(EXISTS "${gen_toolchain}" AND ("${_INTERNAL_DEPTHAI_ORIGINAL_CMAKE_TOOLCHAIN_FILE}" STREQUAL "${CMAKE_TOOLCHAIN_FILE}" OR NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL ""))
message(STATUS "Using existing generated toolchain")
else()
message(STATUS "Generating new toolchain...")
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/toolchain/custom.cmake.in"
"${gen_toolchain}"
@ONLY
)
endif()
set(CMAKE_TOOLCHAIN_FILE "${gen_toolchain}" CACHE STRING "" FORCE)
if(DEFINED _INTERNAL_DEPTHAI_ORIGINAL_CMAKE_TOOLCHAIN_FILE)
message(STATUS "Using specified toolchain file: ${_INTERNAL_DEPTHAI_ORIGINAL_CMAKE_TOOLCHAIN_FILE} combined into: ${CMAKE_TOOLCHAIN_FILE}")
else()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()
# Create depthai project
project(depthai VERSION "3.1.0" LANGUAGES CXX C)
set(DEPTHAI_PRE_RELEASE_TYPE "") # Valid options are "alpha", "beta", "rc", ""
set(DEPTHAI_PRE_RELEASE_VERSION "0") # Valid options are "0", "1", "2", ...
# Set DEPTHAI_VERSION universally, not conditionally
if(DEPTHAI_PRE_RELEASE_TYPE STREQUAL "")
set(DEPTHAI_VERSION ${PROJECT_VERSION})
else()
set(DEPTHAI_VERSION ${PROJECT_VERSION}-${DEPTHAI_PRE_RELEASE_TYPE}.${DEPTHAI_PRE_RELEASE_VERSION})
endif()
get_directory_property(has_parent PARENT_DIRECTORY)
if(has_parent)
set(DEPTHAI_VERSION ${DEPTHAI_VERSION} PARENT_SCOPE) # Set in parent scope if there's a parent
endif()
# Set default build type depending on context
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT DEFINED ENV{CI})
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Set to export compile commands for tools like clang-tidy and format
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Add module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/sanitizers")
# Force Colored output when using Ninja
# Global option - affects all targets
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)" OFF)
if(FORCE_COLORED_OUTPUT)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()
# Specify exporting all symbols on Windows
if(WIN32 AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE BOOL "")
endif()
### Constants
set(PROJECT_EXPORT_GROUP "${PROJECT_NAME}Targets")
## Check if cloned or sources
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE _git_root_dir_error
OUTPUT_VARIABLE _git_root_dir
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(DEPTHAI_DOWNLOADED_SOURCES ON)
if(_git_root_dir_error EQUAL 0 AND "${_git_root_dir}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
set(DEPTHAI_DOWNLOADED_SOURCES OFF)
endif()
message(DEBUG "Git root dir (${_git_root_dir_error}): ${_git_root_dir}")
message(DEBUG "DepthAI as downloaded sources: ${DEPTHAI_DOWNLOADED_SOURCES}")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE BUILD_COMMIT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} show -s --format=%ci ${BUILD_COMMIT}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE BUILD_COMMIT_DATETIME
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
### Get and find dependencies
# Include project dependencies
set(DEPTHAI_DEPENDENCY_INCLUDE "" CACHE FILEPATH "Optional cmake file to append to dependency processing, e.g. additional find_package()")
include(depthaiDependencies)
# Add threads preference
set(THREADS_PREFER_PTHREAD_FLAG ON)
# TODO Remove shared naming
set(DEPTHAI_SHARED_3RDPARTY_INCLUDE
${CMAKE_CURRENT_LIST_DIR}/include/3rdparty/
)
# Add depthai-bootloader-shared
include(${CMAKE_CURRENT_LIST_DIR}/shared/depthai-bootloader-shared.cmake)
if(DEPTHAI_ENABLE_KOMPUTE)
add_subdirectory(shaders)
list(APPEND targets_to_export shaders)
endif()
# Add flags helpers
include(Flags)
### End of dependencies
set(TARGET_CORE_NAME ${PROJECT_NAME}-core)
set(TARGET_CORE_ALIAS core)
########################
# OpenCV Support 1
########################
set(THIRDPARTY_OPENCV_LIBRARIES "" CACHE STRING "Optional libraries to link OpenCV support, e.g. TBB::tbb")
set(TARGET_OPENCV_NAME ${PROJECT_NAME}-opencv)
set(TARGET_OPENCV_ALIAS opencv)
if(DEPTHAI_OPENCV_SUPPORT)
set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio" "opencv_highgui" "opencv_calib3d")
set(OPENCV_SUPPORT_AVAILABLE ${OpenCV_FOUND})
foreach(lib ${REQUIRED_OPENCV_LIBRARIES})
if(NOT (lib IN_LIST OpenCV_LIBS))
set(OPENCV_SUPPORT_AVAILABLE FALSE)
endif()
endforeach()
if(OPENCV_SUPPORT_AVAILABLE)
# Add public compile definition indicating that OpenCV support is available
set(DEPTHAI_HAVE_OPENCV_SUPPORT ON)
message(STATUS "OpenCV and required libraries (${REQUIRED_OPENCV_LIBRARIES}) found. OpenCV Support enabled")
else()
message(STATUS "OpenCV or required libraries (${REQUIRED_OPENCV_LIBRARIES}) not found. OpenCV Support disabled")
endif()
endif()
########################
# PCL Support 1
########################
set(TARGET_PCL_NAME ${PROJECT_NAME}-pcl)
set(TARGET_PCL_ALIAS pcl)
if(DEPTHAI_PCL_SUPPORT)
if(PCL_FOUND)
# Add public compile definition indicating that PCL support is available
set(DEPTHAI_HAVE_PCL_SUPPORT ON)
message(STATUS "PCL found. PCL Support enabled")
else()
message(STATUS "PCL not found. PCL Support disabled")
endif()
endif()
########################
# RTABMap Support 1
########################
set(THIRDPARTY_RTABMAP_LIBRARIES "rtabmap::utilite" CACHE STRING "Optional libraries to link RTABMap support, e.g. TBB::tbb")
set(TARGET_RTABMAP_NAME ${PROJECT_NAME}-rtabmap)
set(TARGET_RTABMAP_ALIAS rtabmap)
if(DEPTHAI_RTABMAP_SUPPORT)
if(${RTABMap_FOUND} AND DEPTHAI_HAVE_PCL_SUPPORT)
set(DEPTHAI_HAVE_RTABMAP_SUPPORT ON)
message(STATUC "RTABMAP found. RTABMAP Support enabled")
else()
if(${RTABMap_FOUND})
message(WARNING "RTABMAP found but depthai does not have PCL support. RTABMAP Support disabled")
else()
message(WARNING "RTABMAP not found. RTABMAP Support disabled")
endif()
endif()
endif()
########################
# Basalt Support 1
########################
set(THIRDPARTY_BASALT_LIBRARIES "basalt_sdk::basalt_sdk" CACHE STRING "Optional libraries to link Basalt support, e.g. TBB::tbb")
set(TARGET_BASALT_NAME ${PROJECT_NAME}-basalt)
set(TARGET_BASALT_ALIAS basalt)
if(DEPTHAI_BASALT_SUPPORT)
if(${basalt_sdk_FOUND})
set(DEPTHAI_HAVE_BASALT_SUPPORT ON)
message(STATUC "Basalt found. Basalt Support enabled")
else()
message(WARNING "Basalt not found. Basalt Support disabled")
endif()
endif()
# Create core library
set(TARGET_CORE_SOURCES
# depthai-bootloader-shared sources
"${DEPTHAI_BOOTLOADER_SHARED_SOURCES}"
# sources
src/common/ModelType.cpp
src/device/Device.cpp
src/device/DeviceBase.cpp
src/device/DeviceBootloader.cpp
# src/device/CallbackHandler.cpp
src/device/CalibrationHandler.cpp
src/device/Version.cpp
src/pipeline/Pipeline.cpp
src/pipeline/AssetManager.cpp
src/pipeline/MessageQueue.cpp
src/pipeline/Node.cpp
src/pipeline/InputQueue.cpp
src/pipeline/ThreadedNode.cpp
src/pipeline/ThreadedHostNode.cpp
src/pipeline/DeviceNode.cpp
src/pipeline/DeviceNodeGroup.cpp
src/pipeline/node/internal/XLinkIn.cpp
src/pipeline/node/internal/XLinkOut.cpp
src/pipeline/node/ColorCamera.cpp
src/pipeline/node/Camera.cpp
src/pipeline/node/Thermal.cpp
src/pipeline/node/ToF.cpp
src/pipeline/node/MessageDemux.cpp
src/pipeline/node/MonoCamera.cpp
src/pipeline/node/StereoDepth.cpp
src/pipeline/node/Sync.cpp
src/pipeline/node/NeuralNetwork.cpp
src/pipeline/node/ImageManip.cpp
src/pipeline/node/Warp.cpp
src/pipeline/node/VideoEncoder.cpp
src/pipeline/node/DetectionNetwork.cpp
src/pipeline/node/Script.cpp
src/pipeline/node/BenchmarkIn.cpp
src/pipeline/node/BenchmarkOut.cpp
src/pipeline/node/SpatialDetectionNetwork.cpp
src/pipeline/node/SystemLogger.cpp
src/pipeline/node/SpatialLocationCalculator.cpp
src/pipeline/node/AprilTag.cpp
src/pipeline/node/ObjectTracker.cpp
src/pipeline/node/IMU.cpp
src/pipeline/node/EdgeDetector.cpp
src/pipeline/node/SPIIn.cpp
src/pipeline/node/FeatureTracker.cpp
src/pipeline/node/ImageAlign.cpp
src/pipeline/node/ToF.cpp
src/pipeline/node/DetectionParser.cpp
src/pipeline/node/test/MyProducer.cpp
src/pipeline/node/test/MyConsumer.cpp
src/pipeline/node/UVC.cpp
src/pipeline/node/internal/XLinkInHost.cpp
src/pipeline/node/internal/XLinkOutHost.cpp
src/pipeline/node/host/HostNode.cpp
src/pipeline/node/host/RGBD.cpp
src/pipeline/datatype/DatatypeEnum.cpp
src/pipeline/datatype/ADataType.cpp
src/pipeline/node/PointCloud.cpp
src/pipeline/datatype/Buffer.cpp
src/pipeline/datatype/ImgFrame.cpp
src/pipeline/datatype/ImgTransformations.cpp
src/pipeline/datatype/EncodedFrame.cpp
src/pipeline/datatype/ImgAnnotations.cpp
src/pipeline/datatype/ImageManipConfig.cpp
src/pipeline/datatype/ImageFiltersConfig.cpp
src/pipeline/datatype/ImageAlignConfig.cpp
src/pipeline/datatype/CameraControl.cpp
src/pipeline/datatype/NNData.cpp
src/pipeline/datatype/ImgDetections.cpp
src/pipeline/datatype/SpatialImgDetections.cpp
src/pipeline/datatype/SystemInformation.cpp
src/pipeline/datatype/SystemInformationS3.cpp
src/pipeline/datatype/StreamMessageParser.cpp
src/pipeline/datatype/SpatialLocationCalculatorData.cpp
src/pipeline/datatype/SpatialLocationCalculatorConfig.cpp
src/pipeline/datatype/AprilTags.cpp
src/pipeline/datatype/AprilTagConfig.cpp
src/pipeline/datatype/Tracklets.cpp
src/pipeline/datatype/IMUData.cpp
src/pipeline/datatype/StereoDepthConfig.cpp
src/pipeline/datatype/EdgeDetectorConfig.cpp
src/pipeline/datatype/TrackedFeatures.cpp
src/pipeline/datatype/FeatureTrackerConfig.cpp
src/pipeline/datatype/ToFConfig.cpp
src/pipeline/datatype/BenchmarkReport.cpp
src/pipeline/datatype/PointCloudConfig.cpp
src/pipeline/datatype/ObjectTrackerConfig.cpp
src/pipeline/datatype/PointCloudData.cpp
src/pipeline/datatype/RGBDData.cpp
src/pipeline/datatype/MessageGroup.cpp
src/pipeline/datatype/ThermalConfig.cpp
src/pipeline/datatype/TransformData.cpp
src/properties/Properties.cpp
src/capabilities/Capabilities.cpp
src/utility/H26xParsers.cpp
src/utility/ImageManipImpl.cpp
src/utility/ObjectTrackerImpl.cpp
src/utility/Memory.cpp
src/utility/VectorMemory.cpp
src/utility/SharedMemory.cpp
src/utility/ProtoSerializable.cpp
src/utility/Initialization.cpp
src/utility/Resources.cpp
src/utility/Platform.cpp
src/utility/RecordReplay.cpp
src/utility/McapImpl.cpp
src/utility/Environment.cpp
src/utility/Compression.cpp
src/utility/XLinkGlobalProfilingLogger.cpp
src/utility/Logging.cpp
src/utility/Checksum.cpp
src/utility/matrixOps.cpp
src/utility/EepromDataParser.cpp
src/utility/LogCollection.cpp
src/utility/MemoryWrappers.cpp
src/utility/Serialization.cpp
src/xlink/XLinkConnection.cpp
src/xlink/XLinkStream.cpp
src/openvino/OpenVINO.cpp
src/openvino/BlobReader.cpp
src/bspatch/bspatch.c
src/device/DeviceGate.cpp
src/utility/ArchiveUtil.cpp
src/nn_archive/NNArchive.cpp
src/nn_archive/NNArchiveVersionedConfig.cpp
src/modelzoo/Zoo.cpp
)
if(DEPTHAI_ENABLE_EVENTS_MANAGER)
list(APPEND TARGET_CORE_SOURCES
src/utility/EventsManager.cpp
)
endif()
if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
list(APPEND TARGET_CORE_SOURCES
src/remote_connection/RemoteConnection.cpp
src/remote_connection/RemoteConnectionImpl.cpp
)
endif()
if(DEPTHAI_ENABLE_PROTOBUF)
list(APPEND TARGET_CORE_SOURCES
src/utility/ProtoSerialize.cpp
)
endif()
if(DEPTHAI_DYNAMIC_CALIBRATION_SUPPORT)
list(APPEND TARGET_CORE_SOURCES
src/pipeline/node/DynamicCalibrationNode.cpp
src/pipeline/datatype/DynamicCalibrationResults.cpp
src/pipeline/datatype/DynamicCalibrationControl.cpp
)
endif()
set(TARGET_OPENCV_SOURCES
src/opencv/ImgFrame.cpp
src/pipeline/node/host/Display.cpp
src/pipeline/node/host/HostCamera.cpp
src/pipeline/node/host/Record.cpp
src/pipeline/node/host/Replay.cpp
src/pipeline/node/ImageFilters.cpp
src/opencv/RecordReplay.cpp
src/opencv/HolisticRecordReplay.cpp
)
set(TARGET_PCL_SOURCES src/pcl/PointCloudData.cpp)
set(TARGET_BASALT_SOURCES src/basalt/BasaltVIO.cpp)
set(TARGET_RTABMAP_SOURCES
src/rtabmap/CalibrationHandler.cpp
src/rtabmap/TransformData.cpp
src/rtabmap/RTABMapVIO.cpp src/rtabmap/RTABMapSLAM.cpp
)
if(DEPTHAI_HAVE_OPENCV_SUPPORT AND DEPTHAI_MERGED_TARGET)
list(APPEND TARGET_CORE_SOURCES
${TARGET_OPENCV_SOURCES}
)
endif()
if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET)
list(APPEND TARGET_CORE_SOURCES
${TARGET_PCL_SOURCES}
)
endif()
if(DEPTHAI_HAVE_BASALT_SUPPORT AND DEPTHAI_MERGED_TARGET)
list(APPEND TARGET_CORE_SOURCES
${TARGET_BASALT_SOURCES}
)
endif()
if(DEPTHAI_HAVE_RTABMAP_SUPPORT AND DEPTHAI_MERGED_TARGET)
list(APPEND TARGET_CORE_SOURCES
${TARGET_RTABMAP_SOURCES}
)
endif()
add_library(${TARGET_CORE_NAME} ${TARGET_CORE_SOURCES})
add_library("${PROJECT_NAME}::${TARGET_CORE_ALIAS}" ALIAS ${TARGET_CORE_NAME})
# Specify that we are building core
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_CORE)
# Specifies name of generated IMPORTED target (set to alias)
set_target_properties(${TARGET_CORE_NAME} PROPERTIES EXPORT_NAME ${TARGET_CORE_ALIAS})
# Add to list of targets to export and install
list(APPEND targets_to_export ${TARGET_CORE_NAME})
if(DEPTHAI_BUILD_ZOO_HELPER)
# Add model_zoo helper binary
find_package(fmt REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(argparse REQUIRED)
set(ZOO_HELPER_SOURCES
src/modelzoo/zoo_helper.cpp
src/modelzoo/Zoo.cpp
src/utility/Environment.cpp
src/utility/Logging.cpp
src/utility/Platform.cpp
)
set(ZOO_HELPER_LINK_LIBRARIES
nlohmann_json::nlohmann_json
fmt::fmt
yaml-cpp::yaml-cpp
CURL::libcurl
cpr::cpr
)
add_executable(zoo_helper ${ZOO_HELPER_SOURCES})
target_compile_definitions(zoo_helper PRIVATE DEPTHAI_ENABLE_CURL)
target_compile_definitions(zoo_helper PRIVATE DEPTHAI_TARGET_CORE)
target_link_libraries(zoo_helper PRIVATE ${ZOO_HELPER_LINK_LIBRARIES})
target_include_directories(zoo_helper
PRIVATE
# depthai-related include dirs - include and src (for src/utilities)
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>"
# argparse
"$<BUILD_INTERFACE:${argparse_INCLUDE_DIRS}>"
)
# Set C++17 standard for zoo_helper
set_property(TARGET zoo_helper PROPERTY CXX_STANDARD 17)
set_property(TARGET zoo_helper PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET zoo_helper PROPERTY CXX_EXTENSIONS OFF)
endif()
if(DEPTHAI_ENABLE_KOMPUTE)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE shaders kompute::kompute)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_KOMPUTE)
endif()
# Add default flags to core
add_default_flags(${TARGET_CORE_NAME})
if(DEPTHAI_VCPKG_INTERNAL_ONLY)
exclude_archive_libs_symbols(${TARGET_CORE_NAME})
endif()
# And clang-tidy and format
if(DEPTHAI_CLANG_TIDY)
include(ClangTidy)
target_clangtidy_setup(${TARGET_CORE_NAME})
endif()
# Set compiler features (c++17), and disables extensions (g++17)
set_property(TARGET ${TARGET_CORE_NAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGET_CORE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${TARGET_CORE_NAME} PROPERTY CXX_EXTENSIONS OFF)
# Add interface transitive property (C++17)
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
target_compile_features(${TARGET_CORE_NAME} INTERFACE cxx_generic_lambdas)
else()
target_compile_features(${TARGET_CORE_NAME} INTERFACE cxx_std_17)
endif()
# Link merged target libraries and add compile definitions
if(DEPTHAI_HAVE_OPENCV_SUPPORT AND DEPTHAI_MERGED_TARGET)
# Link to OpenCV (publically)
target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${REQUIRED_OPENCV_LIBRARIES} ${THIRDPARTY_OPENCV_LIBRARIES})
# Specify that we are building target opencv
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_OPENCV)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_OPENCV_SUPPORT)
endif()
if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET)
# Link to PCL (publically)
target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${PCL_LIBRARIES})
# Specify that we are building target pcl
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_PCL)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT)
target_link_directories(${TARGET_CORE_NAME} PUBLIC
$<BUILD_INTERFACE:${PCL_LIBRARY_DIRS}>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC ${PCL_DEFINITIONS})
endif()
if(DEPTHAI_HAVE_RTABMAP_SUPPORT AND DEPTHAI_MERGED_TARGET)
# Link to rtabmap
target_link_libraries(${TARGET_CORE_NAME} PUBLIC rtabmap::core ${THIRDPARTY_RTABMAP_LIBRARIES})
# add compile defs
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_RTABMAP)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_RTABMAP_SUPPORT)
add_flag(${TARGET_CORE_NAME} -Wno-switch-enum)
endif()
if(DEPTHAI_HAVE_BASALT_SUPPORT AND DEPTHAI_MERGED_TARGET)
# Link to Basalt
target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${THIRDPARTY_BASALT_LIBRARIES})
# add compile defs
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_BASALT)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_BASALT_SUPPORT)
endif()
if(DEPTHAI_MERGED_TARGET)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_MERGED_TARGET)
endif()
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC MCAP_STATIC)
endif()
if(DEPTHAI_DYNAMIC_CALIBRATION_SUPPORT)
# Link the dynamic calibration target
target_link_libraries(${TARGET_CORE_NAME} PRIVATE dynamic_calibration_imported)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_DYNAMIC_CALIBRATION_SUPPORT)
endif()
# Set constant
set(DEPTHAI_RESOURCES_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/resources")
# Include configuration
include(Depthai/DepthaiDeviceSideConfig) # Depthai device binary commit/version configuration
include(Depthai/DepthaiBootloaderConfig) # Depthai bootloader binary commit/version configuration
include(Depthai/DepthaiDeviceKbConfig) # depthai-device-kb fwp commit/version configuration
include(Depthai/DepthaiDeviceRVC4Config) # depthai-device-rvc4 fwp commit/version configuration
include(Depthai/DepthaiVisualizerConfig) # depthai-visualizer commit/version configuration
# Include downloaders
include(DepthaiDownloader) # Depthai device binary downloader
include(DepthaiBootloaderDownloader) # Depthai bootloader binary downloader
include(DepthaiDeviceKbDownloader) # depthai-device-kb fwp downloader
include(DepthaiVisualizerDownloader) # depthai-visualizer downloader
# depthai-shared enforce commit hash match if CI
if($ENV{CI})
# TODO(themarpe) - Disable before final merge
# set(DEPTHAI_SHARED_COMMIT_HASH_ENFORCE ON)
set(DEPTHAI_SHARED_COMMIT_HASH_ENFORCE OFF)
set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH_ENFORCE ON)
endif()
# No user specified paths, download from server
message(STATUS "Downloading Depthai device side binaries from server...")
# Then get the Depthai device side binaries (local or download)
if(DEPTHAI_CMD_PATH OR DEPTHAI_USB2_CMD_PATH OR DEPTHAI_USB2_PATCH_PATH)
# At least one of the paths is set. include binaries locally
message(STATUS "Using local Depthai device side binaries...")
DepthaiLocal(
PATCH_ONLY ${DEPTHAI_USB2_PATCH_ONLY_MODE}
"${DEPTHAI_RESOURCES_OUTPUT_DIR}" # Output folder
DEPTHAI_RESOURCE_LIST # List of output resources
"${DEPTHAI_CMD_PATH}" # depthai.cmd
"${DEPTHAI_USB2_CMD_PATH}" # depthai-usb2.cmd
"${DEPTHAI_USB2_PATCH_PATH}" # depthai-usb2-patch.patch
)
else()
# No user specified paths, download from server
message(STATUS "Downloading Depthai device side binaries from server...")
endif()
if(DEPTHAI_ENABLE_DEVICE_FW)
# Add device FW
DepthaiDownload(
"${DEPTHAI_SHARED_COMMIT_HASH}" "${DEPTHAI_SHARED_COMMIT_HASH_ENFORCE}"
PATCH_ONLY ON
"${DEPTHAI_RESOURCES_OUTPUT_DIR}" # Output folder
DEPTHAI_RESOURCE_LIST # List of output resources
"${DEPTHAI_DEVICE_SIDE_MATURITY}" # Maturity
"${DEPTHAI_DEVICE_SIDE_COMMIT}" # commit hash
"${DEPTHAI_DEVICE_SIDE_VERSION}" # Optional version
)
list(APPEND RESOURCE_COMPILED_FILES ${DEPTHAI_RESOURCE_LIST})
endif()
if(DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW)
# Add bootloader FW
DepthaiBootloaderDownload(
"${DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH}" "${DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH_ENFORCE}"
"${DEPTHAI_RESOURCES_OUTPUT_DIR}" # Output folder
DEPTHAI_BOOTLOADER_RESOURCE_LIST # List of output resources
"${DEPTHAI_BOOTLOADER_MATURITY}" # Maturity
"${DEPTHAI_BOOTLOADER_VERSION}" # if maturity == snapshot -> hash else version
)
list(APPEND RESOURCE_COMPILED_FILES ${DEPTHAI_BOOTLOADER_RESOURCE_LIST})
endif()
if(DEPTHAI_ENABLE_DEVICE_RVC3_FW)
# Add device-kb FW
DepthaiDeviceDownloader(
"depthai-device-kb"
"luxonis-keembay-snapshot-local"
"luxonis-keembay-release-local"
"${DEPTHAI_SHARED_COMMIT_HASH}" "${DEPTHAI_SHARED_COMMIT_HASH_ENFORCE}"
"${DEPTHAI_RESOURCES_OUTPUT_DIR}" # Output folder
DEPTHAI_DEVICE_KB_RESOURCE_LIST # List of output resources
"${DEPTHAI_DEVICE_KB_MATURITY}" # Maturity
"${DEPTHAI_DEVICE_RVC3_VERSION}"
)
list(APPEND RESOURCE_COMPILED_FILES ${DEPTHAI_DEVICE_KB_RESOURCE_LIST})
endif()
if(DEPTHAI_ENABLE_DEVICE_RVC4_FW)
if(DEPTHAI_SANITIZE AND SANITIZE_THREAD)
string(APPEND DEPTHAI_DEVICE_RVC4_VERSION "-tsan")
elseif(DEPTHAI_SANITIZE)
string(APPEND DEPTHAI_DEVICE_RVC4_VERSION "-asan-ubsan")
endif()
# Add device-RVC4 FW
DepthaiDeviceDownloader(
"depthai-device-rvc4"
"luxonis-rvc4-snapshot-local"
"luxonis-rvc4-release-local"
"${DEPTHAI_SHARED_COMMIT_HASH}" "${DEPTHAI_SHARED_COMMIT_HASH_ENFORCE}"
"${DEPTHAI_RESOURCES_OUTPUT_DIR}" # Output folder
DEPTHAI_DEVICE_RVC4_RESOURCE_LIST # List of output resources
"${DEPTHAI_DEVICE_RVC4_MATURITY}" # Maturity
"${DEPTHAI_DEVICE_RVC4_VERSION}"
)
list(APPEND RESOURCE_COMPILED_FILES ${DEPTHAI_DEVICE_RVC4_RESOURCE_LIST})
endif()
if(DEPTHAI_EMBED_FRONTEND)
DepthaiVisualizerDownloader(
"${DEPTHAI_VISUALIZER_COMMIT}" # Visualizer hash
"${DEPTHAI_RESOURCES_OUTPUT_DIR}"
DEPTHAI_VISUALIZER_RESOURCE_LIST # List of output resources
)
list(APPEND RESOURCE_COMPILED_FILES ${DEPTHAI_VISUALIZER_RESOURCE_LIST}) # TODO - Handle the case non debug case
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_VISUALIZER_VERSION="${DEPTHAI_VISUALIZER_COMMIT}")
endif()
message(STATUS "LIST OF RESOURCE COMPILED FILES: ${RESOURCE_COMPILED_FILES}")
if(DEPTHAI_BINARIES_RESOURCE_COMPILE)
# Add RC and resource compile the binares
include(CMakeRC)
set(DEPTHAI_RESOURCE_LIBRARY_NAME "depthai-resources")
# Add resource library
cmrc_add_resource_library("${DEPTHAI_RESOURCE_LIBRARY_NAME}" NAMESPACE depthai
WHENCE "${DEPTHAI_RESOURCES_OUTPUT_DIR}"
"${RESOURCE_COMPILED_FILES}"
)
# Link to resource library
target_link_libraries(${TARGET_CORE_NAME} PRIVATE "${DEPTHAI_RESOURCE_LIBRARY_NAME}")
# Set define that binaries are resource compiled
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_RESOURCE_COMPILED_BINARIES)
else()
# TODO
# Don't add RC and don't resource compile the binaries
# Install to share/ instead for instance
endif()
# Add include directories
target_include_directories(${TARGET_CORE_NAME}
PUBLIC
# Relative path to include directories after installed
"$<INSTALL_INTERFACE:include>"
"$<INSTALL_INTERFACE:include/${DEPTHAI_SHARED_3RDPARTY_HEADERS_PATH}>"
# Build time path to include directories
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<BUILD_INTERFACE:${DEPTHAI_SHARED_PUBLIC_INCLUDE}>"
"$<BUILD_INTERFACE:${DEPTHAI_BOOTLOADER_SHARED_PUBLIC_INCLUDE}>"
#INTERFACE
# # ...
PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/depthai>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>"
"$<BUILD_INTERFACE:${DEPTHAI_SHARED_INCLUDE}>"
"$<BUILD_INTERFACE:${DEPTHAI_BOOTLOADER_SHARED_INCLUDE}>"
)
target_include_directories(${TARGET_CORE_NAME} SYSTEM
PUBLIC
"$<BUILD_INTERFACE:${DEPTHAI_SHARED_3RDPARTY_INCLUDE}>"
)
# Add clang format after specifying include directories
if(DEPTHAI_CLANG_FORMAT)
# HEADER DIRECTORIES
set(header_dirs "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_CURRENT_LIST_DIR}/src" "${DEPTHAI_SHARED_PUBLIC_INCLUDE}" "${DEPTHAI_SHARED_INCLUDE}")
include(ClangFormat)
target_clangformat_setup(${TARGET_CORE_NAME} "${header_dirs}")
endif()
# link libraries
target_link_libraries(${TARGET_CORE_NAME}
PUBLIC
nlohmann_json::nlohmann_json
libnop
INTERFACE
XLinkPublic
PRIVATE
fmt::fmt
yaml-cpp::yaml-cpp
spdlog::spdlog
XLink
Threads::Threads
BZip2::BZip2
LibArchive::LibArchive
ZLIB::ZLIB
httplib::httplib
semver::semver
magic_enum::magic_enum
liblzma::liblzma
lz4::lz4
Eigen3::Eigen
)
if(DEPTHAI_ENABLE_MP4V2)
message(STATUS "DepthAI recording enabled, finding the mp4v2 library!")
target_link_libraries(${TARGET_CORE_NAME} PRIVATE mp4v2::mp4v2)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_MP4V2)
endif()
if(DEPTHAI_ENABLE_PROTOBUF)
# Load protobuf support into library messages_proto
message(STATUS "Protobuf support enabled")
add_subdirectory(protos)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE protobuf::libprotobuf messages)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_ENABLE_PROTOBUF)
endif()
if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
foxglove-websocket::foxglove-websocket
)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_REMOTE_CONNECTION)
endif()
if(DEPTHAI_HAS_APRIL_TAG)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
apriltag::apriltag
)
endif()
if(DEPTHAI_ENABLE_CURL)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
CURL::libcurl
cpr::cpr
)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_CURL)
endif()
# Add compile & CMake definitions
set(DEPTHAI_DEVICE_VERSION "${DEPTHAI_DEVICE_SIDE_COMMIT}")
target_compile_definitions(${TARGET_CORE_NAME}
PRIVATE
# Add depthai-device version
DEPTHAI_DEVICE_VERSION="${DEPTHAI_DEVICE_VERSION}"
# Add depthai-bootloader version
DEPTHAI_BOOTLOADER_VERSION="${DEPTHAI_BOOTLOADER_VERSION}"
# Add depthai-device-kb version
DEPTHAI_DEVICE_RVC3_VERSION="${DEPTHAI_DEVICE_RVC3_VERSION}"
# Add depthai-device-rvc4 version
DEPTHAI_DEVICE_RVC4_VERSION="${DEPTHAI_DEVICE_RVC4_VERSION}"
)
# Add compile flag if libusb is available
if(DEPTHAI_ENABLE_LIBUSB)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_LIBUSB)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_HAVE_LIBUSB_SUPPORT)
set(DEPTHAI_HAVE_LIBUSB_SUPPORT ON)
endif()
if(DEPTHAI_XTENSOR_SUPPORT)
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_XTENSOR_SUPPORT)
target_link_libraries(${TARGET_CORE_NAME} PUBLIC xtensor)
endif()
# Specify available FW
if(DEPTHAI_ENABLE_DEVICE_FW)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_DEVICE_FW)
endif()
if(DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW)
endif()
if(DEPTHAI_ENABLE_DEVICE_RVC3_FW)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_DEVICE_RVC3_FW)
endif()
if(DEPTHAI_ENABLE_DEVICE_RVC4_FW)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_DEVICE_RVC4_FW)
endif()
if(DEPTHAI_EMBED_FRONTEND)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_EMBED_FRONTEND)
endif()
if(DEPTHAI_HAS_APRIL_TAG)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_HAS_APRIL_TAG)
endif()
# Add Backward dependency if enabled (On by default)
if(DEPTHAI_ENABLE_BACKWARD)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_BACKWARD)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE Backward::Backward)
endif()
# Add patch only mode definition
if(DEPTHAI_USB2_PATCH_ONLY_MODE)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_PATCH_ONLY_MODE)
endif()
# Helper function
macro(add_runtime_dependencies depending_target dependency)
if(TARGET ${dependency})
get_property(imported_configs TARGET ${dependency} PROPERTY IMPORTED_CONFIGURATIONS)
set(dlls "")
message(STATUS "Adding runtime dependencies for ${depending_target} on ${dependency}. Imported configurations: ${imported_configs}")
foreach(cfg ${imported_configs})
message(STATUS "Adding runtime dependencies for ${depending_target} on ${dependency} (${cfg})")
get_property(dll TARGET ${dependency} PROPERTY IMPORTED_LOCATION_${cfg})
message(STATUS "Retrieved dll for ${cfg}: '${dll}'")
list(APPEND dlls $<$<CONFIG:${cfg}>:${dll}>)
endforeach()
message(STATUS "Required dlls for ${depending_target} on ${dependency} are: ${dlls}")
endif()
# Create a list of required dll files
set(required_dll_files ${dlls})
# Copy the required dlls
if(WIN32)
add_custom_command(TARGET ${depending_target} POST_BUILD COMMAND
"$<$<BOOL:${required_dll_files}>:${CMAKE_COMMAND};-E;copy_if_different;${required_dll_files};$<TARGET_FILE_DIR:${depending_target}>>"
COMMAND_EXPAND_LISTS
VERBATIM
)
message(STATUS "Required dlls for core are: ${required_dll_files}")
endif()
endmacro()
# Add libusb dll in build time
add_runtime_dependencies(${TARGET_CORE_NAME} usb-1.0)
# Add dynamic calibration dll in build time
if(DEPTHAI_DYNAMIC_CALIBRATION_SUPPORT)
add_runtime_dependencies(${TARGET_CORE_NAME} dynamic_calibration_imported)
endif()
########################
# OpenCV Support 2
########################
if(DEPTHAI_HAVE_OPENCV_SUPPORT AND NOT DEPTHAI_MERGED_TARGET)
# Add depthai-core-opencv library and depthai::core::opencv alias
add_library(${TARGET_OPENCV_NAME}
${TARGET_OPENCV_SOURCES}
)
add_library("${PROJECT_NAME}::${TARGET_OPENCV_ALIAS}" ALIAS ${TARGET_OPENCV_NAME})
# Specifies name of generated IMPORTED target (set to alias)
set_target_properties(${TARGET_OPENCV_NAME} PROPERTIES EXPORT_NAME ${TARGET_OPENCV_ALIAS})
# Add default flags
add_default_flags(${TARGET_OPENCV_NAME})
# Link to OpenCV (publically)
target_link_libraries(${TARGET_OPENCV_NAME} PUBLIC ${REQUIRED_OPENCV_LIBRARIES} ${THIRDPARTY_OPENCV_LIBRARIES})
# Specify that we are building target opencv
target_compile_definitions(${TARGET_OPENCV_NAME} PUBLIC DEPTHAI_TARGET_OPENCV)
target_compile_definitions(${TARGET_OPENCV_NAME} PUBLIC DEPTHAI_HAVE_OPENCV_SUPPORT)
# Add public dependency to depthai::core library
target_link_libraries(${TARGET_OPENCV_NAME} PUBLIC ${TARGET_CORE_NAME})
# Add to clangformat target
if(COMMAND target_clangformat_setup)
target_clangformat_setup(${TARGET_OPENCV_NAME} "")
endif()
# Add to list of targets to export and install
list(APPEND targets_to_export ${TARGET_OPENCV_NAME})
endif()
########################
# PCL Support 2
########################
if(DEPTHAI_HAVE_PCL_SUPPORT AND NOT DEPTHAI_MERGED_TARGET)
# Add depthai-core-pcl library and depthai::core::pcl alias
add_library(${TARGET_PCL_NAME} ${TARGET_PCL_SOURCES})
add_library("${PROJECT_NAME}::${TARGET_PCL_ALIAS}" ALIAS ${TARGET_PCL_NAME})
# Specifies name of generated IMPORTED target (set to alias)
set_target_properties(${TARGET_PCL_NAME} PROPERTIES EXPORT_NAME ${TARGET_PCL_ALIAS})
# Add default flags
add_default_flags(${TARGET_PCL_NAME})
# Link to PCL (publically)
target_link_libraries(${TARGET_PCL_NAME} PUBLIC ${PCL_LIBRARIES})
target_link_libraries(${TARGET_PCL_NAME} PUBLIC pcl_io_ply)
# Specify that we are building target pcl
target_compile_definitions(${TARGET_PCL_NAME} PUBLIC DEPTHAI_TARGET_PCL)
target_compile_definitions(${TARGET_PCL_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT)
target_include_directories(${TARGET_PCL_NAME} PUBLIC ${PCL_INCLUDE_DIRS})
target_link_directories(${TARGET_PCL_NAME} PUBLIC ${PCL_LIBRARY_DIRS})
target_compile_definitions(${TARGET_PCL_NAME} PUBLIC ${PCL_DEFINITIONS})
# Add public dependency to depthai::core library
target_include_directories(${TARGET_CORE_NAME} PUBLIC $<TARGET_PROPERTY:${TARGET_PCL_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(${TARGET_PCL_NAME} PUBLIC ${TARGET_CORE_NAME})
# Add to clangformat target
if(COMMAND target_clangformat_setup)
target_clangformat_setup(${TARGET_PCL_NAME} "")
endif()
# Add to list of targets to export and install
list(APPEND targets_to_export ${TARGET_PCL_NAME})
endif()
########################
# RTABMap Support 2
########################
if(DEPTHAI_HAVE_RTABMAP_SUPPORT AND NOT DEPTHAI_MERGED_TARGET)