-
Notifications
You must be signed in to change notification settings - Fork 148
/
CMakeLists.txt
165 lines (117 loc) · 4.71 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
# Copyright 2014 The Imaging Source Europe GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 3.10)
#Name your project here
project(tcam)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(version.cmake)
set(TCAM_VERSION "${TCAM_VERSION_MAJOR}.${TCAM_VERSION_MINOR}.${TCAM_VERSION_PATCH}${TCAM_VERSION_MODIFIER}" CACHE STRING "Version number")
set(TCAM_ORIGIN "https://github.com/TheImagingSource/tiscamera")
include("cmake/CompilerWarnings.cmake")
include("cmake/git-helper.cmake")
set(default_build_type "Release") # Override the default build type to be 'Release' and not 'RelWithDebInfo'
include("cmake/StandardProjectSettings.cmake")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
find_git_settings() # exports GIT_COMMIT_COUNT, GIT_TAG, ...
set(TCAM_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(TCAM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TCAM_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${TCAM_BINARY_DIR}/lib)
if( ${GIT_REPO_PRESENT} )
message(STATUS "TCAM_VERSION: ${TCAM_VERSION}, Git: commit#=${GIT_COMMIT_COUNT}, branch=${GIT_BRANCH} hash=${GIT_COMMIT_HASH}" )
else()
message(STATUS "TCAM_VERSION: ${TCAM_VERSION}, Git: No repo found" )
endif()
# All option for configuration come from here
include(CMakeOptions.cmake)
add_compile_options( -Wno-psabi ) # disable ABI change message of g++8
add_compile_options( -Wall -Wextra -pedantic -pthread )
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options( -fsized-deallocation )
endif()
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_POSITION_INDEPENDENT_CODE ON )
# external/json defaults to the highest cpp standard it can find
# this causes inclusion of std::filesystem
# which is not present on older systems (Ubuntu 18.04 LTS)
# add_definitions is used instead of
# target_compile_definitions as that would require cmake >= 1.12
add_definitions(-DJSON_HAS_CPP_11)
include(CMakeInstall.cmake)
if ( TCAM_ENABLE_CMAKE_CLANGFORMAT_TARGET)
include("clang-format")
endif (TCAM_ENABLE_CMAKE_CLANGFORMAT_TARGET)
if (TCAM_BUILD_UVC_EXTENSION_LOADER_ONLY)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/src/tcam-config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/src/tcam-config.h")
add_subdirectory(src/v4l2)
add_subdirectory(tools/tcam-uvc-extension-loader/)
add_subdirectory(data/uvc-extensions/)
add_subdirectory(data/udev/)
endif (TCAM_BUILD_UVC_EXTENSION_LOADER_ONLY)
if (TCAM_BUILD_GIGETOOL_ONLY)
add_subdirectory(external)
add_subdirectory(src/tcam-network/)
add_subdirectory(tools/tcam-gigetool)
endif (TCAM_BUILD_GIGETOOL_ONLY)
if (NOT TCAM_EXCLUSIVE_BUILD)
# TODO: these should not always be included
add_subdirectory(external)
add_subdirectory(libs)
add_subdirectory(src)
if (TCAM_ENABLE_DATA_INSTALL)
add_subdirectory(data)
# TODO: this should not be always on
install(DIRECTORY examples
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/theimagingsource/tiscamera/"
COMPONENT dev)
endif (TCAM_ENABLE_DATA_INSTALL)
if (TCAM_BUILD_TOOLS)
add_subdirectory(tools)
endif (TCAM_BUILD_TOOLS)
if (TCAM_BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif (TCAM_BUILD_DOCUMENTATION)
if (TCAM_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif (TCAM_BUILD_TESTS)
endif (NOT TCAM_EXCLUSIVE_BUILD)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
# create target uninstall to deinstall tiscamera
# if tiscamera is a subproject/module
# create uninstall-tiscamera instead
if (TARGET uninstall)
add_custom_target(uninstall-tiscamera
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
else (TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif (TARGET uninstall)
# is never installed, etc. can come last
add_subdirectory(packaging)
add_subdirectory(scripts)
#
#
#
# Give overview over build configuration
print_install_overview()