Split build.gradle: one for Windows, one for Linux/OSX

This commit is contained in:
Francis ANDRE 2018-03-29 18:24:42 +02:00
parent 502462c4bd
commit 2b7d2b5337
5 changed files with 1311 additions and 132 deletions

View File

@ -38,15 +38,6 @@ File appendStaticSuffix(File binaryFile) {
}
return new File(parent, name.substring(0, extensionSeparatorIndex) + "MT" + name.substring(extensionSeparatorIndex))
}
File appendSemiStaticSuffix(File binaryFile) {
String name = binaryFile.getName()
File parent = binaryFile.getParentFile()
int extensionSeparatorIndex = name.lastIndexOf('.')
if (extensionSeparatorIndex == -1) {
return new File(parent, name + "MD")
}
return new File(parent, name.substring(0, extensionSeparatorIndex) + "MD" + name.substring(extensionSeparatorIndex))
}
File prefixByPoco(File binaryFile) {
String name = binaryFile.getName()
String prefix = ''
@ -280,47 +271,42 @@ subprojects {
}
}
}
def openSSLWinHome = new File(rootDir, "openssl/build")
def openSSLBrewHome = new File('/usr/local/opt/openssl')
def openSSLLinuxLib = new File('/usr/local/lib')
def openSSLLinuxInc = new File('/usr/local/include/openssl')
def opensslHome = new File(rootDir, "openssl/build")
def opensslBrewHome = new File('/usr/local/opt/openssl')
def opensslLinuxHome = new File('/usr/lib/x86_64-linux-gnu')
crypto {
headers.srcDir "$opensslHome/include"
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
headers.srcDir "$openSSLWinHome/include"
libName = 'libcryptod.lib'
staticLibraryFile = file("$openSSLWinHome/win32/lib/debug/$libName")
staticLibraryFile = file("$opensslHome/win32/lib/debug/$libName")
} else if (targetPlatform.name == 'win64') {
headers.srcDir "$openSSLWinHome/include"
libName = 'libcryptod.lib'
staticLibraryFile = file("$openSSLWinHome/win64/lib/debug/$libName")
staticLibraryFile = file("$opensslHome/win64/lib/debug/$libName")
} else if (targetPlatform.operatingSystem.macOsX) {
headers.srcDir "$openSSLBrewHome/include"
libName = 'libcryptod.a'
staticLibraryFile = file("$openSSLBrewHome/lib/$libName")
staticLibraryFile = file("$opensslBrewHome/lib/$libName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
libName = 'libcrypto.a'
staticLibraryFile = file("$openSSLLinuxLib/$libName")
libName = 'libcryptod.a'
staticLibraryFile = file("$opensslLinuxHome/$libName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
libName = 'libcrypto.lib'
staticLibraryFile = file("$openSSLWinHome/win32/lib/release/$libName")
staticLibraryFile = file("$opensslHome/win32/lib/release/$libName")
} else if (targetPlatform.name == 'win64') {
libName = 'libcrypto.lib'
staticLibraryFile = file("$openSSLWinHome/win64/lib/release/$libName")
staticLibraryFile = file("$opensslHome/win64/lib/release/$libName")
} else if (targetPlatform.operatingSystem.macOsX) {
libName = 'libcrypto.a'
staticLibraryFile = file("$openSSLBrewHome/lib/$libName")
staticLibraryFile = file("$opensslBrewHome/lib/$libName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
libName = 'libcrypto.a'
staticLibraryFile = file("$openSSLLinuxLib/$libName")
staticLibraryFile = file("$opensslLinuxHome/$libName")
}
} else {
throw new GradleException("Unknown buildType" + buildType)
@ -333,48 +319,46 @@ subprojects {
if (targetPlatform.name == 'win32') {
dllName = 'libcryptod.dll'
linkName = 'libcryptod.lib'
sharedLibraryFile = file("$openSSLWinHome/win32/bin/debug/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win32/bin/debug/$linkName")
sharedLibraryFile = file("$opensslHome/win32/bin/debug/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win32/bin/debug/$linkName")
} else if (targetPlatform.name == 'win64') {
dllName = 'libcryptod.dll'
linkName = 'libcryptod.lib'
sharedLibraryFile = file("$openSSLWinHome/win64/bin/debug/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win64/bin/debug/$linkName")
sharedLibraryFile = file("$opensslHome/win64/bin/debug/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win64/bin/debug/$linkName")
} else if (targetPlatform.operatingSystem.macOsX) {
dllName = 'libcryptod.dylib'
linkName = 'libcryptod.dylib'
sharedLibraryFile = file("$openSSLBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$openSSLBrewHome/lib/$linkName")
sharedLibraryFile = file("$opensslBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$opensslBrewHome/lib/$linkName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
dllName = 'libcrypto.so'
linkName = 'libcrypto.a'
sharedLibraryFile = file("$openSSLLinuxLib/$dllName")
sharedLibraryLinkFile = file("$openSSLLinuxLib/$linkName")
dllName = 'libcryptod.so'
linkName = 'libcryptod.so'
sharedLibraryFile = file("$opensslLinuxHome/$dllName")
sharedLibraryLinkFile = file("$opensslLinuxHome/$linkName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
dllName = 'libcrypto.dll'
linkName = 'libcrypto.lib'
sharedLibraryFile = file("$openSSLWinHome/win32/bin/release/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win32/bin/release/$linkName")
sharedLibraryFile = file("$opensslHome/win32/bin/release/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win32/bin/release/$linkName")
} else if (targetPlatform.name == 'win64') {
dllName = 'libcrypto.dll'
linkName = 'libcrypto.lib'
sharedLibraryFile = file("$openSSLWinHome/win64/bin/release/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win64/bin/release/$linkName")
sharedLibraryFile = file("$opensslHome/win64/bin/release/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win64/bin/release/$linkName")
} else if (targetPlatform.operatingSystem.macOsX) {
dllName = 'libcrypto.dylib'
linkName = 'libcrypto.dylib'
sharedLibraryFile = file("$openSSLBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$openSSLBrewHome/lib/$linkName")
sharedLibraryFile = file("$opensslBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$opensslBrewHome/lib/$linkName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
dllName = 'libcrypto.so'
linkName = 'libcrypto.a'
sharedLibraryFile = file("$openSSLLinuxLib/$dllName")
sharedLibraryLinkFile = file("$openSSLLinuxLib/$linkName")
linkName = 'libcrypto.so'
sharedLibraryFile = file("$opensslLinuxHome/$dllName")
sharedLibraryLinkFile = file("$opensslLinuxHome/$linkName")
}
} else {
throw new GradleException("Unknown buildType" + buildType)
@ -382,41 +366,38 @@ subprojects {
}
}
ssl {
headers.srcDir "$opensslHome/include"
binaries.withType(StaticLibraryBinary) {
def libName
if (buildType == buildTypes.debug) {
if (targetPlatform.name == 'win32') {
headers.srcDir "$openSSLWinHome/include"
libName = 'libssld.lib'
staticLibraryFile = file("$openSSLWinHome/win32/lib/debug/$libName")
staticLibraryFile = file("$opensslHome/win32/lib/debug/$libName")
} else if (targetPlatform.name == 'win64') {
headers.srcDir "$openSSLWinHome/include"
libName = 'libssld.lib'
staticLibraryFile = file("$openSSLWinHome/win64/lib/debug/$libName")
staticLibraryFile = file("$opensslHome/win64/lib/debug/$libName")
} else if (targetPlatform.operatingSystem.macOsX) {
libName = 'libssld.a'
staticLibraryFile = file("$openSSLBrewHome/lib/$libName")
staticLibraryFile = file("$opensslBrewHome/lib/$libName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
libName = 'libssl.a'
staticLibraryFile = file("$openSSLLinuxLib/$libName")
libName = 'libssld.a'
staticLibraryFile = file("$opensslLinuxHome/$libName")
}
} else
if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
libName = 'libssl.lib'
staticLibraryFile = file("$openSSLWinHome/win32/lib/release/$libName")
staticLibraryFile = file("$opensslHome/win32/lib/release/$libName")
} else if (targetPlatform.name == 'win64') {
libName = 'libssl.lib'
staticLibraryFile = file("$openSSLWinHome/win64/lib/release/$libName")
staticLibraryFile = file("$opensslHome/win64/lib/release/$libName")
} else if (targetPlatform.operatingSystem.macOsX) {
libName = 'libssl.a'
staticLibraryFile = file("$openSSLBrewHome/lib/$libName")
staticLibraryFile = file("$opensslBrewHome/lib/$libName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
libName = 'libssl.a'
staticLibraryFile = file("$openSSLLinuxLib/$libName")
staticLibraryFile = file("$opensslLinuxHome/$libName")
}
} else {
throw new GradleException("Unknown buildType" + buildType)
@ -429,47 +410,45 @@ subprojects {
if (targetPlatform.name == 'win32') {
dllName = 'libssld.dll'
linkName = 'libssld.lib'
sharedLibraryFile = file("$openSSLWinHome/win32/bin/debug/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win32/bin/debug/$linkName")
sharedLibraryFile = file("$opensslHome/win32/bin/debug/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win32/bin/debug/$linkName")
} else if (targetPlatform.name == 'win64') {
dllName = 'libssld.dll'
linkName = 'libssld.lib'
sharedLibraryFile = file("$openSSLWinHome/win64/bin/debug/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win64/bin/debug/$linkName")
sharedLibraryFile = file("$opensslHome/win64/bin/debug/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win64/bin/debug/$linkName")
} else if (targetPlatform.operatingSystem.macOsX) {
dllName = 'libssld.dylib'
linkName = 'libssld.dylib'
sharedLibraryFile = file("$openSSLBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$openSSLBrewHome/lib/$linkName")
sharedLibraryFile = file("$opensslBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$opensslBrewHome/lib/$linkName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
dllName = 'libssl.so'
linkName = 'libssl.a'
sharedLibraryFile = file("$openSSLLinuxLib/$dllName")
sharedLibraryLinkFile = file("$openSSLLinuxLib/$linkName")
dllName = 'libssld.so'
linkName = 'libssld.so'
sharedLibraryFile = file("$opensslLinuxHome/$dllName")
sharedLibraryLinkFile = file("$opensslLinuxHome/$linkName")
}
} else if (buildType == buildTypes.release) {
if (targetPlatform.name == 'win32') {
dllName = 'libssl.dll'
linkName = 'libssl.lib'
sharedLibraryFile = file("$openSSLWinHome/win32/bin/release/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win32/bin/release/$linkName")
sharedLibraryFile = file("$opensslHome/win32/bin/release/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win32/bin/release/$linkName")
} else if (targetPlatform.name == 'win64') {
dllName = 'libssl.dll'
linkName = 'libssl.lib'
sharedLibraryFile = file("$openSSLWinHome/win64/bin/release/$dllName")
sharedLibraryLinkFile = file("$openSSLWinHome/win64/bin/release/$linkName")
sharedLibraryFile = file("$opensslHome/win64/bin/release/$dllName")
sharedLibraryLinkFile = file("$opensslHome/win64/bin/release/$linkName")
} else if (targetPlatform.operatingSystem.macOsX) {
dllName = 'libssl.dylib'
linkName = 'libssl.dylib'
sharedLibraryFile = file("$openSSLBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$openSSLBrewHome/lib/$linkName")
sharedLibraryFile = file("$opensslBrewHome/lib/$dllName")
sharedLibraryLinkFile = file("$opensslBrewHome/lib/$linkName")
} else if (targetPlatform.operatingSystem.linux) {
headers.srcDir "$openSSLLinuxInc/include"
dllName = 'libssl.so'
linkName = 'libssl.a'
sharedLibraryFile = file("$openSSLLinuxLib/$dllName")
sharedLibraryLinkFile = file("$openSSLLinuxLib/$linkName")
linkName = 'libssl.so'
sharedLibraryFile = file("$opensslLinuxHome/$dllName")
sharedLibraryLinkFile = file("$opensslLinuxHome/$linkName")
}
} else {
throw new GradleException("Unknown buildType" + buildType)
@ -480,9 +459,9 @@ subprojects {
}
components {
withType(NativeComponentSpec) {
// targetPlatform "win32"
// targetPlatform "win64"
// targetPlatform "linux32"
targetPlatform "win32"
targetPlatform "win64"
targetPlatform "linux32"
targetPlatform "linux64"
targetPlatform "macos"
@ -531,11 +510,6 @@ subprojects {
}
}
} else
/*
if (it instanceof SemiStaticLibraryBinarySpec) {
semiStaticLibraryFile = toStatic(prefixByPoco(appendDebugSuffix(appendSemiStaticSuffix(semiStaticLibraryFile))), targetPlatform)
} else
*/
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toBin(appendDebugSuffix(executable.file), targetPlatform)
}
@ -568,17 +542,6 @@ subprojects {
}
}
} else
/*
if (it instanceof SemiStaticLibraryBinarySpec) {
semiStaticLibraryFile = toStatic(prefixByPoco(appendSemiStaticSuffix(semiStaticLibraryFile)), targetPlatform)
def binary = it
tasks.withType(CreateSemiStaticLibrary) {
doFirst {
binary.semiStaticLibraryFile.parentFile.mkdirs()
}
}
} else
*/
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toBin(executable.file, targetPlatform)
}
@ -722,30 +685,6 @@ subprojects {
if (toolChain in Gcc) {
}
}
/*
withType(SemiStaticLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cCompiler.define '_LIB'
cCompiler.define 'POCO_STATIC'
cppCompiler.define '_LIB'
cppCompiler.define 'POCO_STATIC'
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cCompiler.args "/Fd" + toStatic(toPDB(semiStaticLibraryFile), targetPlatform)
cppCompiler.args "/MDd"
cppCompiler.args "/Fd" + toStatic(toPDB(semiStaticLibraryFile), targetPlatform)
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
*/
withType(NativeExecutableBinarySpec) {
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {

1169
build.gradle.win Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,10 +22,10 @@ WDKVers=10.0.16299.0
# VisualStudio 2017
# c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503
VCHome=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503
VCHome=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\cl.exe
CLPath=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\114.13.26128\bin\HostX86\x86\cl.exe
CLPath=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/HostX86/x86
# https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311.exe
WiXHome=C:/Program Files (x86)/WiX Toolset v3.11

View File

@ -18,7 +18,6 @@ if (os.windows) {
include ':Data:ODBC'
include ':Data:SQLite'
include ':Data:MySQL'
include ':Data:PostgreSQL'
}
include ':Zip'
include ':PageCompiler'
@ -46,9 +45,8 @@ if (os.windows) {
include ':Data:ODBC:testsuite'
include ':Data:SQLite:testsuite'
include ':Data:MySQL:testsuite'
include ':Data:PostgreSQL:testsuite'
}
include ':MongoDB:testsuite'
//include ':MongoDB:testsuite'
include ':Redis:testsuite'
include ':CppParser:testsuite'
include ':Zip:testsuite'
@ -63,7 +61,7 @@ if (os.windows) {
include ':NetSSL_Win:samples'
}
include ':JSON:samples'
//include ':MongoDB:samples'
include ':MongoDB:samples'
include ':Net:samples'
include ':PageCompiler:samples'
include ':PDF:samples'

73
settings.gradle.win Normal file
View File

@ -0,0 +1,73 @@
def os = org.gradle.internal.os.OperatingSystem.current()
rootProject.name = 'Poco'
//rootProject.build.gradle = 'build.gradle.win'
include ':CppUnit'
include ':Encodings'
include ':Foundation'
include ':XML'
include ':JSON'
include ':Util'
include ':Net'
include ':Crypto'
include ':NetSSL_OpenSSL'
if (os.windows) {
include ':NetSSL_Win'
}
include ':Data'
if (os.windows) {
include ':Data:ODBC'
include ':Data:SQLite'
include ':Data:MySQL'
}
include ':Zip'
include ':PageCompiler'
include ':PageCompiler:File2Page'
include ':PDF'
include ':CppParser'
include ':MongoDB'
include ':Redis'
include ':PocoDoc'
include ':ProGen'
include ':Encodings:testsuite'
include ':Foundation:testsuite'
include ':XML:testsuite'
include ':JSON:testsuite'
include ':Util:testsuite'
include ':Net:testsuite'
include ':Crypto:testsuite'
include ':NetSSL_OpenSSL:testsuite'
if (os.windows) {
include ':NetSSL_Win:testsuite'
}
include ':Data:testsuite'
if (os.windows) {
include ':Data:ODBC:testsuite'
include ':Data:SQLite:testsuite'
include ':Data:MySQL:testsuite'
}
//include ':MongoDB:testsuite'
include ':Redis:testsuite'
include ':CppParser:testsuite'
include ':Zip:testsuite'
include ':Encodings:samples'
include ':Foundation:samples'
if (os.windows) {
include ':Data:samples'
}
include ':NetSSL_OpenSSL:samples'
if (os.windows) {
include ':NetSSL_Win:samples'
}
include ':JSON:samples'
include ':MongoDB:samples'
include ':Net:samples'
include ':PageCompiler:samples'
include ':PDF:samples'
include ':Util:samples'
include ':XML:samples'
include ':SevenZip:samples'
include ':Zip:samples'