This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
/
fastuidraw-config.in
168 lines (141 loc) · 4.07 KB
/
fastuidraw-config.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/sh
print_help() {
echo "Usage: $0 [--release] [--debug] [--cflags] [--libs] [--gl] [--gles] [--prefix=[/some/path]]"
echo " --release: indicate to compile/link for release"
echo " --debug: indicate to compile/link for debug"
echo " --cflags: print compile flags"
echo " --libs: print link flags"
echo " --static: modifier to indicate statically linking against FastUIDraw"
echo " --nodirs: exclude directory directives of FastUIDraw install location"
echo " --libdir=/some/path: specify library directory"
echo " --incdir=/some/path: specify include directory"
echo " --gl: use GL API (includes flags to use NGL dispatch)"
echo " --gles: use GLES API (includes flags to use NGL dispatch)"
echo " --ngl: add flags to use NGL dispatch"
echo " --ngles: add flags to use NGLES dispatch"
echo " --prefix: print path to which fastuidraw was installed"
echo " --prefix=/some/path: specify the path to which fastuidraw was installed"
echo "Notes: Never mix release and debug in a single executable, they are NOT ABI compatible"
echo " if both --release and --debug options are placed, all but the last of those is ignored"
echo " if both --gl and --gles options are placed, all but the last of those is ignored"
}
#if ! options=$(getopt -o- -l release,debug,cflags,libs,gl,gles,help -- "$@"); then
# print_help
# exit 1
#fi
if test $# -eq 0; then
print_help
exit 1
fi
mode=unknown
static_linking=0
print_cflags=0
print_libs=0
print_dirs=1
add_gl=0
add_gles=0
add_ngl=0
add_ngles=0
printhelp=0
location="@INSTALL_LOCATION@"
lib_location=$location/lib
include_location=$location/include
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--prefix=*)
location=$optarg
lib_location=$location/lib
include_location=$location/include
;;
--libdir=*)
lib_location=$optarg
;;
--incdir=*)
include_location=$optarg
;;
--prefix) echo $location ;;
--release) mode=release ;;
--debug) mode=debug ;;
--cflags) print_cflags=1 ;;
--libs) print_libs=1 ;;
--nodirs) print_dirs=0 ;;
--gles) add_gles=1 add_ngles=1 ;;
--gl) add_gl=1 add_ngl=1 ;;
--GLES) add_gles=1 add_ngles=1 ;;
--GL) add_gl=1 add_ngl=1 ;;
--ngl) add_ngl=1 ;;
--ngles) add_ngles=1 ;;
--static) static_linking=1 ;;
--help) printhelp=1 ;;
*)
print_help
exit 1 ;;
esac
shift
done
cflags=
base_cflags=
libs=
dir_libs=
if [ "$print_dirs" = "1" ]; then
base_cflags=-I$include_location
dir_libs=-L$lib_location
fi
if [ "$printhelp" = "1" ]; then
print_help
exit 1
fi
if [ "$print_cflags" = "1" ] || [ "$print_libs" = "1" ]; then
bad=0
if [ "$mode" = "unknown" ]; then
echo "Must specify debug or release (with --debug or --release respectively)"
bad=1
fi
if [ "$add_ngl" = "1" ] && [ "$add_ngles" = "1" ]; then
echo "Cannot mix GL and GLES dispatch in the same application"
bad=1
fi
if [ "$bad" = 1 ]; then
exit 1
fi
fi
libs="$dir_libs -lFastUIDraw_$mode"
cflags="$base_cflags"
if [ "$mode" = "release" ]; then
cflags="$cflags @FASTUIDRAW_release_CFLAGS@"
else
cflags="$cflags @FASTUIDRAW_debug_CFLAGS@"
fi
if [ "$add_ngl" = "1" ]; then
libs="$libs -lNGL_$mode"
fi
if [ "$add_ngles" = "1" ]; then
libs="$libs -lNGLES_$mode"
fi
if [ "$add_gl" = "1" ]; then
libs="$libs -lFastUIDrawGL_$mode"
cflags="$cflags @FASTUIDRAW_GL_CFLAGS@"
fi
if [ "$add_gles" = "1" ]; then
libs="$libs -lFastUIDrawGLES_$mode"
cflags="$cflags @FASTUIDRAW_GLES_CFLAGS@"
fi
if [ "$print_cflags" = "1" ]; then
echo $cflags
fi
if [ "$static_linking" = "1" ]; then
pre_link="-Wl,--whole-archive,-Bstatic"
post_link="-Wl,--no-whole-archive -static-libstdc++ -static-libgcc"
base_libs="@FASTUIDRAW_DEPS_STATIC_LIBS@"
else
pre_link=
post_link=
base_libs="@FASTUIDRAW_DEPS_LIBS@"
fi
if [ "$print_libs" = "1" ]; then
echo $base_libs $pre_link $libs $post_link
fi