-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
162 lines (130 loc) · 4.36 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
cmake_minimum_required(VERSION 2.6)
project(Pipelib)
set(PIPELIB_VERSION_MAJOR 0)
set(PIPELIB_VERSION_MINOR 5)
set(PIPELIB_VERSION_PATCH 3)
set(PIPELIB_VERSION "${PIPELIB_VERSION_MAJOR}.${PIPELIB_VERSION_MINOR}.${PIPELIB_VERSION_PATCH}")
message(STATUS "Configuring Pipelib ${PIPELIB_VERSION}")
## CONFIGURATION SETTINGS ##############################
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR CMake)
else()
set(DEF_INSTALL_CMAKE_DIR share/${CMAKE_PROJECT_NAME}/cmake)
endif()
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
"Installation directory for CMake files")
# Build options ###
set(PIPELIB_BUILD_TESTS FALSE CACHE BOOL "Build pipelib tests")
configure_file(
"${PROJECT_SOURCE_DIR}/include/pipelib/PipelibConfig.h.in"
"${PROJECT_BINARY_DIR}/include/pipelib/PipelibConfig.h"
)
## pipelib
set(pipelib_Header_Files__
# ${PROJECT_BINARY_DIR}/include/pipelib/PipelibConfig.h
include/pipelib/Barrier.h
include/pipelib/Block.h
include/pipelib/BlockConnector.h
include/pipelib/BlockHandle.h
include/pipelib/BlockIterator.h
include/pipelib/BoostThreadEngine.h
include/pipelib/pipelib.h
include/pipelib/PipelineState.h
include/pipelib/PipeBlock.h
include/pipelib/PipeEngine.h
include/pipelib/Pipeline.h
include/pipelib/SerialEngine.h
include/pipelib/SimpleBarrier.h
include/pipelib/Sinks.h
include/pipelib/StartBlock.h
include/pipelib/Types.h
)
source_group("Header Files\\" FILES ${pipelib_Header_Files__})
## pipelib/detail
set(pipelib_Header_Files__detail
include/pipelib/detail/Block.h
include/pipelib/detail/BlockConnector.h
include/pipelib/detail/BlockIterator.h
include/pipelib/detail/BoostThreadEngine.h
include/pipelib/detail/PipeEngine.h
include/pipelib/detail/SerialEngine.h
include/pipelib/detail/SimpleBarrier.h
)
source_group("Header Files\\detail" FILES ${pipelib_Header_Files__detail})
## pipelib/event
set(pipelib_Header_Files__event
include/pipelib/event/EventSupport.h
include/pipelib/event/PipeEngineListener.h
include/pipelib/event/PipeEngineEvents.h
include/pipelib/event/PipeEngineStateChanged.h
)
source_group("Header Files\\event" FILES ${pipelib_Header_Files__event})
## pipelib/event/detail
set(pipelib_Header_Files__event__detail
include/pipelib/event/detail/PipeEngineEvents.h
)
source_group("Header Files\\event\\detail" FILES ${pipelib_Header_Files__event__detail})
set(pipelib_Header_Files
${pipelib_Header_Files__}
${pipelib_Header_Files__detail}
${pipelib_Header_Files__event}
${pipelib_Header_Files__event__detail}
)
set(PIPELIB_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/include # So that we find PipelibConfig.h
${PROJECT_SOURCE_DIR}/include
CACHE FILEPATH INTERNAL FORCE
)
## CONFIG - set up export files for projects to use pipelib
# Make relative paths absolute
foreach(p INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
# Create the *Config.cmake and *ConfigVersion.cmake files
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
"${INSTALL_INCLUDE_DIR}")
# ... for the build tree
set(CONF_INCLUDE_DIRS
"${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include"
)
configure_file(cmake/PipelibConfig.cmake.in
"${PROJECT_BINARY_DIR}/PipelibConfig.cmake" @ONLY)
# ... for the install tree
set(CONF_INCLUDE_DIRS "\${PIPELIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file(cmake/PipelibConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PipelibConfig.cmake" @ONLY)
# ... for both
configure_file(cmake/PipelibConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/PipelibConfigVersion.cmake" @ONLY)
configure_file(cmake/PipelibConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PipelibConfig.cmake" @ONLY
)
## INSTALL
install(DIRECTORY
include/pipelib
DESTINATION "${INSTALL_INCLUDE_DIR}"
COMPONENT dev
PATTERN "*.in" EXCLUDE
)
install(DIRECTORY
"${PROJECT_BINARY_DIR}/include/pipelib"
DESTINATION "${INSTALL_INCLUDE_DIR}"
COMPONENT dev
)
install(FILES
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PipelibConfig.cmake
${PROJECT_BINARY_DIR}/PipelibConfigVersion.cmake
DESTINATION "${INSTALL_CMAKE_DIR}"
COMPONENT dev
)
###########
## Tests ##
###########
if(PIPELIB_BUILD_TESTS)
add_subdirectory(tests)
endif(PIPELIB_BUILD_TESTS)