Skip to content

Commit 4cae46c

Browse files
committed
Improve adding all .def files
This now adds .def files to the SAPI targets directly as they are needed there and not in the extensions target. Some other nits fixed on the way.
1 parent 4539c23 commit 4cae46c

File tree

7 files changed

+51
-22
lines changed

7 files changed

+51
-22
lines changed

cmake/ext/iconv/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,21 @@ target_sources(
6565
PRIVATE
6666
iconv.c
6767
iconv.stub.php
68-
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:php_iconv.def>
6968
PUBLIC
7069
FILE_SET HEADERS
7170
FILES
7271
php_iconv.h
7372
)
7473

74+
get_target_property(type php_ext_iconv TYPE)
75+
if(
76+
CMAKE_SYSTEM_NAME STREQUAL "Windows"
77+
AND TARGET php_sapi
78+
AND NOT type MATCHES "^(MODULE|SHARED)_LIBRARY$"
79+
)
80+
target_sources(php_sapi INTERFACE php_iconv.def)
81+
endif()
82+
7583
target_compile_definitions(
7684
php_ext_iconv
7785
PRIVATE

cmake/ext/libxml/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ target_sources(
4747
PRIVATE
4848
libxml.c
4949
libxml.stub.php
50-
php_libxml2.def
5150
PUBLIC
5251
FILE_SET HEADERS
5352
FILES
5453
php_libxml.h
5554
)
5655

56+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND TARGET php_sapi)
57+
target_sources(php_sapi INTERFACE php_libxml2.def)
58+
endif()
59+
5760
target_compile_definitions(
5861
php_ext_libxml
5962
PRIVATE

cmake/ext/tidy/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@ endif()
6363
target_sources(
6464
php_ext_tidy
6565
PRIVATE
66-
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:php_tidy.def>
6766
tidy.c
6867
tidy.stub.php
6968
)
7069

70+
get_target_property(type php_ext_tidy TYPE)
71+
if(
72+
CMAKE_SYSTEM_NAME STREQUAL "Windows"
73+
AND TARGET php_sapi
74+
AND NOT type MATCHES "^(MODULE|SHARED)_LIBRARY$"
75+
)
76+
target_sources(php_sapi INTERFACE php_tidy.def)
77+
endif()
78+
7179
# Add -Wno-ignored-qualifiers as this is an issue upstream. Fixed in tidy-html5
7280
# 5.7.20. See: https://github.com/htacg/tidy-html5/issues/866
7381
if(Tidy_VERSION VERSION_LESS 5.7.20)

cmake/ext/zlib/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,21 @@ endif()
6060
target_sources(
6161
php_ext_zlib
6262
PRIVATE
63-
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:php_zlib.def>
6463
zlib_filter.c
6564
zlib_fopen_wrapper.c
6665
zlib.c
6766
zlib.stub.php
6867
)
6968

69+
get_target_property(type php_ext_zlib TYPE)
70+
if(
71+
CMAKE_SYSTEM_NAME STREQUAL "Windows"
72+
AND TARGET php_sapi
73+
AND NOT type MATCHES "^(MODULE|SHARED)_LIBRARY$"
74+
)
75+
target_sources(php_sapi INTERFACE php_zlib.def)
76+
endif()
77+
7078
target_compile_definitions(php_ext_zlib PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
7179

7280
find_package(ZLIB ${PHP_ZLIB_MIN_VERSION})

cmake/main/CMakeLists.txt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,27 +241,27 @@ function(_php_main_configure_build_defs)
241241
set(CONFIGURE_COMMAND "cmake")
242242

243243
if(NOT "@PHP_PEAR_DIR@" STREQUAL "")
244-
set(PEAR_INSTALLDIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_PEAR_DIR@,${CMAKE_INSTALL_PREFIX}>")
244+
set(PHP_PEAR_INSTALLDIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_PEAR_DIR@,${CMAKE_INSTALL_PREFIX}>")
245245
endif()
246246

247247
set(PHP_BINDIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@CMAKE_INSTALL_BINDIR@,${CMAKE_INSTALL_PREFIX}>")
248248

249249
if("@CMAKE_SYSTEM_NAME@" STREQUAL "Windows")
250-
set(EXPANDED_PHP_CONFIG_FILE_PATH "")
250+
set(PHP_CONFIG_FILE_PATH "")
251251
else()
252-
set(EXPANDED_PHP_CONFIG_FILE_PATH "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_CONFIG_FILE_PATH@,${CMAKE_INSTALL_PREFIX}>")
252+
set(PHP_CONFIG_FILE_PATH "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_CONFIG_FILE_PATH@,${CMAKE_INSTALL_PREFIX}>")
253253
endif()
254254

255-
set(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_CONFIG_FILE_SCAN_DIR@,${CMAKE_INSTALL_PREFIX}>")
255+
set(PHP_CONFIG_FILE_SCAN_DIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_CONFIG_FILE_SCAN_DIR@,${CMAKE_INSTALL_PREFIX}>")
256256

257257
set(PHP_DATADIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@CMAKE_INSTALL_DATADIR@,${CMAKE_INSTALL_PREFIX}>")
258258

259-
set(EXPANDED_EXTENSION_DIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_EXTENSION_DIR@,${CMAKE_INSTALL_PREFIX}>")
259+
set(PHP_EXTENSION_DIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@PHP_EXTENSION_DIR@,${CMAKE_INSTALL_PREFIX}>")
260260

261261
if("@CMAKE_SYSTEM_NAME@" STREQUAL "Windows")
262-
set(PHP_INCLUDE_PATH ".;${PEAR_INSTALLDIR}")
262+
set(PHP_INCLUDE_PATH ".;${PHP_PEAR_INSTALLDIR}")
263263
else()
264-
set(PHP_INCLUDE_PATH ".:${PEAR_INSTALLDIR}")
264+
set(PHP_INCLUDE_PATH ".:${PHP_PEAR_INSTALLDIR}")
265265
endif()
266266

267267
set(PHP_LIBDIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,@CMAKE_INSTALL_LIBDIR@,${CMAKE_INSTALL_PREFIX}>")
@@ -301,12 +301,14 @@ function(_php_main_configure_build_defs)
301301
# Regenerate file on the install step when using different installation prefix
302302
# at the 'cmake --install ... --prefix <install-prefix>' phase.
303303
string(CONFIGURE [[
304-
@code@
305-
configure_file(
306-
"@PHP_SOURCE_DIR@/main/cmake/build-defs.h.in"
307-
"@PHP_BINARY_DIR@/$<CONFIG>/main/build-defs.h"
308-
@ONLY
309-
)
304+
block()
305+
@code@
306+
configure_file(
307+
"@PHP_SOURCE_DIR@/main/cmake/build-defs.h.in"
308+
"@PHP_BINARY_DIR@/$<CONFIG>/main/build-defs.h"
309+
@ONLY
310+
)
311+
endblock()
310312
]] code @ONLY)
311313
install(CODE "${code}")
312314
endfunction()

cmake/main/cmake/build-defs.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212
#cmakedefine CONFIGURE_COMMAND "@CONFIGURE_COMMAND@"
1313

1414
/* The path to the PEAR installation directory. */
15-
#define PEAR_INSTALLDIR "@PEAR_INSTALLDIR@"
15+
#define PEAR_INSTALLDIR "@PHP_PEAR_INSTALLDIR@"
1616

1717
/* The path to the directory containing command-line executables (bin). */
1818
#define PHP_BINDIR "@PHP_BINDIR@"
1919

2020
/* The path to the directory in which PHP looks for the php.ini configuration
2121
file. On Windows this macro isn't utilized in the C code. */
22-
#define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@"
22+
#define PHP_CONFIG_FILE_PATH "@PHP_CONFIG_FILE_PATH@"
2323

2424
/* The path to the directory where PHP scans for additional INI
2525
configuration files. */
26-
#define PHP_CONFIG_FILE_SCAN_DIR "@EXPANDED_PHP_CONFIG_FILE_SCAN_DIR@"
26+
#define PHP_CONFIG_FILE_SCAN_DIR "@PHP_CONFIG_FILE_SCAN_DIR@"
2727

2828
/* The path to the directory containing architecture-independent data
2929
(share). */
3030
#define PHP_DATADIR "@PHP_DATADIR@"
3131

3232
/* The default path to the directory containing dynamically loadable PHP
3333
extensions. */
34-
#define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@"
34+
#define PHP_EXTENSION_DIR "@PHP_EXTENSION_DIR@"
3535

3636
/* The default 'include_path' PHP INI directive. */
3737
#define PHP_INCLUDE_PATH "@PHP_INCLUDE_PATH@"

cmake/sapi/fpm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ block()
690690
endblock()
691691

692692
################################################################################
693-
# Configure init.d.php-fpm.
693+
# Configure php-fpm.service.
694694
################################################################################
695695

696696
block()

0 commit comments

Comments
 (0)