-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread_system_install.cmake
More file actions
193 lines (171 loc) · 6.83 KB
/
Copy paththread_system_install.cmake
File metadata and controls
193 lines (171 loc) · 6.83 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
##################################################
# thread_system_install.cmake
#
# Installation configuration for thread_system
# Handles header and library installation, config files
##################################################
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
##################################################
# Install headers
##################################################
function(install_thread_system_headers)
# Canonical headers. The whole public API lives under
# include/kcenon/thread/... in the current layout, so a single recursive
# rule installs every header (core, interfaces, utils, lockfree,
# implementation details, etc.) to <prefix>/include/kcenon/thread/...
# *.tpp template implementation files are installed alongside the headers
# they back (e.g. typed_thread_pool), which the previous per-component
# rules only handled for one module.
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Development
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.tpp")
# Legacy forwarding-stub headers (EPIC #683 deprecation window). These are
# thin shims such as core/base/include/thread_base.h that #include the
# canonical <kcenon/thread/...> header, kept so that downstream code using
# the old flat include names keeps compiling for one release. They are
# installed flat into <prefix>/include so that #include "thread_base.h"
# style usage still resolves. Each rule is guarded by EXISTS so it becomes
# a no-op once the stubs are removed.
#
# NOTE: the previously referenced interfaces/ and
# implementations/{thread_pool,typed_thread_pool,lockfree}/include/
# directories do not exist in this tree. Those dangling install(DIRECTORY)
# entries are removed here because their canonical headers are already
# covered by the include/ rule above; leaving them broke the audit of the
# install/export surface (issue #696).
foreach(_legacy_inc
core/base/include
core/sync/include
utilities/include)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_legacy_inc})
install(DIRECTORY ${_legacy_inc}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Development
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp")
endif()
endforeach()
message(STATUS "Configured header installation")
endfunction()
##################################################
# Install libraries
##################################################
function(install_thread_system_libraries)
if(TARGET thread_system)
install(TARGETS thread_system
EXPORT thread_system-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
message(STATUS "Configured library installation (thread_system)")
endif()
endfunction()
##################################################
# Install CMake config files
##################################################
function(install_cmake_config_files)
# Install targets with single standardized namespace
install(EXPORT thread_system-targets
FILE thread_system-targets.cmake
NAMESPACE thread_system::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/thread_system)
# Generate standardized config files
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/thread_system-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/thread_system-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/thread_system
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/thread_system-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
# Install config files
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/thread_system-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/thread_system-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/thread_system
)
message(STATUS "Configured CMake config file installation")
endfunction()
##################################################
# Install pkg-config file
##################################################
function(install_pkgconfig_file)
set(PKG_CONFIG_FEATURE_FLAGS "")
if(USE_STD_FORMAT)
set(PKG_CONFIG_FEATURE_FLAGS "${PKG_CONFIG_FEATURE_FLAGS} -DUSE_STD_FORMAT")
endif()
if(USE_STD_JTHREAD)
set(PKG_CONFIG_FEATURE_FLAGS "${PKG_CONFIG_FEATURE_FLAGS} -DUSE_STD_JTHREAD")
endif()
if(USE_STD_CHRONO_CURRENT_ZONE)
set(PKG_CONFIG_FEATURE_FLAGS "${PKG_CONFIG_FEATURE_FLAGS} -DUSE_STD_CHRONO_CURRENT_ZONE")
endif()
# Get simdutf libraries for pkg-config
if(TARGET simdutf::simdutf)
set(SIMDUTF_LIBRARIES "-lsimdutf")
else()
set(SIMDUTF_LIBRARIES "")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/thread_system.pc.in
${CMAKE_CURRENT_BINARY_DIR}/thread_system.pc
@ONLY
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/thread_system.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
message(STATUS "Configured pkg-config file installation")
endfunction()
##################################################
# Install documentation files
##################################################
function(install_documentation_files)
# Adapter headers are now installed from include/kcenon/thread/adapters/
# via the main header installation in install_thread_system_headers()
# Install dependency documentation
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/docs/dependency_compatibility_matrix.md)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/docs/dependency_compatibility_matrix.md
${CMAKE_CURRENT_SOURCE_DIR}/docs/license_compatibility.md
DESTINATION ${CMAKE_INSTALL_DOCDIR}/dependencies
COMPONENT Documentation
)
endif()
# Install main documentation
set(DOC_FILES "")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
list(APPEND DOC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md)
list(APPEND DOC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
list(APPEND DOC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
endif()
if(DOC_FILES)
install(FILES ${DOC_FILES}
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT Documentation)
endif()
message(STATUS "Configured documentation installation")
endfunction()
##################################################
# Main installation setup
##################################################
function(setup_thread_system_install)
install_thread_system_headers()
install_thread_system_libraries()
install_cmake_config_files()
install_pkgconfig_file()
install_documentation_files()
message(STATUS "Installation configuration complete")
endfunction()