diff --git a/README.md b/README.md
index edb544e..b4070a9 100644
--- a/README.md
+++ b/README.md
@@ -105,6 +105,7 @@ On Linux (GCC):
* For faster building without unit tests use this:exclamation:
./gradlew --max-workers=1 -PuseGcc clean buildFixes
+Also there is a task `buildEngine`, it builds only a part of the engine.
Compiled binaries will be placed in the rehlds/build/binaries/ directory
## How can I help the project?
diff --git a/rehlds/HLTV/Console/build.gradle b/rehlds/HLTV/Console/build.gradle
index 0505a1d..49d64d7 100644
--- a/rehlds/HLTV/Console/build.gradle
+++ b/rehlds/HLTV/Console/build.gradle
@@ -20,6 +20,7 @@ List getRcCompileTasks(NativeBinarySpec binary)
}
void setupToolchain(NativeBinarySpec b) {
+ boolean useGcc = project.hasProperty("useGcc")
def cfg = rootProject.createToolchainConfig(b);
cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds');
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', '_CONSOLE'
@@ -38,12 +39,14 @@ void setupToolchain(NativeBinarySpec b) {
cfg.extraLibs "user32.lib"
}
else if (cfg instanceof GccToolchainConfig) {
- cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
- enabled: true,
- pchSourceSet: 'hltv_pch'
- );
+ if (!useGcc) {
+ cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
+ enabled: true,
+ pchSourceSet: 'hltv_pch'
+ );
+ }
- cfg.compilerOptions.languageStandard = 'c++0x'
+ cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_strdup': 'strdup',
'_stricmp': 'strcasecmp',
@@ -52,7 +55,16 @@ void setupToolchain(NativeBinarySpec b) {
'_snprintf': 'snprintf',
]);
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti', '-fno-exceptions'
+
+ if (useGcc) {
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
+ } else {
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
+ }
+
+ cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions'
cfg.extraLibs 'dl'
}
@@ -73,7 +85,10 @@ model {
toolChains {
visualCpp(VisualCpp) {
}
- icc(Icc) {
+ if (project.hasProperty("useGcc")) {
+ gcc(Gcc)
+ } else {
+ icc(Icc)
}
}
diff --git a/rehlds/HLTV/Core/build.gradle b/rehlds/HLTV/Core/build.gradle
index 3b137cc..fda3d20 100644
--- a/rehlds/HLTV/Core/build.gradle
+++ b/rehlds/HLTV/Core/build.gradle
@@ -14,6 +14,7 @@ apply plugin: GccCompilerPlugin
project.ext.dep_bzip2 = project(':dep/bzip2')
void setupToolchain(NativeBinarySpec b) {
+ boolean useGcc = project.hasProperty("useGcc")
def cfg = rootProject.createToolchainConfig(b);
cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared');
cfg.projectInclude(dep_bzip2, '/include')
@@ -32,12 +33,14 @@ void setupToolchain(NativeBinarySpec b) {
cfg.extraLibs "ws2_32.lib", "psapi.lib"
}
else if (cfg instanceof GccToolchainConfig) {
- cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
- enabled: true,
- pchSourceSet: 'core_pch'
- );
+ if (!useGcc) {
+ cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
+ enabled: true,
+ pchSourceSet: 'core_pch'
+ );
+ }
- cfg.compilerOptions.languageStandard = 'c++0x'
+ cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_strdup': 'strdup',
'_stricmp': 'strcasecmp',
@@ -46,7 +49,15 @@ void setupToolchain(NativeBinarySpec b) {
'_snprintf': 'snprintf',
]);
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-exceptions'
+ if (useGcc) {
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
+ } else {
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
+ }
+
+ cfg.compilerOptions.args '-fno-exceptions'
}
ToolchainConfigUtils.apply(project, cfg, b);
@@ -66,7 +77,10 @@ model {
toolChains {
visualCpp(VisualCpp) {
}
- icc(Icc) {
+ if (project.hasProperty("useGcc")) {
+ gcc(Gcc)
+ } else {
+ icc(Icc)
}
}
diff --git a/rehlds/HLTV/DemoPlayer/build.gradle b/rehlds/HLTV/DemoPlayer/build.gradle
index 11ae425..5a22f94 100644
--- a/rehlds/HLTV/DemoPlayer/build.gradle
+++ b/rehlds/HLTV/DemoPlayer/build.gradle
@@ -12,6 +12,7 @@ apply plugin: IccCompilerPlugin
apply plugin: GccCompilerPlugin
void setupToolchain(NativeBinarySpec b) {
+ boolean useGcc = project.hasProperty("useGcc")
def cfg = rootProject.createToolchainConfig(b);
cfg.projectInclude(project, '/..', '/../..', '/src', '/../common', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared');
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'DEMOPLAYER_MODULE'
@@ -28,12 +29,14 @@ void setupToolchain(NativeBinarySpec b) {
cfg.extraLibs "psapi.lib"
}
else if (cfg instanceof GccToolchainConfig) {
- cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
- enabled: true,
- pchSourceSet: 'demoplayer_pch'
- );
+ if (!useGcc) {
+ cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
+ enabled: true,
+ pchSourceSet: 'demoplayer_pch'
+ );
+ }
- cfg.compilerOptions.languageStandard = 'c++0x'
+ cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_strdup': 'strdup',
'_stricmp': 'strcasecmp',
@@ -42,7 +45,15 @@ void setupToolchain(NativeBinarySpec b) {
'_snprintf': 'snprintf',
]);
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-exceptions'
+ if (useGcc) {
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
+ } else {
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
+ }
+
+ cfg.compilerOptions.args '-fno-exceptions'
}
ToolchainConfigUtils.apply(project, cfg, b);
@@ -62,7 +73,10 @@ model {
toolChains {
visualCpp(VisualCpp) {
}
- icc(Icc) {
+ if (project.hasProperty("useGcc")) {
+ gcc(Gcc)
+ } else {
+ icc(Icc)
}
}
diff --git a/rehlds/HLTV/Director/build.gradle b/rehlds/HLTV/Director/build.gradle
index 23790c3..7633173 100644
--- a/rehlds/HLTV/Director/build.gradle
+++ b/rehlds/HLTV/Director/build.gradle
@@ -12,6 +12,7 @@ apply plugin: IccCompilerPlugin
apply plugin: GccCompilerPlugin
void setupToolchain(NativeBinarySpec b) {
+ boolean useGcc = project.hasProperty("useGcc")
def cfg = rootProject.createToolchainConfig(b);
cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared');
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'DIRECTOR_MODULE'
@@ -27,10 +28,12 @@ void setupToolchain(NativeBinarySpec b) {
cfg.compilerOptions.args '/Ob2', '/Oi', '/GF'
}
else if (cfg instanceof GccToolchainConfig) {
- cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
- enabled: true,
- pchSourceSet: 'director_pch'
- );
+ if (!useGcc) {
+ cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
+ enabled: true,
+ pchSourceSet: 'director_pch'
+ );
+ }
cfg.compilerOptions.languageStandard = 'c++0x'
cfg.defines([
@@ -41,7 +44,15 @@ void setupToolchain(NativeBinarySpec b) {
'_snprintf': 'snprintf',
]);
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-exceptions'
+ if (useGcc) {
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
+ } else {
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
+ }
+
+ cfg.compilerOptions.args '-fno-exceptions'
}
ToolchainConfigUtils.apply(project, cfg, b);
@@ -61,7 +72,10 @@ model {
toolChains {
visualCpp(VisualCpp) {
}
- icc(Icc) {
+ if (project.hasProperty("useGcc")) {
+ gcc(Gcc)
+ } else {
+ icc(Icc)
}
}
diff --git a/rehlds/HLTV/Proxy/build.gradle b/rehlds/HLTV/Proxy/build.gradle
index 53e85cf..e17eb94 100644
--- a/rehlds/HLTV/Proxy/build.gradle
+++ b/rehlds/HLTV/Proxy/build.gradle
@@ -14,6 +14,7 @@ apply plugin: GccCompilerPlugin
project.ext.dep_bzip2 = project(':dep/bzip2')
void setupToolchain(NativeBinarySpec b) {
+ boolean useGcc = project.hasProperty("useGcc")
def cfg = rootProject.createToolchainConfig(b);
cfg.projectInclude(project, '/..', '/../..', '/src', '/../Director/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared');
cfg.projectInclude(dep_bzip2, '/include')
@@ -33,12 +34,14 @@ void setupToolchain(NativeBinarySpec b) {
cfg.extraLibs "steam_api.lib", "psapi.lib", "ws2_32.lib"
}
else if (cfg instanceof GccToolchainConfig) {
- cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
- enabled: true,
- pchSourceSet: 'proxy_pch'
- );
+ if (!useGcc) {
+ cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
+ enabled: true,
+ pchSourceSet: 'proxy_pch'
+ );
+ }
- cfg.compilerOptions.languageStandard = 'c++0x'
+ cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_strdup': 'strdup',
'_stricmp': 'strcasecmp',
@@ -47,7 +50,15 @@ void setupToolchain(NativeBinarySpec b) {
'_snprintf': 'snprintf',
]);
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-exceptions'
+ if (useGcc) {
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
+ } else {
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
+ }
+
+ cfg.compilerOptions.args '-fno-exceptions'
cfg.projectLibpath(project, '/../../lib/linux32')
cfg.extraLibs "steam_api"
}
@@ -69,7 +80,10 @@ model {
toolChains {
visualCpp(VisualCpp) {
}
- icc(Icc) {
+ if (project.hasProperty("useGcc")) {
+ gcc(Gcc)
+ } else {
+ icc(Icc)
}
}
diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp
index c49f635..b1ccfc7 100644
--- a/rehlds/HLTV/Proxy/src/Proxy.cpp
+++ b/rehlds/HLTV/Proxy/src/Proxy.cpp
@@ -222,7 +222,7 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name)
-1.f, -1.f, // x, y
0.5f, 2.f, // fadein, fadeout
5.f, 0.f, // holdtime, fxtime
- "" // text
+ {} // text
};
Q_memset(&m_CommentatorMessage, 0, sizeof(m_CommentatorMessage));
@@ -233,7 +233,7 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name)
-1.f, -1.f, // x, y
0.3f, 1.f, // fadein, fadeout
5.f, 0.f, // holdtime, fxtime
- "" // text
+ {} // text
};
Q_strlcpy(m_OffLineText, "Game is delayed. Please try again later.");
diff --git a/rehlds/build.gradle b/rehlds/build.gradle
index 4098d5d..fb6c0bd 100644
--- a/rehlds/build.gradle
+++ b/rehlds/build.gradle
@@ -168,10 +168,10 @@ void setupToolchain(NativeBinarySpec b) {
// As new processors are deployed in the marketplace, the behavior of this option will change.
cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3'
} else {
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti'
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
}
- cfg.compilerOptions.args '-fno-exceptions'
+ cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions'
cfg.projectLibpath(project, '/lib/linux32')
cfg.extraLibs 'rt', 'dl', 'm', 'steam_api', 'aelf32'
}
@@ -364,8 +364,14 @@ task buildFixes {
}
}
+task buildEngine {
+ dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
+ SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'rehldsFixes' && blib.component.name == 'rehlds_swds_engine'
+ }
+}
+
gradle.taskGraph.whenReady { graph ->
- if (!graph.hasTask(buildFixes)) {
+ if (!graph.hasTask(buildFixes) && !graph.hasTask(buildEngine)) {
return;
}
diff --git a/rehlds/dedicated/build.gradle b/rehlds/dedicated/build.gradle
index a759f32..9de9d64 100644
--- a/rehlds/dedicated/build.gradle
+++ b/rehlds/dedicated/build.gradle
@@ -47,7 +47,7 @@ void setupToolchain(NativeBinarySpec b) {
pchSourceSet: 'dedicated_pch'
);
}
- cfg.compilerOptions.languageStandard = 'c++0x'
+ cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_strdup': 'strdup',
'_stricmp': 'strcasecmp',
@@ -55,14 +55,16 @@ void setupToolchain(NativeBinarySpec b) {
'_vsnprintf': 'vsnprintf',
'_snprintf': 'snprintf',
]);
+
if (useGcc) {
- // MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
- cfg.compilerOptions.args '-march=sandybridge', '-Wno-write-strings'
+ // Produce code optimized for the most common IA32/AMD64/EM64T processors.
+ // As new processors are deployed in the marketplace, the behavior of this option will change.
+ cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto'
} else {
- cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti'
+ cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp'
}
- cfg.compilerOptions.args '-fno-exceptions'
+ cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions'
cfg.extraLibs 'dl'
}