-
Notifications
You must be signed in to change notification settings - Fork 50
/
CMakeLists.txt
89 lines (71 loc) · 3.01 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
# Open The CMake GUI
# specify the source directory and the binary directory
# press configure
# set CMAKE_INSTALL_PREFIX to the path where you want to install the program
# press configure
# check BUILD_WITH_QT if you want to build the program with a QT-Config GUI
# check GENERATE_DEB_PACKAGE if you want to build a debian package (only on Linux)
#
# UNIX Makefile:
# 1) go to the binary folder and type "make" to build the project
# 2) (optional) type "make install all" to install the files into the install
# directory
# 3) (optional) type "make package" to create a package of the install folder
# (.tgz file if GENERATE_DEB_PACKAGE=false, .deb file if GENERATE_DEB_PACKAGE=true)
#
# Microsoft Visual C++:
# 1) open the .sln file
# 2) change the mode to "Release" -> only Release is supported!
# 3) build the project "ALL_BUILD" to build the opentld project
# 4) build the project "INSTALL" to install the files into the install
# directory
# 5) build the project "PACKAGE" to create an NSIS-installer (NSIS is required)
project(OpenTLD)
cmake_minimum_required(VERSION 2.6)
find_package(OpenCV REQUIRED)
if(CUDA_ENABLED)
find_package(CUDA 4.0 REQUIRED)
add_definitions(-DCUDA_ENABLED)
endif(CUDA_ENABLED)
if(BUILD_QOPENTLD)
find_package(Qt4 REQUIRED)
endif(BUILD_QOPENTLD)
#-------------------------------------------------------------------------------
#version
set(TLD_VERSION_MAJOR 1)
set(TLD_VERSION_MINOR 3)
set(TLD_VERSION_PATCH 0)
set(TLD_VERSION ${TLD_VERSION_MAJOR}.${TLD_VERSION_MINOR}.${TLD_VERSION_PATCH})
#------------------------------------------------------------------------------
#build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
if((CMAKE_BUILD_TYPE MATCHES Release) AND CUDA_ENABLED)
add_definitions(-DNO_ERROR_CHECK)
endif((CMAKE_BUILD_TYPE MATCHES Release) AND CUDA_ENABLED)
option(CUDA_ENABLED "Build with CUDA acceleration enabled." OFF)
option(BUILD_QOPENTLD "Build with Qt-config-dialog." OFF)
option(USE_SYSTEM_LIBS "Use the installed version of libconfig++." OFF)
if(WIN32)
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC) #Needed when linking libconfig statically
endif(WIN32)
if(APPLE)
add_definitions(-DHAVE_XLOCALE_H)
endif(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -fPIC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgomp")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#-------------------------------------------------------------------------------
#add subdirectories
add_subdirectory(src/3rdparty/cvblobs)
if(NOT USE_SYSTEM_LIBS)
add_subdirectory(src/3rdparty/libconfig)
endif(NOT USE_SYSTEM_LIBS)
add_subdirectory(src/libopentld)
add_subdirectory(src/opentld)
configure_file("${PROJECT_SOURCE_DIR}/OpenTLDConfig.cmake.in" "${PROJECT_BINARY_DIR}/OpenTLDConfig.cmake" @ONLY)