mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
2f64cfc873
* GCC support - could be used via -PuseGcc command line argument. * Refactoring around __FUNCTION__, change __FUNCTION__ into __func__. * Refactoring, formatting, small fixes.
80 lines
1.6 KiB
Groovy
80 lines
1.6 KiB
Groovy
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
|
|
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
|
|
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
|
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
|
|
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
|
|
import org.gradle.nativeplatform.NativeBinarySpec
|
|
import org.gradle.nativeplatform.NativeLibrarySpec
|
|
import org.gradle.nativeplatform.toolchain.VisualCpp
|
|
|
|
|
|
apply plugin: 'c'
|
|
apply plugin: IccCompilerPlugin
|
|
apply plugin: GccCompilerPlugin
|
|
|
|
void setupToolchain(NativeBinarySpec b) {
|
|
def cfg = rootProject.createToolchainConfig(b)
|
|
if (cfg instanceof MsvcToolchainConfig) {
|
|
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
|
|
enabled: true,
|
|
pchHeader: 'bzlib_private.h',
|
|
pchSourceSet: 'bz2_pch'
|
|
)
|
|
}
|
|
|
|
ToolchainConfigUtils.apply(project, cfg, b)
|
|
}
|
|
|
|
model {
|
|
buildTypes {
|
|
debug
|
|
release
|
|
}
|
|
|
|
platforms {
|
|
x86 {
|
|
architecture "x86"
|
|
}
|
|
}
|
|
|
|
toolChains {
|
|
visualCpp(VisualCpp)
|
|
if (project.hasProperty("useGcc")) {
|
|
gcc(Gcc)
|
|
} else {
|
|
icc(Icc)
|
|
}
|
|
}
|
|
|
|
components {
|
|
bzip2(NativeLibrarySpec) {
|
|
targetPlatform 'x86'
|
|
|
|
sources {
|
|
bz2_main(CSourceSet) {
|
|
source {
|
|
srcDir "src"
|
|
include "**/*.c"
|
|
exclude "precompiled.c"
|
|
}
|
|
exportedHeaders {
|
|
srcDir "include"
|
|
}
|
|
}
|
|
|
|
bz2_pch(CSourceSet) {
|
|
source {
|
|
srcDir "src"
|
|
include "precompiled.c"
|
|
}
|
|
exportedHeaders {
|
|
srcDir "include"
|
|
}
|
|
}
|
|
}
|
|
|
|
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
|
}
|
|
}
|
|
}
|