-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
62 lines (52 loc) · 1.78 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
cmake_minimum_required (VERSION 2.6)
project (DLR)
MESSAGE( STATUS "PROJECT_NAME: " ${PROJECT_NAME} )
option(ENABLE_OPENCV "Build with OpenCV" OFF)
MESSAGE(STATUS "Build with OpenCV: ${ENABLE_OPENCV}")
# Check platforms
if (CMAKE_HOST_WIN32)
set(WINDOWS 1)
elseif(CMAKE_HOST_APPLE)
set(MACOS 1)
elseif(CMAKE_HOST_UNIX)
set(LINUX 1)
endif()
# Set RPATH
if(WINDOWS)
else()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
MESSAGE( STATUS "CMAKE_INSTALL_RPATH: " "${CMAKE_INSTALL_PREFIX}/lib" )
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
# Add search path for include and lib files
if(WINDOWS)
link_directories("${PROJECT_SOURCE_DIR}/platforms/win/lib/")
elseif(LINUX)
link_directories("${PROJECT_SOURCE_DIR}/platforms/linux/")
elseif(MACOS)
link_directories("${PROJECT_SOURCE_DIR}/platforms/macos/")
endif()
include_directories("${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/include/")
# Add the executable
if (ENABLE_OPENCV)
find_package(OpenCV REQUIRED)
add_executable(LabelRecognition LabelRecognitionDemoOpenCV.cpp)
if(WINDOWS)
target_link_libraries (LabelRecognition "DynamsoftLabelRecognitionx64" ${OpenCV_LIBS})
else()
target_link_libraries (LabelRecognition "DynamsoftLabelRecognition" ${OpenCV_LIBS})
endif()
else()
add_executable(LabelRecognition LabelRecognitionDemo.cpp)
if(WINDOWS)
target_link_libraries (LabelRecognition "DynamsoftLabelRecognitionx64")
else()
target_link_libraries (LabelRecognition "DynamsoftLabelRecognition")
endif()
endif()
if(WINDOWS)
add_custom_command(TARGET LabelRecognition POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/platforms/win/bin/"
$<TARGET_FILE_DIR:LabelRecognition>)
endif()