Skip to content

Commit

Permalink
Add Gradle build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
zosrothko committed Oct 31, 2017
1 parent 6273f52 commit f2e58c1
Show file tree
Hide file tree
Showing 56 changed files with 3,946 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
*.vsp
*.psess

# Gradle #
##########
.gradle/
gradle/

# Make #
########
config.build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "openssl"]
path = openssl
url = https://github.com/pocoproject/openssl
[submodule "gradle"]
path = gradle
url = https://github.com/pocoproject/gradle
32 changes: 32 additions & 0 deletions CppParser/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
model {
components {
CppParser(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "CppParser_EXPORTS"
}
}
}
}
task poco { dependsOn "assemble" }
52 changes: 52 additions & 0 deletions CppParser/testsuite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec

model {
components {
TestSuite(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit'
lib project: ':CppParser', library: 'CppParser'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
testSuites {
CppParserTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
all {
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cppCompiler.args "/MDd"
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
}
}
}
task testsuite { dependsOn "assemble" }


33 changes: 33 additions & 0 deletions CppUnit/WinTestRunner/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
project(":CppUnit/WinTestRunner") {
model {
components {
PocoWinTestRunner(NativeExecutableSpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
}
}
}
}
binaries {
all {
}
withType(SharedLibraryBinarySpec) {
lib project: ':CppUnit', library: 'PocoCppUnit', linkage: 'shared'
if (toolChain in VisualCpp) {
cppCompiler.define "WinTestRunner_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
lib project: ':CppUnit', library: 'PocoCppUnit', linkage: 'static'
}
}
}
}

35 changes: 35 additions & 0 deletions CppUnit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
model {
components {
CppUnit(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
}
}
}
}
binaries {
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "CppUnit_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }


45 changes: 45 additions & 0 deletions Crypto/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
model {
components {
Crypto(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib library: 'ssl'
lib library: 'crypto'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
if (toolChain in VisualCpp) {
linker.args "ws2_32.lib"
linker.args "iphlpapi.lib"
}
if (toolChain in Gcc) {
linker.args "-lssl"
linker.args "-lcrypto"
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "Crypto_EXPORTS"
}
}
}
}
task poco { dependsOn "assemble" }

27 changes: 27 additions & 0 deletions Crypto/samples/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
model {
components {
genrsakey(NativeExecutableSpec) {
sources {
cpp.source { srcDir 'genrsakey/src' include '**/*.cpp' }
cpp.lib project: ':Crypto', library: 'Crypto'
cpp.lib project: ':Foundation', library: 'Foundation'
}
}
}
binaries {
all {
}
withType(SharedLibraryBinarySpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
withType(StaticLibraryBinarySpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'static'
}
withType(NativeExecutableSpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'static'
}
}
}
task sample { dependsOn "assemble" }


65 changes: 65 additions & 0 deletions Crypto/testsuite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec

model {
components {
withType(NativeComponentSpec) {
binaries.withType(NativeBinarySpec) {
if (buildType == buildTypes.debug) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
}
} else
if (buildType == buildTypes.release) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(executable.file, targetPlatform)
}
}
}
}
TestSuite(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit'
lib project: ':Crypto', library: 'Crypto'
lib library: 'ssl'
lib library: 'crypto'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
testSuites {
CryptoTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cppCompiler.args "/MDd"
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
}
}
task testsuite { dependsOn "assemble" }

Loading

0 comments on commit f2e58c1

Please sign in to comment.