-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
find_dependencies.cmake
1745 lines (1667 loc) · 67.3 KB
/
find_dependencies.cmake
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
#
# Open3D 3rd party library integration
#
set(Open3D_3RDPARTY_DIR "${CMAKE_CURRENT_LIST_DIR}")
# EXTERNAL_MODULES
# CMake modules we depend on in our public interface. These are modules we
# need to find_package() in our CMake config script, because we will use their
# targets.
set(Open3D_3RDPARTY_EXTERNAL_MODULES)
# XXX_FROM_CUSTOM vs. XXX_FROM_SYSTEM
# - "FROM_CUSTOM": downloaded or compiled
# - "FROM_SYSTEM": installed with a system package manager, deteced by CMake
# PUBLIC_TARGETS
# CMake targets we link against in our public interface. They are either locally
# defined and installed, or imported from an external module (see above).
set(Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_CUSTOM)
set(Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_SYSTEM)
# HEADER_TARGETS
# CMake targets we use in our public interface, but as a special case we only
# need to link privately against the library. This simplifies dependencies
# where we merely expose declared data types from other libraries in our
# public headers, so it would be overkill to require all library users to link
# against that dependency.
set(Open3D_3RDPARTY_HEADER_TARGETS_FROM_CUSTOM)
set(Open3D_3RDPARTY_HEADER_TARGETS_FROM_SYSTEM)
# PRIVATE_TARGETS
# CMake targets for dependencies which are not exposed in the public API. This
# will include anything else we use internally.
set(Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM)
set(Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM)
find_package(PkgConfig QUIET)
# open3d_build_3rdparty_library(name ...)
#
# Builds a third-party library from source
#
# Valid options:
# PUBLIC
# the library belongs to the public interface and must be installed
# HEADER
# the library headers belong to the public interface, but the library
# itself is linked privately
# INCLUDE_ALL
# install all files in the include directories. Default is *.h, *.hpp
# VISIBLE
# Symbols from this library will be visible for use outside Open3D.
# Required, for example, if it may throw exceptions that need to be
# caught in client code.
# DIRECTORY <dir>
# the library source directory <dir> is either a subdirectory of
# 3rdparty/ or an absolute directory.
# INCLUDE_DIRS <dir> [<dir> ...]
# include headers are in the subdirectories <dir>. Trailing slashes
# have the same meaning as with install(DIRECTORY). <dir> must be
# relative to the library source directory.
# If your include is "#include <x.hpp>" and the path of the file is
# "path/to/libx/x.hpp" then you need to pass "path/to/libx/"
# with the trailing "/". If you have "#include <libx/x.hpp>" then you
# need to pass "path/to/libx".
# SOURCES <src> [<src> ...]
# the library sources. Can be omitted for header-only libraries.
# All sources must be relative to the library source directory.
# LIBS <target> [<target> ...]
# extra link dependencies
# DEPENDS <target> [<target> ...]
# targets on which <name> depends on and that must be built before.
#
function(open3d_build_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER;INCLUDE_ALL;VISIBLE" "DIRECTORY" "INCLUDE_DIRS;SOURCES;LIBS;DEPENDS" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_build_3rdparty_library(${name} ${ARGN})")
endif()
get_filename_component(arg_DIRECTORY "${arg_DIRECTORY}" ABSOLUTE BASE_DIR "${Open3D_3RDPARTY_DIR}")
if(arg_SOURCES)
add_library(${name} STATIC)
set_target_properties(${name} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_${name}")
open3d_set_global_properties(${name})
else()
add_library(${name} INTERFACE)
endif()
if(arg_INCLUDE_DIRS)
set(include_dirs)
foreach(incl IN LISTS arg_INCLUDE_DIRS)
list(APPEND include_dirs "${arg_DIRECTORY}/${incl}")
endforeach()
else()
set(include_dirs "${arg_DIRECTORY}/")
endif()
if(arg_SOURCES)
foreach(src IN LISTS arg_SOURCES)
get_filename_component(abs_src "${src}" ABSOLUTE BASE_DIR "${arg_DIRECTORY}")
# Mark as generated to skip CMake's file existence checks
set_source_files_properties(${abs_src} PROPERTIES GENERATED TRUE)
target_sources(${name} PRIVATE ${abs_src})
endforeach()
foreach(incl IN LISTS include_dirs)
if (incl MATCHES "(.*)/$")
set(incl_path ${CMAKE_MATCH_1})
else()
get_filename_component(incl_path "${incl}" DIRECTORY)
endif()
target_include_directories(${name} SYSTEM PUBLIC $<BUILD_INTERFACE:${incl_path}>)
endforeach()
# Do not export symbols from 3rd party libraries outside the Open3D DSO.
if(NOT arg_PUBLIC AND NOT arg_HEADER AND NOT arg_VISIBLE)
set_target_properties(${name} PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
CUDA_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
endif()
if(arg_LIBS)
target_link_libraries(${name} PRIVATE ${arg_LIBS})
endif()
else()
foreach(incl IN LISTS include_dirs)
if (incl MATCHES "(.*)/$")
set(incl_path ${CMAKE_MATCH_1})
else()
get_filename_component(incl_path "${incl}" DIRECTORY)
endif()
target_include_directories(${name} SYSTEM INTERFACE $<BUILD_INTERFACE:${incl_path}>)
endforeach()
endif()
if(NOT BUILD_SHARED_LIBS OR arg_PUBLIC)
install(TARGETS ${name} EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION ${Open3D_INSTALL_BIN_DIR}
ARCHIVE DESTINATION ${Open3D_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${Open3D_INSTALL_LIB_DIR}
)
endif()
if(arg_PUBLIC OR arg_HEADER)
foreach(incl IN LISTS include_dirs)
if(arg_INCLUDE_ALL)
install(DIRECTORY ${incl}
DESTINATION ${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty
)
else()
install(DIRECTORY ${incl}
DESTINATION ${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
endif()
target_include_directories(${name} INTERFACE $<INSTALL_INTERFACE:${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty>)
endforeach()
endif()
if(arg_DEPENDS)
add_dependencies(${name} ${arg_DEPENDS})
endif()
add_library(${PROJECT_NAME}::${name} ALIAS ${name})
endfunction()
# CMake arguments for configuring ExternalProjects. Use the second _hidden
# version by default.
set(ExternalProject_CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_CUDA_COMPILER_LAUNCHER=${CMAKE_CUDA_COMPILER_LAUNCHER}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_INSTALL_LIBDIR=${Open3D_INSTALL_LIB_DIR}
# Always build 3rd party code in Release mode. Ignored by multi-config
# generators (XCode, MSVC). MSVC needs matching config anyway.
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
)
# Keep 3rd party symbols hidden from Open3D user code. Do not use if 3rd party
# libraries throw exceptions that escape Open3D.
set(ExternalProject_CMAKE_ARGS_hidden
${ExternalProject_CMAKE_ARGS}
# Apply LANG_VISIBILITY_PRESET to static libraries and archives as well
-DCMAKE_POLICY_DEFAULT_CMP0063:STRING=NEW
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_CUDA_VISIBILITY_PRESET=hidden
-DCMAKE_C_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON
)
# open3d_pkg_config_3rdparty_library(name ...)
#
# Creates an interface library for a pkg-config dependency.
#
# The function will set ${name}_FOUND to TRUE or FALSE
# indicating whether or not the library could be found.
#
# Valid options:
# PUBLIC
# the library belongs to the public interface and must be installed
# HEADER
# the library headers belong to the public interface, but the library
# itself is linked privately
# SEARCH_ARGS
# the arguments passed to pkg_search_module()
#
function(open3d_pkg_config_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER" "" "SEARCH_ARGS" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_pkg_config_3rdparty_library(${name} ${ARGN})")
endif()
if(PKGCONFIG_FOUND)
pkg_search_module(pc_${name} ${arg_SEARCH_ARGS})
endif()
if(pc_${name}_FOUND)
message(STATUS "Using installed third-party library ${name} ${${name_uc}_VERSION}")
add_library(${name} INTERFACE)
target_include_directories(${name} SYSTEM INTERFACE ${pc_${name}_INCLUDE_DIRS})
target_link_libraries(${name} INTERFACE ${pc_${name}_LINK_LIBRARIES})
foreach(flag IN LISTS pc_${name}_CFLAGS_OTHER)
if(flag MATCHES "-D(.*)")
target_compile_definitions(${name} INTERFACE ${CMAKE_MATCH_1})
endif()
endforeach()
if(NOT BUILD_SHARED_LIBS OR arg_PUBLIC)
install(TARGETS ${name} EXPORT ${PROJECT_NAME}Targets)
endif()
set(${name}_FOUND TRUE PARENT_SCOPE)
add_library(${PROJECT_NAME}::${name} ALIAS ${name})
else()
message(STATUS "Unable to find installed third-party library ${name}")
set(${name}_FOUND FALSE PARENT_SCOPE)
endif()
endfunction()
# open3d_find_package_3rdparty_library(name ...)
#
# Creates an interface library for a find_package dependency.
#
# The function will set ${name}_FOUND to TRUE or FALSE
# indicating whether or not the library could be found.
#
# Valid options:
# PUBLIC
# the library belongs to the public interface and must be installed
# HEADER
# the library headers belong to the public interface, but the library
# itself is linked privately
# REQUIRED
# finding the package is required
# QUIET
# finding the package is quiet
# PACKAGE <pkg>
# the name of the queried package <pkg> forwarded to find_package()
# PACKAGE_VERSION_VAR <pkg_version>
# the variable <pkg_version> where to find the version of the queried package <pkg> find_package().
# If not provided, PACKAGE_VERSION_VAR will default to <pkg>_VERSION.
# TARGETS <target> [<target> ...]
# the expected targets to be found in <pkg>
# INCLUDE_DIRS
# the expected include directory variable names to be found in <pkg>.
# If <pkg> also defines targets, use them instead and pass them via TARGETS option.
# LIBRARIES
# the expected library variable names to be found in <pkg>.
# If <pkg> also defines targets, use them instead and pass them via TARGETS option.
#
function(open3d_find_package_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER;REQUIRED;QUIET" "PACKAGE;PACKAGE_VERSION_VAR" "TARGETS;INCLUDE_DIRS;LIBRARIES" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_find_package_3rdparty_library(${name} ${ARGN})")
endif()
if(NOT arg_PACKAGE)
message(FATAL_ERROR "open3d_find_package_3rdparty_library: Expected value for argument PACKAGE")
endif()
if(NOT arg_PACKAGE_VERSION_VAR)
set(arg_PACKAGE_VERSION_VAR "${arg_PACKAGE}_VERSION")
endif()
set(find_package_args "")
if(arg_REQUIRED)
list(APPEND find_package_args "REQUIRED")
endif()
if(arg_QUIET)
list(APPEND find_package_args "QUIET")
endif()
find_package(${arg_PACKAGE} ${find_package_args})
if(${arg_PACKAGE}_FOUND)
message(STATUS "Using installed third-party library ${name} ${${arg_PACKAGE}_VERSION}")
add_library(${name} INTERFACE)
if(arg_TARGETS)
foreach(target IN LISTS arg_TARGETS)
if (TARGET ${target})
target_link_libraries(${name} INTERFACE ${target})
else()
message(WARNING "Skipping undefined target ${target}")
endif()
endforeach()
endif()
if(arg_INCLUDE_DIRS)
foreach(incl IN LISTS arg_INCLUDE_DIRS)
target_include_directories(${name} INTERFACE ${${incl}})
endforeach()
endif()
if(arg_LIBRARIES)
foreach(lib IN LISTS arg_LIBRARIES)
target_link_libraries(${name} INTERFACE ${${lib}})
endforeach()
endif()
if(NOT BUILD_SHARED_LIBS OR arg_PUBLIC)
install(TARGETS ${name} EXPORT ${PROJECT_NAME}Targets)
# Ensure that imported targets will be found again.
if(arg_TARGETS)
list(APPEND Open3D_3RDPARTY_EXTERNAL_MODULES ${arg_PACKAGE})
set(Open3D_3RDPARTY_EXTERNAL_MODULES ${Open3D_3RDPARTY_EXTERNAL_MODULES} PARENT_SCOPE)
endif()
endif()
set(${name}_FOUND TRUE PARENT_SCOPE)
set(${name}_VERSION ${${arg_PACKAGE_VERSION_VAR}} PARENT_SCOPE)
add_library(${PROJECT_NAME}::${name} ALIAS ${name})
else()
message(STATUS "Unable to find installed third-party library ${name}")
set(${name}_FOUND FALSE PARENT_SCOPE)
endif()
endfunction()
# List of linker options for libOpen3D client binaries (eg: pybind) to hide Open3D 3rd
# party dependencies. Only needed with GCC, not AppleClang.
set(OPEN3D_HIDDEN_3RDPARTY_LINK_OPTIONS)
if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
find_library(LexLIB libl.a) # test archive in macOS
if (LexLIB)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_LINK_OPTIONS -load_hidden ${LexLIB})
check_cxx_source_compiles("int main() {return 0;}" FLAG_load_hidden)
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()
endif()
if (NOT FLAG_load_hidden)
set(FLAG_load_hidden 0)
endif()
# open3d_import_3rdparty_library(name ...)
#
# Imports a third-party library that has been built independently in a sub project.
#
# Valid options:
# PUBLIC
# the library belongs to the public interface and must be installed
# HEADER
# the library headers belong to the public interface and will be
# installed, but the library is linked privately.
# INCLUDE_ALL
# install all files in the include directories. Default is *.h, *.hpp
# HIDDEN
# Symbols from this library will not be exported to client code during
# linking with Open3D. This is the opposite of the VISIBLE option in
# open3d_build_3rdparty_library. Prefer hiding symbols during building 3rd
# party libraries, since this option is not supported by the MSVC linker.
# GROUPED
# add "-Wl,--start-group" libx.a liby.a libz.a "-Wl,--end-group" around
# the libraries.
# INCLUDE_DIRS
# the temporary location where the library headers have been installed.
# Trailing slashes have the same meaning as with install(DIRECTORY).
# If your include is "#include <x.hpp>" and the path of the file is
# "/path/to/libx/x.hpp" then you need to pass "/path/to/libx/"
# with the trailing "/". If you have "#include <libx/x.hpp>" then you
# need to pass "/path/to/libx".
# LIBRARIES
# the built library name(s). It is assumed that the library is static.
# If the library is PUBLIC, it will be renamed to Open3D_${name} at
# install time to prevent name collisions in the install space.
# LIB_DIR
# the temporary location of the library. Defaults to
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY.
# DEPENDS <target> [<target> ...]
# targets on which <name> depends on and that must be built before.
#
function(open3d_import_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER;INCLUDE_ALL;HIDDEN;GROUPED" "LIB_DIR" "INCLUDE_DIRS;LIBRARIES;DEPENDS" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_import_3rdparty_library(${name} ${ARGN})")
endif()
if(NOT arg_LIB_DIR)
set(arg_LIB_DIR "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
endif()
add_library(${name} INTERFACE)
if(arg_INCLUDE_DIRS)
foreach(incl IN LISTS arg_INCLUDE_DIRS)
if (incl MATCHES "(.*)/$")
set(incl_path ${CMAKE_MATCH_1})
else()
get_filename_component(incl_path "${incl}" DIRECTORY)
endif()
target_include_directories(${name} SYSTEM INTERFACE $<BUILD_INTERFACE:${incl_path}>)
if(arg_PUBLIC OR arg_HEADER)
if(arg_INCLUDE_ALL)
install(DIRECTORY ${incl}
DESTINATION ${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty
)
else()
install(DIRECTORY ${incl}
DESTINATION ${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
endif()
target_include_directories(${name} INTERFACE $<INSTALL_INTERFACE:${Open3D_INSTALL_INCLUDE_DIR}/open3d/3rdparty>)
endif()
endforeach()
endif()
if(arg_LIBRARIES)
list(LENGTH arg_LIBRARIES libcount)
if(arg_HIDDEN AND NOT arg_PUBLIC AND NOT arg_HEADER)
set(HIDDEN 1)
else()
set(HIDDEN 0)
endif()
if(arg_GROUPED)
target_link_libraries(${name} INTERFACE "-Wl,--start-group")
endif()
foreach(arg_LIBRARY IN LISTS arg_LIBRARIES)
set(library_filename ${CMAKE_STATIC_LIBRARY_PREFIX}${arg_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX})
if(libcount EQUAL 1)
set(installed_library_filename ${CMAKE_STATIC_LIBRARY_PREFIX}${PROJECT_NAME}_${name}${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(installed_library_filename ${CMAKE_STATIC_LIBRARY_PREFIX}${PROJECT_NAME}_${name}_${arg_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
# Apple compiler ld
target_link_libraries(${name} INTERFACE
"$<BUILD_INTERFACE:$<$<AND:${HIDDEN},${FLAG_load_hidden}>:-load_hidden >${arg_LIB_DIR}/${library_filename}>")
if(NOT BUILD_SHARED_LIBS OR arg_PUBLIC)
install(FILES ${arg_LIB_DIR}/${library_filename}
DESTINATION ${Open3D_INSTALL_LIB_DIR}
RENAME ${installed_library_filename}
)
target_link_libraries(${name} INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${Open3D_INSTALL_LIB_DIR}/${installed_library_filename}>)
endif()
if (HIDDEN)
# GNU compiler ld
target_link_options(${name} INTERFACE
$<$<CXX_COMPILER_ID:GNU>:LINKER:--exclude-libs,${library_filename}>)
list(APPEND OPEN3D_HIDDEN_3RDPARTY_LINK_OPTIONS $<$<CXX_COMPILER_ID:GNU>:LINKER:--exclude-libs,${library_filename}>)
set(OPEN3D_HIDDEN_3RDPARTY_LINK_OPTIONS
${OPEN3D_HIDDEN_3RDPARTY_LINK_OPTIONS} PARENT_SCOPE)
endif()
endforeach()
if(arg_GROUPED)
target_link_libraries(${name} INTERFACE "-Wl,--end-group")
endif()
endif()
if(NOT BUILD_SHARED_LIBS OR arg_PUBLIC)
install(TARGETS ${name} EXPORT ${PROJECT_NAME}Targets)
endif()
if(arg_DEPENDS)
add_dependencies(${name} ${arg_DEPENDS})
endif()
add_library(${PROJECT_NAME}::${name} ALIAS ${name})
endfunction()
include(ProcessorCount)
ProcessorCount(NPROC)
# CUDAToolkit (required at this point for subsequent checks and targets)
if(BUILD_CUDA_MODULE)
find_package(CUDAToolkit REQUIRED)
endif()
# Threads
open3d_find_package_3rdparty_library(3rdparty_threads
REQUIRED
PACKAGE Threads
TARGETS Threads::Threads
)
# Assimp
if(USE_SYSTEM_ASSIMP)
open3d_find_package_3rdparty_library(3rdparty_assimp
PACKAGE assimp
TARGETS assimp::assimp
)
if(NOT 3rdparty_assimp_FOUND)
set(USE_SYSTEM_ASSIMP OFF)
endif()
endif()
if(NOT USE_SYSTEM_ASSIMP)
include(${Open3D_3RDPARTY_DIR}/assimp/assimp.cmake)
open3d_import_3rdparty_library(3rdparty_assimp
INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR}
LIB_DIR ${ASSIMP_LIB_DIR}
LIBRARIES ${ASSIMP_LIBRARIES}
DEPENDS ext_assimp
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_assimp)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_assimp)
endif()
# OpenMP
if(WITH_OPENMP)
open3d_find_package_3rdparty_library(3rdparty_openmp
PACKAGE OpenMP
PACKAGE_VERSION_VAR OpenMP_CXX_VERSION
TARGETS OpenMP::OpenMP_CXX
)
if(3rdparty_openmp_FOUND)
message(STATUS "Building with OpenMP")
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_openmp)
endif()
endif()
# X11
if(UNIX AND NOT APPLE)
open3d_find_package_3rdparty_library(3rdparty_x11
QUIET
PACKAGE X11
TARGETS X11::X11
)
endif()
# CUB (already included in CUDA 11.0+)
if(BUILD_CUDA_MODULE AND CUDAToolkit_VERSION VERSION_LESS "11.0")
include(${Open3D_3RDPARTY_DIR}/cub/cub.cmake)
open3d_import_3rdparty_library(3rdparty_cub
INCLUDE_DIRS ${CUB_INCLUDE_DIRS}
DEPENDS ext_cub
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_cub)
endif()
# cutlass
if(BUILD_CUDA_MODULE)
include(${Open3D_3RDPARTY_DIR}/cutlass/cutlass.cmake)
open3d_import_3rdparty_library(3rdparty_cutlass
INCLUDE_DIRS ${CUTLASS_INCLUDE_DIRS}
DEPENDS ext_cutlass
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_cutlass)
endif()
# Dirent
if(WIN32)
open3d_build_3rdparty_library(3rdparty_dirent DIRECTORY dirent)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_dirent)
endif()
# Eigen3
if(USE_SYSTEM_EIGEN3)
open3d_find_package_3rdparty_library(3rdparty_eigen3
PUBLIC
PACKAGE Eigen3
TARGETS Eigen3::Eigen
)
if(NOT 3rdparty_eigen3_FOUND)
set(USE_SYSTEM_EIGEN3 OFF)
endif()
endif()
if(NOT USE_SYSTEM_EIGEN3)
include(${Open3D_3RDPARTY_DIR}/eigen/eigen.cmake)
open3d_import_3rdparty_library(3rdparty_eigen3
PUBLIC
INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}
INCLUDE_ALL
DEPENDS ext_eigen
)
list(APPEND Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_CUSTOM Open3D::3rdparty_eigen3)
else()
list(APPEND Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_SYSTEM Open3D::3rdparty_eigen3)
endif()
# Nanoflann
if(USE_SYSTEM_NANOFLANN)
open3d_find_package_3rdparty_library(3rdparty_nanoflann
PACKAGE nanoflann
TARGETS nanoflann::nanoflann
)
if(NOT 3rdparty_nanoflann_FOUND)
set(USE_SYSTEM_NANOFLANN OFF)
endif()
endif()
if(NOT USE_SYSTEM_NANOFLANN)
include(${Open3D_3RDPARTY_DIR}/nanoflann/nanoflann.cmake)
open3d_import_3rdparty_library(3rdparty_nanoflann
INCLUDE_DIRS ${NANOFLANN_INCLUDE_DIRS}
DEPENDS ext_nanoflann
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_nanoflann)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_nanoflann)
endif()
# GLEW
if(USE_SYSTEM_GLEW)
open3d_find_package_3rdparty_library(3rdparty_glew
HEADER
PACKAGE GLEW
TARGETS GLEW::GLEW
)
if(NOT 3rdparty_glew_FOUND)
open3d_pkg_config_3rdparty_library(3rdparty_glew
HEADER
SEARCH_ARGS glew
)
if(NOT 3rdparty_glew_FOUND)
set(USE_SYSTEM_GLEW OFF)
endif()
endif()
endif()
if(NOT USE_SYSTEM_GLEW)
open3d_build_3rdparty_library(3rdparty_glew DIRECTORY glew
HEADER
SOURCES
src/glew.c
INCLUDE_DIRS
include/
)
if(ENABLE_HEADLESS_RENDERING)
target_compile_definitions(3rdparty_glew PUBLIC GLEW_OSMESA)
endif()
if(WIN32)
target_compile_definitions(3rdparty_glew PUBLIC GLEW_STATIC)
endif()
list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_CUSTOM Open3D::3rdparty_glew)
else()
list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_SYSTEM Open3D::3rdparty_glew)
endif()
# GLFW
if(USE_SYSTEM_GLFW)
open3d_find_package_3rdparty_library(3rdparty_glfw
HEADER
PACKAGE glfw3
TARGETS glfw
)
if(NOT 3rdparty_glfw_FOUND)
open3d_pkg_config_3rdparty_library(3rdparty_glfw
HEADER
SEARCH_ARGS glfw3
)
if(NOT 3rdparty_glfw_FOUND)
set(USE_SYSTEM_GLFW OFF)
endif()
endif()
endif()
if(NOT USE_SYSTEM_GLFW)
message(STATUS "Building library 3rdparty_glfw from source")
add_subdirectory(${Open3D_3RDPARTY_DIR}/glfw)
open3d_import_3rdparty_library(3rdparty_glfw
HEADER
INCLUDE_DIRS ${Open3D_3RDPARTY_DIR}/glfw/include/
LIBRARIES glfw3
DEPENDS glfw
)
target_link_libraries(3rdparty_glfw INTERFACE Open3D::3rdparty_threads)
if(UNIX AND NOT APPLE)
find_library(RT_LIBRARY rt)
if(RT_LIBRARY)
target_link_libraries(3rdparty_glfw INTERFACE ${RT_LIBRARY})
endif()
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
target_link_libraries(3rdparty_glfw INTERFACE ${MATH_LIBRARY})
endif()
if(CMAKE_DL_LIBS)
target_link_libraries(3rdparty_glfw INTERFACE ${CMAKE_DL_LIBS})
endif()
endif()
if(APPLE)
find_library(COCOA_FRAMEWORK Cocoa)
find_library(IOKIT_FRAMEWORK IOKit)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
find_library(CORE_VIDEO_FRAMEWORK CoreVideo)
target_link_libraries(3rdparty_glfw INTERFACE
${COCOA_FRAMEWORK}
${IOKIT_FRAMEWORK}
${CORE_FOUNDATION_FRAMEWORK}
${CORE_VIDEO_FRAMEWORK}
)
endif()
if(WIN32)
target_link_libraries(3rdparty_glfw INTERFACE gdi32)
endif()
list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_CUSTOM Open3D::3rdparty_glfw)
else()
list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_SYSTEM Open3D::3rdparty_glfw)
endif()
if(TARGET Open3D::3rdparty_x11)
target_link_libraries(3rdparty_glfw INTERFACE Open3D::3rdparty_x11)
endif()
# TurboJPEG
if(USE_SYSTEM_JPEG AND BUILD_AZURE_KINECT)
open3d_pkg_config_3rdparty_library(3rdparty_turbojpeg
SEARCH_ARGS turbojpeg
)
if(NOT 3rdparty_turbojpeg_FOUND)
message(STATUS "Azure Kinect driver needs TurboJPEG API")
set(USE_SYSTEM_JPEG OFF)
endif()
endif()
# JPEG
if(USE_SYSTEM_JPEG)
open3d_find_package_3rdparty_library(3rdparty_jpeg
PACKAGE JPEG
TARGETS JPEG::JPEG
)
if(3rdparty_jpeg_FOUND)
if(TARGET Open3D::3rdparty_turbojpeg)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_turbojpeg)
endif()
else()
set(USE_SYSTEM_JPEG OFF)
endif()
endif()
if(NOT USE_SYSTEM_JPEG)
message(STATUS "Building third-party library JPEG from source")
include(${Open3D_3RDPARTY_DIR}/libjpeg-turbo/libjpeg-turbo.cmake)
open3d_import_3rdparty_library(3rdparty_jpeg
INCLUDE_DIRS ${JPEG_TURBO_INCLUDE_DIRS}
LIB_DIR ${JPEG_TURBO_LIB_DIR}
LIBRARIES ${JPEG_TURBO_LIBRARIES}
DEPENDS ext_turbojpeg
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_jpeg)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_jpeg)
endif()
# jsoncpp
if(USE_SYSTEM_JSONCPP)
open3d_find_package_3rdparty_library(3rdparty_jsoncpp
PACKAGE jsoncpp
TARGETS jsoncpp_lib
)
if(NOT 3rdparty_jsoncpp_FOUND)
set(USE_SYSTEM_JSONCPP OFF)
endif()
endif()
if(NOT USE_SYSTEM_JSONCPP)
include(${Open3D_3RDPARTY_DIR}/jsoncpp/jsoncpp.cmake)
open3d_import_3rdparty_library(3rdparty_jsoncpp
INCLUDE_DIRS ${JSONCPP_INCLUDE_DIRS}
LIB_DIR ${JSONCPP_LIB_DIR}
LIBRARIES ${JSONCPP_LIBRARIES}
DEPENDS ext_jsoncpp
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_jsoncpp)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_jsoncpp)
endif()
# liblzf
if(USE_SYSTEM_LIBLZF)
open3d_find_package_3rdparty_library(3rdparty_liblzf
PACKAGE liblzf
TARGETS liblzf::liblzf
)
if(NOT 3rdparty_liblzf_FOUND)
set(USE_SYSTEM_LIBLZF OFF)
endif()
endif()
if(NOT USE_SYSTEM_LIBLZF)
open3d_build_3rdparty_library(3rdparty_liblzf DIRECTORY liblzf
SOURCES
liblzf/lzf_c.c
liblzf/lzf_d.c
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_liblzf)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_liblzf)
endif()
# tritriintersect
open3d_build_3rdparty_library(3rdparty_tritriintersect DIRECTORY tomasakeninemoeller
INCLUDE_DIRS include/
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_tritriintersect)
# librealsense SDK
if (BUILD_LIBREALSENSE)
if(USE_SYSTEM_LIBREALSENSE AND NOT GLIBCXX_USE_CXX11_ABI)
# Turn off USE_SYSTEM_LIBREALSENSE.
# Because it is affected by libraries built with different CXX ABIs.
# See details: https://github.com/isl-org/Open3D/pull/2876
message(STATUS "Set USE_SYSTEM_LIBREALSENSE=OFF, because GLIBCXX_USE_CXX11_ABI is OFF.")
set(USE_SYSTEM_LIBREALSENSE OFF)
endif()
if(USE_SYSTEM_LIBREALSENSE)
open3d_find_package_3rdparty_library(3rdparty_librealsense
PACKAGE realsense2
TARGETS realsense2::realsense2
)
if(NOT 3rdparty_librealsense_FOUND)
set(USE_SYSTEM_LIBREALSENSE OFF)
endif()
endif()
if(NOT USE_SYSTEM_LIBREALSENSE)
include(${Open3D_3RDPARTY_DIR}/librealsense/librealsense.cmake)
open3d_import_3rdparty_library(3rdparty_librealsense
INCLUDE_DIRS ${LIBREALSENSE_INCLUDE_DIR}
LIBRARIES ${LIBREALSENSE_LIBRARIES}
LIB_DIR ${LIBREALSENSE_LIB_DIR}
DEPENDS ext_librealsense
)
if (UNIX AND NOT APPLE) # Ubuntu dependency: libudev-dev
find_library(UDEV_LIBRARY udev REQUIRED
DOC "Library provided by the deb package libudev-dev")
target_link_libraries(3rdparty_librealsense INTERFACE ${UDEV_LIBRARY})
endif()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_librealsense)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_librealsense)
endif()
endif()
# Curl
# - Curl should be linked before PNG, otherwise it will have undefined symbols.
# - openssl.cmake needs to be included before curl.cmake, for the
# BORINGSSL_ROOT_DIR variable.
include(${Open3D_3RDPARTY_DIR}/boringssl/boringssl.cmake)
include(${Open3D_3RDPARTY_DIR}/curl/curl.cmake)
open3d_import_3rdparty_library(3rdparty_curl
INCLUDE_DIRS ${CURL_INCLUDE_DIRS}
INCLUDE_ALL
LIB_DIR ${CURL_LIB_DIR}
LIBRARIES ${CURL_LIBRARIES}
DEPENDS ext_zlib ext_curl
)
if(APPLE)
# Missing frameworks: https://stackoverflow.com/a/56157695/1255535
# Link frameworks : https://stackoverflow.com/a/18330634/1255535
# Fixes error:
# ```
# Undefined symbols for architecture arm64:
# "_SCDynamicStoreCopyProxies", referenced from:
# _Curl_resolv in libcurl.a(hostip.c.o)
# ```
# The "Foundation" framework is already linked by GLFW.
target_link_libraries(3rdparty_curl INTERFACE "-framework SystemConfiguration")
endif()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_curl)
# BoringSSL
open3d_import_3rdparty_library(3rdparty_openssl
INCLUDE_DIRS ${BORINGSSL_INCLUDE_DIRS}
INCLUDE_ALL
INCLUDE_DIRS ${BORINGSSL_INCLUDE_DIRS}
LIB_DIR ${BORINGSSL_LIB_DIR}
LIBRARIES ${BORINGSSL_LIBRARIES}
DEPENDS ext_zlib ext_boringssl
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_openssl)
# PNG
if(USE_SYSTEM_PNG)
# ZLIB::ZLIB is automatically included by the PNG package.
open3d_find_package_3rdparty_library(3rdparty_png
PACKAGE PNG
PACKAGE_VERSION_VAR PNG_VERSION_STRING
TARGETS PNG::PNG
)
if(NOT 3rdparty_png_FOUND)
set(USE_SYSTEM_PNG OFF)
endif()
endif()
if(NOT USE_SYSTEM_PNG)
include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake)
open3d_import_3rdparty_library(3rdparty_zlib
HIDDEN
INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
LIB_DIR ${ZLIB_LIB_DIR}
LIBRARIES ${ZLIB_LIBRARIES}
DEPENDS ext_zlib
)
include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake)
open3d_import_3rdparty_library(3rdparty_png
INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS}
LIB_DIR ${LIBPNG_LIB_DIR}
LIBRARIES ${LIBPNG_LIBRARIES}
DEPENDS ext_libpng
)
add_dependencies(ext_libpng ext_zlib)
target_link_libraries(3rdparty_png INTERFACE Open3D::3rdparty_zlib)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_png)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_png)
endif()
# rply
open3d_build_3rdparty_library(3rdparty_rply DIRECTORY rply
SOURCES
rply/rply.c
INCLUDE_DIRS
rply/
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_rply)
# tinyfiledialogs
open3d_build_3rdparty_library(3rdparty_tinyfiledialogs DIRECTORY tinyfiledialogs
SOURCES
include/tinyfiledialogs/tinyfiledialogs.c
INCLUDE_DIRS
include/
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_tinyfiledialogs)
# tinygltf
if(USE_SYSTEM_TINYGLTF)
open3d_find_package_3rdparty_library(3rdparty_tinygltf
PACKAGE TinyGLTF
TARGETS TinyGLTF::TinyGLTF
)
if(NOT 3rdparty_tinygltf_FOUND)
set(USE_SYSTEM_TINYGLTF OFF)
endif()
endif()
if(NOT USE_SYSTEM_TINYGLTF)
include(${Open3D_3RDPARTY_DIR}/tinygltf/tinygltf.cmake)
open3d_import_3rdparty_library(3rdparty_tinygltf
INCLUDE_DIRS ${TINYGLTF_INCLUDE_DIRS}
DEPENDS ext_tinygltf
)
target_compile_definitions(3rdparty_tinygltf INTERFACE TINYGLTF_IMPLEMENTATION STB_IMAGE_IMPLEMENTATION STB_IMAGE_WRITE_IMPLEMENTATION)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_tinygltf)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tinygltf)
endif()
# tinyobjloader
if(USE_SYSTEM_TINYOBJLOADER)
open3d_find_package_3rdparty_library(3rdparty_tinyobjloader
PACKAGE tinyobjloader
TARGETS tinyobjloader::tinyobjloader
)
if(NOT 3rdparty_tinyobjloader_FOUND)
set(USE_SYSTEM_TINYOBJLOADER OFF)
endif()
endif()
if(NOT USE_SYSTEM_TINYOBJLOADER)
include(${Open3D_3RDPARTY_DIR}/tinyobjloader/tinyobjloader.cmake)
open3d_import_3rdparty_library(3rdparty_tinyobjloader
INCLUDE_DIRS ${TINYOBJLOADER_INCLUDE_DIRS}
DEPENDS ext_tinyobjloader
)
target_compile_definitions(3rdparty_tinyobjloader INTERFACE TINYOBJLOADER_IMPLEMENTATION)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_tinyobjloader)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tinyobjloader)
endif()
# Qhullcpp
if(USE_SYSTEM_QHULLCPP)
open3d_find_package_3rdparty_library(3rdparty_qhullcpp
PACKAGE Qhull
TARGETS Qhull::qhullcpp Qhull::qhull_r
)
if(NOT 3rdparty_qhullcpp_FOUND)
set(USE_SYSTEM_QHULLCPP OFF)
endif()
endif()
if(NOT USE_SYSTEM_QHULLCPP)
include(${Open3D_3RDPARTY_DIR}/qhull/qhull.cmake)
open3d_build_3rdparty_library(3rdparty_qhull_r DIRECTORY ${QHULL_SOURCE_DIR}
SOURCES
src/libqhull_r/global_r.c
src/libqhull_r/stat_r.c
src/libqhull_r/geom2_r.c
src/libqhull_r/poly2_r.c
src/libqhull_r/merge_r.c
src/libqhull_r/libqhull_r.c
src/libqhull_r/geom_r.c
src/libqhull_r/poly_r.c
src/libqhull_r/qset_r.c
src/libqhull_r/mem_r.c
src/libqhull_r/random_r.c
src/libqhull_r/usermem_r.c
src/libqhull_r/userprintf_r.c
src/libqhull_r/io_r.c
src/libqhull_r/user_r.c
src/libqhull_r/rboxlib_r.c
src/libqhull_r/userprintf_rbox_r.c
INCLUDE_DIRS
src/
DEPENDS
ext_qhull
)
open3d_build_3rdparty_library(3rdparty_qhullcpp DIRECTORY ${QHULL_SOURCE_DIR}
SOURCES
src/libqhullcpp/Coordinates.cpp
src/libqhullcpp/PointCoordinates.cpp
src/libqhullcpp/Qhull.cpp
src/libqhullcpp/QhullFacet.cpp