From 7aeca162d62056967f2d4479422a5181249ba1cb Mon Sep 17 00:00:00 2001 From: s1lent Date: Fri, 5 Oct 2018 14:31:40 +0700 Subject: [PATCH] Resolved #307 --- dep/cppunitlite/build.gradle | 10 +++++++--- regamedll/build.gradle | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dep/cppunitlite/build.gradle b/dep/cppunitlite/build.gradle index 496d1603..3e643317 100644 --- a/dep/cppunitlite/build.gradle +++ b/dep/cppunitlite/build.gradle @@ -2,11 +2,13 @@ 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 apply plugin: 'cpp' apply plugin: IccCompilerPlugin +apply plugin: GccCompilerPlugin void setupToolchain(NativeBinarySpec b) { def cfg = rootProject.createToolchainConfig(b) @@ -27,9 +29,11 @@ model { } toolChains { - visualCpp(VisualCpp) { - } - icc(Icc) { + visualCpp(VisualCpp) + if (project.hasProperty("useGcc")) { + gcc(Gcc) + } else { + icc(Icc) } } diff --git a/regamedll/build.gradle b/regamedll/build.gradle index 53fca488..f21c3d38 100644 --- a/regamedll/build.gradle +++ b/regamedll/build.gradle @@ -237,6 +237,16 @@ class RegamedllSrc { } } + static void regamedll_tests_gcc_src(def h) { + h.regamedll_tests_gcc_src(CppSourceSet) { + source { + srcDir "unittests" + include "**/*.cpp" + exclude "mathfun_tests.cpp" + } + } + } + static void regamedll_tests_src(def h) { h.regamedll_tests_src(CppSourceSet) { source { @@ -291,7 +301,12 @@ model { sources { RegamedllSrc.regamedll_pch(it) RegamedllSrc.regamedll_src(it) - RegamedllSrc.regamedll_tests_src(it) + + if (project.hasProperty("useGcc")) { + RegamedllSrc.regamedll_tests_gcc_src(it) + } else { + RegamedllSrc.regamedll_tests_src(it) + } } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }