diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 08326bc6b..40f609725 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -36,7 +36,6 @@ message(STATUS "Configuring PHP") message(STATUS "---------------\n") add_subdirectory(pear) -add_subdirectory(TSRM) add_subdirectory(win32) add_subdirectory(main) add_subdirectory(scripts) diff --git a/cmake/TSRM/CMakeLists.txt b/cmake/TSRM/CMakeLists.txt deleted file mode 100644 index 8ecb90be6..000000000 --- a/cmake/TSRM/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -add_library(php_tsrm OBJECT) -add_library(PHP::TSRM ALIAS php_tsrm) - -target_sources( - php_tsrm - PRIVATE - $<$:tsrm_win32.c> - TSRM.c - PUBLIC - FILE_SET HEADERS - FILES - $<$:tsrm_win32.h> - TSRM.h -) - -target_link_libraries(php_tsrm PRIVATE PHP::configuration) - -target_include_directories(php_tsrm INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - -target_compile_definitions( - php_tsrm - PRIVATE - ZEND_ENABLE_STATIC_TSRMLS_CACHE=1 - $<$:TSRM_EXPORTS> - INTERFACE - # Pass transitively only to Zend::Zend library on Windows. - $<$,zend>,$>:TSRM_EXPORTS> -) - -install( - TARGETS php_tsrm - ARCHIVE EXCLUDE_FROM_ALL - FILE_SET HEADERS - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/TSRM -) diff --git a/cmake/Zend/CMakeLists.txt b/cmake/Zend/CMakeLists.txt index 802d182d3..1edace5eb 100644 --- a/cmake/Zend/CMakeLists.txt +++ b/cmake/Zend/CMakeLists.txt @@ -1,6 +1,11 @@ #[=============================================================================[ Zend Engine. +TSRM (Thread-Safe Resource Manager) is a separate directory in php-src as it was +once a standalone project. Here it is part of the Zend Engine as it is not meant +to be a separate library anymore. In the future, TSRM should ideally be +integrated into Zend Engine. + CMake target properties for the `Zend::Zend` (`zend`) target: * `VERSION` @@ -302,9 +307,6 @@ target_link_libraries( zend PRIVATE PHP::configuration - PUBLIC - PHP::TSRM - $ ) target_include_directories( @@ -318,6 +320,7 @@ target_compile_definitions( zend PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE=1 + PUBLIC $<$:LIBZEND_EXPORTS> ) @@ -666,3 +669,32 @@ install( FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/Zend ) + +################################################################################ +# Configure TSRM. +################################################################################ + +set(tsrmSourceDir ${CMAKE_CURRENT_SOURCE_DIR}/../TSRM) + +target_sources( + zend + PRIVATE + $<$:${tsrmSourceDir}/tsrm_win32.c> + ${tsrmSourceDir}/TSRM.c + PUBLIC + FILE_SET tsrm + TYPE HEADERS + BASE_DIRS ${tsrmSourceDir} + FILES + $<$:${tsrmSourceDir}/tsrm_win32.h> + ${tsrmSourceDir}/TSRM.h +) + +target_include_directories(zend PUBLIC ${tsrmSourceDir}) +target_compile_definitions(zend PUBLIC $<$:TSRM_EXPORTS>) + +install( + TARGETS zend + FILE_SET tsrm + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/TSRM +)