@@ -2480,10 +2480,15 @@ function toolset_is_64()
2480
2480
if ( VS_TOOLSET ) {
2481
2481
return probe_binary ( PHP_CL , 64 ) ;
2482
2482
} else if ( CLANG_TOOLSET ) {
2483
- var command = 'cmd /c ""' + PHP_CL + '" -v"' ;
2483
+ /* var command = 'cmd /c ""' + PHP_CL + '" -v"';
2484
2484
var full = execute(command + '" 2>&1"');
2485
2485
2486
- return null != full . match ( / x 8 6 _ 6 4 / ) ;
2486
+ return null != full.match(/x86_64/);*/
2487
+
2488
+ /* Even executed within an environment setup with vcvars32.bat,
2489
+ clang-cl doesn't recognize the arch toolset. But as it needs
2490
+ the VS environment, checking the arch of cl.exe is correct. */
2491
+ return probe_binary ( PATH_PROG ( 'cl' , null ) , 64 ) ;
2487
2492
} else if ( INTEL_TOOLSET ) {
2488
2493
var command = 'cmd /c ""' + PHP_CL + '" -v"' ;
2489
2494
var full = execute ( command + '" 2>&1"' ) ;
@@ -2511,6 +2516,13 @@ function toolset_setup_linker()
2511
2516
2512
2517
function toolset_setup_common_cflags ( )
2513
2518
{
2519
+ // CFLAGS for building the PHP dll
2520
+ DEFINE ( "CFLAGS_PHP" , "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
2521
+ /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER ) ;
2522
+
2523
+ DEFINE ( 'CFLAGS_PHP_OBJ' , '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)' ) ;
2524
+
2525
+ // General CFLAGS for building objects
2514
2526
DEFINE ( "CFLAGS" , "/nologo $(BASE_INCLUDES) /D _WINDOWS \
2515
2527
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 " ) ;
2516
2528
@@ -2545,9 +2557,9 @@ function toolset_setup_common_cflags()
2545
2557
2546
2558
} else if ( CLANG_TOOLSET ) {
2547
2559
if ( X64 ) {
2548
- ADD_FLAG ( 'CFLAGS' , ' -m64 ' ) ;
2560
+ ADD_FLAG ( 'CFLAGS' , '-m64' ) ;
2549
2561
} else {
2550
- ADD_FLAG ( 'CFLAGS' , ' -m32 ' ) ;
2562
+ ADD_FLAG ( 'CFLAGS' , '-m32' ) ;
2551
2563
}
2552
2564
ADD_FLAG ( "CFLAGS" , " /fallback " ) ;
2553
2565
}
0 commit comments