summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh')
-rwxr-xr-xsrc/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh b/src/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh
new file mode 100755
index 0000000..500cd09
--- /dev/null
+++ b/src/contrib/SDL-2.30.2/cmake/test/test_pkgconfig.sh
@@ -0,0 +1,51 @@
1#!/bin/sh
2
3if test "x$CC" = "x"; then
4 CC=cc
5fi
6
7machine="$($CC -dumpmachine)"
8case "$machine" in
9 *mingw* )
10 EXEPREFIX=""
11 EXESUFFIX=".exe"
12 ;;
13 *android* )
14 EXEPREFIX="lib"
15 EXESUFFIX=".so"
16 LDFLAGS="$LDFLAGS -shared"
17 ;;
18 * )
19 EXEPREFIX=""
20 EXESUFFIX=""
21 ;;
22esac
23
24set -e
25
26# Get the canonical path of the folder containing this script
27testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
28SDL_CFLAGS="$( pkg-config sdl2 --cflags )"
29SDL_LDFLAGS="$( pkg-config sdl2 --libs )"
30SDL_STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
31
32compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS"
33link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
34static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
35
36echo "-- CC: $CC"
37echo "-- CFLAGS: $CFLAGS"
38echo "-- LDFLASG: $LDFLAGS"
39echo "-- SDL_CFLAGS: $SDL_CFLAGS"
40echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
41echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
42
43echo "-- COMPILE: $compile_cmd"
44echo "-- LINK: $link_cmd"
45echo "-- STATIC_LINK: $static_link_cmd"
46
47set -x
48
49$compile_cmd
50$link_cmd
51$static_link_cmd