forked from Dynamsoft/barcode-reader-c-cpp-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (70 loc) · 3.76 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
cmake_minimum_required(VERSION 3.6)
project(Samples)
# set the platform
option(BUILD_LINUX "Build samples for running on Linux x86_64" ON)
option(BUILD_ARM "Build samples for running on Linux ARM32" OFF)
option(BUILD_ARM64 "Build samples for running on Linux ARM64" OFF)
option(BUILD_C_HELLOWORLD "Build the sample HelloWorld under ./samples/C/HelloWorld" ON)
option(BUILD_C_GENERALSETTINGS "Build the sample GeneralSettings under ./samples/C/GeneralSettings" ON)
option(BUILD_CPP_HELLOWORLD "Build the sample HelloWorld under ./samples/C++/HelloWorld" ON)
option(BUILD_CPP_GENERALSETTINGS "Build the sample GeneralSettings under ./samples/C++/GeneralSettings" ON)
option(BUILD_CPP_BATCHDECODE "Build the sample BatchDecode under ./samples/C++/Performance/BatchDecode" ON)
option(BUILD_CPP_VIDEODECODING "Build the sample VideoDecoding under ./samples/C++/VideoDecoding" ON)
option(BUILD_CPP_SPEEDFIRSTSETTINGS "Build the sample SpeedFirstSettings under ./sample/C++/Performance/SpeedFirstSettings" ON)
option(BUILD_CPP_ACCURACYFIRSTSETTINGS "Build the sample AccuracyFirstSettings under ./sample/C++/Performance/AccuracyFirstSettings" ON)
option(BUILD_CPP_READRATEFIRSTSETTINGS "Build the sample ReadRateFirstSettings under ./sample/C++/Performance/ReadRateFirstSettings" ON)
option(BUILD_CPP_MULTITHREADDECODING "Build the sample MultiThreadDecoding under ./sample/C++/MultiThreadDecoding" ON)
option(BUILD_CPP_READLOWQUALITYBARCODES "Build the sample ReadLowQualityBarcodes under ./sample/C++/UseCases/ReadLowQualityBarcodes" ON)
if(BUILD_LINUX)
set(DBRLIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/Linux/x64)
elseif(BUILD_ARM)
set(DBRLIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/Linux/ARM32)
add_compile_options(-DDM_ARM -D__ARM_NEON__ -mfpu=neon)
elseif(BUILD_ARM64)
set(DBRLIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/Linux/ARM64)
add_compile_options(-DDM_ARM -D__ARM_NEON__)
else()
message(FATAL_ERROR "Please specify a supported platform")
endif()
set (CMAKE_CXX_STANDARD 11)
add_compile_options(-O2 -fPIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2 -fvisibility=hidden -fvisibility-inlines-hidden -L ${DBRLIB} -Wl,-rpath,${DBRLIB} -Wl,-rpath,'$ORIGIN' -static-libgcc -static-libstdc++ -s")
#include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
if(BUILD_C_HELLOWORLD)
add_subdirectory(samples/C/HelloWorld)
endif()
if(BUILD_C_GENERALSETTINGS)
add_subdirectory(samples/C/GeneralSettings)
endif()
if(BUILD_CPP_HELLOWORLD)
add_subdirectory(samples/C++/HelloWorld)
endif()
if(BUILD_CPP_GENERALSETTINGS)
add_subdirectory(samples/C++/GeneralSettings)
endif()
if(BUILD_CPP_BATCHDECODE)
add_subdirectory(samples/C++/Performance/BatchDecode)
endif()
if(BUILD_CPP_VIDEODECODING)
add_subdirectory(samples/C++/VideoDecoding)
endif()
if(BUILD_CPP_SPEEDFIRSTSETTINGS)
add_subdirectory(samples/C++/Performance/SpeedFirstSettings)
endif()
if(BUILD_CPP_ACCURACYFIRSTSETTINGS)
add_subdirectory(samples/C++/Performance/AccuracyFirstSettings)
endif()
if(BUILD_CPP_READRATEFIRSTSETTINGS)
add_subdirectory(samples/C++/Performance/ReadRateFirstSettings)
endif()
if(BUILD_CPP_MULTITHREADDECODING)
add_subdirectory(samples/C++/MultiThreadDecoding)
endif()
if(BUILD_CPP_READLOWQUALITYBARCODES)
add_subdirectory(samples/C++/UseCases/ReadLowQualityBarcodes)
File(COPY samples/C++/UseCases/ReadLowQualityBarcodes/images DESTINATION samples/C++/UseCases/ReadLowQualityBarcodes)
File(COPY samples/C++/UseCases/ReadLowQualityBarcodes/templates DESTINATION samples/C++/UseCases/ReadLowQualityBarcodes)
endif()
if(BUILD_C_HELLOWORLD OR BUILD_C_GENERALSETTINGS OR BUILD_CPP_HELLOWORLD OR BUILD_CPP_GENERALSETTINGS OR BUILD_CPP_SPEEDFIRSTSETTINGS OR BUILD_CPP_ACCURACYFIRSTSETTINGS OR BUILD_CPP_READRATEFIRSTSETTINGS)
File(COPY ./images/AllSupportedBarcodeTypes.png DESTINATION images)
endif()