Skip to content

Commit f0edab9

Browse files
committed
Fine tune and fix some CS
1 parent 87179ea commit f0edab9

File tree

8 files changed

+24
-38
lines changed

8 files changed

+24
-38
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ if(TARGET Zend::MaxExecutionTimers)
523523
endif()
524524

525525
################################################################################
526-
# Generate lexers and parsers.
526+
# Generate lexer and parser files.
527527
################################################################################
528528

529529
include(cmake/GenerateGrammar.cmake)

cmake/Zend/cmake/GenerateGrammar.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#[=============================================================================[
2-
Generate lexer and parser files for Zend Engine.
3-
#]=============================================================================]
1+
# Generate lexer and parser files.
42

53
if(
64
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.c

cmake/cmake/modules/FindRE2C.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ These variables can be set before calling the `find_package(RE2C)`:
2626
2727
* `RE2C_DEFAULT_OPTIONS` - A semicolon-separated list of default global re2c
2828
options to be prepended to `re2c(OPTIONS)` argument for all re2c invocations
29-
when generating lexers.
29+
when generating lexer files.
3030
3131
* `RE2C_DISABLE_DOWNLOAD` - Set to `TRUE` to disable downloading and building
3232
RE2C package from source, when it is not found on the system or found version

cmake/cmake/scripts/GenerateCredits.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif()
1212
set(PHP_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../)
1313

1414
if(NOT EXISTS ${PHP_SOURCE_DIR}/ext/standard/credits.h)
15-
message(FATAL_ERROR "This script should be run inside the php-src repository")
15+
message(FATAL_ERROR "This script should be run in the php-src repository.")
1616
endif()
1717

1818
set(template [[

cmake/cmake/scripts/GenerateGrammar.cmake

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
#
66
# Run as:
77
#
8-
# cmake -P cmake/scripts/GenerateLexersParsers.cmake
8+
# cmake -P cmake/scripts/GenerateGrammar.cmake
99
#
1010
# To manually override bison and re2c executables:
1111
#
1212
# cmake \
1313
# [-D BISON_EXECUTABLE=path/to/bison] \
1414
# [-D RE2C_EXECUTABLE=path/to/re2c] \
15-
# -P cmake/scripts/GenerateLexersParsers.cmake
16-
#
17-
# TODO: Fix CS and fine tune this.
15+
# -P cmake/scripts/GenerateGrammar.cmake
1816
#
1917
# TODO: Should the Bison-generated report files (*.output) really be also
2018
# created by this script (the `VERBOSE REPORT_FILE <file>` options)? PHP still
@@ -32,10 +30,10 @@ endif()
3230
set(PHP_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
3331

3432
if(NOT EXISTS ${PHP_SOURCE_DIR}/main/php_version.h)
35-
message(FATAL_ERROR "This script should be run inside the php-src repository")
33+
message(FATAL_ERROR "This script should be run in the php-src repository.")
3634
endif()
3735

38-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../modules)
36+
list(APPEND CMAKE_MODULE_PATH ${PHP_SOURCE_DIR}/cmake/modules)
3937

4038
include(PHP/BISON)
4139
include(PHP/RE2C)
@@ -48,26 +46,16 @@ feature_summary(
4846
DEFAULT_DESCRIPTION
4947
)
5048

51-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/ext/json)
52-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/ext/json)
53-
include(${PHP_SOURCE_DIR}/ext/json/cmake/GenerateGrammar.cmake)
54-
55-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/ext/pdo)
56-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/ext/pdo)
57-
include(${PHP_SOURCE_DIR}/ext/pdo/cmake/GenerateGrammar.cmake)
58-
59-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/ext/phar)
60-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/ext/phar)
61-
include(${PHP_SOURCE_DIR}/ext/phar/cmake/GenerateGrammar.cmake)
62-
63-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/ext/standard)
64-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/ext/standard)
65-
include(${PHP_SOURCE_DIR}/ext/standard/cmake/GenerateGrammar.cmake)
66-
67-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/sapi/phpdbg)
68-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/sapi/phpdbg)
69-
include(${PHP_SOURCE_DIR}/sapi/phpdbg/cmake/GenerateGrammar.cmake)
70-
71-
set(CMAKE_CURRENT_SOURCE_DIR ${PHP_SOURCE_DIR}/Zend)
72-
set(CMAKE_CURRENT_BINARY_DIR ${PHP_SOURCE_DIR}/Zend)
73-
include(${PHP_SOURCE_DIR}/Zend/cmake/GenerateGrammar.cmake)
49+
file(
50+
GLOB_RECURSE scripts
51+
${PHP_SOURCE_DIR}/ext/*/cmake/GenerateGrammar.cmake
52+
${PHP_SOURCE_DIR}/sapi/*/cmake/GenerateGrammar.cmake
53+
${PHP_SOURCE_DIR}/Zend/cmake/GenerateGrammar.cmake
54+
)
55+
foreach(script IN LISTS scripts)
56+
cmake_path(GET script PARENT_PATH path)
57+
cmake_path(GET path PARENT_PATH path)
58+
set(CMAKE_CURRENT_SOURCE_DIR ${path})
59+
set(CMAKE_CURRENT_BINARY_DIR ${path})
60+
include(${script})
61+
endforeach()

cmake/ext/standard/cmake/GenerateGrammar.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generate lexers.
1+
# Generate lexer files.
22

33
if(
44
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/url_scanner_ex.c

cmake/sapi/phpdbg/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ if(PHP_SAPI_PHPDBG_SHARED)
242242
endif()
243243

244244
################################################################################
245-
# Generate lexers and parsers.
245+
# Generate lexer and parser files.
246246
################################################################################
247247

248248
include(cmake/GenerateGrammar.cmake)

cmake/sapi/phpdbg/cmake/GenerateGrammar.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generate lexers and parsers.
1+
# Generate lexer and parser files.
22

33
if(
44
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/phpdbg_parser.c

0 commit comments

Comments
 (0)