Skip to content

Commit 7f0e4a2

Browse files
authored
Merge pull request #8209 from The-OpenROAD-Project-staging/ci-build
etc: add ci options to Build.sh
2 parents 266bd86 + 29cf512 commit 7f0e4a2

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

Jenkinsfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ def getParallelTests(String image) {
127127
stage('no-test Build') {
128128
timeout(time: 20, unit: 'MINUTES') {
129129
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
130-
sh label: 'no-test Build', script: 'cmake -B build_no_tests -D ENABLE_TESTS=OFF 2>&1 | tee no_test.log';
130+
sh label: 'no-test Build', script: './etc/Build.sh -no-warnings -no-tests';
131131
}
132132
}
133+
sh 'mv build/openroad_build.log no_test.log'
133134
archiveArtifacts artifacts: 'no_test.log';
134135
}
135136
}
@@ -176,11 +177,8 @@ def getParallelTests(String image) {
176177
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
177178
checkout scm;
178179
}
179-
stage('C++ Unit Tests Setup') {
180-
sh label: 'C++ Unit Tests Setup', script: 'cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja -B build .';
181-
}
182-
stage('C++ Unit Tests') {
183-
sh label: 'C++ Unit Tests', script: 'cd build && CLICOLOR_FORCE=1 ninja build_and_test';
180+
stage('C++ Build and Unit Tests') {
181+
sh label: 'C++ Build with Ninja', script: './etc/Build.sh -no-warnings -ninja';
184182
}
185183
}
186184
}
@@ -203,7 +201,7 @@ def getParallelTests(String image) {
203201
checkout scm;
204202
}
205203
stage('Compile with C++20') {
206-
sh label: 'Compile C++20', script: "./etc/Build.sh -no-warnings -compiler='clang-16' -cmake='-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=20'";
204+
sh label: 'Compile C++20', script: "./etc/Build.sh -cpp20"
207205
}
208206
}
209207
}

etc/Build.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ EOF
1919
numThreads=2
2020
fi
2121
cmakeOptions=""
22+
isNinja=no
2223
cleanBefore=no
2324
depsPrefixesFile=""
2425
keepLog=no
@@ -45,6 +46,9 @@ OPTIONS:
4546
-coverage Enable cmake coverage options
4647
-clean Remove build dir before compile
4748
-no-gui Disable GUI support
49+
-no-tests Disable GTest
50+
-ninja Use Ninja build system
51+
-cpp20 Use C++20 standard
4852
-build-man Build Man Pages (optional)
4953
-threads=NUM_THREADS Number of threads to use during
5054
compile. Default: \`nproc\` on linux
@@ -80,6 +84,16 @@ while [ "$#" -gt 0 ]; do
8084
-no-gui)
8185
cmakeOptions+=" -DBUILD_GUI=OFF"
8286
;;
87+
-no-tests)
88+
cmakeOptions+=" -DENABLE_TESTS=OFF"
89+
;;
90+
-ninja)
91+
cmakeOptions+=" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja"
92+
isNinja=yes
93+
;;
94+
-cpp20)
95+
cmakeOptions+=" -DCMAKE_CXX_STANDARD=20"
96+
;;
8397
-build-man)
8498
cmakeOptions+=" -DBUILD_MAN=ON"
8599
;;
@@ -194,5 +208,11 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
194208
fi
195209

196210
echo "[INFO] Using ${numThreads} threads."
211+
if [[ "$isNinja" == "yes" ]]; then
212+
eval cmake "${cmakeOptions}" -B "${buildDir}" .
213+
cd "${buildDir}"
214+
CLICOLOR_FORCE=1 ninja build_and_test
215+
exit 0
216+
fi
197217
eval cmake "${cmakeOptions}" -B "${buildDir}" .
198218
eval time cmake --build "${buildDir}" -j "${numThreads}"

0 commit comments

Comments
 (0)