Skip to content

Commit 9cdeead

Browse files
committed
Extend FindPHP.cmake module
This enables using the same find module in various scenarios: - building PHP extension with CMake - building application with embedded PHP - finding only PHP executable
1 parent 8ffa4a7 commit 9cdeead

File tree

13 files changed

+910
-373
lines changed

13 files changed

+910
-373
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,19 @@ jobs:
149149
run: |
150150
cd php-${{ matrix.php }}
151151
ctest --preset all-enabled
152+
153+
- name: Install PHP
154+
run: |
155+
cd php-${{ matrix.php }}
156+
cmake --install php-build/all-enabled
157+
158+
- name: Setup shared standalone extension
159+
run: |
160+
cd php-${{ matrix.php }}
161+
php ext/ext_skel.php --ext phantom
162+
mkdir ext/phantom/cmake/modules
163+
cp cmake/modules/FindPHP.cmake ext/phantom/cmake/modules
164+
cmake -S ext/phantom -B ext/phantom/cmake-build
165+
cmake --build ext/phantom/cmake-build -j
166+
cmake --install ext/phantom/cmake-build
167+
#php -d extension=phantom -m | grep phantom

bin/check-cmake.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function checkCMakeInclude(Iterator $files, array $modules): int
327327
};
328328

329329
/**
330-
* Check if given string is regular expression.
330+
* Check if given string is a regular expression.
331331
*/
332332
function isRegularExpression(string $string): bool
333333
{

cmake/cmake/CMakeDefaults.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html
88
include_guard(GLOBAL)
99

1010
# Set CMake module paths where include() and find_package() look for modules.
11-
if(NOT ${CMAKE_CURRENT_LIST_DIR}/modules IN_LIST CMAKE_MODULE_PATH)
12-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
13-
endif()
11+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
1412

1513
# Automatically include current source or build tree for the current target.
1614
set(CMAKE_INCLUDE_CURRENT_DIR ON)

cmake/cmake/Platform.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include(PHP/SystemExtensions)
2323
# _GNU_SOURCE.
2424
target_link_libraries(php_config INTERFACE PHP::SystemExtensions)
2525

26-
# Set installation directories.
26+
# Set GNU standard installation directories.
2727
include(GNUInstallDirs)
2828

2929
# Detect C standard library implementation.

cmake/cmake/Requirements.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,4 @@ find_package(Sendmail)
5656
# used at the build phase, where possible. The minimum version should match the
5757
# version required to run these PHP scripts.
5858
################################################################################
59-
block(PROPAGATE PHP_FOUND)
60-
find_package(PHP 7.4)
61-
endblock()
59+
find_package(PHP 7.4 COMPONENTS Interpreter)

0 commit comments

Comments
 (0)