poco/Data/PostgreSQL/build.gradle
2018-05-12 14:55:01 +02:00

340 lines
13 KiB
Groovy

model {
repositories {
libs(PrebuiltLibraries) {
intl {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres64LinuxInc"))
staticLibraryFile = new File("$postgres64LinuxLib/$libName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'libintl.lib'
headers.srcDir(new File("$postgres64LinuxInc"))
staticLibraryFile = new File("$postgres64LinuxLib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
dllName = 'libintl-8.dll'
linkName = 'libintl.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libintl-8.dll'
linkName = 'libintl.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libintl-8.so'
linkName = 'libintl.a'
headers.srcDir(new File("$postgres64LinuxInc"))
sharedLibraryFile = new File("$postgres64LinuxLib/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
dllName = 'libintl-8.dll'
linkName = 'libintl.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libintl-8.dll'
linkName = 'libintl.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libintl-8.so'
linkName = 'libintl.a'
headers.srcDir(new File("$postgres64LinuxInc"))
sharedLibraryFile = new File("$postgres64LinuxLib/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
}
}
}
iconv {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
libName = 'iconv.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'iconv.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'iconv.a'
headers.srcDir(new File("$postgres64LinuxInc"))
staticLibraryFile = new File("$postgres64LinuxLib/$libName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
libName = 'iconv.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'iconv.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'iconv.a'
headers.srcDir(new File("$postgres64LinuxInc"))
staticLibraryFile = new File("$postgres64LinuxLib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
dllName = 'libiconv-2.dll'
linkName = 'iconv.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libiconv-2.dll'
linkName = 'iconv.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libiconv-2.so'
linkName = 'iconv.a'
headers.srcDir(new File("$postgres64LinuxInc"))
sharedLibraryFile = new File("$postgres64LinuxLib/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
dllName = 'libiconv-2.dll'
linkName = 'iconv.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libiconv-2.dll'
linkName = 'iconv.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libiconv-2.so'
linkName = 'iconv.a'
headers.srcDir(new File("$postgres64LinuxInc"))
sharedLibraryFile = new File("$postgres64LinuxLib/bin/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
}
}
}
postgres {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
libName = 'libpq.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'libpq.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'libpq.a'
headers.srcDir(new File("$postgres64LinuxInc") )
staticLibraryFile = new File("$postgres32LinuxLib/$libName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
libName = 'libpq.lib'
headers.srcDir(new File("$postgres32Home/include"))
staticLibraryFile = new File("$postgres32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
libName = 'libpq.lib'
headers.srcDir(new File("$postgres64Home/include"))
staticLibraryFile = new File("$postgres64Home/lib/$libName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
libName = 'libpq.a'
headers.srcDir(new File("$postgres64LinuxInc"))
staticLibraryFile = new File("$postgres32LinuxLib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
dllName = 'libpq.dll'
linkName = 'libpq.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libpq.dll'
linkName = 'libpq.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libpq.so'
linkName = 'libpq.a'
headers.srcDir( new File("$postgres64LinuxInc") )
sharedLibraryFile = new File("$postgres64LinuxLib/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
dllName = 'libpq.dll'
linkName = 'libpq.lib'
headers.srcDir(new File("$postgres32Home/include"))
sharedLibraryFile = new File("$postgres32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$postgres32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
dllName = 'libpq.dll'
linkName = 'libpq.lib'
headers.srcDir(new File("$postgres64Home/include"))
sharedLibraryFile = new File("$postgres64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$postgres64Home/lib/$linkName")
} else
if (targetPlatform.operatingSystem.macOsX) {
} else
if (targetPlatform.operatingSystem.linux) {
dllName = 'libpq.so'
linkName = 'libpq.a'
headers.srcDir(new File("$postgres64LinuxInc"))
sharedLibraryFile = new File("$postgres64LinuxLib/$dllName")
sharedLibraryLinkFile = new File("$postgres64LinuxLib/$linkName")
}
}
}
}
}
}
components {
DataPostgreSQL(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '../..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib library: 'postgres'
lib project: ':Data', library: 'Data'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
if (toolChain in Gcc) {
cppCompiler.args ( "-I", "/usr/include/postgresql")
linker.args ( "-L", "/usr/lib/x86_64-linux-gnu/")
linker.args ( "-l", "pq")
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "PostgreSQL_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }