aboutsummaryrefslogtreecommitdiff
path: root/client/libacron/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'client/libacron/meson.build')
-rw-r--r--client/libacron/meson.build81
1 files changed, 81 insertions, 0 deletions
diff --git a/client/libacron/meson.build b/client/libacron/meson.build
new file mode 100644
index 0000000..bd79834
--- /dev/null
+++ b/client/libacron/meson.build
@@ -0,0 +1,81 @@
+project('libac', 'c',
+ version : '1.0',
+ license : 'GPL-2.0-only',
+ default_options : [
+ 'c_std=gnu11', # c11 won't have ssize_t
+ 'b_lundef=false'
+ ]
+)
+
+xtra_link_args = []
+xtra_c_args = []
+if get_option('debug') == true
+ add_global_arguments('-DDEBUG', language : 'c')
+endif
+
+if meson.get_compiler('c').get_id() != 'msvc'
+ xtra_c_args = [ '-fvisibility=hidden' ]
+endif
+
+add_global_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c')
+
+install_headers([
+ 'include/common.h',
+ 'include/events.h',
+ 'include/ids.h',
+ 'include/incl.h',
+ 'include/libac.h',
+ 'include/net.h',
+ 'include/requests.h'
+ ],
+ subdir : 'libac'
+)
+
+libac_sources = [
+ 'ids.c',
+ 'library.c',
+ 'net.c',
+ 'private/helpers.c',
+ 'private/log.c',
+ 'private/serializer.c',
+ 'wic/src/http_parser.c',
+ 'wic/src/wic.c'
+]
+
+inc = include_directories('include', 'private', 'wic/include')
+
+jsonc_dep = dependency('json-c',
+ fallback : [ 'json-c', 'json_c_dep' ],
+ default_options: [ 'default_library=static' ]
+)
+
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m', required : false)
+
+libac = library('ac',
+ libac_sources,
+ version : '1.0',
+ soversion : '0',
+ include_directories : inc,
+ dependencies : [ jsonc_dep, m_dep ],
+ link_args : xtra_link_args,
+ c_args : xtra_c_args,
+ install : true
+)
+
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(
+ libraries : libac,
+ version : '1.0',
+ name : 'libac',
+ filebase : 'ac',
+ description : 'Acron client library'
+)
+
+# Warnings
+if get_option('debug') == true
+ message('Debug build')
+ if get_option('b_sanitize') == 'none'
+ message('Make sure to use -Db_sanitize=address to enable ASAN for debug builds.')
+ endif
+endif