Skip to content

Commit 9be4957

Browse files
committed
Add various improvements
- Added initial deplister executable to Windows. - Added new custom target property PHP_EXTENSION to be able to pick PHP extensions from a list of all targets more easily in generator expressions and similar (for the future changes). - More checks refactored. - Updated documentation of some modules.
1 parent b04c86e commit 9be4957

14 files changed

+485
-242
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -428,47 +428,8 @@ cmake_pop_check_state()
428428
check_symbol_exists(pthread_stackseg_np pthread.h HAVE_PTHREAD_STACKSEG_NP)
429429
check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP)
430430

431-
message(CHECK_START "Checking for asm goto support")
432-
cmake_push_check_state(RESET)
433-
set(CMAKE_REQUIRED_QUIET TRUE)
434-
check_source_compiles(C [[
435-
int main(void)
436-
{
437-
#if defined(__x86_64__) || defined(__i386__)
438-
__asm__ goto("jmp %l0\n" :::: end);
439-
#elif defined(__aarch64__)
440-
__asm__ goto("b %l0\n" :::: end);
441-
#endif
442-
end:
443-
return 0;
444-
}
445-
]] HAVE_ASM_GOTO)
446-
cmake_pop_check_state()
447-
if(HAVE_ASM_GOTO)
448-
message(CHECK_PASS "yes")
449-
else()
450-
message(CHECK_FAIL "no")
451-
endif()
452-
453-
message(CHECK_START "Checking whether __cpuid_count is available")
454-
cmake_push_check_state(RESET)
455-
set(CMAKE_REQUIRED_QUIET TRUE)
456-
check_source_compiles(C [[
457-
#include <cpuid.h>
458-
int main(void)
459-
{
460-
unsigned eax, ebx, ecx, edx;
461-
__cpuid_count(0, 0, eax, ebx, ecx, edx);
462-
return 0;
463-
}
464-
]] HAVE_CPUID_COUNT)
465-
cmake_pop_check_state()
466-
if(HAVE_CPUID_COUNT)
467-
message(CHECK_PASS "yes")
468-
else()
469-
message(CHECK_FAIL "no")
470-
endif()
471-
431+
include(cmake/CheckAsmGoto.cmake)
432+
include(cmake/CheckCpuidCount.cmake)
472433
include(cmake/CheckDlsym.cmake)
473434
include(cmake/CheckFloatPrecision.cmake)
474435

@@ -507,9 +468,6 @@ add_feature_info(
507468
################################################################################
508469

509470
include(cmake/MaxExecutionTimers.cmake)
510-
if(TARGET Zend::MaxExecutionTimers)
511-
target_link_libraries(zend PUBLIC Zend::MaxExecutionTimers)
512-
endif()
513471

514472
################################################################################
515473
# Generate parser and lexer files.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#[=============================================================================[
2+
Check whether the C compiler has support for the asm goto.
3+
4+
Result variables:
5+
6+
* HAVE_ASM_GOTO
7+
#]=============================================================================]
8+
9+
include_guard(GLOBAL)
10+
11+
include(CheckSourceCompiles)
12+
include(CMakePushCheckState)
13+
14+
set(HAVE_ASM_GOTO FALSE)
15+
16+
# Skip in consecutive configuration phases.
17+
if(DEFINED PHP_ZEND_HAS_ASM_GOTO)
18+
if(PHP_ZEND_HAS_ASM_GOTO)
19+
set(HAVE_ASM_GOTO TRUE)
20+
endif()
21+
return()
22+
endif()
23+
24+
# TODO: The check in this module otherwise passes on Windows. Should this be
25+
# enabled on Windows?
26+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
27+
return()
28+
endif()
29+
30+
message(CHECK_START "Checking for asm goto support")
31+
cmake_push_check_state(RESET)
32+
set(CMAKE_REQUIRED_QUIET TRUE)
33+
check_source_compiles(C [[
34+
int main(void)
35+
{
36+
#if defined(__x86_64__) || defined(__i386__)
37+
__asm__ goto("jmp %l0\n" :::: end);
38+
#elif defined(__aarch64__)
39+
__asm__ goto("b %l0\n" :::: end);
40+
#endif
41+
end:
42+
return 0;
43+
}
44+
]] PHP_ZEND_HAS_ASM_GOTO)
45+
cmake_pop_check_state()
46+
47+
if(PHP_ZEND_HAS_ASM_GOTO)
48+
set(HAVE_ASM_GOTO TRUE)
49+
message(CHECK_PASS "yes")
50+
else()
51+
message(CHECK_FAIL "no")
52+
endif()
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#[=============================================================================[
2+
Check for the __cpuid_count support.
3+
4+
Result variables:
5+
6+
* HAVE_CPUID_COUNT
7+
#]=============================================================================]
8+
9+
include_guard(GLOBAL)
10+
11+
include(CheckSourceCompiles)
12+
include(CMakePushCheckState)
13+
14+
set(HAVE_CPUID_COUNT FALSE)
15+
16+
# Skip in consecutive configuration phases.
17+
if(DEFINED PHP_ZEND_HAS_CPUID_COUNT)
18+
if(PHP_ZEND_HAS_CPUID_COUNT)
19+
set(HAVE_CPUID_COUNT TRUE)
20+
endif()
21+
return()
22+
endif()
23+
24+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
25+
return()
26+
endif()
27+
28+
message(CHECK_START "Checking whether __cpuid_count is available")
29+
cmake_push_check_state(RESET)
30+
set(CMAKE_REQUIRED_QUIET TRUE)
31+
check_source_compiles(C [[
32+
#include <cpuid.h>
33+
int main(void)
34+
{
35+
unsigned eax, ebx, ecx, edx;
36+
__cpuid_count(0, 0, eax, ebx, ecx, edx);
37+
return 0;
38+
}
39+
]] PHP_ZEND_HAS_CPUID_COUNT)
40+
cmake_pop_check_state()
41+
42+
if(PHP_ZEND_HAS_CPUID_COUNT)
43+
set(HAVE_CPUID_COUNT TRUE)
44+
message(CHECK_PASS "yes")
45+
else()
46+
message(CHECK_FAIL "no")
47+
endif()

0 commit comments

Comments
 (0)