summaryrefslogtreecommitdiff
path: root/glib/CMakeLists.txt
blob: f640304d992da107eb95fe93f453fce686edcc05 (plain)
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# darwin-aarch64 PUBLIC os/darwin/aarch64) android_target_link_libraries( glib2
# darwin-x86_64 PUBLIC "-framework CoreFoundation" "-framework AppKit")

# Let's add in the library, we are appending the binary type, as we will ship
# multiple versions on m1.
message(STATUS "Building glib2 for ${ANDROID_TARGET_TAG}")
android_add_library(
  TARGET
  glib2_${ANDROID_TARGET_TAG}
  SHARED
  LIBNAME
  glib-2.0
  URL
  "https://android.googlesource.com/platform/external/bluetooth/glib/+/refs/heads/emu-master-dev/"
  SPDX
  "LGPL-2.1-only"
  LICENSE
  "https://android.googlesource.com/platform/external/bluetooth/glib/+/refs/heads/emu-master-dev/COPYING"
  LOCAL
  "${ANDROID_QEMU2_TOP_DIR}/LICENSES/LICENSE.LGPLv21"
  SRC
  garcbox.c
  garray.c
  gasyncqueue.c
  gatomic.c
  gbacktrace.c
  gbase64.c
  gbitlock.c
  gbookmarkfile.c
  gbytes.c
  gcharset.c
  gchecksum.c
  gconvert.c
  gdataset.c
  gdate.c
  gdatetime.c
  gdir.c
  genviron.c
  gerror.c
  gfileutils.c
  # ggettext.c # This requires the gettext packages.
  ghash.c
  ghmac.c
  ghook.c
  ghostutils.c
  giochannel.c
  gkeyfile.c
  glib-init.c
  glib-private.c
  glist.c
  gmain.c
  gmappedfile.c
  gmarkup.c
  gmem.c
  gmessages.c
  gnode.c
  goption.c
  gpathbuf.c
  gpattern.c
  gpoll.c
  gprimes.c
  gprintf.c
  gqsort.c
  gquark.c
  gqueue.c
  grand.c
  grcbox.c
  grefcount.c
  grefstring.c
  # gregex.c
  gscanner.c
  gsequence.c
  gshell.c
  gslice.c
  gslist.c
  gstdio.c
  gstrfuncs.c
  gstring.c
  gstringchunk.c
  gstrvbuilder.c
  gtestutils.c
  gthread.c
  gthreadpool.c
  gtimer.c
  gtimezone.c
  gtrace-private.h
  gtrace.c
  gtranslit.c
  gtrashstack.c
  gtree.c
  gunibreak.c
  gunicollate.c
  gunidecomp.c
  guniprop.c
  guri.c
  guriprivate.h
  gutf8.c
  gutils.c
  gutilsprivate.h
  # guuid.c # needs libintl.h from gettext
  gvariant-core.c
  gvariant-parser.c
  gvariant-serialiser.c
  gvariant.c
  gvarianttype.c
  gvarianttypeinfo.c
  gversion.c
  gwakeup.c
  libcharset/localcharset.c
  WINDOWS
  dirent/dirent.c
  giowin32.c
  gnulib/isnan.c
  gnulib/printf-args.c
  gnulib/printf-frexp.c
  gnulib/printf-frexpl.c
  gnulib/printf-parse.c
  gnulib/printf.c
  gnulib/vasnprintf.c
  gspawn-win32.c
  gthread-win32.c
  gwin32.c
  POSIX
  giounix.c
  glib-unix.c
  glib-unixprivate.h
  gspawn.c
  gthread-posix.c
  DARWIN
  gosxutils.m
  LINUX
  gjournal-private.c)

target_compile_options(
  glib2_${ANDROID_TARGET_TAG}
  PRIVATE -fvisibility=hidden
          -Winvalid-pch
          -Wextra
          -Wpedantic
          -std=gnu99
          -fno-strict-aliasing
          -Wimplicit-fallthrough
          -Wmisleading-indentation
          -Wmissing-field-initializers
          -Wnonnull
          -Wunused
          -Wno-unused-parameter
          -Wno-cast-function-type
          -Wno-pedantic
          -Wno-format-zero-length
          -Wno-variadic-macros
          -Werror=format=2
          -Werror=init-self
          -Werror=missing-include-dirs
          -Werror=pointer-arith
          -Werror=unused-result
          -Wstrict-prototypes
          -Wno-bad-function-cast
          -Werror=implicit-function-declaration
          -Werror=missing-prototypes
          -Wduplicate-decl-specifier
          -Werror=pointer-sign
          -Wno-string-plus-int)

target_compile_definitions(
  glib2_${ANDROID_TARGET_TAG}
  PRIVATE GLIB_COMPILATION _GNU_SOURCE G_DISABLE_CAST_CHECKS
          GLIB_CHARSETALIAS_DIR="")

android_target_include_directories(
  glib2_${ANDROID_TARGET_TAG}
  linux
  PUBLIC
  ../os/linux/glib
  ../glib
  ../os/linux
  ..)

android_target_include_directories(
  glib2_${ANDROID_TARGET_TAG}
  darwin
  PUBLIC
  ../os/darwin/glib
  ../glib
  ../os/darwin
  ..)
android_target_link_libraries(
  glib2_${ANDROID_TARGET_TAG}
  darwin
  PUBLIC
  "-framework CoreFoundation"
  "-framework AppKit"
  iconv
  c)

android_target_include_directories(
  glib2_${ANDROID_TARGET_TAG}
  windows
  PUBLIC
  ../os/windows/glib
  ../glib
  ../os/windows
  ..)
android_target_compile_definitions(
  glib2_${ANDROID_TARGET_TAG}
  windows
  PRIVATE
  UNICODE
  _UNICODE
  HAVE_ISNAN_IN_LIBC
  HAVE_ISNAND_IN_LIBC
  HAVE_ISNANF_IN_LIBC
  HAVE_ISNANL_IN_LIBC)
android_target_compile_options(
  glib2_${ANDROID_TARGET_TAG}
  windows
  PRIVATE
  -Wno-unknown-argument
  -Wno-format
  -Wno-unused-but-set-variable
  -Wno-implicit-fallthrough
  -Wno-format-nonliteral)

android_target_link_libraries(glib2_${ANDROID_TARGET_TAG} windows PUBLIC
                              ws2_32::ws2_32)
android_install_shared(glib2_${ANDROID_TARGET_TAG})

add_library(glib2 ALIAS glib2_${ANDROID_TARGET_TAG})
android_license(
  TARGET
  "glib2"
  LIBNAME
  glib-2.0
  URL
  "https://android.googlesource.com/platform/external/bluetooth/glib/+/refs/heads/emu-master-dev/"
  SPDX
  "LGPL-2.1-only"
  LICENSE
  "https://android.googlesource.com/platform/external/bluetooth/glib/+/refs/heads/emu-master-dev/COPYING"
  LOCAL
  "${ANDROID_QEMU2_TOP_DIR}/LICENSES/LICENSE.LGPLv21")