poco/Data/MySQL/build.gradle
2018-04-18 10:21:50 +02:00

103 lines
2.9 KiB
Groovy

model {
repositories {
libs(PrebuiltLibraries) {
mysql {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
libName = 'libmysqld.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
} else
if (buildType == buildTypes.release) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
dllName = 'libmysqld.dll'
linkName = 'libmysqld.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
sharedLibraryFile = new File("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql64Home/lib/$linkName")
}
} else
if (buildType == buildTypes.release) {
dllName = 'libmysql.dll'
linkName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
sharedLibraryFile = new File("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql64Home/lib/$linkName")
}
}
}
}
}
}
components {
DataMySQL(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib library: 'mysql'
lib project: ':Data', library: 'Data'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
cppCompiler.define "THREADSAFE"
cppCompiler.define "__LCC__"
if (toolChain in VisualCpp) {
cppCompiler.define "WINVER=0x0600"
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "MySQL_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }