Skip to content

Commit b155ba2

Browse files
committed
further refactoring of toolset+phpize stuff
1 parent 4d8c28a commit b155ba2

File tree

3 files changed

+60
-79
lines changed

3 files changed

+60
-79
lines changed

win32/build/config.w32

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -75,45 +75,7 @@ DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
7575
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
7676

7777
// General CFLAGS for building objects
78-
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \
79-
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
80-
if (VS_TOOLSET) {
81-
ADD_FLAG("CFLAGS", " /FD ");
82-
}
83-
84-
if (CLANG_TOOLSET) {
85-
if (X64) {
86-
ADD_FLAG('CFLAGS', ' -m64 ');
87-
} else {
88-
ADD_FLAG('CFLAGS', ' -m32 ');
89-
}
90-
}
91-
92-
if (VS_TOOLSET && VCVERS < 1400) {
93-
// Enable automatic precompiled headers
94-
ADD_FLAG('CFLAGS', ' /YX ');
95-
96-
if (PHP_DEBUG == "yes") {
97-
// Set some debug/release specific options
98-
ADD_FLAG('CFLAGS', ' /GZ ');
99-
}
100-
}
101-
102-
if (VS_TOOLSET && VCVERS >= 1400) {
103-
// fun stuff: MS deprecated ANSI stdio and similar functions
104-
// disable annoying warnings. In addition, time_t defaults
105-
// to 64-bit. Ask for 32-bit.
106-
if (X64) {
107-
ADD_FLAG('CFLAGS', ' /wd4996 ');
108-
} else {
109-
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
110-
}
111-
112-
if (PHP_DEBUG == "yes") {
113-
// Set some debug/release specific options
114-
ADD_FLAG('CFLAGS', ' /RTC1 ');
115-
}
116-
}
78+
toolset_setup_common_cflags();
11779

11880
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
11981
var PHP_MP_DISABLED = true;
@@ -133,15 +95,7 @@ if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {
13395
}
13496

13597
// General link flags
136-
137-
if (VS_TOOLSET || CLANG_TOOLSET) {
138-
if (VCVERS >= 1700 || CLANG_TOOLSET) {
139-
DEFINE("LDFLAGS", "/nologo ");
140-
} else {
141-
DEFINE("LDFLAGS", "/nologo /version:" +
142-
PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
143-
}
144-
}
98+
toolset_setup_common_ldlags();
14599

146100
// General DLL link flags
147101
DEFINE("DLL_LDFLAGS", "/dll ");

win32/build/config.w32.phpize.in

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,37 +60,7 @@ DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
6060
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
6161

6262
// General CFLAGS for building objects
63-
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \
64-
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
65-
if (VS_TOOLSET) {
66-
ADD_FLAG("CFLAGS", " /FD ");
67-
}
68-
69-
if (VS_TOOLSET && VCVERS < 1400) {
70-
// Enable automatic precompiled headers
71-
ADD_FLAG('CFLAGS', ' /YX ');
72-
73-
if (PHP_DEBUG == "yes") {
74-
// Set some debug/release specific options
75-
ADD_FLAG('CFLAGS', ' /GZ ');
76-
}
77-
}
78-
79-
if (VS_TOOLSET && VCVERS >= 1400) {
80-
// fun stuff: MS deprecated ANSI stdio and similar functions
81-
// disable annoying warnings. In addition, time_t defaults
82-
// to 64-bit. Ask for 32-bit.
83-
if (X64) {
84-
ADD_FLAG('CFLAGS', ' /wd4996 ');
85-
} else {
86-
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
87-
}
88-
89-
if (PHP_DEBUG == "yes") {
90-
// Set some debug/release specific options
91-
ADD_FLAG('CFLAGS', ' /RTC1 ');
92-
}
93-
}
63+
toolset_setup_common_cflags();
9464

9565
ARG_WITH('prefix', 'PHP installation prefix', '');
9666
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');

win32/build/confutils.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,3 +2507,60 @@ function toolset_setup_linker()
25072507
ERROR("Unsupported toolset");
25082508
}
25092509

2510+
function toolset_setup_common_cflags()
2511+
{
2512+
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \
2513+
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
2514+
2515+
if (VS_TOOLSET) {
2516+
ADD_FLAG("CFLAGS", " /FD ");
2517+
2518+
if (VCVERS < 1400) {
2519+
// Enable automatic precompiled headers
2520+
ADD_FLAG('CFLAGS', ' /YX ');
2521+
2522+
if (PHP_DEBUG == "yes") {
2523+
// Set some debug/release specific options
2524+
ADD_FLAG('CFLAGS', ' /GZ ');
2525+
}
2526+
}
2527+
2528+
if (VCVERS >= 1400) {
2529+
// fun stuff: MS deprecated ANSI stdio and similar functions
2530+
// disable annoying warnings. In addition, time_t defaults
2531+
// to 64-bit. Ask for 32-bit.
2532+
if (X64) {
2533+
ADD_FLAG('CFLAGS', ' /wd4996 ');
2534+
} else {
2535+
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
2536+
}
2537+
2538+
if (PHP_DEBUG == "yes") {
2539+
// Set some debug/release specific options
2540+
ADD_FLAG('CFLAGS', ' /RTC1 ');
2541+
}
2542+
}
2543+
2544+
} else if (CLANG_TOOLSET) {
2545+
if (X64) {
2546+
ADD_FLAG('CFLAGS', ' -m64 ');
2547+
} else {
2548+
ADD_FLAG('CFLAGS', ' -m32 ');
2549+
}
2550+
}
2551+
}
2552+
2553+
function toolset_setup_common_ldlags()
2554+
{
2555+
if (VS_TOOLSET) {
2556+
if (VCVERS >= 1700) {
2557+
DEFINE("LDFLAGS", "/nologo ");
2558+
} else {
2559+
DEFINE("LDFLAGS", "/nologo /version:" +
2560+
PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
2561+
}
2562+
} else {
2563+
DEFINE("LDFLAGS", "/nologo ");
2564+
}
2565+
}
2566+

0 commit comments

Comments
 (0)