Skip to content

Commit 79bc9e9

Browse files
committed
Further sync configuration output and messages
1 parent 1d833f0 commit 79bc9e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+230
-159
lines changed

cmake/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ include(cmake/Testing.cmake)
7575
include(cmake/CPack.cmake)
7676

7777
include(PHP/FeatureSummary)
78+
php_feature_summary()
7879

7980
message(
8081
STATUS

cmake/cmake/ConfigureChecks.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,5 +837,5 @@ endif()
837837
add_feature_info(
838838
"Valgrind"
839839
PHP_VALGRIND
840-
"support for dynamic analysis"
840+
"dynamic analysis"
841841
)

cmake/cmake/modules/FindFFI.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ set_package_properties(
2727
FFI
2828
PROPERTIES
2929
URL "https://sourceware.org/libffi/"
30-
DESCRIPTION "Foreign Function Interfaces library"
30+
DESCRIPTION "Foreign Function Interface library"
3131
)
3232

3333
set(_reason "")

cmake/cmake/modules/PHP/FeatureSummary.cmake

Lines changed: 105 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,136 @@ summary alphabetically and categorizes enabled features into SAPIs, extensions,
88
and other global PHP features. Common misconfiguration issues are summarized
99
together with missing required system packages.
1010
11-
https://cmake.org/cmake/help/latest/module/FeatureSummary.html
11+
See also: https://cmake.org/cmake/help/latest/module/FeatureSummary.html
12+
13+
## Basic usage
14+
15+
```cmake
16+
# CMakeLists.txt
17+
18+
# Include module and output configuration summary
19+
include(PHP/FeatureSummary)
20+
php_feature_summary()
21+
```
22+
23+
## Functions
24+
25+
Output PHP configuration summary:
26+
27+
```cmake
28+
php_feature_summary()
29+
```
1230
#]=============================================================================]
1331

1432
include_guard(GLOBAL)
1533

1634
include(FeatureSummary)
1735

18-
# Output summary prelude.
19-
block()
36+
# Add new item to the summary preamble with dotted leader:
37+
# " * <what> ..................... : <value>"
38+
function(php_feature_summary_preamble_add_item what value output)
39+
if(${output})
40+
# If preamble is already set, get first line to calculate column width:
41+
string(REGEX MATCH "^ \\\* ([^\r\n]+ [.]+) : " _ "${${output}}")
42+
else()
43+
# Helper template to calculate column width:
44+
set(template " * <what> ..................... : <value>")
45+
string(REGEX MATCH [[^ \* (<what> [.]+)]] _ "${template}")
46+
endif()
47+
48+
string(LENGTH "${CMAKE_MATCH_1}" width)
49+
string(LENGTH "${what}" length)
50+
math(EXPR numberOfDots "${width} - ${length} - 1")
51+
52+
if(numberOfDots GREATER 0)
53+
string(REPEAT "." ${numberOfDots} leader)
54+
set(leader " ${leader} ")
55+
else()
56+
set(leader)
57+
endif()
58+
59+
string(APPEND ${output} " * ${what}${leader}: ${value}\n")
60+
set("${output}" "${${output}}" PARENT_SCOPE)
61+
endfunction()
62+
63+
# Get summary preamble.
64+
function(php_feature_summary_preamble result)
2065
get_target_property(zendVersion Zend::Zend VERSION)
2166
get_target_property(zendExtensionApiNumber Zend::Zend ZEND_EXTENSION_API_NO)
2267
get_target_property(zendModuleApiNumber Zend::Zend ZEND_MODULE_API_NO)
2368

24-
set(info)
69+
set(preamble)
2570
string(
2671
APPEND
27-
info
72+
preamble
2873
" * PHP version ................ : ${PHP_VERSION}\n"
2974
" * PHP API version ............ : ${PHP_API_VERSION}\n"
3075
" * Zend Engine version ........ : ${zendVersion}\n"
3176
" * Zend extension API number .. : ${zendExtensionApiNumber}\n"
3277
" * Zend module API number ..... : ${zendModuleApiNumber}\n"
33-
" * C compiler ................. : ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} (${CMAKE_C_COMPILER})\n"
3478
)
3579

80+
if(CMAKE_C_COMPILER_LOADED)
81+
set(compiler)
82+
if(CMAKE_C_COMPILER_ID)
83+
string(APPEND compiler "${CMAKE_C_COMPILER_ID}")
84+
endif()
85+
if(CMAKE_C_COMPILER_VERSION)
86+
string(APPEND compiler " ${CMAKE_C_COMPILER_VERSION}")
87+
endif()
88+
string(STRIP "${compiler}" compiler)
89+
if(compiler)
90+
string(APPEND compiler " (${CMAKE_C_COMPILER})")
91+
else()
92+
string(APPEND compiler "${CMAKE_C_COMPILER}")
93+
endif()
94+
php_feature_summary_preamble_add_item("C compiler" "${compiler}" preamble)
95+
endif()
96+
3697
if(CMAKE_CXX_COMPILER_LOADED)
37-
string(
38-
APPEND
39-
info
40-
" * CXX compiler ............... : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} (${CMAKE_CXX_COMPILER})\n"
41-
)
98+
set(compiler)
99+
if(CMAKE_CXX_COMPILER_ID)
100+
string(APPEND compiler "${CMAKE_CXX_COMPILER_ID}")
101+
endif()
102+
if(CMAKE_CXX_COMPILER_VERSION)
103+
string(APPEND compiler " ${CMAKE_CXX_COMPILER_VERSION}")
104+
endif()
105+
string(STRIP "${compiler}" compiler)
106+
if(compiler)
107+
string(APPEND compiler " (${CMAKE_CXX_COMPILER})")
108+
else()
109+
string(APPEND compiler "${CMAKE_CXX_COMPILER}")
110+
endif()
111+
php_feature_summary_preamble_add_item("CXX compiler" "${compiler}" preamble)
42112
endif()
43113

44-
string(
45-
APPEND
46-
info
47-
" * Install prefix ............. : ${CMAKE_INSTALL_PREFIX}\n"
48-
)
114+
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
115+
if(isMultiConfig)
116+
set(buildType "Multi-config generator")
117+
elseif(CMAKE_BUILD_TYPE)
118+
set(buildType "${CMAKE_BUILD_TYPE}")
119+
else()
120+
set(buildType "N/A")
121+
endif()
122+
123+
php_feature_summary_preamble_add_item("Build type" "${buildType}" preamble)
124+
php_feature_summary_preamble_add_item("Install prefix" "${CMAKE_INSTALL_PREFIX}" preamble)
125+
126+
set(${result} "${preamble}" PARENT_SCOPE)
127+
endfunction()
128+
129+
# Output configuration summary.
130+
function(php_feature_summary)
131+
php_feature_summary_preamble(preamble)
49132

50133
message(STATUS "")
51134
message(STATUS "")
52-
message(STATUS "PHP summary")
53-
message(STATUS "===========\n\n${info}")
54-
endblock()
135+
message(STATUS "PHP configuration summary")
136+
message(STATUS "=========================\n\n${preamble}")
55137

56-
# Output enabled features.
57-
block()
138+
# Output enabled features.
58139
get_property(enabledFeatures GLOBAL PROPERTY ENABLED_FEATURES)
59-
60-
if(enabledFeatures)
61-
list(REMOVE_DUPLICATES enabledFeatures)
62-
endif()
63-
140+
list(REMOVE_DUPLICATES enabledFeatures)
64141
list(SORT enabledFeatures COMPARE NATURAL CASE INSENSITIVE)
65142

66143
set(php "")
@@ -116,10 +193,8 @@ block()
116193
if(extensions)
117194
message(STATUS "Enabled PHP extensions:\n\n${extensions}")
118195
endif()
119-
endblock()
120196

121-
# Get missing extensions.
122-
block()
197+
# Get missing extensions.
123198
set(missingExtensions "")
124199
set(sharedExtensionsSummary "")
125200

@@ -216,4 +291,4 @@ block()
216291
QUIET_ON_EMPTY
217292
DESCRIPTION "The following REQUIRED packages have not been found:\n"
218293
)
219-
endblock()
294+
endfunction()

cmake/cmake/modules/PHP/ThreadSafety.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ endfunction()
9393
# automatic enabling in the configuration phase shouldn't be encouraged.
9494
cmake_language(
9595
DEFER
96-
DIRECTORY ${PHP_SOURCE_DIR}
97-
ID 1 # Run before other calls so ZTS variable is added in main/php_config.h.
96+
DIRECTORY ${PHP_SOURCE_DIR}
97+
ID 1 # Run before other calls so ZTS variable is added in main/php_config.h.
9898
CALL _php_thread_safety
9999
)

cmake/cmake/presets/all-enabled.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@
113113
"EXT_OPENSSL_KERBEROS": true,
114114
"EXT_OPENSSL_SYSTEM_CIPHERS": true,
115115
"EXT_PCRE_EXTERNAL": true,
116+
"EXT_PDO_MYSQL_DRIVER": "mysql",
116117
"EXT_SESSION_MM": true,
117-
"EXT_STANDARD_EXTERNAL_CRYPT": true,
118+
"EXT_STANDARD_CRYPT_EXTERNAL": true,
118119
"EXT_XML_EXPAT": true
119120
}
120121
},

cmake/cmake/toolchains/template.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ set(HAVE_FLUSHIO_EXITCODE 1)
166166
set(HAVE_FNMATCH_EXITCODE 0)
167167

168168
# Set the exit codes for the algos checks when using external crypt library
169-
# (EXT_STANDARD_EXTERNAL_CRYPT).
169+
# (EXT_STANDARD_CRYPT_EXTERNAL).
170170
set(_PHP_CRYPT_HAVE_BLOWFISH_EXITCODE 0)
171171
set(_PHP_CRYPT_HAVE_EXT_DES_EXITCODE 0)
172172
set(_PHP_CRYPT_HAVE_MD5_EXITCODE 0)

cmake/ext/ctype/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ option(EXT_CTYPE "Enable the ctype extension" ON)
3434
add_feature_info(
3535
"ext/ctype"
3636
EXT_CTYPE
37-
"support for character type checking according to the locale"
37+
"character type checking according to the locale"
3838
)
3939

4040
cmake_dependent_option(

0 commit comments

Comments
 (0)