Skip to content

Commit 7c499f7

Browse files
committed
Enable Assembly language with dialect
- Windows requires ASM_MASM or ASM_MARMASM (the generic ASM works only for Unix-alike systems). - Public headers in win32 refactored a bit, to bypass the include flags appended by CMake (the BASE_DIRS set accordingly).
1 parent 5ddbeb4 commit 7c499f7

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

cmake/CMakeLists.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,38 @@ project(
1414
VERSION ${PHP_VERSION}
1515
DESCRIPTION "Widely-used general-purpose scripting language"
1616
HOMEPAGE_URL "https://www.php.net"
17-
LANGUAGES C ASM
17+
LANGUAGES C
1818
)
1919

20+
################################################################################
21+
# Configure languages.
22+
################################################################################
23+
24+
# Optionally enable C++ language for PHP extensions.
25+
include(CheckLanguage)
26+
check_language(CXX)
27+
if(CMAKE_CXX_COMPILER)
28+
enable_language(CXX)
29+
endif()
30+
31+
# Enable Assembly language dialect.
32+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
33+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^ARM")
34+
enable_language(ASM_MARMASM)
35+
else()
36+
enable_language(ASM_MASM)
37+
endif()
38+
else()
39+
enable_language(ASM)
40+
endif()
41+
2042
set(CMAKE_C_STANDARD 99)
2143
set(CMAKE_C_STANDARD_REQUIRED TRUE)
2244

45+
################################################################################
2346
# Configure project.
47+
################################################################################
48+
2449
include(cmake/Bootstrap.cmake)
2550

2651
add_subdirectory(sapi)

cmake/Zend/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,20 @@ project(
4242
Zend
4343
VERSION ${Zend_VERSION}
4444
DESCRIPTION "Zend Engine library"
45-
LANGUAGES C ASM
45+
LANGUAGES C
4646
)
4747

48+
# Enable Assembly language dialect.
49+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
50+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^ARM")
51+
enable_language(ASM_MARMASM)
52+
else()
53+
enable_language(ASM_MASM)
54+
endif()
55+
else()
56+
enable_language(ASM)
57+
endif()
58+
4859
include(CheckIncludeFiles)
4960
include(CheckSourceCompiles)
5061
include(CheckSymbolExists)

cmake/cmake/Bootstrap.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ define_property(
1616
BRIEF_DOCS "Whether the PHP SAPI is FastCGI-based"
1717
)
1818

19-
# Optionally enable CXX for extensions.
20-
include(CheckLanguage)
21-
check_language(CXX)
22-
if(CMAKE_CXX_COMPILER)
23-
enable_language(CXX)
24-
endif()
25-
2619
# Check whether IPO/LTO can be enabled.
2720
include(PHP/Optimization)
2821

cmake/win32/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ target_sources(
3737
wsyslog.c
3838
PUBLIC
3939
FILE_SET HEADERS
40+
BASE_DIRS ${PHP_SOURCE_DIR}
4041
FILES
4142
codepage.h
4243
console.h
@@ -62,7 +63,7 @@ target_sources(
6263
PUBLIC
6364
FILE_SET generated
6465
TYPE HEADERS
65-
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}
66+
BASE_DIRS ${PHP_BINARY_DIR}
6667
FILES
6768
${CMAKE_CURRENT_BINARY_DIR}/wsyslog.h
6869
)
@@ -191,7 +192,7 @@ install(
191192
TARGETS php_windows
192193
ARCHIVE EXCLUDE_FROM_ALL
193194
FILE_SET HEADERS
194-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/win32
195+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}
195196
FILE_SET generated
196-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/win32
197+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}
197198
)

0 commit comments

Comments
 (0)