WORKSPACE=$1
build_mode=$2
+
rm -rf $WORKSPACE/build
mkdir $WORKSPACE/build
if test "$(uname -o)" = "Msys"
then
+
cmake -G "MSYS Makefiles" $WORKSPACE
+ #$NUMBER_OF_PROCESSORS should be already set on win
+ if [ -z "$NUMBER_OF_PROCESSORS" ]; then
+ NUMBER_OF_PROCESSORS=1
+ fi
if [ $? -ne 0 ] ; then
echo "Failed to do the first cmake - Halting"
exit 5
fi
- make
+ make -j$NUMBER_OF_PROCESSORS
if [ $? -ne 0 ] ; then
echo "Build failure - Halting"
exit 6
fi
-else
+else
+ NUMBER_OF_PROCESSORS=0
+ # Linux:
+ cpuinfo_file="/proc/cpuinfo"
+ if [ -f "${cpuinfo_file}" ]; then
+ NUMBER_OF_PROCESSORS=$(grep -c "processor.: " ${cpuinfo_file})
+ fi
+ # grep returns 0 or cpuinfo not found
+ if [ $NUMBER_OF_PROCESSORS = 0 ]; then
+ NUMBER_OF_PROCESSORS=1
+ fi
+
cmake $WORKSPACE
if [ $? -ne 0 ] ; then
exit 5
fi
- make
+ make -j$NUMBER_OF_PROCESSORS
if [ $? -ne 0 ] ; then
echo "Build failure - Halting"
fi
-ctest -T test --no-compress-output --timeout 100 || true
+
+echo "running tests with $NUMBER_OF_PROCESSORS processors"
+
+ctest -T test --no-compress-output --timeout 100 -j$NUMBER_OF_PROCESSORS || true
if [ -f Testing/TAG ] ; then
xsltproc $WORKSPACE/buildtools/jenkins/ctest2junit.xsl -o "$WORKSPACE/CTestResults.xml" Testing/`head -n 1 < Testing/TAG`/Test.xml
fi