-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
1444 lines (1224 loc) · 52.8 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
# ----------------------------------------------------------------------------
# Root CMake file for OpenCV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_OPENCV_ROOT>
#
#
# - OCT-2008: Initial version <[email protected]>
#
# ----------------------------------------------------------------------------
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
# Add these standard paths to the search paths for FIND_LIBRARY
# to find libraries from these locations first
if(UNIX)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib)
endif()
# it _must_ go before PROJECT(OpenCV) in order to work
if (NOT CMAKE_INSTALL_PREFIX)
if (WIN32)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE INTERNAL "" FORCE)
elseif()
set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "" FORCE)
endif()
endif()
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")
if (CMAKE_VERBOSE)
set (CMAKE_VERBOSE_MAKEFILE 1)
endif()
project(OpenCV)
cmake_minimum_required(VERSION 2.4)
if(MSVC)
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
endif()
#set(CMAKE_C_COMPILER "/opt/BullseyeCoverage/bin/gcc")
#set(CMAKE_CXX_COMPILER "/opt/BullseyeCoverage/bin/g++")
#set(CMAKE_CXX_COMPILER_INIT "/opt/BullseyeCoverage/bin/gcc")
# --------------------------------------------------------------
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists.
# Run "cmake --help-policy CMP0003" for more information.
# --------------------------------------------------------------
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
# ----------------------------------------------------------------------------
# Current version number:
# ----------------------------------------------------------------------------
set(OPENCV_VERSION "2.2.0")
string(REGEX MATCHALL "[0-9]" OPENCV_VERSION_PARTS "${OPENCV_VERSION}")
list(GET OPENCV_VERSION_PARTS 0 OPENCV_VERSION_MAJOR)
list(GET OPENCV_VERSION_PARTS 1 OPENCV_VERSION_MINOR)
list(GET OPENCV_VERSION_PARTS 2 OPENCV_VERSION_PATCH)
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
#set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
set(OPENCV_DLLVERSION "")
set(OPENCV_DEBUG_POSTFIX)
# ----------------------------------------------------------------------------
# Build static or dynamic libs?
# ----------------------------------------------------------------------------
# Default: dynamic libraries:
SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
IF(BUILD_SHARED_LIBS)
SET(OPENCV_BUILD_SHARED_LIB 1) # For cvconfig.h, etc.
ELSE(BUILD_SHARED_LIBS)
SET(OPENCV_BUILD_SHARED_LIB 0)
ENDIF(BUILD_SHARED_LIBS)
# ----------------------------------------------------------------------------
# Variables for cvconfig.h.cmake
# ----------------------------------------------------------------------------
set(PACKAGE "opencv")
set(PACKAGE_BUGREPORT "[email protected]")
set(PACKAGE_NAME "opencv")
set(PACKAGE_STRING "${PACKAGE} ${OPENCV_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE}")
set(PACKAGE_VERSION "${OPENCV_VERSION}")
# ----------------------------------------------------------------------------
# Autodetect if we are in a SVN repository
# ----------------------------------------------------------------------------
find_program(SVNVERSION_PATH svnversion)
mark_as_advanced(force SVNVERSION_PATH)
if(SVNVERSION_PATH)
message(STATUS "Extracting svn version, please wait...")
execute_process(COMMAND ${SVNVERSION_PATH} -n ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE SVNVERSION_RESULT)
if(SVNVERSION_RESULT MATCHES "exported")
# This is NOT a svn repository:
set(OPENCV_SVNVERSION "")
else()
set(OPENCV_SVNVERSION " svn:${SVNVERSION_RESULT}")
endif()
message(STATUS "SVNVERSION: ${OPENCV_SVNVERSION}")
else()
# We don't have svnversion:
set(OPENCV_SVNVERSION "")
endif()
# ----------------------------------------------------------------------------
# Detect GNU version:
# ----------------------------------------------------------------------------
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"
# Look for the version number
string(REGEX MATCH "[0-9].[0-9].[0-9]" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
# Split the three parts:
string(REGEX MATCHALL "[0-9]" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
endif()
endif()
endif()
# ----------------------------------------------------------------------------
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
# NOTE: The system needs to determine if the '-fPIC' option needs to be added
# for the 3rdparty static libs being compiled. The CMakeLists.txt files
# in 3rdparty use the CV_ICC definition being set here to determine if
# the -fPIC flag should be used.
# ----------------------------------------------------------------------------
if(UNIX)
if (__ICL)
set(CV_ICC __ICL)
elseif(__ICC)
set(CV_ICC __ICC)
elseif(__ECL)
set(CV_ICC __ECL)
elseif(__ECC)
set(CV_ICC __ECC)
elseif(__INTEL_COMPILER)
set(CV_ICC __INTEL_COMPILER)
elseif(CMAKE_C_COMPILER MATCHES "icc")
set(CV_ICC icc_matches_c_compiler)
endif()
endif()
# ----------------------------------------------------------------------------
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
# ----------------------------------------------------------------------------
# Build/install (or not) some apps:
# ===================================================
set(BUILD_EXAMPLES OFF CACHE BOOL "Build all examples")
set(INSTALL_C_EXAMPLES OFF CACHE BOOL "Install C examples")
set(INSTALL_PYTHON_EXAMPLES OFF CACHE BOOL "Install Python examples")
# Build tests:
# ===================================================
set(BUILD_TESTS ON CACHE BOOL "Build tests")
# Build 3rdparty libraries under unix
# ===================================================
if(WIN32 OR APPLE)
set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE BOOL "Build 3rd party libraries")
else()
set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
endif()
include(OpenCVPCHSupport.cmake REQUIRED)
include(OpenCVModule.cmake REQUIRED)
if(UNIX)
include(OpenCVFindPkgConfig.cmake OPTIONAL)
include(CheckFunctionExists)
include(CheckIncludeFile)
endif()
#if(MSVC)
# set(DEFAULT_ENABLE_OPENMP ON)
#else()
# set(DEFAULT_ENABLE_OPENMP OFF)
#endif()
#set(ENABLE_OPENMP ${DEFAULT_ENABLE_OPENMP} CACHE BOOL "")
if(CMAKE_COMPILER_IS_GNUCXX)
set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)")
set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm*)
# We can use only -O2 because the -O3 causes gcc crash
set(USE_O2 ON CACHE BOOL "Enable -O2 for GCC")
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math for GCC")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
set(X86_64 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
set(X86_64 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i386*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*)
set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")
set(ENABLE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC")
endif ()
if(X86 OR X86_64)
# enable everything, since the available set of instructions is checked at runtime
set(USE_O3 ON CACHE BOOL "Enable -O3")
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math")
set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions")
set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions")
set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions")
set(ENABLE_SSSE3 OFF CACHE BOOL "Enable SSSE3 instructions")
set(ENABLE_SSE41 OFF CACHE BOOL "Enable SSE4.1 instructions")
set(ENABLE_SSE42 OFF CACHE BOOL "Enable SSE4.2 instructions")
endif()
endif()
# allow fine grained control over which libraries not to link, even if
# they are available on the system
# ====================================================================
set(WITH_PNG ON CACHE BOOL "Include PNG support")
set(WITH_JPEG ON CACHE BOOL "Include JPEG support")
set(WITH_JASPER ON CACHE BOOL "Include JPEG2K support")
set(WITH_TIFF ON CACHE BOOL "Include TIFF support")
set(WITH_OPENEXR ON CACHE BOOL "Include ILM support via OpenEXR")
if(UNIX)
set(WITH_FFMPEG ON CACHE BOOL "Include FFMPEG support")
if(NOT APPLE)
set(WITH_UNICAP OFF CACHE BOOL "Include Unicap support (GPL)")
set(WITH_GTK ON CACHE BOOL "Include GTK support")
set(WITH_GSTREAMER ON CACHE BOOL "Include Gstreamer support")
set(WITH_V4L ON CACHE BOOL "Include Video 4 Linux support")
set(WITH_XINE OFF CACHE BOOL "Include Xine support (GPL)")
endif()
set(WITH_PVAPI ON CACHE BOOL "Include Prosilica GigE support")
set(WITH_1394 ON CACHE BOOL "Include IEEE1394 support")
endif()
if(APPLE)
set(WITH_CARBON OFF CACHE BOOL "Use Carbon for UI instead of Cocoa")
set(WITH_QUICKTIME OFF CACHE BOOL "Use QuickTime for Video I/O insted of QTKit")
endif()
set(WITH_TBB OFF CACHE BOOL "Include TBB support")
set(WITH_EIGEN2 ON CACHE BOOL "Include Eigen2/Eigen3 support")
set(WITH_CUDA OFF CACHE BOOL "Include NVidia Cuda Runtime support")
if(WIN32)
set(WITH_VIDEOINPUT ON CACHE BOOL "Enable VideoInput support")
endif()
# ===================================================
# Macros that checks if module have been installed.
# After it adds module to build and define
# constants passed as second arg
# ===================================================
macro(CHECK_MODULE module_name define)
set(${define} 0)
if(PKG_CONFIG_FOUND)
set(ALIAS ALIASOF_${module_name})
set(ALIAS_FOUND ${ALIAS}_FOUND)
set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)
set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)
set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)
PKG_CHECK_MODULES(${ALIAS} ${module_name})
if (${ALIAS_FOUND})
set(${define} 1)
foreach(P "${ALIAS_INCLUDE_DIRS}")
if (${P})
list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})
endif()
endforeach()
foreach(P "${ALIAS_LIBRARY_DIRS}")
if (${P})
list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}})
endif()
endforeach()
list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})
endif()
endif()
endmacro()
if(UNIX)
if(NOT APPLE)
if(WITH_GTK)
CHECK_MODULE(gtk+-2.0 HAVE_GTK)
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
else()
set(HAVE_GTK FALSE)
set(HAVE_GTHREAD FALSE)
endif()
if(WITH_GSTREAMER)
CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER)
CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER_APP)
CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER)
else()
set(HAVE_GSTREAMER FALSE)
endif()
endif()
if(WITH_UNICAP)
CHECK_MODULE(libunicap HAVE_UNICAP_)
CHECK_MODULE(libucil HAVE_UNICAP_UCIL)
if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)
set(HAVE_UNICAP 1)
endif()
else()
set(HAVE_UNICAP FALSE)
endif()
if(WITH_PVAPI)
find_path(PVAPI_INCLUDE_PATH "PvApi.h"
PATHS "/usr/local/include" "/usr/include"
DOC "The path to PvAPI header")
if(PVAPI_INCLUDE_PATH)
set(HAVE_PVAPI 1)
endif()
endif()
set(HAVE_FFMPEG 0)
if(WITH_FFMPEG)
CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)
if(EXISTS /usr/include/ffmpeg/libavformat/avformat.h OR HAVE_FFMPEG_SWSCALE)
set(HAVE_GENTOO_FFMPEG 1)
endif()
endif()
if(HAVE_FFMPEG_CODEC AND HAVE_FFMPEG_FORMAT AND HAVE_FFMPEG_UTIL)
if(HAVE_FFMPEG_SWSCALE OR NOT HAVE_GENTOO_FFMPEG)
set(HAVE_FFMPEG 1)
endif()
endif()
# Find the bzip2 library because it is required on some systems
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)
if(NOT BZIP2_LIBRARIES)
# Do an other trial
FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)
endif()
endif()
if(WITH_1394)
CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)
if(NOT HAVE_DC1394_2)
CHECK_MODULE(libdc1394 HAVE_DC1394)
endif()
else()
set(HAVE_DC1394_2 FALSE)
set(HAVE_DC1394 FALSE)
endif()
if(NOT APPLE)
CHECK_INCLUDE_FILE(alloca.h HAVE_ALLOCA_H)
CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
if(WITH_XINE)
CHECK_MODULE(libxine HAVE_XINE)
else()
set(HAVE_XINE FALSE)
endif()
if(WITH_V4L)
CHECK_MODULE(libv4l1 HAVE_LIBV4L)
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
else()
set(HAVE_LIBV4L FALSE)
set(HAVE_CAMV4L FALSE)
set(HAVE_CAMV4L2 FALSE)
endif()
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
if(WITH_PNG)
include(FindPNG)
if(PNG_FOUND)
CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)
CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)
endif()
else()
set(PNG_FOUND FALSE)
endif()
if(WITH_TIFF)
include(FindTIFF)
else()
set(TIFF_FOUND FALSE)
endif()
if(WITH_JASPER)
include(FindJasper)
else()
set(JASPER_FOUND FALSE)
endif()
if(WITH_JPEG)
include(FindJPEG)
else()
set(JPEG_FOUND FALSE)
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(OPENCV_LINKER_LIBS m pthread)
else()
set(OPENCV_LINKER_LIBS dl m pthread rt)
endif()
else()
add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H)
endif()
endif()
if(WITH_PNG AND NOT PNG_FOUND)
set(PNG_LIBRARIES libpng)
endif()
if(WITH_JPEG AND NOT JPEG_FOUND)
set(JPEG_LIBRARIES libjpeg)
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
set(TIFF_LIBRARIES libtiff)
endif()
if(WITH_JASPER AND NOT JASPER_FOUND)
set(JASPER_LIBRARIES libjasper)
endif()
#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
if(WITH_OPENEXR)
include(OpenCVFindOpenEXR.cmake)
endif()
set(BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support")
if(BUILD_NEW_PYTHON_SUPPORT)
find_package(PythonInterp)
find_package(PythonLibs)
# cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
set(PYTHONLIBS_FOUND ON)
endif(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
ERROR_VARIABLE PYTHON_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
if(UNIX)
set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages)
endif()
if(WIN32)
get_filename_component(PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE)
set(PYTHON_PLUGIN_INSTALL_PATH "${PYTHON_PATH}/Lib/site-packages/opencv")
set(PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages")
endif()
# Attempt to discover the NumPy include directory. If this succeeds, build with NumPy
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(PYTHON_NUMPY_PROCESS EQUAL 0)
set(PYTHON_USE_NUMPY 1)
add_definitions(-D PYTHON_USE_NUMPY=1)
include_directories(AFTER ${PYTHON_NUMPY_INCLUDE_DIRS})
message(STATUS " Use INCLUDE: ${PYTHON_NUMPY_INCLUDE_DIRS}")
else()
set(PYTHON_USE_NUMPY 0)
endif()
endif()
#YV
############################### QT ################################
set(WITH_QT OFF CACHE BOOL "Build with Qt Backend support")
set(WITH_QT_OPENGL OFF CACHE BOOL "Add OpenGL extension to Qt")
set(HAVE_QT 0)
set(HAVE_QT_OPENGL 0)
if (WITH_QT)
find_package(Qt4)
if (QT4_FOUND)
set(HAVE_QT 1)
add_definitions(-DHAVE_QT)#We need to define te macro this way, using cvconfig.h.cmake does not work
find_package (OpenGL QUIET)
#if (NOT WIN32)
if (WITH_QT_OPENGL)
if (QT_QTOPENGL_FOUND AND OPENGL_FOUND)
set(HAVE_QT_OPENGL 1)
add_definitions(-DHAVE_QT_OPENGL)
#link_directories("${OPENGL_LIBRARIES}")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES})
endif()
endif()
#endif()
endif()
endif()
############################### TBB ################################
if (WITH_TBB)
if (UNIX AND NOT APPLE)
PKG_CHECK_MODULES(TBB tbb)
message(STATUS "TBB detected: ${TBBLIB_FOUND}")
if (TBB_FOUND)
set(HAVE_TBB 1)
if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
include_directories(${TBB_INCLUDE_DIRS})
endif()
link_directories(${TBB_LIBRARY_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
else()
set(TBB_DEFAULT_INCLUDE_DIRS
"/opt/intel/tbb"
"/usr/local/include"
"/usr/include")
endif()
endif()
if (APPLE)
set(TBB_DEFAULT_INCLUDE_DIRS
"/usr/local/include"
"/usr/include")
endif()
if (WIN32)
set(TBB_DEFAULT_INCLUDE_DIRS
"C:/Program Files/Intel/TBB"
"C:/Program Files (x86)/Intel/TBB")
endif()
if (NOT HAVE_TBB)
find_path(TBB_INCLUDE_DIR "tbb/tbb.h"
PATHS TBB_DEFAULT_INCLUDE_DIRS
DOC "The path to TBB headers")
if (TBB_INCLUDE_DIR)
if (UNIX)
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
link_directories("${TBB_LIB_DIR}")
endif()
if (APPLE)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
elseif (UNIX)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
elseif (WIN32)
if (CMAKE_COMPILER_IS_GNUCXX)
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
link_directories("${TBB_LIB_DIR}")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
else()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
set(X86_64 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
set(X86_64 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i386*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*)
set(X86 1)
endif()
set(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib")
if (X86_64)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
elseif(X86)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
endif()
if (MSVC80)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
elseif(MSVC90)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
endif()
set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
link_directories("${TBB_LIB_DIR}")
endif()
endif()
set(HAVE_TBB 1)
if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")
include_directories("${TBB_INCLUDE_DIR}")
endif()
endif()
endif()
endif()
############################### CUDA ################################
if (WITH_CUDA)
find_package(CUDA 3.2)
if (CUDA_FOUND)
set(HAVE_CUDA 1)
message(STATUS "CUDA detected: " ${CUDA_VERSION})
set(CUDA_COMPUTE_CAPABILITIES " 1.1 1.2 1.3 2.0 " CACHE STRING "Add or remove compute capability")
set(CUDA_NVCC_FLAGS_ARCH ${CUDA_COMPUTE_CAPABILITIES})
set(CUDA_NVCC_FLAGS_NUM "")
while(NOT ${CUDA_NVCC_FLAGS_ARCH} STREQUAL "")
string(REGEX MATCH "[0-9]+.[0-9]+" RESULT_NUM ${CUDA_NVCC_FLAGS_ARCH})
string(REGEX MATCHALL "[0-9]" RESULT_STR ${RESULT_NUM})
string(REGEX REPLACE ";" "\ " RESULT ${RESULT_STR})
list(APPEND CUDA_NVCC_FLAGS_NUM ${RESULT})
string(REGEX REPLACE "${RESULT_NUM}" "\ " CUDA_NVCC_FLAGS_ARCH_STR ${CUDA_NVCC_FLAGS_ARCH})
string(STRIP ${CUDA_NVCC_FLAGS_ARCH_STR} CUDA_NVCC_FLAGS_ARCH)
endwhile()
set (OpenCV_CUDA_CC "")
set (loop_var "")
foreach( loop_var IN LISTS CUDA_NVCC_FLAGS_NUM)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_${loop_var},code=sm_${loop_var})
set (OpenCV_CUDA_CC ${OpenCV_CUDA_CC} -gencode arch=compute_${loop_var},code=sm_${loop_var})
endforeach()
### set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${OpenCV_COMPUTE_CAPABILITIES})
endif()
endif()
############################### VideoInput ################################
if (WIN32 AND WITH_VIDEOINPUT)
if(CMAKE_CXX_COMPILER MATCHES "dw2")
else()
if(NOT MINGW64)
set(HAVE_VIDEOINPUT 1)
endif()
endif()
endif()
############################## Eigen2 ##############################
if(WITH_EIGEN2)
find_path(EIGEN2_INCLUDE_PATH "Eigen/Core"
PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2"
"/usr/local/include/eigen3" "/opt/include/eigen3" "/usr/include/eigen3"
DOC "The path to Eigen2/Eigen3 headers")
if(EIGEN2_INCLUDE_PATH)
include_directories(${EIGEN2_INCLUDE_PATH})
set(HAVE_EIGEN2 1)
endif()
endif()
############################### IPP ################################
set(IPP_FOUND)
set(OPENCV_LOADER_PATH)
if(UNIX)
if(APPLE)
set(OPENCV_LOADER_PATH DYLD_LIBRARY_PATH)
else()
set(OPENCV_LOADER_PATH LD_LIBRARY_PATH)
endif()
endif()
foreach(v "6.1" "6.0" "5.3" "5.2" "5.1")
if(NOT IPP_FOUND)
if(WIN32)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "ippiem64t-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(UNIX)
find_path(IPP_PATH "libippi${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "libippiem64t${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(IPP_PATH)
file(GLOB IPP_HDRS "${IPP_PATH}/../include")
if(IPP_HDRS)
set(IPP_FOUND TRUE)
endif()
endif()
endif()
endforeach()
message(STATUS "IPP detected: ${IPP_FOUND}")
if(WIN32 AND NOT MSVC)
set(IPP_FOUND)
endif()
set(USE_IPP ${IPP_FOUND} CACHE BOOL "Use IPP when available")
if(IPP_FOUND AND USE_IPP)
add_definitions(-DHAVE_IPP)
include_directories("${IPP_PATH}/../include")
link_directories("${IPP_PATH}/../lib")
file(GLOB em64t_files "${IPP_PATH}/../lib/*em64t*")
set(IPP_ARCH)
if(em64t_files)
set(IPP_ARCH "em64t")
endif()
set(A ${CMAKE_STATIC_LIBRARY_PREFIX})
set(B ${IPP_ARCH}${CMAKE_STATIC_LIBRARY_SUFFIX})
if(WIN32)
set(L l)
else()
set(L)
endif()
set(IPP_LIBS ${A}ippsmerged${B} ${A}ippsemerged${B}
${A}ippimerged${B} ${A}ippiemerged${B}
${A}ippvmmerged${B} ${A}ippvmemerged${B}
${A}ippccmerged${B} ${A}ippccemerged${B}
${A}ippcvmerged${B} ${A}ippcvemerged${B}
${A}ippcore${IPP_ARCH}${L}${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
################## Extra HighGUI libs on Windows ###################
if(WIN32)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)
if (MSVC)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32)
endif()
if(MINGW)
if(MINGW64)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} msvfw32 avifil32 avicap32 winmm)
if(HAVE_VIDEOINPUT)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput64 strmiids)
endif()
else()
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32 winmm)
if(HAVE_VIDEOINPUT)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput strmiids)
endif()
endif()
endif()
endif()
################## LATEX ##################
set(BUILD_LATEX_DOCS OFF CACHE BOOL "Build LaTeX OpenCV Documentation")
################### DOXYGEN ###############
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen")
endif()
# ----------------------------------------------------------------------------
# UPDATE CONFIG FILES & SCRIPTS:
#
# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
# If @ONLY is specified, only variables of the form @VAR@ will be
# replaces and ${VAR} will be ignored.
#
# A directory will be created for each platform so the "cvconfig.h" file is
# not overwritten if cmake generates code in the same path.
# ----------------------------------------------------------------------------
add_definitions(-DHAVE_CONFIG_H)
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
message(STATUS "Parsing 'cvconfig.h.cmake'")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
# ---------------------------------------------------------------------------
# The C+//0 include & link directories:
# ---------------------------------------------------------------------------
include_directories("."
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv"
)
# ----------------------------------------------------------------------------
# Set the maximum level of warnings:
# ----------------------------------------------------------------------------
# Should be set to true for development
set(OPENCV_WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors")
set(EXTRA_C_FLAGS "")
set(EXTRA_C_FLAGS_RELEASE "")
set(EXTRA_C_FLAGS_DEBUG "")
set(EXTRA_EXE_LINKER_FLAGS "")
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")
set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")
if(MSVC)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
# 64-bit portability warnings, in MSVC8
if(MSVC80)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Wp64")
endif()
#if(MSVC90)
# set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
#endif()
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
#if(ENABLE_OPENMP)
# set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /openmp")
#endif()
# Remove unreferenced functions: function level linking
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# High level of warnings.
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")
# The -Wno-long-long is required in 64bit systems when including sytem headers.
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
endif()
# We need pthread's
if(UNIX)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -pthread")
endif()
if(OPENCV_WARNINGS_ARE_ERRORS)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
endif()
if(X86)
if(NOT MINGW64)
if(NOT X86_64)
if(NOT APPLE)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686")
endif()
endif()
endif()
endif()
# Other optimizations
if(USE_OMIT_FRAME_POINTER)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")
endif()
if(USE_O2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2")
endif()
if(USE_O3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3")
endif()
if(USE_FAST_MATH)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")
endif()
if(ENABLE_POWERPC)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5")
endif()
if(ENABLE_SSE)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse")
endif()
if(ENABLE_SSE2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2")
endif()
# SSE3 and further should be disabled under MingW because it generates compiler errors
if(NOT MINGW)
if(ENABLE_SSE3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3")
endif()
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402)
set(HAVE_GCC43_OR_NEWER 1)
endif()
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 401)
set(HAVE_GCC42_OR_NEWER 1)
endif()
if(HAVE_GCC43_OR_NEWER OR APPLE)
if(ENABLE_SSSE3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mssse3")
endif()
if(HAVE_GCC42_OR_NEWER)
if(ENABLE_SSE41)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.1")
endif()
if(ENABLE_SSE42)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.2")
endif()
endif()
endif()
endif()
if(X86 OR X86_64)
if(NOT APPLE)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387")
endif()
endif()
endif()
# Profiling?
if(ENABLE_PROFILING)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g")
else()
# Remove unreferenced functions: function level linking
if(NOT APPLE)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")
endif()
endif()
# Parallel mode
#if(ENABLE_OPENMP)
# set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -D_GLIBCXX_PARALLEL -fopenmp")
# set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} gomp)
#endif()
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -ggdb3 -DDEBUG -D_DEBUG")
endif()
# Extra link libs if the user selects building static libs: