Commit 3adb0741 authored by Dominik Charousset's avatar Dominik Charousset

Clean up CMake argument handling and invocation

parent 621dbc7f
#!/usr/bin/env groovy #!/usr/bin/env groovy
// List of CMake arguments used by most builds.
defaultCmakeArgs = '-DCAF_MORE_WARNINGS:BOOL=yes' \
+ ' -DCAF_ENABLE_RUNTIME_CHECKS:BOOL=yes' \
+ ' -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl' \
+ ' -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include' \
// Our build matrix. The keys are the operating system labels and the values // Our build matrix. The keys are the operating system labels and the values
// are lists of tool labels. // are lists of tool labels.
buildMatrix = [ buildMatrix = [
// Debug builds with ASAN + logging for various OS/compiler combinations. // Debug builds with ASAN + logging for various OS/compiler combinations.
['unix', [ ['unix', [
cmakeArgs: '-D CAF_LOG_LEVEL=4 '
+ '-D CAF_ENABLE_ADDRESS_SANITIZER:BOOL=yes',
builds: ['debug'], builds: ['debug'],
tools: ['gcc4.8', 'gcc4.9', 'gcc5', 'gcc6', 'gcc7', 'gcc8', 'clang'], tools: ['gcc4.8', 'gcc4.9', 'gcc5', 'gcc6', 'gcc7', 'gcc8', 'clang'],
cmakeArgs: defaultCmakeArgs
+ ' -DCAF_LOG_LEVEL:STRING=4'
+ ' -DCAF_ENABLE_ADDRESS_SANITIZER:BOOL=yes',
]], ]],
// One release build per supported OS. FreeBSD and Windows have the least // One release build per supported OS. FreeBSD and Windows have the least
// testing outside Jenkins, so we also explicitly schedule debug builds. // testing outside Jenkins, so we also explicitly schedule debug builds.
['Linux', [ ['Linux', [
builds: ['release'], builds: ['release'],
tools: ['gcc', 'clang'], tools: ['gcc', 'clang'],
cmakeArgs: defaultCmakeArgs,
]], ]],
['macOS', [ ['macOS', [
builds: ['release'], builds: ['release'],
tools: ['clang'], tools: ['clang'],
cmakeArgs: defaultCmakeArgs,
]], ]],
['FreeBSD', [ ['FreeBSD', [
builds: ['debug'], // no release build for now, because it takes 1h builds: ['debug'], // no release build for now, because it takes 1h
tools: ['clang'], tools: ['clang'],
cmakeArgs: defaultCmakeArgs,
]], ]],
['Windows', [ ['Windows', [
builds: ['debug', 'release'], builds: ['debug', 'release'],
tools: ['msvc'], tools: ['msvc'],
cmakeArgs: '-DCAF_BUILD_STATIC_ONLY:BOOL=yes'
+ ' -DCAF_ENABLE_RUNTIME_CHECKS:BOOL=yes'
+ ' -DCAF_NO_OPENCL:BOOL=yes',
]], ]],
// One Additional build for coverage reports. // One Additional build for coverage reports.
['unix', [ ['unix', [
cmakeArgs: '-D CAF_ENABLE_GCOV:BOOL=yes '
+ '-D CAF_NO_EXCEPTIONS:BOOL=yes '
+ '-D CAF_FORCE_NO_EXCEPTIONS:BOOL=yes',
builds: ['debug'], builds: ['debug'],
tools: ['gcovr'], tools: ['gcovr'],
extraSteps: ['coverageReport'], extraSteps: ['coverageReport'],
cmakeArgs: '-DCAF_ENABLE_GCOV:BOOL=yes '
+ ' -DCAF_NO_EXCEPTIONS:BOOL=yes '
+ ' -DCAF_FORCE_NO_EXCEPTIONS:BOOL=yes',
]], ]],
] ]
...@@ -45,23 +58,6 @@ buildEnvironments = [ ...@@ -45,23 +58,6 @@ buildEnvironments = [
'Linux && clang': ['CXX=clang++'], 'Linux && clang': ['CXX=clang++'],
] ]
// Builds options on UNIX.
unixOpts = "-DCAF_NO_PROTOBUF_EXAMPLES:BOOL=yes " +
"-DCAF_NO_QT_EXAMPLES:BOOL=yes " +
"-DCAF_MORE_WARNINGS:BOOL=yes " +
"-DCAF_ENABLE_RUNTIME_CHECKS:BOOL=yes " +
"-DCAF_NO_BENCHMARKS:BOOL=yes " +
"-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl " +
"-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include"
// Builds options on Windows.
msOpts = "-DCAF_BUILD_STATIC_ONLY:BOOL=yes " +
"-DCAF_NO_BENCHMARKS:BOOL=yes " +
"-DCAF_NO_EXAMPLES:BOOL=yes " +
"-DCAF_NO_MEM_MANAGEMENT:BOOL=yes " +
"-DCAF_NO_OPENCL:BOOL=yes " +
"-DCAF_LOG_LEVEL:INT=0 "
// Called *after* a build succeeded. // Called *after* a build succeeded.
def coverageReport() { def coverageReport() {
dir('caf-sources') { dir('caf-sources') {
...@@ -84,6 +80,24 @@ def coverageReport() { ...@@ -84,6 +80,24 @@ def coverageReport() {
} }
} }
def cmakeSteps(buildType, cmakeArgs) {
// Configure and build.
cmakeBuild([
buildDir: 'build',
buildType: buildType,
cmakeArgs: cmakeArgs,
installation: 'cmake in search path',
sourceDir: '.',
steps: [[withCmake: true]],
])
// Run unit tests.
ctest([
arguments: '--output-on-failure',
installation: 'cmake in search path',
workingDir: 'build',
])
}
def buildSteps(buildType, cmakeArgs) { def buildSteps(buildType, cmakeArgs) {
echo "build stage: $STAGE_NAME" echo "build stage: $STAGE_NAME"
deleteDir() deleteDir()
...@@ -92,45 +106,14 @@ def buildSteps(buildType, cmakeArgs) { ...@@ -92,45 +106,14 @@ def buildSteps(buildType, cmakeArgs) {
if (STAGE_NAME.contains('Windows')) { if (STAGE_NAME.contains('Windows')) {
echo "Windows build on $NODE_NAME" echo "Windows build on $NODE_NAME"
withEnv(['PATH=C:\\Windows\\System32;C:\\Program Files\\CMake\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\bin']) { withEnv(['PATH=C:\\Windows\\System32;C:\\Program Files\\CMake\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\bin']) {
// Configure and build. cmakeSteps(buildType, cmakeArgs)
cmakeBuild([
buildDir: 'build',
buildType: "$buildType",
cmakeArgs: "$msOpts $cmakeArgs",
generator: 'Visual Studio 15 2017',
installation: 'cmake in search path',
sourceDir: '.',
steps: [[withCmake: true]],
])
// Test.
ctest([
arguments: '--output-on-failure',
installation: 'cmake auto install',
workingDir: 'build',
])
} }
} else { } else {
echo "Unix build on $NODE_NAME" echo "Unix build on $NODE_NAME"
def leakCheck = STAGE_NAME.contains("Linux") && !STAGE_NAME.contains("clang") def leakCheck = STAGE_NAME.contains("Linux") && !STAGE_NAME.contains("clang")
withEnv(["label_exp=" + STAGE_NAME.toLowerCase(), withEnv(["label_exp=" + STAGE_NAME.toLowerCase(),
"ASAN_OPTIONS=detect_leaks=" + (leakCheck ? 1 : 0)]) { "ASAN_OPTIONS=detect_leaks=" + (leakCheck ? 1 : 0)]) {
// Configure and build. cmakeSteps(buildType, cmakeArgs)
cmakeBuild([
buildDir: 'build',
buildType: "$buildType",
cmakeArgs: "$unixOpts $cmakeArgs",
generator: 'Unix Makefiles',
installation: 'cmake in search path',
preloadScript: '../cmake/jenkins.cmake',
sourceDir: '.',
steps: [[args: 'all']],
])
// Test.
ctest([
arguments: '--output-on-failure',
installation: 'cmake in search path',
workingDir: 'build',
])
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment