Skip to content

Commit b04af48

Browse files
committed
Sync Windows build
1 parent 9c497a1 commit b04af48

File tree

5 files changed

+57
-17
lines changed

5 files changed

+57
-17
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,9 @@ php_search_libraries(
703703
# The gai_strerror() is mostly in C library (Solaris 11.4...)
704704
php_search_libraries(
705705
gai_strerror
706-
HEADERS netdb.h
706+
HEADERS
707+
netdb.h
708+
ws2tcpip.h
707709
LIBRARIES
708710
socket # Solaris <= 11.3, illumos
709711
network # Haiku

cmake/cmake/Flags.cmake

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Check and configure compilation options.
44

55
include_guard(GLOBAL)
66

7+
include(CheckLinkerFlag)
78
include(CheckSourceRuns)
89
include(CMakePushCheckState)
910
include(PHP/CheckCompilerFlag)
@@ -75,13 +76,23 @@ target_compile_options(
7576

7677
php_check_compiler_flag(C -Wall PHP_HAS_WALL_C)
7778
php_check_compiler_flag(CXX -Wall PHP_HAS_WALL_CXX)
78-
target_compile_options(
79-
php_config
80-
BEFORE
81-
INTERFACE
82-
$<$<AND:$<BOOL:${PHP_HAS_WALL_C}>,$<COMPILE_LANGUAGE:ASM,C>>:-Wall>
83-
$<$<AND:$<BOOL:${PHP_HAS_WALL_CXX}>,$<COMPILE_LANGUAGE:CXX>>:-Wall>
84-
)
79+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
80+
target_compile_options(
81+
php_config
82+
BEFORE
83+
INTERFACE
84+
$<$<AND:$<BOOL:${PHP_HAS_WALL_C}>,$<CONFIG:Debug>,$<COMPILE_LANGUAGE:ASM,C>>:-Wall>
85+
$<$<AND:$<BOOL:${PHP_HAS_WALL_CXX}>,$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CXX>>:-Wall>
86+
)
87+
else()
88+
target_compile_options(
89+
php_config
90+
BEFORE
91+
INTERFACE
92+
$<$<AND:$<BOOL:${PHP_HAS_WALL_C}>,$<COMPILE_LANGUAGE:ASM,C>>:-Wall>
93+
$<$<AND:$<BOOL:${PHP_HAS_WALL_CXX}>,$<COMPILE_LANGUAGE:CXX>>:-Wall>
94+
)
95+
endif()
8596

8697
# Check if compiler supports -Wno-clobbered (only GCC).
8798
php_check_compiler_flag(C -Wno-clobbered PHP_HAS_WNO_CLOBBERED_C)
@@ -485,3 +496,19 @@ endif()
485496

486497
# Align segments on huge page boundary.
487498
include(PHP/CheckSegmentsAlignment)
499+
500+
check_linker_flag(C LINKER:/verbose PHP_HAS_VERBOSE_LINKER_FLAG_C)
501+
if(PHP_HAS_VERBOSE_LINKER_FLAG_C)
502+
target_link_options(
503+
php_config
504+
INTERFACE $<$<AND:$<CONFIG:Debug>,$<LINK_LANGUAGE:C>>:LINKER:/verbose>
505+
)
506+
endif()
507+
508+
check_linker_flag(CXX LINKER:/verbose PHP_HAS_VERBOSE_LINKER_FLAG_CXX)
509+
if(PHP_HAS_VERBOSE_LINKER_FLAG_CXX)
510+
target_link_options(
511+
php_config
512+
INTERFACE $<$<AND:$<CONFIG:Debug>,$<LINK_LANGUAGE:CXX>>:LINKER:/verbose>
513+
)
514+
endif()

cmake/cmake/modules/PHP/CheckIPv6.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ if(NOT PHP_IPV6)
2929
return()
3030
endif()
3131

32+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
33+
message(CHECK_PASS "yes")
34+
set(HAVE_IPV6 TRUE)
35+
return()
36+
endif()
37+
3238
cmake_push_check_state(RESET)
3339
set(CMAKE_REQUIRED_QUIET TRUE)
3440

cmake/main/cmake/php_config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
#cmakedefine PHP_BUILD_SYSTEM "@PHP_BUILD_SYSTEM@"
552552

553553
/* Compiler identification string. */
554-
#cmakedefine PHP_COMPILER_ID "@PHP_COMPILER_ID@"
554+
#cmakedefine PHP_COMPILER_ID "@CMAKE_C_COMPILER_ID@"
555555

556556
/* Define to 1 if the compiler supports AVX-512, and to 0 if not. */
557557
#cmakedefine01 PHP_HAVE_AVX512_SUPPORTS

cmake/win32/CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,26 @@ set_source_files_properties(
179179

180180
# Determine major and minor linker version.
181181
block(PROPAGATE PHP_LINKER_MAJOR PHP_LINKER_MINOR)
182-
if(CMAKE_C_COMPILER_LINKER_VERSION)
183-
set(version "${CMAKE_C_COMPILER_LINKER_VERSION}")
184-
else()
185-
set(version "")
182+
if(
183+
NOT DEFINED CMAKE_C_COMPILER_LINKER_VERSION
184+
OR NOT CMAKE_C_COMPILER_LINKER_VERSION MATCHES "^[^0-9]*[0-9]"
185+
)
186+
message(
187+
FATAL_ERROR
188+
"The linker version could not be detected. Please ensure the linker "
189+
"version can be determined, or set the 'CMAKE_C_COMPILER_LINKER_VERSION' "
190+
"variable to the linker version of format '<major>.<minor>'."
191+
)
186192
endif()
187193

188-
string(REGEX MATCH "^([0-9]+)\\.?" _ "${version}")
194+
string(REGEX MATCH "^[^0-9]*([0-9]+)\\.?" _ "${CMAKE_C_COMPILER_LINKER_VERSION}")
189195
set(PHP_LINKER_MAJOR "${CMAKE_MATCH_1}")
190-
string(REGEX MATCH "^[0-9]+\\.([0-9]+)\\.?" _ "${version}")
191-
set(PHP_LINKER_MINOR "${CMAKE_MATCH_1}")
192-
193196
if(NOT PHP_LINKER_MAJOR)
194197
set(PHP_LINKER_MAJOR 0)
195198
endif()
196199

200+
string(REGEX MATCH "^[^0-9]*[0-9]+\\.([0-9]+)\\.?" _ "${CMAKE_C_COMPILER_LINKER_VERSION}")
201+
set(PHP_LINKER_MINOR "${CMAKE_MATCH_1}")
197202
if(NOT PHP_LINKER_MINOR)
198203
set(PHP_LINKER_MINOR 0)
199204
endif()

0 commit comments

Comments
 (0)