Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement I/O as asynchronous activities
[simgrid.git] / src / smpi / smpicxx.in
1 #!/usr/bin/env sh
2
3 # Copyright (c) 2014-2018. 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 "-std=gnu++11"
20 list_set LINKARGS "-std=gnu++11"
21 if [ "@WIN32@" != "1" ]; then
22     # list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
23     list_add CXXFLAGS "-fpic"
24     if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
25        list_add LINKARGS "-shared"
26     else
27        echo "Warning: smpicxx pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
28     fi
29     list_add LINKARGS "-lsimgrid"
30 else
31     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
32     list_add LINKARGS "@libdir@\libsimgrid.dll"
33 fi
34
35 list_set CMDARGS
36 while [ $# -gt 0 ]; do
37     ARG="$1"
38     shift
39     case "${ARG}" in
40         -c)
41             CMAKE_LINKARGS=""
42             LINKARGS=""
43             list_add CMDARGS "-c"
44             ;;
45         *.c)
46             SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
47             if [ -z "$SRCFILE" ] ; then
48                 SRCFILE="$ARG"
49             fi
50             list_add CMDARGS "${SRCFILE}"
51             ;;
52         '-version' | '--version')
53             printf '%b\n' "$SIMGRID_VERSION"
54             exit 0
55             ;;
56         "-git-version" | "--git-version")
57             printf '%b\n' "$SIMGRID_GITHASH"
58             exit 0
59             ;;
60         '-compiler-version' | '--compiler-version')
61             ${CXX} --version
62             ;;
63         *)
64             list_add CMDARGS "${ARG}"
65       ;;
66   esac
67 done
68
69 list_set CMDLINE "${CXX}"
70 list_add_not_empty CMDLINE "${CXXFLAGS}"
71 list_add_not_empty CMDLINE ${INCLUDEARGS}
72 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
73 list_add_not_empty CMDLINE "${CMDARGS}"
74 list_add_not_empty CMDLINE "${LINKARGS}"
75
76 eval $(list_get CMDLINE)
77 "$@"