@@ -14,6 +14,7 @@ apply plugin: GccCompilerPlugin
14
14
project. ext. dep_bzip2 = project(' :dep/bzip2' )
15
15
16
16
void setupToolchain (NativeBinarySpec b ) {
17
+ boolean useGcc = project. hasProperty(" useGcc" )
17
18
def cfg = rootProject. createToolchainConfig(b);
18
19
cfg. projectInclude(project, ' /..' , ' /../..' , ' /src' , ' /../Director/src' , ' /../../common' , ' /../../engine' , ' /../../public' , ' /../../public/rehlds' , ' /../../pm_shared' );
19
20
cfg. projectInclude(dep_bzip2, ' /include' )
@@ -33,12 +34,14 @@ void setupToolchain(NativeBinarySpec b) {
33
34
cfg. extraLibs " steam_api.lib" , " psapi.lib" , " ws2_32.lib"
34
35
}
35
36
else if (cfg instanceof GccToolchainConfig ) {
36
- cfg. compilerOptions. pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions (
37
- enabled : true ,
38
- pchSourceSet : ' proxy_pch'
39
- );
37
+ if (! useGcc) {
38
+ cfg. compilerOptions. pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions (
39
+ enabled : true ,
40
+ pchSourceSet : ' proxy_pch'
41
+ );
42
+ }
40
43
41
- cfg. compilerOptions. languageStandard = ' c++0x '
44
+ cfg. compilerOptions. languageStandard = ' c++11 '
42
45
cfg. defines([
43
46
' _strdup' : ' strdup' ,
44
47
' _stricmp' : ' strcasecmp' ,
@@ -47,7 +50,15 @@ void setupToolchain(NativeBinarySpec b) {
47
50
' _snprintf' : ' snprintf' ,
48
51
]);
49
52
50
- cfg. compilerOptions. args ' -Qoption,cpp,--treat_func_as_string_literal_cpp' , ' -fno-exceptions'
53
+ if (useGcc) {
54
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
55
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
56
+ cfg. compilerOptions. args ' -mtune=generic' , ' -Wno-write-strings' , ' -msse3' , ' -flto'
57
+ } else {
58
+ cfg. compilerOptions. args ' -Qoption,cpp,--treat_func_as_string_literal_cpp'
59
+ }
60
+
61
+ cfg. compilerOptions. args ' -fno-exceptions'
51
62
cfg. projectLibpath(project, ' /../../lib/linux32' )
52
63
cfg. extraLibs " steam_api"
53
64
}
@@ -69,7 +80,10 @@ model {
69
80
toolChains {
70
81
visualCpp(VisualCpp ) {
71
82
}
72
- icc(Icc ) {
83
+ if (project. hasProperty(" useGcc" )) {
84
+ gcc(Gcc )
85
+ } else {
86
+ icc(Icc )
73
87
}
74
88
}
75
89
0 commit comments