Skip to content

Commit 2d214af

Browse files
committed
Specify dependencies between extensions and main targets
- Additionally, some unused Markdown simplified.
1 parent 35a152b commit 2d214af

File tree

5 files changed

+46
-23
lines changed

5 files changed

+46
-23
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
#[=============================================================================[
22
Zend Engine.
33
4-
## Targets
4+
Targets:
55
6-
* OBJECT library `zend` (ALIAS `Zend::Zend`) holds all Zend Engine objects
7-
and compile properties.
6+
* OBJECT library 'zend' (ALIAS Zend::Zend) holds all Zend Engine objects and
7+
compile properties.
88
9-
## Target properties
9+
Target properties:
1010
11-
CMake target properties for the `Zend::Zend` target:
11+
CMake target properties for the Zend::Zend target:
1212
13-
* `VERSION`
14-
15-
Zend Engine version as defined in the `Zend/zend.h` file.
16-
17-
* `ZEND_EXTENSION_API_NO`
13+
* VERSION
14+
Zend Engine version as defined in the Zend/zend.h file.
1815
16+
* ZEND_EXTENSION_API_NO
1917
Custom target property with internal API version number for PHP extensions
20-
(dynamically loaded with the `extension` INI directive). This is the
21-
`ZEND_MODULE_API_NO` number from the `Zend/zend_modules.h` and ensures that
22-
built extension is compatible with particular PHP build.
23-
24-
* `ZEND_MODULE_API_NO`
18+
(dynamically loaded with the 'extension' INI directive). This is the
19+
ZEND_MODULE_API_NO number from the Zend/zend_modules.h and ensures that built
20+
extension is compatible with particular PHP build.
2521
22+
* ZEND_MODULE_API_NO
2623
Custom target property with internal API version number for Zend extensions in
27-
PHP (dynamically loaded with the `zend_extension` INI directive), such as
28-
opcache, debuggers, profilers, etc. This is the `ZEND_EXTENSION_API_NO` number
29-
from the `Zend/zend_extensions.h` and ensures that built extension is
30-
compatible with particular PHP build.
24+
PHP (dynamically loaded with the 'zend_extension' INI directive), such as
25+
opcache, debuggers, profilers, etc. This is the ZEND_EXTENSION_API_NO number
26+
from the Zend/zend_extensions.h and ensures that built extension is compatible
27+
with particular PHP build.
3128
#]=============================================================================]
3229

3330
message(STATUS "")

cmake/cmake/Version.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ number from the php-src main/php.h header file.
66
77
Variables:
88
9-
* `PHP_API_VERSION`
10-
* `PHP_VERSION`
11-
* `PHP_VERSION_LABEL`
9+
* PHP_API_VERSION
10+
* PHP_VERSION
11+
* PHP_VERSION_LABEL
1212
#]=============================================================================]
1313

1414
include_guard(GLOBAL)

cmake/ext/standard/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,16 @@ target_sources(
497497
add_dependencies(php_ext_standard_functions php_ext_standard)
498498
add_dependencies(php_ext_standard_functions_cli php_ext_standard)
499499

500+
################################################################################
501+
# ext/standard depends on ext/zlib for SWC images and transitively depends on
502+
# the zlib library.
503+
# TODO: https://github.com/php/php-src/pull/4681
504+
################################################################################
505+
506+
if(PHP_EXT_ZLIB)
507+
add_dependencies(php_ext_standard php_ext_zlib)
508+
endif()
509+
500510
################################################################################
501511
# Configuration header
502512
################################################################################

cmake/ext/zlib/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ set_package_properties(
8585
PURPOSE "Necessary to enable the zlib extension."
8686
)
8787

88-
target_link_libraries(php_ext_zlib PRIVATE ZLIB::ZLIB)
88+
# Link publicly for internal_functions files.
89+
target_link_libraries(php_ext_zlib PUBLIC ZLIB::ZLIB)
8990

9091
set(HAVE_ZLIB TRUE)
9192

cmake/main/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ target_sources(php_sapi INTERFACE $<TARGET_OBJECTS:PHP::main>)
130130
# Add FastCGI target with objects for use in PHP SAPIs such as CGI and FPM.
131131
################################################################################
132132
add_library(php_main_fastcgi OBJECT fastcgi.c)
133+
add_dependencies(php_main_fastcgi php_main)
133134

134135
target_sources(
135136
php_sapi
@@ -144,6 +145,8 @@ target_sources(
144145

145146
add_library(php_main_internal_functions OBJECT internal_functions.c)
146147
add_library(php_main_internal_functions_cli OBJECT internal_functions_cli.c)
148+
add_dependencies(php_main_internal_functions php_main)
149+
add_dependencies(php_main_internal_functions_cli php_main)
147150

148151
target_sources(
149152
php_sapi
@@ -229,6 +232,18 @@ file(CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/php_version.h CONTENT [[
229232
#define PHP_VERSION_ID @PHP_VERSION_ID@
230233
]])
231234

235+
################################################################################
236+
# When building external libraries with ExternalProject module, the library (and
237+
# its accompanying extension) should be built before the main target so the
238+
# internal functions files have possible library headers available when used in
239+
# extension headers (for example, php_openssl.h, php_zlib.h, etc.).
240+
################################################################################
241+
242+
get_property(extensions GLOBAL PROPERTY PHP_EXTENSIONS)
243+
foreach(extension IN LISTS extensions)
244+
add_dependencies(php_main PHP::ext::${extension})
245+
endforeach()
246+
232247
################################################################################
233248
# Generate configuration headers.
234249
################################################################################

0 commit comments

Comments
 (0)