poco/Data/MySQL/build.gradle
2018-05-07 21:09:22 +02:00

138 lines
4.3 KiB
Groovy

model {
repositories {
libs(PrebuiltLibraries) {
mysql {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir new File("$mysql32Home/include")
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$mysql64Home/include")
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
} else
if (buildType == buildTypes.release) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir new File("$mysql32Home/include")
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$mysql64Home/include")
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
}
}
binaries.withType(SemiStaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir new File("$mysql32Home/include")
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$mysql64Home/include")
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
} else
if (buildType == buildTypes.release) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir new File("$mysql32Home/include")
staticLibraryFile = new File("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$mysql64Home/include")
staticLibraryFile = new File("$mysql64Home/lib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
dllName = 'libmysql.dll'
linkName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir new File("$mysql32Home/include")
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$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 new File("$mysql32Home/include")
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir new File("$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"
if (toolChain in VisualCpp) {
cppCompiler.define "WINVER=0x0600"
cppCompiler.define "__LCC__"
}
if (toolChain in Gcc) {
cppCompiler.define "NO_TCL"
cppCompiler.args ( "-I", "/usr/local/include/mysql/" )
cppCompiler.args ( "-I", "/usr/include/mysql/" )
cppCompiler.args ( "-I", "/usr/mysql/include/mysql" )
cppCompiler.args ( "-I", "/usr/local/mysql/include" )
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "MySQL_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }