set -e
-build_mode="$1"
+echo "Running $0 with arguments:" >&2
+for arg in "$@"; do
+ echo "- $arg"
+done
+build_mode="$1"
echo "Build mode $build_mode on $(uname -np)" >&2
+case "$build_mode" in
+ "Debug")
+ ;;
+
+ "ModelChecker")
+ ;;
+
+ "DynamicAnalysis")
+ ;;
+
+ *)
+ if "$(uname -o)" = "Msys"; then
+ echo "On Windows, jenkins is not willing to expand variables for some reason" >&2
+ echo "Force use Debug mode" >&2
+ else
+ echo "Unknown build_mode $build_mode"
+ exit 1
+ fi
+ ;;
+esac
+
+if test "$(uname -o)" = "Msys"; then
+ if [ -z "$NUMBER_OF_PROCESSORS" ]; then
+ NUMBER_OF_PROCESSORS=1
+ fi
+ GENERATOR="MSYS Makefiles"
+else
+ NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
+ GENERATOR="Unix Makefiles"
+fi
# usage: die status message...
die () {
fi
}
-ulimit -c 0
+ulimit -c 0 || true
if [ -d $WORKSPACE/build ]
then
mkdir $WORKSPACE/build
cd $WORKSPACE/build
-cmake -Denable_documentation=OFF $WORKSPACE
-make dist
+cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
+make dist -j$NUMBER_OF_PROCESSORS
tar xzf `cat VERSION`.tar.gz
cd `cat VERSION`
-case "$build_mode" in
- "Debug")
- ;;
-
- "ModelChecker")
- ;;
-
- "DynamicAnalysis")
- ;;
-
- *)
- die 1 "Unknown build_mode $build_mode"
- ;;
-esac
-
-cmake -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
+cmake -G"$GENERATOR"\
+ -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
-Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
-Denable_compile_optimization=$(onoff test "$build_mode" = "Debug") \
-Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" != "DynamicAnalysis") \
-Denable_compile_warnings=ON -Denable_smpi=ON -Denable_lib_static=OFF \
-Denable_latency_bound_tracking=OFF -Denable_gtnets=OFF -Denable_jedule=OFF \
-Denable_tracing=ON -Denable_java=ON
-make
+make -j$NUMBER_OF_PROCESSORS
cd $WORKSPACE/build
cd `cat VERSION`