Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[TO DELETE] Mess with instr includes.
[simgrid.git] / BuildSimGrid.sh
1 #!/usr/bin/env sh
2 #
3 # This little script rebuilds and runs the SimGrid archive in parallel, extracting a log
4 # This is almost a personal script, but others may find this useful
5 #
6 # Copyright (c) 2017-2023 The SimGrid Team. Licence: LGPL of WDFPL, as you want.
7
8 if [ ! -e Makefile ] && [ ! -e build.ninja ]; then
9   if [ -e build/default/Makefile ] ; then
10     cd build/default
11   else
12     echo "Please configure SimGrid before building it:"
13     echo "   ccmake ."
14     exit 1
15   fi
16 fi
17
18 target=examples
19 ncores=$(grep -c processor /proc/cpuinfo)
20 halfcores=$(expr $ncores / 2 + 1)
21
22 install_path=$(sed -n 's/^CMAKE_INSTALL_PREFIX:PATH=//p' CMakeCache.txt)
23 if [ -e ${install_path} ] && [ -d ${install_path} ] && [ -x ${install_path} ] && [ -w ${install_path} ] ; then
24   target=install
25 fi
26
27 if [ -e build.ninja ] ; then
28   builder="ninja"
29 else
30   builder="make"
31 fi
32
33 (
34   echo "install_path: ${install_path}"
35   echo "Target: ${target}"
36   echo "Cores to build: ${ncores}"
37   echo "Cores to test: ${halfcores}"
38   (nice ${builder} -j${ncores} ${target} tests || ${builder} ${target} tests) && nice ctest -j${halfcores} --output-on-failure ; date
39 ) 2>&1 | tee BuildSimGrid.sh.log
40