Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define simgrid::xbt::Path to manage file names.
[simgrid.git] / src / smpi / smpicxx.in
1 #! /bin/sh
2
3 # Copyright (c) 2014-2017. 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 CXXFLAGS "-fpic"
24     list_add LINKARGS "-shared" "-lsimgrid"
25 else
26     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
27     list_add LINKARGS "@libdir@\libsimgrid.dll"
28 fi
29
30 list_set CMDARGS
31 while [ $# -gt 0 ]; do
32     ARG="$1"
33     shift
34     case "${ARG}" in
35         -c)
36             CMAKE_LINKARGS=""
37             LINKARGS=""
38             list_add CMDARGS "-c"
39             ;;
40         *.c)
41             SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
42             if [ -z "$SRCFILE" ] ; then
43                 SRCFILE="$ARG"
44             fi
45             list_add CMDARGS "${SRCFILE}"
46             ;;
47         '-version' | '--version')
48             printf '%b\n' "$SIMGRID_VERSION"
49             exit 0
50             ;;
51         "-git-version" | "--git-version")
52             printf '%b\n' "$SIMGRID_GITHASH"
53             exit 0
54             ;;
55         '-compiler-version' | '--compiler-version')
56             ${CXX} --version
57             ;;
58         *)
59             list_add CMDARGS "${ARG}"
60       ;;
61   esac
62 done
63
64 list_set CMDLINE "${CXX}"
65 list_add_not_empty CMDLINE "${CXXFLAGS}"
66 list_add_not_empty CMDLINE ${INCLUDEARGS}
67 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
68 list_add_not_empty CMDLINE "${CMDARGS}"
69 list_add_not_empty CMDLINE "${LINKARGS}"
70
71 eval $(list_get CMDLINE)
72 "$@"