Skip to content

Commit 2fbd557

Browse files
committed
Update embed SAPI names
1 parent 3b70adf commit 2fbd557

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

cmake/sapi/embed/CMakeLists.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ Configure the `embed` PHP SAPI.
1111
Enable the embedded PHP SAPI module for embedding PHP into application using C
1212
bindings.
1313
14-
The embed library is then located in the `sapi/embed` directory as a shared
15-
library `libphp.so`, or a static library `libphp.a`, which can be further used
16-
in other applications. It exposes PHP API as C library object for other programs
17-
to use PHP.
14+
The embed library is then located in the `sapi/embed` directory:
15+
* as a shared library `libphp.so` (\*nix), or `libphp.dylib` (macOS), or
16+
`phpembed.dll` (Windows)
17+
* and a static library `libphp.a` (\*nix), or `phpembed.lib` (Windows)
18+
19+
which can be further used in other applications. It exposes PHP API as C library
20+
for other programs to use PHP.
1821
#]=============================================================================]
1922

2023
include(FeatureSummary)
@@ -52,10 +55,25 @@ foreach(target IN ITEMS php_sapi_embed php_sapi_embed_shared)
5255

5356
target_compile_definitions(${target} PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
5457

58+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
59+
set_target_properties(
60+
${target}
61+
PROPERTIES
62+
PREFIX ""
63+
OUTPUT_NAME ${PHP_PROGRAM_PREFIX}phpembed${PHP_PROGRAM_SUFFIX}
64+
)
65+
else()
66+
set_target_properties(
67+
${target}
68+
PROPERTIES
69+
PREFIX lib
70+
OUTPUT_NAME ${PHP_PROGRAM_PREFIX}php${PHP_PROGRAM_SUFFIX}
71+
)
72+
endif()
73+
5574
set_target_properties(
5675
${target}
5776
PROPERTIES
58-
OUTPUT_NAME libphp
5977
ENABLE_EXPORTS TRUE # TODO: Check if there's a better solution.
6078
PHP_CLI TRUE
6179
)
@@ -81,6 +99,7 @@ php_pkgconfig_generate_pc(
8199
PHP_CONFIG_FILE_PATH "$<PATH:ABSOLUTE_PATH,NORMALIZE,${PHP_CONFIG_FILE_PATH},$<INSTALL_PREFIX>>"
82100
PHP_DEBUG "$<IF:$<CONFIG:Debug,DebugAssertions>,yes,no>"
83101
PHP_THREAD_SAFETY "$<IF:$<BOOL:$<TARGET_PROPERTY:PHP::config,PHP_THREAD_SAFETY>>,yes,no>"
102+
PHP_EMBED_SAPI_NAME "$<GENEX_EVAL:$<TARGET_PROPERTY:php_sapi_embed_shared,OUTPUT_NAME>>"
84103
)
85104

86105
install(

cmake/sapi/embed/php-embed.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ Version: @PHP_VERSION@
3535
Cflags.private: @PHP_CFLAGS_PRIVATE@
3636
Cflags: -I${includedir}/${php_include_prefix} -I${includedir}/${php_include_prefix}/main -I${includedir}/${php_include_prefix}/TSRM -I${includedir}/${php_include_prefix}/Zend -I${includedir}/${php_include_prefix}/ext
3737
Libs.private: @PHP_LIBS_PRIVATE@
38-
Libs: -L${libdir} -lphp
38+
Libs: -L${libdir} -l@PHP_EMBED_SAPI_NAME@

0 commit comments

Comments
 (0)