Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[DOC] Fixed even more errors.
[simgrid.git] / src / smpi / smpicxx.in
1 #! /bin/sh
2
3 # Copyright (c) 2014-2015. 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 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
11
12 CXX=@CMAKE_CXX_COMPILER@
13
14 INCLUDEARGS="@includeflag@"
15 CMAKE_LINKARGS="-L@libdir@"
16
17 @SMPITOOLS_SH@
18
19 list_set CXXFLAGS
20 list_set LINKARGS
21 if [ "@WIN32@" != "1" ]; then
22     list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
23     list_add LINKARGS "-lsimgrid"
24 else
25     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
26     list_add LINKARGS "@libdir@\libsimgrid.dll"
27 fi
28
29 list_set CMDARGS
30 while [ $# -gt 0 ]; do
31     ARG="$1"
32     shift
33     case "${ARG}" in
34         -c)
35             CMAKE_LINKARGS=""
36             LINKARGS=""
37             list_add CMDARGS "-c"
38             ;;
39         *.c)
40             SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
41             if [ -z "$SRCFILE" ] ; then
42                 SRCFILE="$ARG"
43             fi
44             list_add CMDARGS "${SRCFILE}"
45             ;;
46         '-version' | '--version')
47             printf '%b\n' "$SIMGRID_VERSION"
48             exit 0
49             ;;
50         "-git-version" | "--git-version")
51             printf '%b\n' "$SIMGRID_GITHASH"
52             exit 0
53             ;;
54         '-compiler-version' | '--compiler-version')
55             ${CXX} --version
56             ;;
57         *)
58             list_add CMDARGS "${ARG}"
59       ;;
60   esac
61 done
62
63 list_set CMDLINE "${CXX}"
64 list_add_not_empty CMDLINE "${CXXFLAGS}"
65 list_add_not_empty CMDLINE ${INCLUDEARGS}
66 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
67 list_add_not_empty CMDLINE "${CMDARGS}"
68 list_add_not_empty CMDLINE "${LINKARGS}"
69
70 eval $(list_get CMDLINE)
71 "$@"