3 # Copyright (c) 2014-2020. The SimGrid Team.
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.
9 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
10 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
12 CXX=@CMAKE_CXX_COMPILER@
14 INCLUDEARGS="@includeflag@"
15 CMAKE_LINKARGS="-L@libdir@"
19 list_set CXXFLAGS "-std=gnu++11" @SMPI_CXX_FLAGS@
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"
27 echo "Warning: smpicxx pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
29 list_add LINKARGS "-lsimgrid"
31 list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
32 list_add LINKARGS "@libdir@\libsimgrid.dll"
36 while [ $# -gt 0 ]; do
46 SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
47 if [ -z "$SRCFILE" ] ; then
50 list_add CMDARGS "${SRCFILE}"
52 '-version' | '--version')
53 printf '%b\n' "$SIMGRID_VERSION"
56 "-git-version" | "--git-version")
57 printf '%b\n' "$SIMGRID_GITHASH"
60 '-compiler-version' | '--compiler-version')
63 '-show'|'-compile-info'|'-link-info')
64 # Dry run displaying commands instead of executing them. Useful to cmake
68 list_add CMDARGS "${ARG}"
73 list_set CMDLINE "${CXX}"
74 list_add_not_empty CMDLINE "${CXXFLAGS}"
75 list_add_not_empty CMDLINE ${INCLUDEARGS}
76 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
77 list_add_not_empty CMDLINE "${CMDARGS}"
78 list_add_not_empty CMDLINE "${LINKARGS}"
80 eval $(list_get CMDLINE)
81 if [ "x$VERBOSE" = x1 -o "x$show" = x1 ] ; then
83 [ "x$show" = x1 ] && exit 0