forked from emgucv/emgucv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
3328 lines (2921 loc) · 163 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-2023 by EMGU Corporation. All rights reserved.
#
# Root CMake file for Emgu CV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_EMGUCV_ROOT>
#
# --------------------------------------------------------
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
INCLUDE (CheckPlatform)
#IF( (WIN32 AND (NOT NETFX_CORE)) OR IS_UBUNTU OR (APPLE AND ("${IOS_ARCH}" STREQUAL "")) )
#IF( (WIN32 AND (NOT NETFX_CORE) AND (NOT IS_ARM64)) OR IS_UBUNTU )
# SET(EMGU_CV_WITH_DEPTHAI ON CACHE BOOL "Build support for OAK-1 and OAK-D")
#ELSE()
SET(EMGU_CV_WITH_DEPTHAI OFF CACHE BOOL "Build support for OAK-1 and OAK-D")
#ENDIF()
#IF(EMGU_CV_WITH_DEPTHAI)
# # Set defaults
# set(HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations")
#
# include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/HunterGate.cmake")
#
# HunterGate(
# URL "https://github.com/cpp-pm/hunter/archive/v0.24.0.tar.gz"
# SHA1 "a3d7f4372b1dcd52faa6ff4a3bd5358e1d0e5efd"
# FILEPATH ${CMAKE_CURRENT_LIST_DIR}/Emgu.CV.Extern/depthai-core/cmake/Hunter/config.cmake # Add depthai-core config (hunter limitation)
# )
#
# # Move binary dir if windows, to shorten the path
# if(WIN32)
# set(HUNTER_BINARY_DIR "${HUNTER_GATE_ROOT}/_bin" CACHE STRING "Hunter binary directory")
# endif()
# #MESSAGE(STATUS: "CMAKE_MODULE_PATH --- ${CMAKE_MODULE_PATH}")
#ENDIF()
IF(EMGU_CV_WITH_DEPTHAI)
# Always build depthai-core as a static library
SET(BUILD_SHARED_LIBS_CACHE ${BUILD_SHARED_LIBS})
SET(BUILD_SHARED_LIBS OFF)
add_subdirectory(Emgu.CV.Extern/depthai-core EXCLUDE_FROM_ALL)
SET(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_CACHE})
ENDIF()
PROJECT(emgucv)
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
if(POLICY CMP0022)
#cmake_policy(SET CMP0022 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0022 NEW)
endif()
if(POLICY CMP0069)
#cmake_policy(SET CMP0069 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
endif()
#IF(ANDROID)
#include(CheckIPOSupported)
#check_ipo_supported(RESULT supported OUTPUT error)
#if( supported )
# message(STATUS "IPO / LTO enabled")
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
#else()
# message(STATUS "IPO / LTO not supported: <${error}>")
#endif()
#ENDIF()
IF( WIN32 OR ANDROID OR APPLE OR NETFX_CORE)
SET(EMGU_CV_WITH_FREETYPE ON CACHE BOOL "BUILD FREETYPE")
ELSE()
SET(EMGU_CV_WITH_FREETYPE OFF CACHE BOOL "BUILD FREETYPE")
ENDIF()
#IF(WIN32)
# FIND_PACKAGE(HDF5)
# IF (TARGET hdf5-static)
# get_target_property(HDF5_LIBRARIES hdf5-static IMPORTED_LOCATION_RELEASE)
# MESSAGE(STATUS "HDF5_DIRS: ${HDF5_DIRS}")
# MESSAGE(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
# MESSAGE(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}")
# SET(HDF5_FOUND ON)
# SET(HDF5_C_LIBRARY ${HDF5_LIBRARIES})
# message(STATUS "HDF5: ${HDF5_DIR} (ver ${HDF5_VERSION})")
# MESSAGE(STATUS "ENV HDF5 : $ENV{HDF5_DIR}/../")
# MESSAGE(STATUS "HDF5_INCLUDE_DIRS SEARCH PATH : $ENV{HDF5_DIR}/../include")
# MESSAGE(STATUS "HDF5_C_LIBRARY SEARCH PATH : $ENV{HDF5_DIR}/../lib")
# else()
# message(STATUS "HDF5: NO")
# endif()
#ENDIF()
IF (EMGU_CV_WITH_FREETYPE)
# ExternalProject_Add(
# harfbuzz
# GIT_REPOSITORY https://github.com/harfbuzz/harfbuzz.git
# GIT_TAG 2.7.2
# CMAKE_ARGS -DCMAKE_FIND_ROOT_PATH:STRING=${FREETYPE_INSTALL_DIR} -DHB_HAVE_FREETYPE:BOOL=TRUE
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install
# )
# ExternalProject_Get_Property(harfbuzz install_dir)
# SET(HARFBUZZ_INSTALL_DIR ${install_dir})
# #add_library(harfbuzz STATIC IMPORTED)
# #set_property(TARGET harfbuzz PROPERTY IMPORTED_LOCATION HARFBUZZ_INSTALL_DIR)
MESSAGE(STATUS "Setting up FREETYPE")
# find_package(FREETYPE CONFIG REQUIRED)
find_package(FREETYPE CONFIG)
if(NOT FREETYPE_FOUND)
message(STATUS "FREETYPE: NO")
else()
message(STATUS "FREETYPE: ${FREETYPE_DIR} (ver ${FREETYPE_VERSION})")
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/../../../include/freetype2")
SET(FREETYPE_LIBRARY freetype)
get_target_property(FREETYPE_LIBRARIES freetype IMPORTED_LOCATION_RELEASE)
#SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} CACHE STRING "FREETYPE library")
#SET(FREETYPE_LINK_LIBRARIES ${FREETYPE_LIBRARIES} CACHE STRING "FREETYPE library")
#SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES})
SET(FREETYPE_LINK_LIBRARIES ${FREETYPE_LIBRARIES})
SET(FREETYPE_LINK_LIBRARIES_XXXXX ${FREETYPE_LINK_LIBRARIES})
MESSAGE(STATUS "FREETYPE_LIBRARIES: ${FREETYPE_LIBRARIES}")
#SET(FREETYPE_LIBRARIES freetype)
#SET(FREETYPE_FOUND ON)
endif()
# find_package(HARFBUZZ CONFIG REQUIRED)
find_package(HARFBUZZ CONFIG)
if(NOT HARFBUZZ_FOUND)
message(STATUS "HARFBUZZ: NO")
else()
message(STATUS "HARFBUZZ: ${HARFBUZZ_DIR} (ver ${HARFBUZZ_VERSION})")
SET(HARFBUZZ_INCLUDE_DIRS "${HARFBUZZ_DIR}/../../../include/harfbuzz")
get_target_property(HARFBUZZ_LIBRARY harfbuzz::harfbuzz IMPORTED_LOCATION_RELEASE)
#SET(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY} CACHE STRING "HARFBUZZ library")
#SET(HARFBUZZ_LINK_LIBRARIES ${HARFBUZZ_LIBRARY} CACHE STRING "HARFBUZZ library")
SET(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})
SET(HARFBUZZ_LINK_LIBRARIES ${HARFBUZZ_LIBRARY})
SET(HARFBUZZ_LINK_LIBRARIES_XXXXX ${HARFBUZZ_LINK_LIBRARIES})
MESSAGE(STATUS "HARFBUZZ_LIBRARIES: ${HARFBUZZ_LIBRARIES}")
#IF (WIN32)
# SET(HARFBUZZ_LIBRARY "${HARFBUZZ_DIR}/../../harfbuzz.lib")
#ELSE()
# SET(HARFBUZZ_LIBRARY "harfbuzz")
#ENDIF()
#message(STATUS "HARFBUZZ_DIR: ${HARFBUZZ_DIR}")
#message(STATUS "harfbuzz_INCLUDE_DIRS: ${harfbuzz_INCLUDE_DIRS}")
#message(STATUS "HARFBUZZ_INCLUDE_DIRS: ${HARFBUZZ_INCLUDE_DIRS}")
#SET(HARFBUZZ_FOUND ON)
#MESSAGE(STATUS "Adding include_directory: ${HARFBUZZ_DIR}/../../../include/harfbuzz")
include_directories(${HARFBUZZ_INCLUDE_DIRS})
endif()
# ELSE()
# ENDIF()
ELSE()
SET(FREETYPE_LIBRARY "")
ENDIF()
IF(WITH_OPENVINO)
find_package(TBB CONFIG)
find_package(OpenVINO CONFIG)
find_package(ngraph CONFIG)
ENDIF()
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten")
SET(CMAKE_C_FLAGS_RELEASE "-flto ${CMAKE_C_FLAGS_RELEASE}")
SET(CMAKE_CXX_FLAGS_RELEASE "-flto ${CMAKE_CXX_FLAGS_RELEASE}")
SET(CMAKE_C_FLAGS_DEBUG "-flto ${CMAKE_C_FLAGS_DEBUG}")
SET(CMAKE_CXX_FLAGS_DEBUG "-flto ${CMAKE_CXX_FLAGS_DEBUG}")
SET(CMAKE_EXE_LINKER_FLAGS "-flto ${CMAKE_EXE_LINKER_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "-flto ${CMAKE_SHARED_LINKER_FLAGS}")
#SET(CMAKE_STATIC_LINKER_FLAGS "-flto ${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_AR "emcc")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> -flto -r -o <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -flto -r -o <TARGET> <LINK_FLAGS> <OBJECTS>")
ENDIF()
#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(OPENCV_EXTRA_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/opencv_extra)
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)
IF ( (IS_UBUNTU OR IS_DEBIAN) AND NOT (DOTNET_FOUND))
MESSAGE(FATAL_ERROR "dotnet core is required to build Emgu CV on Ubuntu, please follow the instructions to install dotnet core on Ubuntu: https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current")
ENDIF()
INCLUDE (CheckTargetArch)
INCLUDE (OpenCVVersion)
IF(WIN32)
INCLUDE (FindCodeSign)
ENDIF()
#SET(LIBRARY_3RDPARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/3rdParty)
# ----------------------------------------------------------------------------
# Check if 32bit or 64-bit
# ----------------------------------------------------------------------------
CHECK_TARGET_ARCH()
SET(EMGUCV_ARCH ${TARGET_ARCH_NAME})
MESSAGE(STATUS "Building for ${EMGUCV_ARCH}")
IF ( TARGET_ARCH_64 )
IF (TARGET_ARM)
SET(NUGET_NATIVE_PLATFORM_ID_ARCH "arm64")
ELSE()
SET(NUGET_NATIVE_PLATFORM_ID_ARCH "x64")
ENDIF()
ELSE()
IF (TARGET_ARM)
SET(NUGET_NATIVE_PLATFORM_ID_ARCH "arm")
ELSE()
SET(NUGET_NATIVE_PLATFORM_ID_ARCH "x86")
ENDIF()
ENDIF()
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 19.1" CACHE STRING "Platform toolset for Visual Studio")
ENDIF()
IF(WIN32 AND NOT MINGW)
SET(NETFX_CORE OFF CACHE BOOL "Build Windows Store App")
# IF(NETFX_CORE)
# add_definitions(-DWINAPI_FAMILY=WINAPI_FAMILY_APP -DWINVER=0x0602 -D_WIN32_WINNT=0x0602)
# add_definitions(-D_UNICODE)
# ENDIF()
ENDIF()
IF(IOS)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/libs)
ELSE()
SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/libs)
ENDIF()
IF(NOT WIN32)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/libs)
ENDIF()
MESSAGE(STATUS "<<<< EMGUCV_ARCH: ${EMGUCV_ARCH} >>>>")
MESSAGE(STATUS "<<<< CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME} >>>>")
MESSAGE(STATUS "<<<< CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION} >>>>")
MESSAGE(STATUS "<<<< CMAKE_GENERATOR: ${CMAKE_GENERATOR} >>>>")
MESSAGE(STATUS "<<<< CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR} >>>>")
MESSAGE(STATUS "<<<< CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR} >>>>")
IF(APPLE)
MESSAGE(STATUS "<<<< CMAKE_APPLE_SILICON_PROCESSOR: ${CMAKE_APPLE_SILICON_PROCESSOR} >>>>")
ENDIF()
IF(IPHONESIMULATOR)
MESSAGE(STATUS "<<<< IPHONESIMULATOR: ${IPHONESIMULATOR} >>>>")
ENDIF()
IF(IPHONEOS)
MESSAGE(STATUS "<<<< IPHONEOS: ${IPHONEOS} >>>>")
ENDIF()
IF(ANDROID)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/android/${ANDROID_ABI}")
ELSEIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/webgl")
ELSEIF(WIN32)
MESSAGE(STATUS "<<<< MSVC_C_ARCHITECTURE_ID: ${MSVC_C_ARCHITECTURE_ID} >>>>")
IF ("${EMGUCV_ARCH}" STREQUAL "win64")
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND (CMAKE_SYSTEM_VERSION MATCHES 10.0))
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win10-x64/native")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win-x64/native")
ENDIF()
ELSEIF("${EMGUCV_ARCH}" STREQUAL "arm64")
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND (CMAKE_SYSTEM_VERSION MATCHES 10.0))
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win10-arm64/native")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win-arm64/native")
ENDIF()
ELSEIF("${EMGUCV_ARCH}" STREQUAL "arm")
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND (CMAKE_SYSTEM_VERSION MATCHES 10.0))
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win10-arm/native")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win-arm/native")
ENDIF()
ELSE()
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND (CMAKE_SYSTEM_VERSION MATCHES 10.0))
#IF("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
# IF(CMAKE_SYSTEM_VERSION MATCHES 10.0)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win10-x86/native")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/win-x86/native")
ENDIF()
ENDIF()
#MESSAGE(STATUS ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
#MESSAGE(STATUS ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> EMGUCV_ARCH: ${EMGUCV_ARCH}")
#MESSAGE(STATUS ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER: ${UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER}")
ELSEIF(APPLE AND NOT IOS)
IF ("${EMGUCV_ARCH}" STREQUAL "arm64")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/osx/native/arm64")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/osx/native/x64")
ENDIF()
ELSEIF("${EMGUCV_ARCH}" STREQUAL "ubuntu_x64")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/ubuntu-x64/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "ubuntu_x86")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/ubuntu-x86/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "ubuntu_arm64")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/ubuntu-arm64/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "ubuntu_arm")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/ubuntu-arm/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "debian_arm")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/linux-arm/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "debian_arm64")
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/runtimes/linux-arm64/native")
ELSEIF("${EMGUCV_ARCH}" STREQUAL "arm64")
IF(IPHONEOS)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/iphoneos_arm64")
ELSEIF(IPHONESIMULATOR)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/simulator_arm64")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/arm64")
ENDIF()
ELSEIF("${EMGUCV_ARCH}" STREQUAL "arm")
IF(IPHONEOS)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/iphoneos_arm")
ELSEIF(IPHONESIMULATOR)
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/simulator_arm")
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "/arm")
ENDIF()
ELSE()
SET(UNMANAGED_LIBRARY_OUTPUT_SUBFOLDER "")
ENDIF()
SET(UNMANAGED_LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/libs${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)
SET(IS_MAC_CATALYST_BUILD OFF)
SET(IS_MAC_CATALYST_ARM64_BUILD OFF)
SET(IS_MAC_CATALYST_X86_64_BUILD OFF)
IF(MAC_CATALYST)
SET(IS_MAC_CATALYST_BUILD ON)
MESSAGE(STATUS "IS_MAC_CATALYST_BUILD: ${IS_MAC_CATALYST_BUILD}")
IF (IS_MAC_CATALYST_BUILD AND ("${EMGUCV_ARCH}" STREQUAL "arm64"))
SET(IS_MAC_CATALYST_ARM64_BUILD ON)
MESSAGE(STATUS "IS_MAC_CATALYST_ARM64_BUILD: ${IS_MAC_CATALYST_ARM64_BUILD}")
ENDIF()
IF (IS_MAC_CATALYST_BUILD AND ("${EMGUCV_ARCH}" STREQUAL "x86_64"))
SET(IS_MAC_CATALYST_X86_64_BUILD ON)
MESSAGE(STATUS "IS_MAC_CATALYST_X86_64_BUILD: ${IS_MAC_CATALYST_X86_64_BUILD}")
ENDIF()
ELSEIF(IOS)
SET(IS_IOS_BUILD ON)
MESSAGE(STATUS "IS_IOS_BUILD: ${IS_IOS_BUILD}")
SET(IS_IOS_I386_BUILD OFF)
IF(IS_IOS_BUILD AND ("${IOS_ARCH}" STREQUAL "i386"))
SET(IS_IOS_I386_BUILD ON)
MESSAGE(STATUS "IS_IOS_I386_BUILD: ${IS_IOS_I386_BUILD}")
ENDIF()
#CHECK_BINARY_EXIST("libs/iOS" "libcvextern_i386.a" HAVE_IOS_I386 ${IS_IOS_I386_BUILD})
SET(IS_IOS_X86_64_BUILD OFF)
IF(IS_IOS_BUILD AND ("${IOS_ARCH}" STREQUAL "x86_64"))
SET(IS_IOS_X86_64_BUILD ON)
MESSAGE(STATUS "IS_IOS_X86_64_BUILD: ${IS_IOS_X86_64_BUILD}")
ENDIF()
#CHECK_BINARY_EXIST("libs/iOS" "libcvextern_x86_64.a" HAVE_IOS_X86_64 ${IS_IOS_X86_64_BUILD})
SET(IS_IOS_ARMV7S_BUILD OFF)
IF(IS_IOS_BUILD AND ("${IOS_ARCH}" STREQUAL "armv7s"))
SET(IS_IOS_ARMV7S_BUILD ON)
MESSAGE(STATUS "IS_IOS_ARMV7S_BUILD: ${IS_IOS_ARMV7S_BUILD}")
ENDIF()
#CHECK_BINARY_EXIST("libs/iOS" "libcvextern_armv7s.a" HAVE_IOS_ARMV7S ${IS_IOS_ARMV7S_BUILD})
SET(IS_IOS_ARMV7_BUILD OFF)
IF(IS_IOS_BUILD AND ("${IOS_ARCH}" STREQUAL "armv7"))
SET(IS_IOS_ARMV7_BUILD ON)
MESSAGE(STATUS "IS_IOS_ARMV7_BUILD: ${IS_IOS_ARMV7_BUILD}")
ENDIF()
#CHECK_BINARY_EXIST("libs/iOS" "libcvextern_armv7.a" HAVE_IOS_ARMV7 ${IS_IOS_ARMV7_BUILD})
SET(IS_IOS_ARM64_BUILD OFF)
IF(IS_IOS_BUILD AND ("${IOS_ARCH}" STREQUAL "arm64"))
SET(IS_IOS_ARM64_BUILD ON)
MESSAGE(STATUS "IS_IOS_ARM64_BUILD: ${IS_IOS_ARM64_BUILD}")
ENDIF()
#CHECK_BINARY_EXIST("libs/iOS" "libcvextern_arm64.a" HAVE_IOS_ARM64 ${IS_IOS_ARM64_BUILD})
ENDIF()
CHECK_BINARY_EXIST("libs/iOS" "libcvextern_iphoneos.a" HAVE_IOS_DEVICE ${IS_IOS_BUILD})
CHECK_BINARY_EXIST("libs/iOS" "libcvextern_simulator.a" HAVE_IOS_SIMULATOR ${IS_IOS_BUILD})
CHECK_BINARY_EXIST("libs/iOS" "libcvextern_universal.a" HAVE_IOS_UNIVERSAL ${IS_IOS_BUILD})
IF (HAVE_IOS_DEVICE OR HAVE_IOS_SIMULATOR OR HAVE_IOS_UNIVERSAL)
SET(HAVE_IOS ON)
MESSAGE(STATUS "HAVE_IOS: ${HAVE_IOS}")
ELSE()
SET(HAVE_IOS OFF)
ENDIF()
CHECK_BINARY_EXIST("libs" "Emgu.CV.Platform.Xamarin.IOS.dll" HAVE_XAMARIN_IOS ${HAVE_IOS})
CHECK_BINARY_EXIST("libs" "Emgu.CV.Platform.Maui.iOS.dll" HAVE_MAUI_IOS ${HAVE_IOS})
CHECK_BINARY_EXIST("libs/iOS" "libcvextern_catalyst_arm64.a" HAVE_MAC_CATALYST_ARM64 ${IS_MAC_CATALYST_ARM64_BUILD})
CHECK_BINARY_EXIST("libs/iOS" "libcvextern_catalyst_x86_64.a" HAVE_MAC_CATALYST_X86_64 ${IS_MAC_CATALYST_X86_64_BUILD})
IF (HAVE_MAC_CATALYST_ARM64 OR HAVE_MAC_CATALYST_X86_64)
SET(HAVE_MAC_CATALYST ON)
MESSAGE(STATUS "HAVE_MAC_CATALYST: ${HAVE_MAC_CATALYST}")
ELSE()
SET(HAVE_MAC_CATALYST OFF)
ENDIF()
CHECK_BINARY_EXIST("libs" "Emgu.CV.Platform.Maui.Mac.dll" HAVE_MAUI_MAC ${HAVE_MAC_CATALYST})
#IF(NOT HAVE_IOS)
# IF(HAVE_IOS_I386 OR HAVE_IOS_X86_64 OR HAVE_IOS_ARMV7S OR HAVE_IOS_ARMV7 OR HAVE_IOS_ARM64)
# SET(HAVE_IOS ON)
# ENDIF()
#ENDIF()
#SET(HAVE_IOS_ALL_ARCH OFF)
#IF(HAVE_IOS_I386 AND HAVE_IOS_X86_64 AND HAVE_IOS_ARMV7S AND HAVE_IOS_ARMV7 AND HAVE_IOS_ARM64)
# SET(HAVE_IOS_ALL_ARCH ON)
#ENDIF()
#IF(HAVE_IOS_ALL_ARCH)
# MESSAGE(STATUS "HAVE_IOS_ALL_ARCH: ${HAVE_IOS_ALL_ARCH}")
#ENDIF()
#IF(HAVE_IOS)
# MESSAGE(STATUS "HAVE_IOS: ON")
#ENDIF()
SET(IS_MACOS_BUILD OFF)
IF(APPLE AND (NOT IOS))
SET(IS_MACOS_BUILD ON)
MESSAGE(STATUS "IS_MACOS_BUILD: ${IS_MACOS_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/osx/native" "lib*.dylib" HAVE_MACOS ${IS_MACOS_BUILD})
CHECK_BINARY_EXIST("libs" "Emgu.CV.Platform.Xamarin.Mac.dll" HAVE_XAMARIN_MAC ${IS_MACOS_BUILD})
SET(IS_ANDROID_ARM64_V8A_BUILD OFF)
IF(ANDROID AND ("${ANDROID_ABI}" STREQUAL "arm64-v8a"))
SET(IS_ANDROID_ARM64_V8A_BUILD ON)
MESSAGE(STATUS "IS_ANDROID_ARM64_V8A_BUILD: ${IS_ANDROID_ARM64_V8A_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/android/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(STATUS "IS_ANDROID_ARMEABI_BUILD: ${IS_ANDROID_ARMEABI_BUILD}")
#ENDIF()
#CHECK_BINARY_EXIST("libs/android/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(STATUS "IS_ANDROID_ARMEABI_V7A_BUILD: ${IS_ANDROID_ARMEABI_V7A_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/android/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(STATUS "IS_ANDROID_X86_BUILD: ${IS_ANDROID_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/android/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(STATUS "IS_ANDROID_X86_64_BUILD: ${IS_ANDROID_X86_64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/android/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_V7A OR HAVE_ANDROID_X86 OR HAVE_ANDROID_X86_64)
SET(HAVE_ANDROID ON)
MESSAGE(STATUS "HAVE_ANDROID: ${HAVE_ANDROID}")
ENDIF()
SET(HAVE_ANDROID_ALL_ARCH OFF)
IF(HAVE_ANDROID_ARM64_V8A AND HAVE_ANDROID_ARMEABI_V7A AND HAVE_ANDROID_X86 AND HAVE_ANDROID_X86_64)
SET(HAVE_ANDROID_ALL_ARCH ON)
MESSAGE(STATUS "HAVE_ANDROID_ALL_ARCH: ${HAVE_ANDROID_ALL_ARCH}")
ENDIF()
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(STATUS "IS_WINSTORE_10_X86_BUILD: ${IS_WINSTORE_10_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win10-x86/native" "*.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(STATUS "IS_WINSTORE_10_X64_BUILD: ${IS_WINSTORE_10_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win10-x64/native" "*.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(STATUS "IS_WINSTORE_10_ARM_BUILD: ${IS_WINSTORE_10_ARM_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win10-arm/native" "*.dll" HAVE_WINSTORE_10_ARM ${IS_WINSTORE_10_ARM_BUILD})
SET(IS_WINSTORE_10_ARM64_BUILD OFF)
IF(("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES 10.0) AND ("${EMGUCV_ARCH}" STREQUAL "arm64"))
SET(IS_WINSTORE_10_ARM64_BUILD ON)
MESSAGE(STATUS "IS_WINSTORE_10_ARM64_BUILD: ${IS_WINSTORE_10_ARM64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win10-arm64/native" "*.dll" HAVE_WINSTORE_10_ARM64 ${IS_WINSTORE_10_ARM64_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(STATUS "IS_WINDESKTOP_X86_BUILD: ${IS_WINDESKTOP_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win-x86/native" "*.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(STATUS "IS_WINDESKTOP_X64_BUILD: ${IS_WINDESKTOP_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win-x64/native" "*.dll" HAVE_WINDESKTOP_X64 ${IS_WINDESKTOP_X64_BUILD})
SET (IS_WINDESKTOP_ARM64_BUILD OFF)
IF (WIN32 AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") AND ("${EMGUCV_ARCH}" STREQUAL "arm64") AND (NOT ANDROID))
SET (IS_WINDESKTOP_ARM64_BUILD ON)
MESSAGE(STATUS "IS_WINDESKTOP_ARM64_BUILD: ${IS_WINDESKTOP_ARM64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/win-arm64/native" "*.dll" HAVE_WINDESKTOP_ARM64 ${IS_WINDESKTOP_ARM64_BUILD})
SET(HAVE_WINDESKTOP OFF)
IF (HAVE_WINDESKTOP_X86 OR HAVE_WINDESKTOP_X64 OR HAVE_WINDESKTOP_ARM64)
SET(HAVE_WINDESKTOP ON)
ENDIF()
SET(IS_DEBIAN_ARM_BUILD OFF)
SET(IS_DEBIAN_ARM64_BUILD OFF)
IF (IS_DEBIAN)
IF(IS_ARM)
SET (IS_DEBIAN_ARM_BUILD ON)
MESSAGE(STATUS "IS_DEBIAN_ARM_BUILD: ${IS_DEBIAN_ARM_BUILD}")
ELSE(IS_ARM64)
SET (IS_DEBIAN_ARM64_BUILD ON)
MESSAGE(STATUS "IS_DEBIAN_ARM64_BUILD: ${IS_DEBIAN_ARM64_BUILD}")
ENDIF()
ENDIF()
SET (IS_DEBIAN_BUILD OFF)
IF(IS_DEBIAN_ARM_BUILD OR IS_DEBIAN_ARM64_BUILD)
SET (IS_DEBIAN_BUILD ON)
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/linux-arm/native" "*.so" HAVE_LINUX_ARM ${IS_DEBIAN_ARM_BUILD})
CHECK_BINARY_EXIST("libs/runtimes/linux-arm64/native" "*.so" HAVE_LINUX_ARM64 ${IS_DEBIAN_ARM64_BUILD})
IF(IS_DEBIAN_ARM_BUILD)
SET(NUGET_NATIVE_PLATFORM_ID_DEBIAN "linux-${NUGET_NATIVE_PLATFORM_ID_ARCH}")
MESSAGE(STATUS "NUGET_NATIVE_PLATFORM_ID_DEBIAN: ${NUGET_NATIVE_PLATFORM_ID_DEBIAN}")
ELSE()
SET(NUGET_NATIVE_PLATFORM_ID_DEBIAN "linux-arm")
ENDIF()
STRING(TOLOWER "${NUGET_NATIVE_PLATFORM_ID_DEBIAN}" NUGET_NATIVE_PLATFORM_ID_DEBIAN)
SET(IS_UBUNTU_X86_BUILD OFF)
IF (("${TARGET_ARCH_NAME}" STREQUAL "ubuntu_x86"))
SET(IS_UBUNTU_X86_BUILD ON)
MESSAGE(STATUS "IS_UBUNTU_X86_BUILD: ${IS_UBUNTU_X86_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/ubuntu-x86/native" "*.so" HAVE_UBUNTU_X86 ${IS_UBUNTU_X86_BUILD})
SET(IS_UBUNTU_X64_BUILD OFF)
IF (("${TARGET_ARCH_NAME}" STREQUAL "ubuntu_x64"))
SET(IS_UBUNTU_X64_BUILD ON)
MESSAGE(STATUS "IS_UBUNTU_X64_BUILD: ${IS_UBUNTU_X64_BUILD}")
ENDIF()
CHECK_BINARY_EXIST("libs/runtimes/ubuntu-x64/native" "*.so" HAVE_UBUNTU_X64 ${IS_UBUNTU_X64_BUILD})
#SET(IS_UBUNTU_ARM64_BUILD OFF)
#IF (("${TARGET_ARCH_NAME}" STREQUAL "ubuntu_arm64"))
# SET(IS_UBUNTU_ARM64_BUILD ON)
# MESSAGE(STATUS "IS_UBUNTU_ARM64_BUILD: ${IS_UBUNTU_ARM64_BUILD}")
#ENDIF()
#CHECK_BINARY_EXIST("libs/arm64" "*.so" HAVE_LINUX_ARM64 ${IS_UBUNTU_ARM64_BUILD})
IF ( IS_UBUNTU )
#MESSAGE(STATUS "TARGET_ARCH_64: ${TARGET_ARCH_64}")
#SET(NUGET_NATIVE_PLATFORM_ID_UBUNTU "${LSB_RELEASE_ID_SHORT}.${LSB_RELEASE_RELEASE_SHORT}-${NUGET_NATIVE_PLATFORM_ID_ARCH}")
SET(NUGET_NATIVE_PLATFORM_ID_UBUNTU "${LSB_RELEASE_ID_SHORT}-${NUGET_NATIVE_PLATFORM_ID_ARCH}")
MESSAGE(STATUS "NUGET_NATIVE_PLATFORM_ID_UBUNTU: ${NUGET_NATIVE_PLATFORM_ID_UBUNTU}")
ELSE()
SET(UBUNTU_DEFAULT_PLATFORM_ID "ubuntu")
IF (HAVE_UBUNTU_X86)
SET(NUGET_NATIVE_PLATFORM_ID_UBUNTU "${UBUNTU_DEFAULT_PLATFORM_ID}-x86")
ENDIF()
IF (HAVE_UBUNTU_X64)
SET(NUGET_NATIVE_PLATFORM_ID_UBUNTU "${UBUNTU_DEFAULT_PLATFORM_ID}-x64")
ENDIF()
IF (HAVE_UBUNTU_ARM64)
SET(NUGET_NATIVE_PLATFORM_ID_UBUNTU "${UBUNTU_DEFAULT_PLATFORM_ID}-arm64")
ENDIF()
ENDIF()
STRING(TOLOWER "${NUGET_NATIVE_PLATFORM_ID_UBUNTU}" NUGET_NATIVE_PLATFORM_ID_UBUNTU)
SET(HAVE_MAUI OFF)
IF(HAVE_IOS AND HAVE_MAC_CATALYST AND HAVE_ANDROID AND HAVE_WINDESKTOP)
SET (HAVE_MAUI ON)
MESSAGE(STATUS "HAVE_MAUI: ${HAVE_MAUI}")
ENDIF()
SET(WINDESKTOP_LABEL "")
IF(HAVE_WINDESKTOP_X86)
SET(WINDESKTOP_LABEL "${WINDESKTOP_LABEL}_x86")
ENDIF()
IF(HAVE_WINDESKTOP_X64)
SET(WINDESKTOP_LABEL "${WINDESKTOP_LABEL}_x64")
ENDIF()
IF(HAVE_WINDESKTOP_ARM64)
SET(WINDESKTOP_LABEL "${WINDESKTOP_LABEL}_arm64")
ENDIF()
IF("${WINDESKTOP_LABEL}" STREQUAL "_x86_x64_arm64")
SET(WINDESKTOP_LABEL "-windesktop")
ELSEIF(NOT ("${WINDESKTOP_LABEL}" STREQUAL ""))
SET(WINDESKTOP_LABEL "-windesktop${WINDESKTOP_LABEL}")
ENDIF()
SET(WINSTORE_10_LABEL "")
IF(HAVE_WINSTORE_10_X86)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_x86")
ENDIF()
IF(HAVE_WINSTORE_10_X64)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_x64")
ENDIF()
IF(HAVE_WINSTORE_10_ARM)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_arm")
ENDIF()
IF(HAVE_WINSTORE_10_ARM64)
SET(WINSTORE_10_LABEL "${WINSTORE_10_LABEL}_arm64")
ENDIF()
SET(HAVE_WINSTORE_10 OFF)
IF(HAVE_WINSTORE_10_X86 OR HAVE_WINSTORE_10_X64 OR HAVE_WINSTORE_10_ARM OR HAVE_WINSTORE_10_ARM64)
SET(HAVE_WINSTORE_10 ON)
ENDIF()
IF("${WINSTORE_10_LABEL}" STREQUAL "_x86_x64_arm_arm64")
SET(WINSTORE_10_LABEL "-UWP")
ELSEIF(NOT ("${WINSTORE_10_LABEL}" STREQUAL ""))
SET(WINSTORE_10_LABEL "-UWP${WINSTORE_10_LABEL}")
ENDIF()
SET(WINDOWS_LABEL "${WINSTORE_10_LABEL}${WINDESKTOP_LABEL}")
IF ("${WINDOWS_LABEL}" STREQUAL "-UWP-windesktop")
SET(WINDOWS_LABEL "-windows")
ENDIF()
SET(IOS_LABEL "")
IF(HAVE_IOS)
SET(IOS_LABEL "-ios")
ENDIF()
SET(MACOS_LABEL "")
IF(HAVE_MACOS)
SET(MACOS_LABEL "-macos")
ENDIF()
IF (IS_DEBIAN_ARM_BUILD OR IS_DEBIAN_ARM64_BUILD OR IS_UBUNTU_X64_BUILD OR IS_UBUNTU_X86_BUILD OR IS_UBUNTU_ARM64_BUILD OR HAVE_LINUX_ARM OR HAVE_LINUX_ARM64 OR HAVE_LINUX_X64 OR HAVE_LINUX_X86)
SET(HAVE_LINUX ON)
ELSE()
SET(HAVE_LINUX OFF)
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()
#IF("${ANDROID_LABEL}" STREQUAL "-arm64-v8a-armeabi-armeabi-v7a-x86-x86_64")
IF("${ANDROID_LABEL}" STREQUAL "-arm64-v8a-armeabi-v7a-x86-x86_64")
SET(ANDROID_LABEL "-android")
ELSEIF(NOT ("${ANDROID_LABEL}" STREQUAL ""))
SET(ANDROID_LABEL "-android${ANDROID_LABEL}")
ENDIF()
#CHECK_BINARY_EXIST("libs" "Emgu.CV.World*" HAVE_PREBUILD_EMGU_CV_WORLD OFF)
CHECK_BINARY_EXIST("libs" "Emgu.CV.Platform.IOS.*" HAVE_PREBUILD_EMGU_CV_IOS OFF)
#IF(HAVE_PREBUILD_EMGU_CV_IOS)
# INSTALL(
# FILES
# "${CMAKE_SOURCE_DIR}/libs/Emgu.CV.Platform.IOS.dll"
# "${CMAKE_SOURCE_DIR}/libs/Emgu.CV.Platform.IOS.xml"
# DESTINATION "libs/"
# COMPONENT emgucv_binary
# )
#ENDIF()
IF (HAVE_IOS AND (NOT HAVE_MACOS) AND (NOT HAVE_ANDROID) AND (NOT HAVE_WINSTORE_10) AND (NOT (HAVE_WINDESKTOP_X86 OR HAVE_WINDESKTOP_X64 OR HAVE_WINDESKTOP_ARM64)) AND (NOT HAVE_LINUX))
SET(HAVE_IOS_ONLY ON)
ELSE()
SET(HAVE_IOS_ONLY OFF)
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}${MACOS_LABEL}${WINDOWS_LABEL}")
#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}-macos")
#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(CV_ICC)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-icc")
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(WITH_INF_ENGINE OR WITH_OPENVINO)
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-dldt")
ENDIF()
SET(IS_PRO_BUILD FALSE)
IF("${CPACK_PACKAGE_NAME}" STREQUAL "${PACKAGE_NAME}-ios-android-macos-windows-ipp-dldt")
SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}-pro")
SET(IS_PRO_BUILD TRUE)
ENDIF()
#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 "LICENSE")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/${LICENSE_FILE_NAME}")
#IF (WIN32 OR APPLE OR ANDROID)
SET(CPACK_PACKAGE_CLI_FOLDER libs)
#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 imgproc video flann ml imgcodecs videoio highgui objdetect features2d calib3d
cudaarithm cudawarping cudafilters cudaimgproc cudalegacy cudaoptflow
cudastereo cudabgsegm cudafeatures2d cudacodec cudaobjdetect
photo superres
videostab shape
cudev
face ximgproc xobjdetect xfeatures2d xphoto bgsegm optflow
stitching plot
dnn dnn_objdetect dnn_superres aruco fuzzy viz bioinspired text tracking
dpm
saliency
img_hash
phase_unwrapping
freetype
hfs
quality
stereo
surface_matching
alphamat
intensity_transform
rapid
line_descriptor
mcc
hdf
gapi
wechat_qrcode
barcode
structured_light
rgbd
reg
)
IF(BUILD_opencv_world)
LIST (APPEND OPENCV_MODULE_NAME_CANDIDATES world)
ENDIF()
FOREACH(OPENCV_MODULE_NAME ${OPENCV_MODULE_NAME_CANDIDATES})
IF(TARGET opencv_${OPENCV_MODULE_NAME})
LIST(APPEND OPENCV_MODULE_NAMES ${OPENCV_MODULE_NAME})
ENDIF()
ENDFOREACH()
# ----------------------------------------------------------------------------
# Autodetect if we are in a GIT repository
# ----------------------------------------------------------------------------
IF(GIT_EXECUTABLE)
MESSAGE(STATUS "Extracting Emgu CV git version, please wait...")
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
OUTPUT_VARIABLE GITVERSION_RESULT)
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:
SET(EMGUCV_GITVERSION "0")
ENDIF()
SET(CPACK_PACKAGE_VENDOR "Emgu Corporation")