poco/Data/MySQL/build.gradle

138 lines
4.3 KiB
Groovy
Raw Normal View History

2017-10-31 09:07:53 +01:00
model {
repositories {
libs(PrebuiltLibraries) {
mysql {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
2018-05-07 21:09:22 +02:00
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'
2017-10-31 09:07:53 +01:00
if (targetPlatform.name == 'win32') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql32Home/include")
2018-04-18 10:21:50 +02:00
staticLibraryFile = new File("$mysql32Home/lib/$libName")
2017-10-31 09:07:53 +01:00
} else
if (targetPlatform.name == 'win64') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql64Home/include")
2018-04-18 10:21:50 +02:00
staticLibraryFile = new File("$mysql64Home/lib/$libName")
2017-10-31 09:07:53 +01:00
}
} else
if (buildType == buildTypes.release) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql32Home/include")
2018-04-18 10:21:50 +02:00
staticLibraryFile = new File("$mysql32Home/lib/$libName")
2017-10-31 09:07:53 +01:00
} else
if (targetPlatform.name == 'win64') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql64Home/include")
2018-04-18 10:21:50 +02:00
staticLibraryFile = new File("$mysql64Home/lib/$libName")
2017-10-31 09:07:53 +01:00
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
2018-05-07 21:09:22 +02:00
dllName = 'libmysql.dll'
linkName = 'libmysql.lib'
2017-10-31 09:07:53 +01:00
if (targetPlatform.name == 'win32') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql32Home/include")
2018-04-18 10:21:50 +02:00
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
2017-10-31 09:07:53 +01:00
} else
if (targetPlatform.name == 'win64') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql64Home/include")
2018-04-18 10:21:50 +02:00
sharedLibraryFile = new File("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql64Home/lib/$linkName")
2017-10-31 09:07:53 +01:00
}
} else
if (buildType == buildTypes.release) {
dllName = 'libmysql.dll'
linkName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql32Home/include")
2018-04-18 10:21:50 +02:00
sharedLibraryFile = new File("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql32Home/lib/$linkName")
2017-10-31 09:07:53 +01:00
} else
if (targetPlatform.name == 'win64') {
2018-04-20 13:25:51 +02:00
headers.srcDir new File("$mysql64Home/include")
2018-04-18 10:21:50 +02:00
sharedLibraryFile = new File("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = new File("$mysql64Home/lib/$linkName")
2017-10-31 09:07:53 +01:00
}
}
}
}
}
}
components {
DataMySQL(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
2018-05-03 18:04:59 +02:00
lib library: 'mysql'
2017-10-31 09:07:53 +01:00
lib project: ':Data', library: 'Data'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
cppCompiler.define "THREADSAFE"
2018-05-02 15:49:58 +02:00
2018-03-31 11:05:43 +02:00
if (toolChain in VisualCpp) {
cppCompiler.define "WINVER=0x0600"
2018-04-20 13:25:51 +02:00
cppCompiler.define "__LCC__"
2018-03-31 11:05:43 +02:00
}
2018-04-20 13:25:51 +02:00
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" )
}
2017-10-31 09:07:53 +01:00
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "MySQL_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }