From 0ae3bbda1325f2c727ea91b56ff547e9ef09541b Mon Sep 17 00:00:00 2001 From: zosrothko Date: Wed, 2 May 2018 22:25:50 +0200 Subject: [PATCH] Use closure to add specific platform c++ code --- Data/ODBC/build.gradle | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Data/ODBC/build.gradle b/Data/ODBC/build.gradle index deb36548d..2931fe530 100644 --- a/Data/ODBC/build.gradle +++ b/Data/ODBC/build.gradle @@ -1,6 +1,6 @@ model { components { - DataODBC(NativeLibrarySpec) { + DataODBC(NativeLibrarySpec) { m -> sources { rc { source { @@ -25,7 +25,28 @@ model { } } binaries { - all { + all { + sources { + if (targetPlatform.operatingSystem.windows) { + platformWindows(CppSourceSet) { + lib m.sources.cpp + source { + srcDir 'src' + include 'Unicode_WIN32.cpp' + } + } + } else + if (targetPlatform.operatingSystem.macOsX || targetPlatform.operatingSystem.linux) { + platformNix(CppSourceSet) { + lib m.sources.cpp + source { + srcDir 'src' + include 'Unicode_UNIXODBC.cpp' + } + } + } + } + if (toolChain in VisualCpp) { cppCompiler.define "THREADSAFE=1" }