diff options
author | Lzu Tao <taolzu@gmail.com> | 2018-12-01 05:15:53 (GMT) |
---|---|---|
committer | Lzu Tao <taolzu@gmail.com> | 2018-12-02 03:00:27 (GMT) |
commit | 5bc119455fde697f132adbd7fd50f095954f703b (patch) | |
tree | d4b4bcffae99a9f793c735f9e59c8a452806c95b /contrib/meson/lib/meson.build | |
parent | 6689dae33ba1eb588abe3d3cb763bc5dc08878b3 (diff) | |
download | lz4-5bc119455fde697f132adbd7fd50f095954f703b.zip lz4-5bc119455fde697f132adbd7fd50f095954f703b.tar.gz lz4-5bc119455fde697f132adbd7fd50f095954f703b.tar.bz2 |
Add meson build system
Diffstat (limited to 'contrib/meson/lib/meson.build')
-rw-r--r-- | contrib/meson/lib/meson.build | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/contrib/meson/lib/meson.build b/contrib/meson/lib/meson.build new file mode 100644 index 0000000..3810601 --- /dev/null +++ b/contrib/meson/lib/meson.build @@ -0,0 +1,52 @@ +# ############################################################################# +# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +lz4_root_dir = '../../..' + +liblz4_includes = [include_directories(join_paths(lz4_root_dir, 'lib'))] +liblz4_sources = [join_paths(lz4_root_dir, 'lib/lz4.c'), + join_paths(lz4_root_dir, 'lib/lz4frame.c'), + join_paths(lz4_root_dir, 'lib/lz4hc.c'), + join_paths(lz4_root_dir, 'lib/xxhash.c')] +liblz4_c_args = [] + +liblz4_debug_cflags = [] +if use_debug + liblz4_c_args += '-DLZ4_DEBUG=@0@'.format(debug_level) + if [compiler_gcc, compiler_clang].contains(cc_id) + liblz4_debug_cflags = ['-Wextra', '-Wcast-qual', '-Wcast-align', '-Wshadow', + '-Wswitch-enum', '-Wdeclaration-after-statement', '-Wstrict-prototypes', + '-Wundef', '-Wpointer-arith', '-Wstrict-aliasing=1'] + endif +endif +liblz4_c_args += cc.get_supported_arguments(liblz4_debug_cflags) + +liblz4 = library('lz4', + liblz4_sources, + include_directories: liblz4_includes, + c_args: liblz4_c_args, + install: true, + soversion: lz4_libversion) + +liblz4_dep = declare_dependency(link_with: liblz4, + include_directories: liblz4_includes) + +pkgconfig.generate(name: 'lz4', + filebase: 'lz4', + libraries: [liblz4], + description: 'extremely fast lossless compression algorithm library', + version: lz4_libversion, + url: 'http://www.lz4.org/') + +install_headers(join_paths(lz4_root_dir, 'lib/lz4.h'), + join_paths(lz4_root_dir, 'lib/lz4hc.h'), + join_paths(lz4_root_dir, 'lib/lz4frame.h')) +if get_option('default_library') != 'shared' + install_headers(join_paths(lz4_root_dir, 'lib/lz4frame_static.h')) +endif |