Skip to content

Commit cac2ba9

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents f537960 + 7723adb commit cac2ba9

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

cmake/cmake/BuildTypes.cmake

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ block()
2020
else()
2121
set(
2222
allowedBuildTypes
23-
Debug # Debug info, assertions, not optimized.
24-
DebugAssertions # Custom PHP debug build type with assertions enabled
25-
# in the RelWithDebInfo mode: optimized, debug info,
26-
# assertions.
23+
Debug # Not optimized, debug info, assertions.
24+
DebugAssertions # Custom PHP debug build type based on RelWithDebInfo:
25+
# optimized, debug info, assertions.
2726
MinSizeRel # Same as Release but optimized for size rather than
2827
# speed.
29-
Release # No debug info, no assertions, optimized.
30-
RelWithDebInfo # Debug info, optimized, no assertions.
28+
Release # Optimized, no debug info, no assertions.
29+
RelWithDebInfo # Optimized, debug info, no assertions.
3130
)
3231

3332
set_property(
@@ -48,19 +47,22 @@ block()
4847
endif()
4948
endblock()
5049

51-
target_compile_definitions(
52-
php_configuration
53-
INTERFACE
54-
$<IF:$<CONFIG:Debug,DebugAssertions>,ZEND_DEBUG=1,ZEND_DEBUG=0>
55-
)
56-
5750
# Set CMAKE_<LANG>_FLAGS_<CONFIG> variables for the DebugAssertions build type.
58-
foreach(prefix CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_ASM_FLAGS)
51+
# These should ideally be set for all languages needed for the project scope
52+
# before adding binary targets that need these flags (for example, PHP
53+
# extensions or SAPIs).
54+
foreach(lang C CXX ASM)
5955
string(
6056
REGEX REPLACE
6157
"(-DNDEBUG|/DNDEBUG)"
6258
""
63-
${prefix}_DEBUGASSERTIONS
64-
"${${prefix}_RELWITHDEBINFO}"
59+
CMAKE_${lang}_FLAGS_DEBUGASSERTIONS
60+
"${CMAKE_${lang}_FLAGS_RELWITHDEBINFO}"
6561
)
6662
endforeach()
63+
64+
target_compile_definitions(
65+
php_configuration
66+
INTERFACE
67+
$<IF:$<CONFIG:Debug,DebugAssertions>,ZEND_DEBUG=1,ZEND_DEBUG=0>
68+
)

cmake/cmake/Configuration.cmake

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,24 @@ set(
182182
)
183183
mark_as_advanced(PHP_EXTENSION_DIR)
184184

185+
# Assemble the PHP_EXTENSION_DIR default value.
185186
block()
186187
if(NOT PHP_EXTENSION_DIR)
187188
file(READ ${PHP_SOURCE_DIR}/Zend/zend_modules.h content)
188189
string(REGEX MATCH "#define ZEND_MODULE_API_NO ([0-9]*)" _ "${content}")
189-
set(zend_module_api_no ${CMAKE_MATCH_1})
190+
set(zendModuleApiNo ${CMAKE_MATCH_1})
190191

191-
set(extension_dir "${CMAKE_INSTALL_LIBDIR}/php")
192+
set(
193+
extensionDir
194+
"${CMAKE_INSTALL_LIBDIR}/php/${zendModuleApiNo}$<$<BOOL:$<TARGET_PROPERTY:php_configuration,PHP_THREAD_SAFETY>>:-zts>$<$<BOOL:$<CONFIG>>:-$<CONFIG>>"
195+
)
192196

193-
# This resembles the PHP Autotools --with-layout=GNU:
194-
set(extension_dir "${extension_dir}/${zend_module_api_no}")
195-
set(extension_dir "${extension_dir}$<$<BOOL:$<TARGET_PROPERTY:php_configuration,PHP_THREAD_SAFETY>>:-zts>")
196-
set(extension_dir "${extension_dir}$<$<CONFIG:Debug,DebugAssertions>:-debug>")
197-
# This would be the PHP Autotools --with-layout=PHP (default):
198-
# set(extension_dir "${extension_dir}/extensions")
199-
# set(extension_dir "${extension_dir}/$<IF:$<CONFIG:Debug,DebugAssertions>,debug,no-debug>")
200-
# set(extension_dir "${extension_dir}$<IF:$<BOOL:$<TARGET_PROPERTY:php_configuration,PHP_THREAD_SAFETY>>,-zts,-non-zts>")
201-
# set(extension_dir "${extension_dir}-${zend_module_api_no}")
197+
# This would resemble the PHP Autotools --with-layout=GNU:
198+
#set(extensionDir "${CMAKE_INSTALL_LIBDIR}/php/${zendModuleApiNo}$<$<BOOL:$<TARGET_PROPERTY:php_configuration,PHP_THREAD_SAFETY>>:-zts>$<$<CONFIG:Debug,DebugAssertions>:-debug>")
199+
# This would ressemble the PHP Autotools --with-layout=PHP (default):
200+
#set(extensionDir "${CMAKE_INSTALL_LIBDIR}/php/extensions/$<IF:$<CONFIG:Debug,DebugAssertions>,debug,no-debug>$<IF:$<BOOL:$<TARGET_PROPERTY:php_configuration,PHP_THREAD_SAFETY>>,-zts,-non-zts>-${zendModuleApiNo}")
202201

203-
set_property(CACHE PHP_EXTENSION_DIR PROPERTY VALUE "${extension_dir}")
202+
set_property(CACHE PHP_EXTENSION_DIR PROPERTY VALUE "${extensionDir}")
204203
endif()
205204
endblock()
206205

0 commit comments

Comments
 (0)