-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
1327 lines (1181 loc) · 47.9 KB
/
CMakeLists.txt
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
#*********************************************************************
#** Image Component Library (ICL) **
#** **
#** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
#** Neuroinformatics Group **
#** Website: www.iclcv.org and **
#** http://opensource.cit-ec.de/projects/icl **
#** **
#** File : CMakeLists.txt **
#** Module : **
#** Authors: Michael Goetting, Christof Elbrechter, **
#** Sergius Gaulik **
#** **
#** **
#** GNU LESSER GENERAL PUBLIC LICENSE **
#** This file may be used under the terms of the GNU Lesser General **
#** Public License version 3.0 as published by the **
#** **
#** Free Software Foundation and appearing in the file LICENSE.LGPL **
#** included in the packaging of this file. Please review the **
#** following information to ensure the license requirements will **
#** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
#** **
#** The development of this software was supported by the **
#** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
#** The Excellence Cluster EXC 277 is a grant of the Deutsche **
#** Forschungsgemeinschaft (DFG) in the context of the German **
#** Excellence Initiative. **
#** **
#*********************************************************************
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
# ---- global definitions ----
# todo: add "-debug" postfix here and there!
# Version information
SET(ICL_VERSION_MAJOR "10" CACHE STRING "Major project version part")
SET(ICL_VERSION_MINOR "0" CACHE STRING "Minor project version part")
SET(ICL_VERSION_PATCH "2" CACHE STRING "Patch project version part")
SET(PROJECT_VERSION "${ICL_VERSION_MAJOR}.${ICL_VERSION_MINOR}.${ICL_VERSION_PATCH}")
# Since version 3.0.2 CMake warns about CMP0048 policy which should be
# set to NEW to allow PROJECT() to handle version and language information
IF(CMAKE_VERSION VERSION_LESS 3.0.0)
PROJECT(ICL)
ELSE()
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0054 NEW)
PROJECT(ICL VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
ENDIF()
# ---- cmake settings ----
INCLUDE(ICLHelperMacros)
INCLUDE(CheckArchitecture)
INCLUDE(InstallFilesRecursive)
INCLUDE(FindSSE)
SET(ICL_FILE_NAME_COMPONENT_DIR PATH)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# ---- build type (debug/release) and opptions
IF(WIN32)
IF(MSVC)
SET(ICL_MSC_VER ${MSVC_VERSION})
ENDIF(MSVC)
ENDIF(WIN32)
IF(MSVC)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
ENDIF(MSVC)
IF(NOT WIN32)
OPTION(ENABLE_NATIVE_BUILD_OPTION "Decide whether to use -march=native optimization flag" OFF)
OPTION(ENABLE_SSEFPMATH_BUILD_OPTION "Decide whether to use -mfpmath=sse optimization flag" OFF)
OPTION(ENABLE_FASTMATH_BUILD_OPTION "Decide whether to use -ffast-math optimization flag" OFF)
ENDIF()
OPTION(ENABLE_OPENMP_BUILD_OPTION "Decide whether to use -fopenmp optimization flag" OFF)
#if(CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+$") # little ugly here
# set(ICL_DEACTIVATED_WARNING -Wno-internal-linkage-in-inline
# -Werror -Wno-\\#warnings
# -Wno-deprecated-declarations
# -Wno-uninitialized
# -Wno-overloaded-virtual)
#else()
set(ICL_DEACTIVATED_WARNING "" CACHE STRING "")
#endif()
string(REPLACE ";" " " ICL_DEACTIVATED_WARNING "${ICL_DEACTIVATED_WARNING}")
IF(NOT CMAKE_BUILD_TYPE)
IF(BUILD_TESTS)
MESSAGE(STATUS "No build type specified: Using Debug for tests")
SET(CMAKE_BUILD_TYPE "Debug")
ELSE()
MESSAGE(STATUS "No build type specified: Using Release")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
ENDIF()
IF(MSVC)
# Disable some warnings
SET(ICL_COMPILER_FLAGS "/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS")
SET(ICL_COMPILER_FLAGS "${ICL_COMPILER_FLAGS} /wd4201 /wd4244 /wd4251 /wd4275 /wd4290 /wd4510 /wd4514 /wd4610 /wd4710 /wd4711 /wd4800 /wd4820")
# Floating point model
SET(ICL_COMPILER_FLAGS "${ICL_COMPILER_FLAGS} /fp:fast")
# Enable intrinsic functions
SET(ICL_COMPILER_FLAGS "${ICL_COMPILER_FLAGS} /Oi")
# Enable function-level linking
SET(ICL_COMPILER_FLAGS "${ICL_COMPILER_FLAGS} /Gy")
# Multi-processor compilation
SET(ICL_COMPILER_FLAGS "${ICL_COMPILER_FLAGS} /MP /bigobj")
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ICL_COMPILER_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ICL_COMPILER_FLAGS}")
IF(ENABLE_OPENMP_BUILD_OPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp -DUSE_OPENMP")
ENDIF()
ELSE(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${ICL_DEACTIVATED_WARNING}")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
IF(ENABLE_OPENMP_BUILD_OPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -DUSE_OPENMP")
ENDIF()
IF(ENABLE_NATIVE_BUILD_OPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
ENDIF()
IF(ENABLE_FASTMATH_BUILD_OPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
ENDIF()
IF(ENABLE_SSEFPMATH_BUILD_OPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse")
ENDIF()
ENDIF(MSVC)
SET(ICL_NAME icl)
SET(SO_VERSION "${ICL_VERSION_MAJOR}.${ICL_VERSION_MINOR}")
SET(INSTALL_PATH_PREFIX "${ICL_NAME}-${SO_VERSION}")
SET(BINARY_PREFIX "${ICL_NAME}-")
SET(RESOURCE_DIR "etc/${INSTALL_PATH_PREFIX}")
SET(ICL_CMAKE_MODULE_PATH "share/${INSTALL_PATH_PREFIX}/cmake/Modules")
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/ICLUtils/src/ICLVersion.h.in ${CMAKE_BINARY_DIR}/src/ICLUtils/ICLVersion.h)
# ---- Check Architecture ----
CURRENT_ARCHITECTURE(ICL_BUILD_ARCH)
IF(${ICL_BUILD_ARCH} EQUAL "64_BIT_FOUND")
ADD_ICL_DEFINITIONS(-DICL_64BIT)
SET(ARCH "x64")
ELSE()
ADD_ICL_DEFINITIONS(-DICL_32BIT)
SET(ARCH "x86")
ENDIF()
# --- global compiler flags ---
IF(APPLE)
ADD_ICL_DEFINITIONS(-DICL_SYSTEM_APPLE)
ELSEIF(UNIX)
ADD_ICL_DEFINITIONS(-DICL_SYSTEM_LINUX)
ELSEIF(WIN32)
ADD_ICL_DEFINITIONS(-DICL_SYSTEM_WINDOWS -DHAVE_STRUCT_TIMESPEC)
ENDIF()
# ---- User options ----
OPTION(BUILD_WITH_OPENCV "Link against OpenCV and provide OpenCV image convertion functions" OFF)
OPTION(BUILD_WITH_QT "Provides GUI and image visualization framework (needs OPENGL)" OFF)
OPTION(BUILD_WITH_OPENGL "Linked to BUILD_WITH_QT" OFF)
OPTION(BUILD_WITH_RSB "Link against the RSB framework for network-based image transfer (needs PROTOBUF)" OFF)
OPTION(BUILD_WITH_PROTOBUF "Needed for RSB-based image transfer" OFF)
OPTION(BUILD_WITH_EIGEN3 "Uses Eigen3 to speed up several algorithms" OFF)
OPTION(BUILD_WITH_IPP "Link against Intel IPP for general speedup" OFF)
OPTION(BUILD_WITH_MKL "Link against Intel MKL to speed up several mathematic fuctions" OFF)
OPTION(BUILD_WITH_MESASR "Link against libmesasr to provide SwissRanger camera support" OFF)
OPTION(BUILD_WITH_IMAGEMAGICK "Use ImageMagick to provide I/O for many common image formats" OFF)
OPTION(BUILD_WITH_LIBAV "Use libav to provide video encoding for many common video formats" OFF)
OPTION(BUILD_WITH_LIBDC "Use libdc to provide FireWire-Camera support" OFF)
OPTION(BUILD_WITH_LIBFREENECT "Use libfreenect to grab from Kinect Devices" OFF)
OPTION(BUILD_WITH_LIBFREENECT2 "Use experimental libfreenect2 dependency to grab from Kinect2 Devices" OFF)
OPTION(BUILD_WITH_XINE "Provides a libxine base Video-Grabber backend" OFF)
IF(NOT WIN32)
OPTION(BUILD_WITH_DL "Link against libdl to provide dynamic runtime linking support" ON)
ENDIF(NOT WIN32)
OPTION(BUILD_WITH_V4L "Provides V4L2 grabber backend for USB-Cameras" OFF)
OPTION(BUILD_WITH_LIBUSB "Provides grabber backend for the pixelsense device (microsoft surface)" OFF)
OPTION(BUILD_WITH_ZMQ "Provides Zero-MQ-based network grabber and image output" OFF)
OPTION(BUILD_WITH_PYLON "Link against the basler Pylon package to support GIG-E cameras" OFF)
OPTION(BUILD_WITH_OPENCL "Uses OpenCL to speed up several algorithms" OFF)
OPTION(BUILD_WITH_OPENNI "Links against OpenNI to grab from Kinect devices" OFF)
OPTION(BUILD_WITH_PCL "Link against PCL to provide a compatibility layer to PCL point clouds" OFF)
OPTION(BUILD_WITH_BULLET "Provides physics simulation. Needs the bullet physics engine" OFF)
OPTION(BUILD_WITH_RST "Link against the RST framework for message definitions (needs PROTOBUF)" OFF)
OPTION(BUILD_WITH_RSC "Link against the RSC framework for message definitions (needs RST)" OFF)
OPTION(BUILD_WITH_XIAPI "Link against the libm3api, e.g. used for Ximea Cameras" OFF)
OPTION(BUILD_WITH_LIBIRIMAGER "Link against the libirimager needed for Optris' IR cameras (requires LIBUDEV and V4L)" OFF)
OPTION(BUILD_WITH_LIBUDEV "Link against the libudev (needed the LIBIRIMAGER dependency)" OFF)
OPTION(DISABLE_SSE2 "Disables SSE2 support, even if found on the current machine" OFF)
OPTION(DISABLE_SSE3 "Disables SSE3 support, even if found on the current machine" OFF)
OPTION(DISABLE_SSSE3 "Disables SSSE3 support, even if found on the current machine" OFF)
OPTION(BUILD_EXAMPLES "Decide if examples shall be build or not" OFF)
OPTION(BUILD_DEMOS "Decide if demos shall be build or not" OFF)
OPTION(BUILD_APPS "Decide if applications shall be build or not" OFF)
OPTION(BUILD_TESTS "Decide whether tests should be build" OFF)
SET(BUILD_REDIST OFF CACHE STRING "Enable redistribution workflow")
SET_PROPERTY(CACHE BUILD_REDIST PROPERTY STRINGS OFF "DEB" "WIX")
# ---- Generate package data ----
IF(NOT BUILD_REDIST STREQUAL OFF)
ADD_SUBDIRECTORY(packaging)
ENDIF(NOT BUILD_REDIST STREQUAL OFF)
IF(BUILD_TESTS)
# integrate local google test build as suggested in
# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project
IF(CMAKE_VERSION VERSION_LESS 3.10.0)
MESSAGE(FATAL_ERROR "For testing cmake version 3.10 or higher is required")
ENDIF(CMAKE_VERSION VERSION_LESS 3.10.0)
configure_file(${CMAKE_SOURCE_DIR}/scripts/CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include")
endif()
include(GoogleTest)
enable_testing()
add_custom_target(tests)
#include(CodeCoverage)
#APPEND_COVERAGE_COMPILER_FLAGS()
# --coverage -fno-inline -fno-inline-small-functions -fno-default-inline
#add_definitions(-fno-inline)
#set(COVERAGE_EXCLUDES '/Applications/*' '/usr/*')
#add_custom_target(coverage)
# run tests automatically after build
# add_custom_target(run-test
# ALL
# DEPENDS tests
# COMMAND ${CMAKE_COMMAND} --build . --target test)
# # In case we want to upload coverage to coveralls at some point
# include(Coveralls)
ENDIF(BUILD_TESTS)
# ---- Dependency handling ----
INCLUDE(ICLFindPackage)
IF(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
ELSEIF(APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib)
ELSE()
set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
ENDIF(WIN32)
IF(WIN32)
SET(PKG_SEARCH_PATHS "")
SET(ARCH_DEPENDENT_INCLUDE_PATHS "")
IF(ICL_64BIT)
SET(ARCH_DEPENDENT_LIB_PATHS "lib/x64;lib/msvc_x64")
ELSE(ICL_64BIT)
SET(ARCH_DEPENDENT_LIB_PATHS "lib/x86;lib/msvc;lib/Win32")
ENDIF(ICL_64BIT)
ELSEIF(APPLE)
SET(ARCH_DEPENDENT_INCLUDE_PATHS "")
SET(PKG_SEARCH_PATHS "/usr;/usr/local")
LIST(APPEND CMAKE_PREFIX_PATH "/usr;/usr/local")
ELSE(WIN32)
SET(PKG_SEARCH_PATHS "/usr;/usr/local")
LIST(APPEND CMAKE_PREFIX_PATH "/usr;/usr/local")
IF(ICL_64BIT)
SET(ARCH_DEPENDENT_LIB_PATHS "lib/x86_64-linux-gnu;lib/intel64")
SET(ARCH_DEPENDENT_INCLUDE_PATHS "include/x86_64-linux-gnu")
ELSE(ICL_64BIT)
SET(ARCH_DEPENDENT_LIB_PATHS "lib/i386-linux-gnu;lib/ia32")
SET(ARCH_DEPENDENT_INCLUDE_PATHS "include/i386-linux-gnu")
ENDIF(ICL_64BIT)
ENDIF(WIN32)
IF(WIN32)
ICL_FIND_PACKAGE(NAME Pthreads
HEADERS "pthread.h"
LIBS "pthreadVC2")
IF(PTHREADS_FOUND)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${PTHREADS_LIBRARIES})
ENDIF()
ELSE()
FIND_PACKAGE(Threads REQUIRED)
IF(Threads_FOUND)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${CMAKE_THREAD_LIBS_INIT})
ENDIF()
ENDIF()
# workaround for the fact that on windows, regex.h is not available
IF(WIN32)
LIST(APPEND REQUIRED_LIBRARIES_LIST regex_icl)
ENDIF()
IF(WIN32)
LIST(APPEND REQUIRED_LIBRARIES_LIST zlib)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBZ)
ELSE()
FIND_PACKAGE(ZLIB REQUIRED)
ENDIF()
IF(ZLIB_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBZ)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${ZLIB_LIBRARIES})
ENDIF()
IF(WIN32)
LIST(APPEND REQUIRED_LIBRARIES_LIST libjpeg)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBJPEG)
ELSE()
FIND_PACKAGE(JPEG REQUIRED)
ENDIF()
IF(JPEG_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBJPEG)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${JPEG_LIBRARIES})
ENDIF()
IF(WIN32)
LIST(APPEND REQUIRED_LIBRARIES_LIST libpng)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBPNG)
ELSE()
FIND_PACKAGE(PNG REQUIRED)
ENDIF()
IF(PNG_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBPNG)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${PNG_LIBRARIES})
ENDIF()
IF((NOT WIN32) AND (NOT APPLE))
ICL_FIND_PACKAGE(NAME DL HEADERS "dlfcn.h" LIBS "dl")
IF(DL_FOUND)
LIST(APPEND REQUIRED_LIBRARIES_LIST ${DL_LIBRARIES})
ENDIF()
ENDIF()
IF(BUILD_WITH_IPP)
IF(ICL_64BIT)
SET(_IPP_LIB_SUF "ipp/lib/intel64")
ELSE(ICL_64BIT)
SET(_IPP_LIB_SUF "ipp/lib/ia32")
ENDIF(ICL_64BIT)
SET(IPP_REQUESTED_LIBS "ippcore;ippi;ipps;ippcv;ippcc;iomp5")
# check for the legacy version of IPP first
# IPP 9 dropped ippm. Defining this check optional to prevent error.
ICL_FIND_PACKAGE(NAME IPP
HEADERS "ipp.h"
LIBS "${IPP_REQUESTED_LIBS};ippm"
PATHS "/opt/intel;/opt/IPP"
HEADER_PATH_SUFFIXES "ipp/include"
LIB_PATH_SUFFIXES ${_IPP_LIB_SUF}
OPTIONAL)
# This double check is a bit annoying. Feel free to improve this section.
IF(NOT IPP_FOUND)
MESSAGE("IPP Legacy not found. Checking for recent releases.")
ICL_FIND_PACKAGE(NAME IPP
HEADERS "ipp.h"
LIBS ${IPP_REQUESTED_LIBS}
PATHS "/opt/intel;/opt/IPP"
HEADER_PATH_SUFFIXES "ipp/include"
LIB_PATH_SUFFIXES ${_IPP_LIB_SUF})
ENDIF(NOT IPP_FOUND)
IF(IPP_FOUND)
IF(EXISTS "${IPP_INCLUDE_DIRS}/ippversion.h")
get_ipp_version(${IPP_INCLUDE_DIRS})
ENDIF()
ADD_ICL_DEFINITIONS(-DICL_HAVE_IPP)
ENDIF()
ENDIF()
IF(BUILD_WITH_MKL)
IF(ICL_64BIT)
SET(_MKL_LIB "mkl_intel_lp64")
SET(_MKL_LIB_SUF "mkl/lib/intel64")
ELSE(ICL_64BIT)
IF(WIN32)
SET(_MKL_LIB "mkl_intel_c")
ELSE(WIN32)
SET(_MKL_LIB "mkl_intel")
ENDIF(WIN32)
SET(_MKL_LIB_SUF "mkl/lib/ia32")
ENDIF(ICL_64BIT)
ICL_FIND_PACKAGE(NAME MKL
HEADERS "mkl_types.h"
LIBS "${_MKL_LIB};mkl_intel_thread;mkl_core;iomp5"
PATHS "/opt/intel;/opt/MKL;/opt/MKL/mkl"
HEADER_PATH_SUFFIXES "mkl/include"
LIB_PATH_SUFFIXES "${_MKL_LIB_SUF}")
ENDIF()
IF(BUILD_WITH_OPENCL)
IF(BUILD_WITH_OPENCL_OPTIONAL)
FIND_PACKAGE(OpenCL)
ELSE()
FIND_PACKAGE(OpenCL REQUIRED)
ENDIF()
IF(OpenCL_FOUND)
MESSAGE(STATUS "Found: OpenCL ${OpenCL_LIBRARIES}")
SET(OPENCL_FOUND TRUE)
IF(WIN32)
SET(CMAKE_CXX_FLAGS "/arch:SSE2 ${CMAKE_CXX_FLAGS}")
ELSE()
SET(CMAKE_CXX_FLAGS "-msse2 ${CMAKE_CXX_FLAGS}")
ENDIF()
ADD_ICL_DEFINITIONS(-DICL_HAVE_OPENCL)
SET(OPENCL_LIBRARIES ${OpenCL_LIBRARIES})
ELSE()
IF(BUILD_WITH_OPENCL_OPTIONAL)
MESSAGE(STATUS "Not Found: optional OpenCL")
ELSE()
MESSAGE(STATUS "Not Found: OpenCL")
ENDIF()
ENDIF()
#wait what? that's not a definition!
#add_definitions("-std=gnu++11")
ENDIF()
IF(BUILD_WITH_EIGEN3)
ICL_FIND_PACKAGE(NAME Eigen3
HEADERS "Eigen/Eigen"
HEADER_PATH_SUFFIXES "include/eigen3")
ENDIF()
IF(BUILD_WITH_OPENNI)
ICL_FIND_PACKAGE(NAME OpenNI
HEADERS "XnOpenNI.h"
LIBS "OpenNI"
HEADER_PATH_SUFFIXES "include/ni")
IF(OpenNI_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_OPENNI)
ENDIF()
ENDIF()
IF(BUILD_WITH_OPENCV)
message(STATUS "opencv root x: ${OPENCV_ROOT}")
IF(OPENCV_ROOT)
SET(OpenCV_DIR ${OPENCV_ROOT})
message(STATUS "opencv root: ${OPENCV_ROOT}")
ENDIF()
SET(OPENCV_FEATURES_2D_FOUND "FALSE")
FIND_PACKAGE(OpenCV REQUIRED)
IF(OPENCV_FOUND)
SET(OpenCV_FOUND "TRUE")
ENDIF()
IF(OpenCV_FOUND)
SET(OPENCV_FOUND "TRUE")
ADD_ICL_DEFINITIONS(-DICL_HAVE_OPENCV)
ADD_ICL_DEFINITIONS(-DQWT_DLL)
# don't show it in the GUI
MARK_AS_ADVANCED(OPENCV_FOUND)
MARK_AS_ADVANCED(OpenCV_FOUND)
message(STATUS "using opencv from : ${OpenCV_INSTALL_PATH}/share/opencv")
ADD_ICL_DEFINITIONS(-DICL_OPENCV_INSTALL_PATH="${OpenCV_INSTALL_PATH}")
# we need at least opencv 2.4 for the ORB-feature interface we want to use
IF(OpenCV_VERSION VERSION_LESS "2.4")
MESSAGE(STATUS "OpenCV < 2.4.x detected, ommitting ORB feature detector")
ELSE()
MESSAGE(STATUS "OpenCV >= 2.4.x detected, adding ORB feature detector")
ADD_ICL_DEFINITIONS(-DICL_HAVE_OPENCV_FEATURES_2D)
SET(OPENCV_FEATURES_2D_FOUND "TRUE")
ENDIF()
ENDIF()
IF(OpenCV_DIR)
SET(OPENCV_DIR ${OpenCV_DIR})
ENDIF()
ENDIF()
IF(BUILD_WITH_IMAGEMAGICK)
FIND_PACKAGE(ImageMagick REQUIRED COMPONENTS Magick++)
IF(ImageMagick_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_IMAGEMAGICK)
SET(IMAGEMAGICK_LIBRARIES ${ImageMagick_LIBRARIES})
ENDIF()
ENDIF()
IF(BUILD_WITH_XIAPI)
ICL_FIND_PACKAGE(NAME XIAPI
HEADERS "m3api/xiApi.h"
LIBS "m3api"
PATHS "${XIAPI_ROOT}/opt/XIMEA;${XIAPI_ROOT}")
IF(XIAPI_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_XIAPI)
ENDIF()
ENDIF()
IF(BUILD_WITH_LIBIRIMAGER)
IF(NOT BUILD_WITH_LIBUDEV)
MESSAGE(SEND_ERROR "BUILD_WITH_LIBIRIMAGER was defined, but BUILD_WITH_LIBUDEV wasn't (udev is needed mandatorily for LIBIRIMAGER)")
ENDIF()
IF(NOT BUILD_WITH_V4L)
MESSAGE(SEND_ERROR "BUILD_WITH_LIBIRIMAGER was defined, but BUILD_WITH_V4L wasn't (video for linus is needed mandatorily for LIBIRIMAGER)")
ENDIF()
ICL_FIND_PACKAGE(NAME LIBIRIMAGER
HEADERS "libirimager/IRImager.h"
LIBS "irimager;ircore;irimageprocessing")
#please note that the library order seems to be mandatory here!
ICL_FIND_PACKAGE(NAME LIBUDEV
LIBS "udev")
IF(LIBIRIMAGER_FOUND AND LIBUDEV_FOUND)
# check version:
FILE(READ "${LIBIRIMAGER_INCLUDE_DIRS}/libirimager/IRImager.h" IRImagerH)
# message(SEND_ERROR ":file content: ${IRImagerH}")
STRING(FIND "${IRImagerH}" "namespace evo" EVO_NAMESPACE_FOUND)
IF(NOT "${EVO_NAMESPACE_FOUND}" STREQUAL "-1")
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBIRIMAGER_EVO)
ENDIF()
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBIRIMAGER -DICL_HAVE_LIBUDEV)
ELSE()
SET(HAVE_LIBIRIMAGER FALSE)
SET(HAVE_LIBUDEV FALSE)
ENDIF()
ENDIF()
IF(BUILD_WITH_MESASR)
ICL_FIND_PACKAGE(NAME MesaSR
HEADERS "libMesaSR.h"
LIBS "mesasr"
PATHS "/opt/MESASR")
IF(MesaSR_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBMESAR)
ENDIF()
ENDIF()
IF(BUILD_WITH_LIBDC)
FIND_PACKAGE(LibDC REQUIRED)
IF(LIBDC_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBDC)
ENDIF()
ENDIF()
IF(BUILD_WITH_LIBUSB)
IF(WIN32)
ICL_FIND_PACKAGE(NAME LIBUSB
HEADERS "usb.h;lusb0_usb.h"
LIBS "libusb"
PATHS "/opt/MESASR")
ELSE(WIN32)
ICL_FIND_PACKAGE(NAME LIBUSB
HEADERS "usb.h;lusb0_usb.h"
LIBS "usb")
# IF(NOT LIBUSB_FOUND)
# ICL_FIND_PACKAGE(NAME LIBUSB
# HEADERS "usb.h"
# HEADER_PATH_SUFFIXES "include/libusb-1.0"
# LIBS "usb")
ENDIF(WIN32)
ENDIF()
IF(BUILD_WITH_V4L)
FIND_PACKAGE(V4L REQUIRED)
IF(V4L_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_VIDEODEV)
ENDIF()
ENDIF()
IF(BUILD_WITH_ZMQ)
ICL_FIND_PACKAGE(NAME ZMQ
HEADERS "zmq.hpp"
LIBS "zmq")
ENDIF()
IF(BUILD_WITH_XINE)
ICL_FIND_PACKAGE(NAME Xine
HEADERS "xine.h"
LIBS "xine")
ENDIF()
IF(BUILD_WITH_QT)
SET(QT_ROOT QT_ROOT CACHE PATH "Root directory of Qt5")
IF(WIN32)
FIND_PACKAGE(WindowsSDK REQUIRED)
# Windows 10 SDK Scheme is a bit different
# Force file names to find the right libraries later
IF(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
SET(WINSDK_LIB_PATH "${WINDOWSSDK_PREFERRED_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/um/${ARCH}")
SET(OPENGL_gl_LIBRARY "${WINSDK_LIB_PATH}/OpenGL32.lib" CACHE STRING "")
SET(OPENGL_glu_LIBRARY "${WINSDK_LIB_PATH}/GlU32.lib" CACHE STRING "")
ENDIF(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
SET(CMAKE_LIBRARY_PATH "${WINDOWSSDK_PREFERRED_DIR}/Lib")
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
IF(ICL_64BIT)
SET(_GLEW_LIB_SUF "lib/Release/x64")
ELSE(ICL_64BIT)
SET(_GLEW_LIB_SUF "lib/Release/Win32")
ENDIF(ICL_64BIT)
ICL_FIND_PACKAGE(NAME GLEW
HEADERS "GL/glew.h"
LIBS "glew32"
LIB_PATH_SUFFIXES ${_GLEW_LIB_SUF})
ELSE(WIN32)
ICL_FIND_PACKAGE(NAME GLEW
HEADERS "GL/glew.h"
LIBS "GLEW")
ENDIF(WIN32)
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW) # Prefer GLVND
endif()
FIND_PACKAGE(OpenGL REQUIRED)
SET(ICL_QT_MODULES Core Gui Multimedia Widgets OpenGL)
SET(ICL_ALL_QT_LIBS_FOUND TRUE)
FOREACH(M ${ICL_QT_MODULES})
FIND_PACKAGE(Qt5${M} REQUIRED HINTS ${QT_ROOT})
IF(NOT Qt5${M}_FOUND)
SET(ICL_ALL_QT_LIBS_FOUND FALSE)
MESSAGE(STATUS "Not Found: Qt-Module ${M}")
ELSE()
MESSAGE(STATUS "Found Qt-Module ${M}")
ENDIF()
ENDFOREACH()
IF(ICL_ALL_QT_LIBS_FOUND)
MESSAGE(STATUS "Found: All Qt Modules")
SET(QT_FOUND TRUE)
#set(CMAKE_AUTOMOC ON)
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(${Qt5Widgets_DEFINITIONS})
IF(NOT WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF(NOT WIN32)
# This creates full library paths from Qt's colon separated paths.
# Colon separated Qt library paths only work when Qt's find package was called.
# This is not necessarily done in projects linking against icl so we need full
# Paths here.
IF(WIN32)
SET(QWHAT IMPLIB)
SET(QPFX Abs)
ELSEIF(APPLE)
SET(QWHAT LOCATION)
SET(QPFX Abs)
ELSE() # unix case
SET(QWHAT SONAME)
SET(QPFX "")
ENDIF()
FOREACH(M ${ICL_QT_MODULES})
get_target_property(ICLQt5${M}Lib${QPFX} Qt5::${M} IMPORTED_${QWHAT}_RELEASE)
ENDFOREACH()
IF(UNIX AND NOT APPLE)
# For some reason cmake does not add library paths to rpath when they end
# with a number like libQt5Core.so.5. Changing the linked libraries to the
# simple .so resolves this problem.
get_target_property(_QT5CORE_LOCATION Qt5::Core LOCATION)
get_filename_component(_QT5CORE_ABSOLUTE ${_QT5CORE_LOCATION} ${ICL_FILE_NAME_COMPONENT_DIR})
FOREACH(M ${ICL_QT_MODULES})
STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5${M}LibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5${M}Lib}")
ENDFOREACH()
ENDIF()
SET(Qt5_LIBRARIES "")
FOREACH(M ${ICL_QT_MODULES})
LIST(APPEND Qt5_LIBRARIES ${ICLQt5${M}LibAbs})
ENDFOREACH()
SET(QT_LIBRARIES ${Qt5_LIBRARIES})
# IF(WIN32)
# get_target_property(ICLQt5CoreLibAbs Qt5::Core IMPORTED_IMPLIB_RELEASE)
# get_target_property(ICLQt5GuiLibAbs Qt5::Gui IMPORTED_IMPLIB_RELEASE)
# get_target_property(ICLQt5MultimediaLibAbs Qt5::Multimedia IMPORTED_IMPLIB_RELEASE)
# get_target_property(ICLQt5WidgetsLibAbs Qt5::Widgets IMPORTED_IMPLIB_RELEASE)
# get_target_property(ICLQt5OpenGLLibAbs Qt5::OpenGL IMPORTED_IMPLIB_RELEASE)
# ELSEIF(APPLE)
# get_target_property(ICLQt5CoreLibAbs Qt5::Core IMPORTED_LOCATION_RELEASE)
# get_target_property(ICLQt5GuiLibAbs Qt5::Gui IMPORTED_LOCATION_RELEASE)
# get_target_property(ICLQt5MultimediaLibAbs Qt5::Multimedia IMPORTED_LOCATION_RELEASE)
# get_target_property(ICLQt5WidgetsLibAbs Qt5::Widgets IMPORTED_LOCATION_RELEASE)
# get_target_property(ICLQt5OpenGLLibAbs Qt5::OpenGL IMPORTED_LOCATION_RELEASE)
# ELSE(WIN32)
# get_target_property(ICLQt5CoreLib Qt5::Core IMPORTED_SONAME_RELEASE)
# get_target_property(ICLQt5GuiLib Qt5::Gui IMPORTED_SONAME_RELEASE)
# get_target_property(ICLQt5MultimediaLib Qt5::Multimedia IMPORTED_SONAME_RELEASE)
# get_target_property(ICLQt5WidgetsLib Qt5::Widgets IMPORTED_SONAME_RELEASE)
# get_target_property(ICLQt5OpenGLLib Qt5::OpenGL IMPORTED_SONAME_RELEASE)
# get_target_property(_QT5CORE_LOCATION Qt5::Core LOCATION)
# get_filename_component(_QT5CORE_ABSOLUTE ${_QT5CORE_LOCATION} DIRECTORY)
# MESSAGE(STATUS "ICLQt5CoreLib : ${ICLQt5CoreLib}")
# MESSAGE(STATUS "ICLQt5GuiLib : ${ICLQt5CoreLib}")
# MESSAGE(STATUS "ICLQt5MultimediaLib : ${ICLQt5MultimediaLib}")
# # For some reason cmake does not add library paths to rpath when they end
# # with a number like libQt5Core.so.5. Changing the linked libraries to the
# # simple .so resolves this problem.
# STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5CoreLibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5CoreLib}")
# STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5OpenGLLibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5OpenGLLib}")
# STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5WidgetsLibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5WidgetsLib}")
# STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5GuiLibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5GuiLib}")
# STRING(REGEX REPLACE "[.]so([.][0-9])+" ".so" ICLQt5MultimediaLibAbs "${_QT5CORE_ABSOLUTE}/${ICLQt5MultimediaLib}")
# ENDIF(WIN32)
# SET(Qt5_LIBRARIES ${ICLQt5CoreLibAbs})
# LIST(APPEND Qt5_LIBRARIES ${ICLQt5OpenGLLibAbs})
# LIST(APPEND Qt5_LIBRARIES ${ICLQt5GuiLibAbs})
# LIST(APPEND Qt5_LIBRARIES ${ICLQt5WidgetsLibAbs})
# LIST(APPEND Qt5_LIBRARIES ${ICLQt5MultimediaLibAbs})
ADD_ICL_DEFINITIONS(-DICL_HAVE_QT)
ADD_ICL_DEFINITIONS(-DICL_HAVE_OPENGL)
ADD_ICL_DEFINITIONS(-DQWT_DLL)
ENDIF()
ENDIF()
IF(BUILD_WITH_LIBFREENECT)
ICL_FIND_PACKAGE(NAME LibFreenect
HEADERS "libfreenect.h"
LIBS "freenect;freenect_sync"
HEADER_PATH_SUFFIXES "include/libfreenect")
ENDIF()
IF(BUILD_WITH_LIBFREENECT2)
IF(LIBFREENECT2_ROOT)
SET(LIBFREENECT2_GLFW3_ROOT ${LIBFREENECT2_ROOT})
SET(LIBFREENECT2_LIBUSB_ROOT ${LIBFREENECT2_ROOT})
ENDIF()
ICL_FIND_PACKAGE(NAME LibFreenect2
HEADERS "libfreenect2/opengl.h;libfreenect2/libfreenect2.hpp;libfreenect2/frame_listener_impl.h"
LIBS "freenect2"
HEADER_PATH_SUFFIXES "examples/protonect/include"
LIB_PATH_SUFFIXES "examples/protonect/lib"
OPTIONAL)
ICL_FIND_PACKAGE(NAME LibFreenect2_GLFW3
HEADERS "GLFW/glfw3.h"
LIBS "glfw"
HEADER_PATH_SUFFIXES "depends/glfw/include"
LIB_PATH_SUFFIXES "depends/glfw/lib"
OPTIONAL)
ICL_FIND_PACKAGE(NAME LibFreenect2_LIBUSB
HEADERS "libusb-1.0/libusb.h"
LIBS "usb-1.0"
HEADER_PATH_SUFFIXES "depends/libusb/include"
LIB_PATH_SUFFIXES "depends/libusb/lib"
OPTIONAL)
IF(LIBFREENECT2_FOUND AND LIBFREENECT2_GLFW3_FOUND AND LIBFREENECT2_LIBUSB_FOUND)
LIST(APPEND LIBFREENECT2_LIBRARIES ${LIBFREENECT2_GLFW3_LIBRARIES} ${LIBFREENECT2_LIBUSB_LIBRARIES})
LIST(APPEND LIBFREENECT2_INCLUDE_DIRS ${LIBFREENECT2_GLFW3_INCLUDE_DIRS} ${LIBFREENECT2_LIBUSB_INCLUDE_DIRS})
ADD_ICL_DEFINITIONS(-DICL_HAVE_LIBFREENECT2)
ELSE()
IF(BUILD_WITH_LIBFREENECT2_OPTIONAL)
MESSAGE(STATUS "Could NOT find all dependencies for OPTIONAL LIBFREENECT2 (continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Could NOT find all dependencies for LIBFREENECT2")
ENDIF()
ENDIF()
ENDIF()
IF(BUILD_WITH_PYLON)
FIND_PACKAGE(Pylon REQUIRED)
IF(PYLON_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_PYLON)
ENDIF()
ENDIF()
IF(BUILD_WITH_PCL)
IF(BUILD_WITH_PCL_OPTIONAL)
FIND_PACKAGE(PCL 1.6 COMPONENTS kdtree common octree search QUIET)
ELSE()
FIND_PACKAGE(PCL 1.6 REQUIRED COMPONENTS kdtree common octree search QUIET)
ENDIF()
# io requires openni aswell !!
# FIND_PACKAGE(PCL REQUIRED) ??
IF(PCL_FOUND)
MESSAGE(STATUS "Found PCL: ${PCL_INCLUDE_DIRS} ${PCL_LIBRARIES}")
# workaround aroud issue that PCL_LIBRARIES contains
# tokens optimized pthread and debug
SET(PCL_LIBRARIES_PC ${PCL_LIBRARIES})
LIST(REMOVE_DUPLICATES PCL_LIBRARIES_PC)
LIST(REMOVE_ITEM PCL_LIBRARIES_PC debug)
LIST(REMOVE_ITEM PCL_LIBRARIES_PC optimized)
LIST(REMOVE_ITEM PCL_LIBRARIES_PC pthread)
ADD_ICL_DEFINITIONS(-DICL_HAVE_PCL)
ELSE()
IF(BUILD_WITH_PCL_OPTIONAL)
MESSAGE(STATUS "Could NOT find OPTIONAL PCL (continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Could NOT find PCL")
ENDIF()
ENDIF()
ENDIF()
# Why does it have to be before the RSB stuff?
IF(BUILD_WITH_RST)
IF(NOT BUILD_WITH_PROTOBUF)
MESSAGE(FATAL_ERROR "Option BUILD_WITH_RST was defined, but BUILD_WITH_PROTOBUF was not defined (these options belong together, so either specify both or none of them)")
ENDIF()
IF(NOT BUILD_WITH_RSC)
MESSAGE(FATAL_ERROR "Option BUILD_WITH_RST was defined, but BUILD_WITH_RSC was not defined (these options belong together, so either specify both or none of them)")
ENDIF()
IF(RST_ROOT)
FIND_PACKAGE(RST COMPONENTS sandbox PATHS ${RST_ROOT} NO_DEFAULT_PATH QUIET)
ELSE()
FIND_PACKAGE(RST COMPONENTS sandbox QUIET)
ENDIF()
IF(RST_FOUND)
set(HAVE_ALL_PROTOS TRUE)
foreach(proto rst/math/Vec3DFloat.proto rst/geometry/PolygonalPatch3D.proto)
LIST(FIND STABLE_PROTOS_REL proto/stable/${proto} _HAVE_STABLE_PROTO)
LIST(FIND SANDBOX_PROTOS_REL proto/sandbox/${proto} _HAVE_SANDBOX_PROTO)
if((_HAVE_STABLE_PROTO LESS 0) AND (_HAVE_SANDBOX_PROTO LESS 0))
LIST(APPEND RST_MISSING ${proto})
set(HAVE_ALL_PROTOS FALSE)
endif()
endforeach()
else()
SET(RST_MISSING "RST package")
endif()
IF(RST_FOUND AND HAVE_ALL_PROTOS AND BUILD_WITH_RSC)
MESSAGE(STATUS "Found RST: ${RST_INCLUDE_DIRS} ${RST_LIBRARIES}")
IF(RSC_ROOT)
FIND_PACKAGE(RSC PATHS ${RSC_ROOT} NO_DEFAULT_PATH QUIET)
ELSE()
FIND_PACKAGE(RSC PATHS QUIET)
ENDIF()
IF(RSC_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_RST ${RST_CFLAGS})
ADD_ICL_DEFINITIONS(-DICL_HAVE_RSC ${RSC_CFLAGS})
ELSE()
IF(BUILD_WITH_RSC_OPTIONAL)
MESSAGE(STATUS "Could NOT find OPTIONAL RSC (missing: continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Could NOT find RST")
ENDIF()
ENDIF()
ELSE()
SET(RSC_FOUND FALSE)
SET(RST_FOUND FALSE)
IF(BUILD_WITH_RST_OPTIONAL)
MESSAGE(STATUS "Could NOT find OPTIONAL RST (missing: ${RST_MISSING}, continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Could NOT find RST (missing: ${RST_MISSING})")
ENDIF()
ENDIF()
ENDIF()
MESSAGE(STATUS ${RST_LIBRARIES_PC})
IF(BUILD_WITH_RSB)
IF(NOT BUILD_WITH_PROTOBUF)
MESSAGE(FATAL_ERROR "Option BUILD_WITH_RSB was defined, but BUILD_WITH_PROTOBUF was not defined (these options belong together, so either specify both or none of them)")
ENDIF()
FIND_PACKAGE(RSB REQUIRED HINTS ${RSB_ROOT} QUIET)
IF(WIN32)
FIND_PACKAGE(WinProtobuf REQUIRED)
ELSE()
IF(PROTOBUF_ROOT)
FIND_PACKAGE(Protobuf REQUIRED HINTS ${PROTOBUF_ROOT} QUIET)
ELSE()
FIND_PACKAGE(Protobuf REQUIRED QUIET)
ENDIF()
ENDIF()
IF(RSB_FOUND AND PROTOBUF_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_RSB)
ADD_ICL_DEFINITIONS(-DICL_HAVE_PROTOBUF)
LIST(APPEND RSB_RSC_AND_PROTOBUF_LIBRARIES_PC ${RSB_LIBRARIES})
LIST(APPEND RSB_RSC_AND_PROTOBUF_LIBRARIES_PC ${PROTOBUF_LIBRARIES})
IF(WIN32)
LIST(APPEND RSB_RSC_AND_PROTOBUF_LIBRARIES_PC ${BOOST_LIBRARIES})
ENDIF(WIN32)
LIST(REMOVE_DUPLICATES RSB_RSC_AND_PROTOBUF_LIBRARIES_PC)
LIST(REMOVE_ITEM RSB_RSC_AND_PROTOBUF_LIBRARIES_PC debug)
LIST(REMOVE_ITEM RSB_RSC_AND_PROTOBUF_LIBRARIES_PC optimized)
LIST(REMOVE_ITEM RSB_RSC_AND_PROTOBUF_LIBRARIES_PC pthread)
LIST(REMOVE_ITEM RSB_LIBRARIES pthread)
LIST(REMOVE_ITEM RSB_LIBRARIES optimized)
LIST(REMOVE_ITEM RSB_LIBRARIES debug)
LIST(REMOVE_ITEM PROTOBUF_LIBRARIES pthread)
LIST(REMOVE_ITEM PROTOBUF_LIBRARIES optimized)
LIST(REMOVE_ITEM PROTOBUF_LIBRARIES debug)
MESSAGE(STATUS "Found RSB: ${RSB_INCLUDE_DIRS} ${RSB_LIBRARIES}")
MESSAGE(STATUS "Found PROTOBUF: ${PROTOBUF_INCLUDE_DIRS} ${PROTOBUF_LIBRARIES}")
ELSE()
IF(NOT RSB_FOUND)
IF(BUILD_WITH_RSB_OPTIONAL)
MESSAGE(STATUS "Could NOT find OPTIONAL RSB (continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Could NOT find RSB")
ENDIF()
ELSE()
IF(NOT PROTOBUF_FOUND)
MESSAGE(SEND_ERROR "Could NOT find PROTOBUF")
IF(BUILD_WITH_PROTOBUF_OPTIONAL)
IF(BUILD_WITH_RSB_OPTIONAL)
MESSAGE(STATUS "Could NOT find OPTIONAL PROTOBUF (continuing...)")
ELSE()
MESSAGE(SEND_ERROR "Defining BUILD_WITH_PROTOBUF_OPTIONAL=TRUE is not possible as RSB needs PROTOBUF mandatorily (define BUILD_WITH_RSB_OPTIONAL=TRUE aswell to achieve a real optional RSB dependency)")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
SET(RSB_FOUND FALSE)
SET(PROTOBUF_FOUND FALSE)
ENDIF()
ENDIF()
MESSAGE(STATUS ${RSB_RSC_AND_PROTOBUF_LIBRARIES_PC})
SET(HAVE_SIMDS "")
FOREACH(EXT SSE2 SSE3 SSSE3)
IF(${EXT}_FOUND)
IF(DISALBE_${EXT})
message(STATUS "${EXT} found but disabled")
ELSE()
message(STATUS "${EXT} found and enabled")
ADD_ICL_DEFINITIONS(-DICL_USE_${EXT})
LIST(APPEND HAVE_SIMDS ${EXT})
ENDIF()
ELSE()
message(STATUS "${EXT} not found")
ENDIF()
ENDFOREACH()
IF(BUILD_WITH_BULLET)
#SET(BULLET_ROOT BULLET_ROOT CACHE PATH "Root directory BULLET")
IF(BUILD_WITH_BULLET_OPTIONAL)
FIND_PACKAGE(Bullet3 QUIET)
SET(BULLET_FOUND ${BULLET3_FOUND})
IF(BULLET_FOUND)
ADD_ICL_DEFINITIONS(-DICL_HAVE_BULLET)
ELSE()
MESSAGE(STATUS "Could NOT find OPTIONAL BULLET (missing: libs and/or headers, continuing...)")
SET(BUILD_WITH_BULLET FALSE)
SET(BULLET_INCLUDE_DIRS "")
SET(BULLET_LIBRARIES "")
SET(BULLET_ROOT_DIR "")
ENDIF()
ELSE()