forked from emgucv/emgucv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1564 lines (1372 loc) · 63.1 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
# --------------------------------------------------------
# Copyright (C) 2004-2017 by EMGU Corporation. All rights reserved.
#
# Root CMake file for Emgu CV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_EMGUCV_ROOT>
#
# --------------------------------------------------------
PROJECT(emgucv)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.1)
IF( NOT (NETFX_CORE OR ANDROID OR IOS ) )
# IF (NOT WIN32)
# SET(CMAKE_C_FLAGS_RELEASE "-fPIC ${CMAKE_C_FLAGS_RELEASE}")
# SET(CMAKE_CXX_FLAGS_RELEASE "-fPIC ${CMAKE_CXX_FLAGS_RELEASE}")
# SET(CMAKE_C_FLAGS_DEBUG "-fPIC ${CMAKE_C_FLAGS_DEBUG}")
# SET(CMAKE_CXX_FLAGS_DEBUG "-fPIC ${CMAKE_CXX_FLAGS_DEBUG}")
# SET(CMAKE_EXE_LINKER_FLAGS "-fPIC ${CMAKE_EXE_LINKER_FLAGS}")
# SET(CMAKE_SHARED_LINKER_FLAGS "-fPIC ${CMAKE_SHARED_LINKER_FLAGS}")
# ENDIF()
IF (WIN32)
SET(BUILD_SHARED_LIBS_CACHE ${BUILD_SHARED_LIBS})
SET(BUILD_SHARED_LIBS OFF)
SET(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON)
ADD_SUBDIRECTORY(vtk) # always build vtk as static library
SET(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_CACHE})
ENDIF()
# IF (NOT WIN32)
# SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE_CACHE} )
# SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE_CACHE})
# ENDIF()
ENDIF()
SET(OPENCV_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/opencv)
SET(OPENCV_CONTRIB_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/opencv_contrib)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
IF (NOT ANDROID)
SET(CSC_PREFERRED_VERSION "4.0")
IF((NOT NETFX_CORE) AND MSVC)
#SET CSC 3.5 as the prefered compiler for EMGU CV
SET(CSC_TARGET_FRAMEWORK "3.5" CACHE STRING "C# target framework")
ELSE()
#SET CSC 4.5 (in the .Net framework 4.0 folder) as the prefered compiler for EMGU CV
SET(CSC_TARGET_FRAMEWORK "" CACHE STRING "C# target framework")
ENDIF()
FIND_PACKAGE(CSharp REQUIRED)
INCLUDE (CSharpMacros)
ENDIF()
INCLUDE (CheckTargetArch)
INCLUDE (OpenCVVersion)
SET(LIBRARY_3RDPARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/3rdParty)
# ----------------------------------------------------------------------------
# Autodetect if we are in a GIT repository
# ----------------------------------------------------------------------------
FIND_PROGRAM(GIT_PATH git)
FIND_PROGRAM(WC_PATH wc)
MARK_AS_ADVANCED(force GIT_PATH WC_PATH)
IF(GIT_PATH AND WC_PATH)
MESSAGE(STATUS "Extracting Emgu CV git version, please wait...")
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${GIT_PATH} log --oneline
COMMAND ${WC_PATH} -l
OUTPUT_VARIABLE GITVERSION_RESULT)
#MESSAGE(STATUS "COMMAND: ${GIT_PATH} log --oneline | ${WC_PATH} -l")
STRING(REGEX REPLACE "^([0123456789]+).*" "\\1" EMGUCV_GITVERSION "${GITVERSION_RESULT}")
STRING(STRIP "${EMGUCV_GITVERSION}" EMGUCV_GITVERSION)
IF(EMGUCV_GITVERSION MATCHES "^$" OR EMGUCV_GITVERSION MATCHES "^-")
# This is NOT a git repository:
SET(EMGUCV_GITVERSION "0")
ENDIF()
MESSAGE(STATUS "Emgu CV GIT VERSION: ${EMGUCV_GITVERSION}")
ELSE()
# We don't have git or wc:
SET(EMGUCV_GITVERSION "0")
ENDIF()
# ----------------------------------------------------------------------------
# Check if 32bit or 64-bit
# ----------------------------------------------------------------------------
CHECK_TARGET_ARCH()
IF (WIN32)
MESSAGE(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
IF(TARGET_ARCH_64)
SET(EMGUCV_ARCH win64)
ELSE()
#ELSEIF ( ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") )
MESSAGE(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
STRING(FIND "${CMAKE_GENERATOR}" "ARM" IS_ARM)
IF(IS_ARM GREATER -1)
SET(EMGUCV_ARCH arm)
ELSE()
SET(EMGUCV_ARCH win32)
ENDIF()
#ELSE()
# SET(EMGUCV_ARCH win32)
ENDIF()
ELSE(WIN32)
SET(EMGUCV_ARCH ${CMAKE_SYSTEM_NAME})
ENDIF(WIN32)
MESSAGE(STATUS "Building for ${EMGUCV_ARCH}")
IF(WIN32 AND CV_ICC)
# SET(CV_ICC_ADDITIONAL_FLAGS_RELEASE "/O3 /QaxCORE-AVX2,AVX,SSE4.1,SSE3 /Qparallel /Qopt-report:1 /Qopt-report-phase:vec /Qopt-report-phase:par /Qopt-report-file:stderr /Qipo /Qunroll-aggressive")
SET(CV_ICC_ADDITIONAL_FLAGS_RELEASE "/O3 /QaxCORE-AVX2,AVX,SSE4.1,SSE3 /Qparallel /Qopt-report:1 /Qopt-report-phase:vec /Qopt-report-phase:par /Qipo /Qrestrict /Ot")
STRING(REGEX REPLACE "/O2" ${CV_ICC_ADDITIONAL_FLAGS_RELEASE} CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
STRING(REGEX REPLACE "/O2" ${CV_ICC_ADDITIONAL_FLAGS_RELEASE} CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"libcmt\"")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:\"libcmt\"")
set(EMGUCV_PLATFORM_TOOLSET "Intel C++ Compiler 17.0" CACHE STRING "Platform toolset for Visual Studio")
ENDIF()
IF(WIN32 AND NOT MINGW)
SET(NETFX_CORE OFF CACHE BOOL "Build Windows Store or Phone App")
# IF(NETFX_CORE)
# add_definitions(-DWINAPI_FAMILY=WINAPI_FAMILY_APP -DWINVER=0x0602 -D_WIN32_WINNT=0x0602)
# add_definitions(-D_UNICODE)
# ENDIF()
ENDIF()
SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
IF(ANDROID)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/${ANDROID_ABI}")
ELSEIF(WIN32)
IF ("${EMGUCV_ARCH}" STREQUAL "win64")
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
IF(CMAKE_SYSTEM_VERSION MATCHES 8.1)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/store8_1_x64")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/UWP_x64")
ENDIF()
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/x64")
ENDIF()
ELSEIF("${EMGUCV_ARCH}" STREQUAL "arm")
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/phone8_1_arm")
ELSE()
IF(CMAKE_SYSTEM_VERSION MATCHES 10.0)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/UWP_arm")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/arm")
ENDIF()
ENDIF()
ELSE()
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/phone8_1_x86")
ELSEIF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
IF(CMAKE_SYSTEM_VERSION MATCHES 10.0)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/UWP_x86")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/store8_1_x86")
ENDIF()
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/x86")
ENDIF()
ENDIF()
#ELSEIF(APPLE)
# SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/lib")
ELSEIF()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "")
ENDIF()
SET(UNMANAGED_LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER}")
IF(ANDROID)
SET(LIBRARY_OUTPUT_PATH ${UNMANAGED_LIBRARY_OUTPUT_PATH})
ENDIF()
FILE(MAKE_DIRECTORY ${UNMANAGED_LIBRARY_OUTPUT_PATH})
SET(UNMANAGED_DLL_EXTRA)
MACRO(CHECK_BINARY_EXIST folder pattern property_name second_check)
#IF("${UNMANAGED_LIBRARY_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/${folder}")
# SET(${property_name} ON)
#ELSE()
FILE(GLOB DLL_LIST "${CMAKE_CURRENT_SOURCE_DIR}/${folder}/${pattern}")
LIST(LENGTH DLL_LIST DLL_LIST_LENGTH)
IF(DLL_LIST_LENGTH GREATER 0)
LIST(APPEND UNMANAGED_DLL_EXTRA ${DLL_LIST})
MESSAGE(STATUS "Including the following files in package: ${DLL_LIST}")
INSTALL(
FILES
${DLL_LIST}
DESTINATION ${folder}
COMPONENT emgucv_binary
)
SET(${property_name} ON)
ELSE()
SET(${property_name} ${second_check})
ENDIF()
#ENDIF()
#MESSAGE(STATUS "Property - ${property_name}: ${${property_name}}")
IF(${${property_name}})
MESSAGE(STATUS "${property_name}: ${${property_name}}")
ENDIF()
ENDMACRO()
#MESSAGE(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
SET(IS_IOS_BUILD OFF)
IF(IOS)
SET(IS_IOS_BUILD ON)
MESSAGE("IS_IOS_BUILD: ${IS_IOS_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("Emgu.CV/PInvoke/iOS" "libemgucv.a" HAVE_IOS ${IS_IOS_BUILD})
#IF(IS_IOS_BUILD)
# SET(HAVE_IOS ON)
#ENDIF()
SET(IS_OSX_BUILD OFF)
IF(APPLE AND (NOT IOS))
SET(IS_OSX_BUILD ON)
MESSAGE("IS_OSX_BUILD: ${IS_OSX_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin" "libcvextern.dylib" HAVE_OSX ${IS_OSX_BUILD})
SET(IS_ANDROID_ARM64_V8A_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "arm64-v8a"))
SET(IS_ANDROID_ARM64_V8A_BUILD ON)
MESSAGE("IS_ANDROID_ARM64_V8A_BUILD: ${IS_ANDROID_ARM64_V8A_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/arm64-v8a" "*.so" HAVE_ANDROID_ARM64_V8A ${IS_ANDROID_ARM64_V8A_BUILD})
SET(IS_ANDROID_ARMEABI_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "armeabi"))
SET(IS_ANDROID_ARMEABI_BUILD ON)
MESSAGE("IS_ANDROID_ARMEABI_BUILD: ${IS_ANDROID_ARMEABI_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/armeabi" "*.so" HAVE_ANDROID_ARMEABI ${IS_ANDROID_ARMEABI_BUILD})
SET(IS_ANDROID_ARMEABI_V7A_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "armeabi-v7a"))
SET(IS_ANDROID_ARMEABI_V7A_BUILD ON)
MESSAGE("IS_ANDROID_ARMEABI_V7A_BUILD: ${IS_ANDROID_ARMEABI_V7A_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/armeabi-v7a" "*.so" HAVE_ANDROID_ARMEABI_V7A ${IS_ANDROID_ARMEABI_V7A_BUILD})
SET(IS_ANDROID_X86_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "x86"))
SET(IS_ANDROID_X86_BUILD ON)
MESSAGE("IS_ANDROID_X86_BUILD: ${IS_ANDROID_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/x86" "*.so" HAVE_ANDROID_X86 ${IS_ANDROID_X86_BUILD})
SET(IS_ANDROID_X86_64_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "x86_64"))
SET(IS_ANDROID_X86_64_BUILD ON)
MESSAGE("IS_ANDROID_X86_64_BUILD: ${IS_ANDROID_X86_64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/x86_64" "*.so" HAVE_ANDROID_X86_64 ${IS_ANDROID_X86_64_BUILD})
SET(HAVE_ANDROID OFF)
IF(HAVE_ANDROID_ARM64_V8A OR HAVE_ANDROID_ARMEABI OR HAVE_ANDROID_ARMEABI_V7A OR HAVE_ANDROID_X86 OR HAVE_ANDROID_X86_64)
SET(HAVE_ANDROID ON)
ENDIF()
IF(HAVE_ANDROID)
MESSAGE(STATUS "HAVE_ANDROID: ON")
ENDIF()
SET(IS_WINSTORE_81_X86_BUILD OFF)
IF(("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 8.1) AND ("${EMGUCV_ARCH}" STREQUAL "win32"))
SET(IS_WINSTORE_81_X86_BUILD ON)
MESSAGE("IS_WINSTORE_81_X86_BUILD: ${IS_WINSTORE_81_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/store8_1_x86" "*.dll" HAVE_WINSTORE_81_X86 ${IS_WINSTORE_81_X86_BUILD})
SET(IS_WINSTORE_81_X64_BUILD OFF)
IF(("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 8.1) AND ("${EMGUCV_ARCH}" STREQUAL "win64"))
SET(IS_WINSTORE_81_X64_BUILD ON)
MESSAGE("IS_WINSTORE_81_X64_BUILD: ${IS_WINSTORE_81_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/store8_1_x64" "*.dll" HAVE_WINSTORE_81_X64 ${IS_WINSTORE_81_X64_BUILD})
SET(IS_WINPHONE_81_X86_BUILD OFF)
IF( ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") AND ("${EMGUCV_ARCH}" STREQUAL "win32") )
SET(IS_WINPHONE_81_X86_BUILD ON)
MESSAGE("IS_WINPHONE_81_X86_BUILD: ${IS_WINPHONE_81_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/phone8_1_x86" "*.dll" HAVE_WINPHONE_81_X86 ${IS_WINPHONE_81_X86_BUILD})
SET(IS_WINPHONE_81_ARM_BUILD OFF)
IF( ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") AND ("${EMGUCV_ARCH}" STREQUAL "arm") )
SET(IS_WINPHONE_81_ARM_BUILD ON)
MESSAGE("IS_WINPHONE_81_ARM_BUILD: ${IS_WINPHONE_81_ARM_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/phone8_1_arm" "*.dll" HAVE_WINPHONE_81_ARM ${IS_WINPHONE_81_ARM_BUILD})
SET(IS_WINSTORE_10_X86_BUILD OFF)
IF( ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 10.0) AND ("${EMGUCV_ARCH}" STREQUAL "win32") )
SET(IS_WINSTORE_10_X86_BUILD ON)
MESSAGE("IS_WINSTORE_10_X86_BUILD: ${IS_WINSTORE_10_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/UWP_x86" "*.dll" HAVE_WINSTORE_10_X86 ${IS_WINSTORE_10_X86_BUILD})
SET(IS_WINSTORE_10_X64_BUILD OFF)
IF( ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 10.0) AND ("${EMGUCV_ARCH}" STREQUAL "win64") )
SET(IS_WINSTORE_10_X64_BUILD ON)
MESSAGE("IS_WINSTORE_10_X64_BUILD: ${IS_WINSTORE_10_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/UWP_x64" "*.dll" HAVE_WINSTORE_10_X64 ${IS_WINSTORE_10_X64_BUILD})
SET(IS_WINSTORE_10_ARM_BUILD OFF)
IF(("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 10.0) AND ("${EMGUCV_ARCH}" STREQUAL "arm"))
SET(IS_WINSTORE_10_ARM_BUILD ON)
MESSAGE("IS_WINSTORE_10_ARM_BUILD: ${IS_WINSTORE_10_ARM_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/UWP_arm" "*.dll" HAVE_WINSTORE_10_ARM ${IS_WINSTORE_10_ARM_BUILD})
SET(IS_WINDESKTOP_X86_BUILD OFF)
IF (WIN32 AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") AND ("${EMGUCV_ARCH}" STREQUAL "win32") AND (NOT ANDROID))
SET (IS_WINDESKTOP_X86_BUILD ON)
MESSAGE("IS_WINDESKTOP_X86_BUILD: ${IS_WINDESKTOP_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/x86" "*.dll" HAVE_WINDESKTOP_X86 ${IS_WINDESKTOP_X86_BUILD})
SET (IS_WINDESKTOP_X64_BUILD OFF)
IF (WIN32 AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") AND ("${EMGUCV_ARCH}" STREQUAL "win64") AND (NOT ANDROID))
SET (IS_WINDESKTOP_X64_BUILD ON)
MESSAGE("IS_WINDESKTOP_X64_BUILD: ${IS_WINDESKTOP_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("bin/x64" "*.dll" HAVE_WINDESKTOP_X64 ${IS_WINDESKTOP_X64_BUILD})
IF(HAVE_WINDESKTOP_X86 AND HAVE_WINDESKTOP_X64)
SET(WINDESKTOP_LABEL "-windesktop")
ELSEIF(HAVE_WINDESKTOP_X86)
SET(WINDESKTOP_LABEL "-windesktop_x86")
ELSEIF(HAVE_WINDESKTOP_X64)
SET(WINDESKTOP_LABEL "-windesktop_x64")
ELSE()
SET(WINDESKTOP_LABEL "")
ENDIF()
IF(HAVE_WINSTORE_81_X86 AND HAVE_WINSTORE_81_X64)
SET(WINSTORE_81_LABEL "-winstore81")
ELSEIF(HAVE_WINSTORE_81_X86)
SET(WINSTORE_81_LABEL "-winstore81_x86")
ELSEIF(HAVE_WINSTORE_81_X64)
SET(WINSTORE_81_LABEL "-winstore81_x64")
ELSE()
SET(WINSTORE_81_LABEL "")
ENDIF()
IF(HAVE_WINPHONE_81_X86 AND HAVE_WINPHONE_81_ARM)
SET(WINPHONE_81_LABEL "-winphone81")
ELSEIF(HAVE_WINPHONE_81_X86)
SET(WINPHONE_81_LABEL "-winphone81-x86")
ELSEIF(HAVE_WINPHONE_81_ARM)
SET(WINPHONE_81_LABEL "-winphone81-arm")
ELSE()
SET(WINPHONE_81_LABEL "")
ENDIF()
SET(WIN_81_LABEL "${WINSTORE_81_LABEL}${WINPHONE_81_LABEL}")
IF("${WIN_81_LABEL}" STREQUAL "-winstore81-winphone81" )
SET(WIN_81_LABEL "-windows81")
ENDIF()
SET(WINSTORE_10_LABEL "")
IF(HAVE_WINSTORE_10_X64)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_x64")
ENDIF()
IF(HAVE_WINSTORE_10_X86)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_x86")
ENDIF()
IF(HAVE_WINSTORE_10_ARM)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_arm")
ENDIF()
IF("${WINSTORE_10_LABEL}" STREQUAL "_x64_x86_arm")
SET(WINSTORE_10_LABEL "-UWP")
ELSEIF(NOT ("${WINSTORE_10_LABEL}" STREQUAL ""))
SET(WINSTORE_10_LABEL "-UWP${WINSTORE_10_LABEL}")
ENDIF()
SET(WINDOWS_LABEL "${WIN_81_LABEL}${WINSTORE_10_LABEL}${WINDESKTOP_LABEL}")
IF ("${WINDOWS_LABEL}" STREQUAL "-windows81-UWP-windesktop")
SET(WINDOWS_LABEL "-windows")
ENDIF()
SET(IOS_LABEL "")
IF(HAVE_IOS)
SET(IOS_LABEL "-ios")
ENDIF()
SET(OSX_LABEL "")
IF(HAVE_OSX)
SET(OSX_LABEL "-osx")
ENDIF()
SET(ANDROID_LABEL "")
IF(HAVE_ANDROID_ARM64_V8A)
SET(ANDROID_LABEL "${ANDROID_LABEL}-arm64-v8a")
ENDIF()
IF(HAVE_ANDROID_ARMEABI)
SET(ANDROID_LABEL "${ANDROID_LABEL}-armeabi")
ENDIF()
IF(HAVE_ANDROID_ARMEABI_V7A)
SET(ANDROID_LABEL "${ANDROID_LABEL}-armeabi-v7a")
ENDIF()
IF(HAVE_ANDROID_X86)
SET(ANDROID_LABEL "${ANDROID_LABEL}-x86")
ENDIF()
IF(HAVE_ANDROID_X86_64)
SET(ANDROID_LABEL "${ANDROID_LABEL}-x86_64")
ENDIF()
CHECK_BINARY_EXIST("bin" "Emgu.CV.World*" HAVE_PREBUILD_EMGU_CV_WORLD OFF)
IF("${ANDROID_LABEL}" STREQUAL "-arm64-v8a-armeabi-armeabi-v7a-x86-x86_64")
SET(ANDROID_LABEL "-android")
ELSEIF(NOT ("${ANDROID_LABEL}" STREQUAL ""))
SET(ANDROID_LABEL "-android${ANDROID_LABEL}")
ENDIF()
# ----------------------------------------------------------------------------
# Setup Package information
# ----------------------------------------------------------------------------
SET(PACKAGE "${PROJECT_NAME}")
SET(CPACK_PACKAGE_CONTACT "Emgu CV SUPPORT <[email protected]>")
SET(PACKAGE_BUGREPORT "${CPACK_PACKAGE_CONTACT}")
SET(PACKAGE_NAME "${PROJECT_NAME}")
#SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Emgu CV is a cross platform .Net wrapper to the OpenCV image processing library.")
SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}${IOS_LABEL}${ANDROID_LABEL}${WINDOWS_LABEL}${OSX_LABEL}")
IF("${CPACK_PACKAGE_NAME}" STREQUAL "${PACKAGE_NAME}-ios-android-windows-osx")
SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}-pro")
ENDIF()
#STRING(LENGTH "${CPACK_PACKAGE_NAME}" PACKAGE_NAME_LENGTH)
#IF (${PACKAGE_NAME_LENGTH} GREATER 30)
# SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}-mixed")
# STRING(LENGTH "${CPACK_PACKAGE_NAME}" PACKAGE_NAME_LENGTH)
#ENDIF()
#IF (APPLE)
# SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-osx")
#ENDIF()
IF(WITH_CUDA)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-cuda")
ENDIF()
IF(WITH_OPENNI)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-openni")
ENDIF()
IF(WITH_TBB)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-tbb")
ENDIF()
IF(WITH_IPP)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-ipp")
ENDIF()
IF(CV_ICC)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-icc")
ENDIF()
SET(CPACK_PACKAGE_VENDOR "Emgu Corporation")
SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENCV_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${OPENCV_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${OPENCV_VERSION_PATCH})
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${EMGUCV_GITVERSION}")
IF(ANDROID)
SET(CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}")
ELSE()
SET(CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
ENDIF()
MESSAGE(STATUS "Package name will be ${CPACK_PACKAGE_NAME}")
FILE(WRITE "emgucv.version.txt" "${CPACK_PACKAGE_VERSION}")
#IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Emgu.CV.Commercial.License.txt")
# SET(LICENSE_FILE_NAME "Emgu.CV.Commercial.License.txt")
#ELSE()
SET(LICENSE_FILE_NAME "Emgu.CV.License.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/${LICENSE_FILE_NAME}")
IF (WIN32 OR APPLE)
SET(CPACK_PACKAGE_CLI_FOLDER bin)
ELSE ()
SET(CPACK_PACKAGE_CLI_FOLDER lib/cli/${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
ENDIF()
# ----------------------------------------------------------------------------
# Build opencv and Emgu.CV.Extern
# ----------------------------------------------------------------------------
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${UNMANAGED_LIBRARY_OUTPUT_PATH}" )
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
#SET(CMAKE_ARCHIEVE_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
#SET(CMAKE_ARCHIEVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIEVE_OUTPUT_DIRECTORY}")
#SET(CMAKE_ARCHIEVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIEVE_OUTPUT_DIRECTORY}")
#SET(CMAKE_INSTALL_PREFIX_COPY ${CMAKE_INSTALL_PREFIX})
#SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER})
#SET(CPACK_PACKAGING_INSTALL_PREFIX ${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER})
#SET(DESTDIR ${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER})
#SET(CPACK_OUTPUT_FILE_PREFIX "x64")
SET(ENTRYPOINT_CS_STRING "")
SET(ENTRYPOINT_MODULES_STRING "")
#Add opencl
#IF(WIN32 AND (NOT NETFX_CORE) )
# IF(WITH_OPENCL)
# MESSAGE(STATUS "Open CL build included")
# SET(OPENCL_SOURCE_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/lib/opencl-icd-1.2.11.0/icd")
# ADD_SUBDIRECTORY(${OPENCL_SOURCE_FOLDER})
# #GET_TARGET_PROPERTY(OPENCL_OUTPUT_NAME OpenCL OUTPUT_NAME)
# set(OPENCL_FOUND YES)
# set(OPENCL_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/bin/Release/opencl.lib" CACHE STRING "OpenCL library")
# set(OPENCL_INCLUDE_DIR "${OPENCL_SOURCE_FOLDER}/inc" CACHE STRING "OpenCL include directory")
# mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
# SET(ENTRYPOINT_MODULES_STRING "${ENTRYPOINT_MODULES_STRING}
# OpenclLibrary,")
# SET(ENTRYPOINT_CS_STRING "${ENTRYPOINT_CS_STRING}
# /// <summary>
# /// The file name of the OpenCL library
# /// </summary>
# public const string OpenclLibrary = \"OpenCL\";")
# ELSE()
# SET(OPENCL_OUTPUT_NAME "")
# MESSAGE(STATUS "Open CL build not included")
# ENDIF()
#ENDIF()
SET(CMAKE_OLD_SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(CMAKE_SOURCE_DIR ${OPENCV_SUBFOLDER})
IF(MSVC)
set(ENABLE_SOLUTION_FOLDERS ON CACHE BOOL "Solution folder in Visual Studio")
ENDIF()
ADD_SUBDIRECTORY(${OPENCV_SUBFOLDER})
SET(CMAKE_SOURCE_DIR ${CMAKE_OLD_SOURCE_DIR})
SET (OPENCV_MODULE_NAME_CANDIDATES
core hal imgproc video flann ml imgcodecs videoio highgui objdetect features2d calib3d
cudalegacy cudaarithm cudawarping cudafilters cudaimgproc cudaoptflow
cudastereo cudabgsegm cudafeatures2d cudacodec cudaobjdetect
photo superres
videostab shape
cudev
text face ximgproc xobjdetect xfeatures2d xphoto bgsegm optflow
stitching latentsvm line_descriptor tracking plot
dnn aruco fuzzy viz bioinspired
)
FOREACH(OPENCV_MODULE_NAME ${OPENCV_MODULE_NAME_CANDIDATES})
IF(TARGET opencv_${OPENCV_MODULE_NAME})
LIST(APPEND OPENCV_MODULE_NAMES ${OPENCV_MODULE_NAME})
ENDIF()
ENDFOREACH()
#IF(NETFX_CORE)
# SET(EMGU_CV_WITH_TESSERACT OFF CACHE BOOL "BUILD TESSERACT OCR")
#ELSE()
SET(EMGU_CV_WITH_TESSERACT ON CACHE BOOL "BUILD TESSERACT OCR")
#ENDIF()
IF(MSVC AND WIN32 AND EMGUCV_WITH_TESSERACT)
SET(TESSERACT_OPENCL OFF CACHE BOOL "ENABLE OpenCL for TESSERACT")
ELSE()
SET(TESSERACT_OPENCL OFF CACHE BOOL "ENABLE OpenCL for TESSERACT")
ENDIF()
IF(TESSERACT_OPENCL)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/lib/opencl-icd-1.2.11.0/icd)
ENDIF()
IF (TARGET_ARCH_64)
SET(EMGU_ENABLE_SSE OFF CACHE BOOL "ENABLE SSE for Emgu CV")
ELSE()
SET(EMGU_ENABLE_SSE ON CACHE BOOL "ENABLE SSE for Emgu CV")
ENDIF()
ADD_SUBDIRECTORY(Emgu.CV.Extern)
IF(NOT (ANDROID OR IOS OR NETFX_CORE))
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests/cvextern_test)
ENDIF()
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}" )
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
#SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_COPY})
#SET(CPACK_PACKAGING_INSTALL_PREFIX "")
#SET(DESTDIR "")
#SET(CPACK_OUTPUT_FILE_PREFIX "")
SET(EMGU_CV_BUILD ON CACHE BOOL "BUILD Emgu CV")
SET(EMGU_CV_EXAMPLE_BUILD ON CACHE BOOL "Build Emgu CV Example")
# ----------------------------------------------------------------------------
# Generate required common assembly file for Emgu CV project
# ----------------------------------------------------------------------------
INCLUDE(Today)
TODAY() #set the variable CURRENT_YEAR
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAssemblyInfo.cs.in ${CMAKE_CURRENT_SOURCE_DIR}/CommonAssemblyInfo.cs)
# ----------------------------------------------------------------------------
# Generate readme file for Emgu CV project
# ----------------------------------------------------------------------------
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/README.txt.in ${CMAKE_CURRENT_SOURCE_DIR}/Emgu.CV/README.txt)
INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Emgu.CV/README.txt" DESTINATION "." COMPONENT libs)
# ----------------------------------------------------------------------------
# Generate CvInvokeEntryPoints.cs file for Emgu CV project
# ----------------------------------------------------------------------------
SET(OPENCV_LIBRARY_OUTPUT_NAME_PREFIX "")
IF (APPLE)
SET(OPENCV_LIBRARY_OUTPUT_NAME_POSTFIX ".${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
ELSE()
SET(OPENCV_LIBRARY_OUTPUT_NAME_POSTFIX "")
ENDIF()
SET(OPENCV_LIBRARY_OUTPUT_NAMES )
FOREACH(OPENCV_MODULE_NAME ${OPENCV_MODULE_NAME_CANDIDATES})
STRING (TOUPPER "${OPENCV_MODULE_NAME}" OPENCV_MODULE_NAME_UPPER)
STRING (SUBSTRING "${OPENCV_MODULE_NAME}" 0 1 OPENCV_MODULE_NAME_FIRST_LETTER)
STRING (TOUPPER "${OPENCV_MODULE_NAME_FIRST_LETTER}" OPENCV_MODULE_NAME_FIRST_LETTER_UPPER)
STRING (SUBSTRING "${OPENCV_MODULE_NAME}" 1 -1 OPENCV_MODULE_NAME_REMAINDER)
SET(OPENCV_MODULE_NAME_FIRST_LETTER_UPPER "${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}${OPENCV_MODULE_NAME_REMAINDER}")
SET(OPENCV_OUTPUT_PROJ_TYPE "")
IF(NOT (TARGET opencv_${OPENCV_MODULE_NAME}))
SET(OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME "")
ELSE()
#MESSAGE( STATUS "opencv_${OPENCV_MODULE_NAME} type: ${OPENCV_OUTPUT_PROJ_TYPE}")
GET_TARGET_PROPERTY(OPENCV_OUTPUT_PROJ_TYPE opencv_${OPENCV_MODULE_NAME} TYPE)
IF(NOT ("${OPENCV_OUTPUT_PROJ_TYPE}" STREQUAL "SHARED_LIBRARY"))
SET(OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME "")
ELSE()
GET_TARGET_PROPERTY(OPENCV_OUTPUT_NAME_TMP opencv_${OPENCV_MODULE_NAME} OUTPUT_NAME)
SET(OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME ${OPENCV_LIBRARY_OUTPUT_NAME_PREFIX}${OPENCV_OUTPUT_NAME_TMP}${OPENCV_LIBRARY_OUTPUT_NAME_POSTFIX})
LIST(APPEND OPENCV_LIBRARY_OUTPUT_NAMES ${OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME})
SET(ENTRYPOINT_MODULES_STRING "${ENTRYPOINT_MODULES_STRING}
Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library,")
ENDIF()
ENDIF()
IF(IOS)
SET(ENTRYPOINT_CS_STRING "${ENTRYPOINT_CS_STRING}
/// <summary>
/// The file name of the ${OPENCV_MODULE_NAME} library
/// </summary>
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"__Internal\";")
ELSEIF(((WIN32 AND NOT ANDROID) OR APPLE))
IF(("${OPENCV_OUTPUT_PROJ_TYPE}" STREQUAL "SHARED_LIBRARY"))
SET(ANDROID_ENTRYPOINT "opencv_${OPENCV_MODULE_NAME}")
SET(OSX_ENTRYPOINT "opencv_${OPENCV_MODULE_NAME}.${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
SET(OSX_UNITY_STANDALONE_ENTRYPOINT "@executable_path/../Plugins/emgucv.bundle/Contents/MacOS/lib${OSX_ENTRYPOINT}.dylib")
SET(OSX_UNITY_EDITOR_ENTRYPOINT "Assets/Plugins/emgucv.bundle/Contents/MacOS/lib${OSX_ENTRYPOINT}.dylib")
SET(WINDOWS_ENTRYPOINT "opencv_${OPENCV_MODULE_NAME}${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
SET(IOS_ENTRYPOINT "__Internal")
IF("${OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME}" STREQUAL "")
SET(ANDROID_ENTRYPOINT "")
SET(OSX_ENTRYPOINT "")
SET(OSX_UNITY_ENTRYPOINT "emgucv")
SET(WINDOWS_ENTRYPOINT "")
SET(IOS_ENTRYPOINT "")
ENDIF()
SET(ENTRYPOINT_CS_STRING "${ENTRYPOINT_CS_STRING}
/// <summary>
/// The file name of the ${OPENCV_MODULE_NAME} library
/// </summary>
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${WINDOWS_ENTRYPOINT}\";
#elif UNITY_EDITOR_OSX
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${OSX_UNITY_EDITOR_ENTRYPOINT}\";
#elif UNITY_STANDALONE_OSX
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${OSX_UNITY_STANDALONE_ENTRYPOINT}\";
#elif __IOS__ || UNITY_IPHONE
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${IOS_ENTRYPOINT}\";
#elif __ANDROID__ || UNITY_ANDROID
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${ANDROID_ENTRYPOINT}\";
#else
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME}\";
#endif
")
ENDIF()
ELSE()
IF("${OPENCV_OUTPUT_PROJ_TYPE}" STREQUAL "SHARED_LIBRARY")
SET(ENTRYPOINT_CS_STRING "${ENTRYPOINT_CS_STRING}
/// <summary>
/// The file name of the ${OPENCV_MODULE_NAME} library
/// </summary>
public const string Opencv${OPENCV_MODULE_NAME_FIRST_LETTER_UPPER}Library = \"${OPENCV_${OPENCV_MODULE_NAME_UPPER}_OUTPUT_NAME}\";")
ENDIF()
ENDIF()
ENDFOREACH()
SET(ENTRYPOINT_MODULES_STRING "public static List<String> OpenCVModuleList = new List<String>
{
#if !(__ANDROID__ || __IOS__ || UNITY_IPHONE || UNITY_ANDROID || NETFX_CORE)
OpencvFFMpegLibrary,
#endif
${ENTRYPOINT_MODULES_STRING}
ExternLibrary
};
")
GET_TARGET_PROPERTY(CVEXTERN_OUTPUT_NAME cvextern OUTPUT_NAME)
LIST(APPEND OPENCV_LIBRARY_OUTPUT_NAMES ${CVEXTERN_OUTPUT_NAME})
if(WIN32 AND WITH_FFMPEG)
if(TARGET_ARCH_64)
set(FFMPEG_SUFFIX _64)
endif()
#STRING(LENGTH "${OPENCV_CORE_OUTPUT_NAME}" temp)
#MATH(EXPR temp "${temp}-3")
#STRING(SUBSTRING ${OPENCV_CORE_OUTPUT_NAME} ${temp} -1 OPENCV_DLLVERSION)
set(OPENCV_FFMPEG_OUTPUT_NAME "opencv_ffmpeg${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}${FFMPEG_SUFFIX}")
#set(OPENCV_FFMPEG_OUTPUT_NAME "opencv_ffmpeg${FFMPEG_SUFFIX}")
MESSAGE(STATUS "OPENCV_FFMPEG_OUTPUT_NAME: ${OPENCV_FFMPEG_OUTPUT_NAME}")
LIST(APPEND OPENCV_LIBRARY_OUTPUT_NAMES ${OPENCV_FFMPEG_OUTPUT_NAME})
endif()
IF(TARGET_ARCH_64)
SET(UNMANAGED_CODE_BITNESS "64")
ELSE()
SET(UNMANAGED_CODE_BITNESS "32")
ENDIF()
#IF(ANDROID)
# SET(CVINVOKE_ENTRYPOINTS_FILE_SUBFOLDER "Android/")
#ELSE()
SET(CVINVOKE_ENTRYPOINTS_FILE_SUBFOLDER "")
#ENDIF()
IF(IOS)
SET(CVEXTERN_OUTPUT_NAME "__Internal")
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CvInvokeEntryPoints.cs.in ${CMAKE_CURRENT_SOURCE_DIR}/Emgu.CV/PInvoke/${CVINVOKE_ENTRYPOINTS_FILE_SUBFOLDER}CvInvokeEntryPoints.cs)
# ----------------------------------------------------------------------------
# Build the managed dlls of Emgu CV
# ----------------------------------------------------------------------------
IF(NOT IOS)
ADD_SUBDIRECTORY(Emgu.Util)
ADD_SUBDIRECTORY(Emgu.CV)
ADD_SUBDIRECTORY(Emgu.CV.UI)
ADD_SUBDIRECTORY(Emgu.CV.Example)
ADD_SUBDIRECTORY(Emgu.UI)
ADD_SUBDIRECTORY(Emgu.CV.Test)
ADD_SUBDIRECTORY(Emgu.CV.Cuda)
IF (EMGU_CV_WITH_TESSERACT)
ADD_SUBDIRECTORY(Emgu.CV.OCR)
ENDIF()
ADD_SUBDIRECTORY(Emgu.CV.Contrib)
IF(NOT (NETFX_CORE OR ANDROID))
ADD_SUBDIRECTORY(Emgu.CV.UI.GL)
ENDIF()
ADD_SUBDIRECTORY(Emgu.CV.World)
ENDIF()
IF(HAVE_ANDROID)
INSTALL(
FILES
"Solution/Android/Emgu.CV.Android.Example.sln"
"Solution/Android/Emgu.CV.Android.sln"
DESTINATION "Solution/Android"
COMPONENT emgucv_example_source
)
INSTALL(
FILES
"opencv/LICENSE"
DESTINATION "opencv"
COMPONENT emgucv_example_source
)
ENDIF()
IF(HAVE_IOS)
INSTALL(
FILES
"Solution/iOS/Emgu.CV.iOS.Example.sln"
"Solution/iOS/Emgu.CV.iOS.sln"
DESTINATION "Solution/iOS"
COMPONENT emgucv_example_source
)
ENDIF()
IF(HAVE_OSX)
INSTALL(
FILES
"Solution/Mac/Emgu.CV.Mac.Example.sln"
DESTINATION "Solution/Mac"
COMPONENT emgucv_example_source
)
IF (NOT IS_OSX_BUILD)
INSTALL(
FILES
"bin/libemgucv.dylib"
DESTINATION "bin"
COMPONENT emgucv_binary
)
ENDIF()
ENDIF()
INSTALL(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/Emgu.CV.snk"
"${CMAKE_CURRENT_SOURCE_DIR}/CommonAssemblyInfo.cs"
"${CMAKE_CURRENT_SOURCE_DIR}/${LICENSE_FILE_NAME}"
"${CMAKE_CURRENT_SOURCE_DIR}/nuget.config"
"${CMAKE_CURRENT_SOURCE_DIR}/components.config"
DESTINATION .
COMPONENT emgucv_source
)
IF (ANDROID)
SET(CPACK_GENERATOR ZIP)
ELSEIF (WIN32)
IF(NETFX_CORE)
SET(CPACK_GENERATOR ZIP)
ELSE()
#SET(CPACK_GENERATOR ZIP)
SET(CPACK_GENERATOR NSIS;ZIP)
ENDIF()
SET(CPACK_ARCHIVE_COMPONENT_INSTALL ON) #enable components install for zip
IF(CPACK_GENERATOR MATCHES "ZIP")
SET(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
ENDIF()
SET(CPACK_NSIS_MODIFY_PATH OFF)
SET(CPACK_NSIS_INSTALL_ROOT "C:\\\\Emgu")
IF(NOT NETFX_CORE)
ADD_SUBDIRECTORY(Emgu.CV.DebuggerVisualizers)
ENDIF()
IF(NOT NETFX_CORE)
if(WITH_FFMPEG)
INSTALL(
FILES
"${UNMANAGED_LIBRARY_OUTPUT_PATH}/${OPENCV_FFMPEG_OUTPUT_NAME}.dll"
DESTINATION "bin/${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER}/"
COMPONENT libs
)
endif()
# ----------------------------------------------------------------------------
# Install Debugger Visualizer
# ----------------------------------------------------------------------------
SET (HAS_WINDESKTOP_X86_NATIVE_BINARY OFF)
IF (IS_WINDESKTOP_X86_BUILD)
FOREACH(tmp_component ${OPENCV_LIBRARY_OUTPUT_NAMES})
LIST(APPEND UNMANAGED_DLL_32BIT "${UNMANAGED_LIBRARY_OUTPUT_PATH}/${tmp_component}.dll")
ENDFOREACH()
FOREACH(tmp_component ${CVEXTERN_DEPENDENCY_DLL_NAMES})
LIST(APPEND UNMANAGED_DLL_32BIT "${UNMANAGED_LIBRARY_OUTPUT_PATH}/${tmp_component}.dll")
ENDFOREACH()
SET (HAS_WINDESKTOP_X86_NATIVE_BINARY ON)
ELSE()
FILE(GLOB UNMANAGED_DLL_32BIT "${CMAKE_CURRENT_SOURCE_DIR}/bin/x86/*.dll")
LIST(LENGTH UNMANAGED_DLL_32BIT UNMANAGED_DLL_32BIT_LENGTH)
IF(UNMANAGED_DLL_32BIT_LENGTH GREATER 0)
SET (HAS_WINDESKTOP_X86_NATIVE_BINARY ON)
ENDIF()
ENDIF()
MESSAGE(STATUS "HAS_WINDESKTOP_X86_NATIVE_BINARY: ${HAS_WINDESKTOP_X86_NATIVE_BINARY}")
#FOREACH (file ${UNMANAGED_DLL_32BIT})
# MESSAGE(STATUS "WILL DEPLOY ${file} with DEBUGGER VISUALIZER")
#ENDFOREACH()
IF (HAS_WINDESKTOP_X86_NATIVE_BINARY)
SET(DEBUGER_VISUALIZER_FILES
"Emgu.CV.World"
"Emgu.CV.UI"
"ZedGraph")
SET(DEBUGGER_VISUALIZER_UNMANAGED_FILES
# "Emgu.CV.DebuggerVisualizers"
${OPENCV_LIBRARY_OUTPUT_NAMES}
${CVEXTERN_DEPENDENCY_DLL_NAMES})
IF (${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER} MATCHES "^$")
SET(DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER "")
ELSE()
#MESSAGE(STATUS "UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER: ${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER}")
#remove leading slashes
STRING(REGEX REPLACE "^/" "" DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER ${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER})
#add tailing slashes
SET(DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER "${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}\\")
#replace single slashes with quard slashes
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER ${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER})
#MESSAGE(STATUS "DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER: ${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}")
ENDIF()
#FOREACH(UNMANAGE_DLL_NAME ${CVEXTERN_DEPENDENCY_DLL_NAMES})
# LIST(APPEND DEBUGGER_VISUALIZER_FILES "${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}${UNMANAGE_DLL_NAME}")
#ENDFOREACH()
#MESSAGE(STATUS "DEBUGGER VISUALIZER FILES: ${DEBUGER_VISUALIZER_FILES}")
MACRO(INSTALL_DEBUGER_VISUALIZER vs_version vs_description hklm_key)
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND "installDebuggerVisualizer4${vs_version}:
ClearErrors
Var /GLOBAL ${vs_version}_INSTALL_FOLDER ")
IF("${vs_version}" STREQUAL "VS2017")
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
ReadRegStr \\\$R1 HKLM '${hklm_key}' '15.0'
StrCpy $${vs_version}_INSTALL_FOLDER '\\\$R1Common7\\\\Packages\\\\Debugger\\\\Visualizers\\\\'")
ELSE()
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
ReadRegStr \\\$R1 HKLM '${hklm_key}' 'InstallDir'
StrCpy $${vs_version}_INSTALL_FOLDER '\\\$R1..\\\\Packages\\\\Debugger\\\\Visualizers\\\\'")
ENDIF()
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
IfErrors installDebuggerVisualizer4${vs_version}Done
MessageBox MB_YESNO 'Install Debugger Visualizer for ${vs_description}?' IDNO installDebuggerVisualizer4${vs_version}Done")
FOREACH (file ${DEBUGER_VISUALIZER_FILES})
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CopyFiles /SILENT '\\\$INSTDIR\\\\bin\\\\${file}.dll' '$${vs_version}_INSTALL_FOLDER'")
ENDFOREACH()
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CreateDirectory '$${vs_version}_INSTALL_FOLDER${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}'")
FOREACH (file ${DEBUGGER_VISUALIZER_UNMANAGED_FILES})
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CopyFiles /SILENT '\\\$INSTDIR\\\\bin\\\\${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}${file}.dll' '$${vs_version}_INSTALL_FOLDER${DEBUGGER_VISUALIZER_UNMANAGED_FILES_SUBFOLDER}'")
ENDFOREACH()
#IF(DEFINED UNIVERSAL_BUILD)
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CreateDirectory '$${vs_version}_INSTALL_FOLDERx86\\\\'")
FOREACH (file ${UNMANAGED_DLL_32BIT})
GET_FILENAME_COMPONENT(UNMANAGED_FILE_NAME_TO_DEPLOY ${file} NAME)
MESSAGE(STATUS "Adding ${UNMANAGED_FILE_NAME_TO_DEPLOY} to debuger visualizer for ${vs_description}")
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CopyFiles /SILENT '\\\$INSTDIR\\\\bin\\\\x86\\\\${UNMANAGED_FILE_NAME_TO_DEPLOY}' '$${vs_version}_INSTALL_FOLDERx86\\\\'")
ENDFOREACH()
#ENDIF()
SET(INSTALL_DEBUGER_VISUALIZER_COMMAND
"${INSTALL_DEBUGER_VISUALIZER_COMMAND}
CopyFiles /SILENT '\\\$INSTDIR\\\\bin\\\\Emgu.CV.DebuggerVisualizers.${vs_version}.dll' '$${vs_version}_INSTALL_FOLDER'
installDebuggerVisualizer4${vs_version}Done:")
ENDMACRO()
MACRO(UNINSTALL_DEBUGER_VISUALIZER vs_version hklm_key)
SET(UNINSTALL_DEBUGER_VISUALIZER_COMMAND "uninstallDebuggerVisualizer4${vs_version}:
ClearErrors")
IF("${vs_version}" STREQUAL "VS2017")
SET(UNINSTALL_DEBUGER_VISUALIZER_COMMAND
"${UNINSTALL_DEBUGER_VISUALIZER_COMMAND}
ReadRegStr \\\$R1 HKLM '${hklm_key}' '15.0'
StrCpy $${vs_version}_INSTALL_FOLDER '\\\$R1Common7\\\\Packages\\\\Debugger\\\\Visualizers\\\\'")
ELSE()
SET(UNINSTALL_DEBUGER_VISUALIZER_COMMAND
"${UNINSTALL_DEBUGER_VISUALIZER_COMMAND}
ReadRegStr \\\$R1 HKLM '${hklm_key}' 'InstallDir'
StrCpy $${vs_version}_INSTALL_FOLDER '\\\$R1..\\\\Packages\\\\Debugger\\\\Visualizers\\\\'")
ENDIF()
SET(UNINSTALL_DEBUGER_VISUALIZER_COMMAND
"${UNINSTALL_DEBUGER_VISUALIZER_COMMAND}
IfErrors uninstallDebuggerVisualizer4${vs_version}Done")
FOREACH (file ${DEBUGER_VISUALIZER_FILES})
SET(UNINSTALL_DEBUGER_VISUALIZER_COMMAND
"${UNINSTALL_DEBUGER_VISUALIZER_COMMAND}