Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make smpirun guess the hostfile for cluster tags too
[simgrid.git] / src / smpi / smpicxx.in
1 #! /bin/sh
2
3 # Copyright (c) 2014. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
10
11 CXX=@CMAKE_CXX_COMPILER@
12
13 INCLUDEARGS="@includeflag@"
14 CMAKE_LINKARGS="-L@libdir@"
15
16 @SMPITOOLS_SH@
17
18 list_set CXXFLAGS
19 list_set LINKARGS
20 if [ "@WIN32@" != "1" ]; then
21     list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
22     list_add LINKARGS "-lsimgrid"
23 else
24     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
25     list_add LINKARGS "@libdir@\libsimgrid.dll"
26 fi
27
28 list_set CMDARGS
29 while [ $# -gt 0 ]; do
30     ARG="$1"
31     shift
32     case "${ARG}" in
33         -c)
34             CMAKE_LINKARGS=""
35             LINKARGS=""
36             list_add CMDARGS "-c"
37             ;;
38         *.c)
39             SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
40             if [ -z "$SRCFILE" ] ; then
41                 SRCFILE="$ARG"
42             fi
43             list_add CMDARGS "${SRCFILE}"
44             ;;
45         '-version' | '--version')
46             printf '%b\n' "$SIMGRID_VERSION"
47             exit 0
48             ;;
49         '-compiler-version' | '--compiler-version')
50             ${CXX} --version
51             ;;
52         *)
53             list_add CMDARGS "${ARG}"
54       ;;
55   esac
56 done
57
58 list_set CMDLINE "${CXX}"
59 list_add_not_empty CMDLINE "${CXXFLAGS}"
60 list_add_not_empty CMDLINE ${INCLUDEARGS}
61 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
62 list_add_not_empty CMDLINE "${CMDARGS}"
63 list_add_not_empty CMDLINE "${LINKARGS}"
64
65 eval $(list_get CMDLINE)
66 "$@"