-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
217 lines (179 loc) · 4.85 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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#[=============================================================================[
# The mysqlnd extension
Configure the `mysqlnd` extension.
This extension contains MySQL Native Driver for supporting MySQL-compatible
database in PHP extensions.
## EXT_MYSQLND
* Default: `OFF`
* Values: `ON|OFF`
Enable the PHP `mysqlnd` extension.
## EXT_MYSQLND_SHARED
* Default: `OFF`
* Values: `ON|OFF`
Build extension as shared library.
## EXT_MYSQLND_COMPRESSION
* Default: `ON`
* Values: `ON|OFF`
Enable compressed protocol support in mysqlnd.
## EXT_MYSQLND_SSL
* Default: `OFF`
* Values: `ON|OFF`
Explicitly enable extended SSL support in the `mysqlnd` extension. On \*nix
systems, extended SSL works through the OpenSSL library and on Windows through
the Windows Crypt32 library. Beneficial when building without the `openssl`
extension or when building with phpize.
\*nix systems: when building with the `openssl` extension (`EXT_OPENSSL=ON`)
in the php-src tree, the extended SSL is enabled implicitly regardless of this
option.
Windows systems: extended SSL is enabled implicitly based on the Crypt32
library regardless of this option.
#]=============================================================================]
project(
PhpExtensionMysqlnd
LANGUAGES C
)
include(CMakeDependentOption)
include(FeatureSummary)
option(EXT_MYSQLND "Enable the mysqlnd extension" OFF)
add_feature_info(
"ext/mysqlnd"
EXT_MYSQLND
"MySQL Native Driver for supporting MySQL-compatible database in extensions"
)
cmake_dependent_option(
EXT_MYSQLND_SHARED
"Build the mysqlnd extension as a shared library"
OFF
"EXT_MYSQLND;NOT BUILD_SHARED_LIBS"
OFF
)
cmake_dependent_option(
EXT_MYSQLND_COMPRESSION
"Enable compressed protocol support in mysqlnd"
ON
"EXT_MYSQLND"
OFF
)
add_feature_info(
"ext/mysqlnd compression"
EXT_MYSQLND_COMPRESSION
"MySQL compressed protocol support in the mysqlnd extension"
)
cmake_dependent_option(
EXT_MYSQLND_SSL
"Explicitly enable extended SSL support in the mysqlnd extension through a\
system library OpenSSL (*nix) or Crypt32 (Windows)."
OFF
[[EXT_MYSQLND AND NOT EXT_OPENSSL AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"]]
OFF
)
if(NOT EXT_MYSQLND)
return()
endif()
if(EXT_MYSQLND_SHARED)
add_library(php_mysqlnd SHARED)
else()
add_library(php_mysqlnd)
endif()
target_sources(
php_mysqlnd
PRIVATE
mysqlnd_alloc.c
mysqlnd_auth.c
mysqlnd_block_alloc.c
mysqlnd_charset.c
mysqlnd_commands.c
mysqlnd_connection.c
mysqlnd_debug.c
mysqlnd_driver.c
mysqlnd_ext_plugin.c
mysqlnd_loaddata.c
mysqlnd_plugin.c
mysqlnd_protocol_frame_codec.c
mysqlnd_ps_codec.c
mysqlnd_ps.c
mysqlnd_read_buffer.c
mysqlnd_result_meta.c
mysqlnd_result.c
mysqlnd_reverse_api.c
mysqlnd_statistics.c
mysqlnd_vio.c
mysqlnd_wireprotocol.c
php_mysqlnd.c
PUBLIC
FILE_SET HEADERS
FILES
$<$<PLATFORM_ID:Windows>:config-win.h>
mysql_float_to_double.h
mysqlnd_alloc.h
mysqlnd_auth.h
mysqlnd_block_alloc.h
mysqlnd_charset.h
mysqlnd_commands.h
mysqlnd_connection.h
mysqlnd_debug.h
mysqlnd_enum_n_def.h
mysqlnd_ext_plugin.h
mysqlnd_libmysql_compat.h
mysqlnd_plugin.h
mysqlnd_portability.h
mysqlnd_priv.h
mysqlnd_protocol_frame_codec.h
mysqlnd_ps.h
mysqlnd_read_buffer.h
mysqlnd_result_meta.h
mysqlnd_result.h
mysqlnd_reverse_api.h
mysqlnd_statistics.h
mysqlnd_structs.h
mysqlnd_vio.h
mysqlnd_wireprotocol.h
mysqlnd.h
php_mysqlnd.h
)
target_compile_definitions(php_mysqlnd PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
target_link_libraries(
php_mysqlnd
PRIVATE
$<$<PLATFORM_ID:Windows>:ws2_32>
)
if(EXT_MYSQLND_COMPRESSION)
include(Packages/ZLIB)
set_package_properties(
ZLIB
PROPERTIES
TYPE REQUIRED
PURPOSE "Necessary to enable compression in the mysqlnd extension."
)
target_link_libraries(php_mysqlnd PRIVATE ZLIB::ZLIB)
set(MYSQLND_COMPRESSION_ENABLED 1)
endif()
set(MYSQLND_SSL_SUPPORTED 1)
if(
(
NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"
AND (EXT_MYSQLND_SSL OR EXT_OPENSSL)
)
OR CMAKE_SYSTEM_NAME STREQUAL "Windows"
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(php_mysqlnd PRIVATE crypt32)
else()
find_package(OpenSSL ${PHP_OPENSSL_MIN_VERSION})
set_package_properties(
OpenSSL
PROPERTIES
TYPE REQUIRED
PURPOSE "Necessary to enable SSL in the mysqlnd extension."
)
target_link_libraries(php_mysqlnd PRIVATE OpenSSL::Crypto)
endif()
set(MYSQLND_HAVE_SSL 1)
add_dependencies(php_mysqlnd php_hash)
endif()
add_feature_info(
"ext/mysqlnd SSL"
MYSQLND_HAVE_SSL
"Extended SSL support through a system library"
)
configure_file(config.cmake.h.in config.h)