diff options
author | Julius Michaelis <gitter@liftm.de> | 2019-09-26 08:23:53 (GMT) |
---|---|---|
committer | Julius Michaelis <gitter@liftm.de> | 2019-09-26 08:29:04 (GMT) |
commit | b6623e710d6bea36634d82547b0d89021b0d6549 (patch) | |
tree | 7318aaa0f75467501645d2ef754a9334d59bf0e1 /contrib | |
parent | e9d8e15263df4a0529dcd22ca48c82869d19abb9 (diff) | |
download | lz4-b6623e710d6bea36634d82547b0d89021b0d6549.zip lz4-b6623e710d6bea36634d82547b0d89021b0d6549.tar.gz lz4-b6623e710d6bea36634d82547b0d89021b0d6549.tar.bz2 |
meson: move one layer deeper to allow easy construction of a wrap file
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/meson/meson.build | 114 | ||||
-rw-r--r-- | contrib/meson/meson/GetLz4LibraryVersion.py (renamed from contrib/meson/GetLz4LibraryVersion.py) | 0 | ||||
-rw-r--r-- | contrib/meson/meson/InstallSymlink.py (renamed from contrib/meson/InstallSymlink.py) | 0 | ||||
-rw-r--r-- | contrib/meson/meson/contrib/gen_manual/meson.build (renamed from contrib/meson/contrib/gen_manual/meson.build) | 2 | ||||
-rw-r--r-- | contrib/meson/meson/contrib/meson.build (renamed from contrib/meson/contrib/meson.build) | 0 | ||||
-rw-r--r-- | contrib/meson/meson/examples/meson.build (renamed from contrib/meson/examples/meson.build) | 2 | ||||
-rw-r--r-- | contrib/meson/meson/lib/meson.build (renamed from contrib/meson/lib/meson.build) | 2 | ||||
-rw-r--r-- | contrib/meson/meson/meson.build | 118 | ||||
-rw-r--r-- | contrib/meson/meson/programs/meson.build (renamed from contrib/meson/programs/meson.build) | 2 | ||||
-rw-r--r-- | contrib/meson/meson/tests/meson.build (renamed from contrib/meson/tests/meson.build) | 2 |
10 files changed, 128 insertions, 114 deletions
diff --git a/contrib/meson/meson.build b/contrib/meson/meson.build index 65a4c26..d1e97d9 100644 --- a/contrib/meson/meson.build +++ b/contrib/meson/meson.build @@ -7,6 +7,10 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# +# This is a dummy meson file. +# The intention is that it can be easily moved to the root of the project +# (together with meson_options.txt) and packaged for wrapdb. + project('lz4', ['c'], license: ['BSD', 'GPLv2'], default_options : ['c_std=c99', @@ -14,112 +18,4 @@ project('lz4', ['c'], version: 'DUMMY', meson_version: '>=0.47.0') -cc = meson.get_compiler('c') -pkgconfig = import('pkgconfig') -python3 = import('python').find_installation() -c_std = get_option('c_std') -default_library = get_option('default_library') - -host_machine_os = host_machine.system() -os_windows = 'windows' -os_linux = 'linux' -os_darwin = 'darwin' -os_freebsd = 'freebsd' -os_sun = 'sunos' - -cc_id = cc.get_id() -compiler_gcc = 'gcc' -compiler_clang = 'clang' -compiler_msvc = 'msvc' - -lz4_version = meson.project_version() - -lz4_h_file = join_paths(meson.current_source_dir(), '../../lib/lz4.h') -GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py') -r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file) -if r.returncode() == 0 - lz4_version = r.stdout().strip() - message('Project version is now: @0@'.format(lz4_version)) -else - error('Cannot find project version in @0@'.format(lz4_h_file)) -endif - -lz4_libversion = lz4_version - -# ============================================================================= -# Installation directories -# ============================================================================= - -lz4_prefix = get_option('prefix') -lz4_bindir = get_option('bindir') -lz4_datadir = get_option('datadir') -lz4_mandir = get_option('mandir') -lz4_docdir = join_paths(lz4_datadir, 'doc', meson.project_name()) - -# ============================================================================= -# Project options -# ============================================================================= - -buildtype = get_option('buildtype') - -# Built-in options -use_debug = get_option('debug') - -# Custom options -debug_level = get_option('debug_level') -use_backtrace = get_option('backtrace') - -bin_programs = get_option('bin_programs') -bin_contrib = get_option('bin_contrib') -bin_tests = get_option('bin_tests') -bin_examples = get_option('bin_examples') -#feature_multi_thread = get_option('multi_thread') - -# ============================================================================= -# Dependencies -# ============================================================================= - -#libm_dep = cc.find_library('m', required: bin_tests) -#thread_dep = dependency('threads', required: feature_multi_thread) -#use_multi_thread = thread_dep.found() - -# ============================================================================= -# Compiler flags -# ============================================================================= - -add_project_arguments(['-DXXH_NAMESPACE=LZ4_'], language: 'c') - -if [compiler_gcc, compiler_clang].contains(cc_id) - common_warning_flags = [] - # Should use Meson's own --werror build option - #common_warning_flags += ['-Werror'] - if c_std == 'c89' or c_std == 'gnu89' - common_warning_flags += ['-pedantic', '-Wno-long-long', '-Wno-variadic-macros'] - elif c_std == 'c99' or c_std == 'gnu99' - common_warning_flags += ['-pedantic'] - endif - cc_compile_flags = cc.get_supported_arguments(common_warning_flags) - add_project_arguments(cc_compile_flags, language: 'c') -endif - -# ============================================================================= -# Subdirs -# ============================================================================= - -subdir('lib') - -if bin_programs - subdir('programs') -endif - -if bin_tests - subdir('tests') -endif - -if bin_contrib - subdir('contrib') -endif - -if bin_examples - subdir('examples') -endif +subdir('meson') diff --git a/contrib/meson/GetLz4LibraryVersion.py b/contrib/meson/meson/GetLz4LibraryVersion.py index d8abfcb..d8abfcb 100644 --- a/contrib/meson/GetLz4LibraryVersion.py +++ b/contrib/meson/meson/GetLz4LibraryVersion.py diff --git a/contrib/meson/InstallSymlink.py b/contrib/meson/meson/InstallSymlink.py index 3f2998c..3f2998c 100644 --- a/contrib/meson/InstallSymlink.py +++ b/contrib/meson/meson/InstallSymlink.py diff --git a/contrib/meson/contrib/gen_manual/meson.build b/contrib/meson/meson/contrib/gen_manual/meson.build index 38180e9..a872bd6 100644 --- a/contrib/meson/contrib/gen_manual/meson.build +++ b/contrib/meson/meson/contrib/gen_manual/meson.build @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# -lz4_root_dir = '../../../..' +lz4_root_dir = '../../../../..' add_languages('cpp') cxx = meson.get_compiler('cpp') diff --git a/contrib/meson/contrib/meson.build b/contrib/meson/meson/contrib/meson.build index 5249a4c..5249a4c 100644 --- a/contrib/meson/contrib/meson.build +++ b/contrib/meson/meson/contrib/meson.build diff --git a/contrib/meson/examples/meson.build b/contrib/meson/meson/examples/meson.build index 3c13214..493049d 100644 --- a/contrib/meson/examples/meson.build +++ b/contrib/meson/meson/examples/meson.build @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# -lz4_root_dir = '../../..' +lz4_root_dir = '../../../..' #examples_c_args = ['-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wstrict-prototypes'] diff --git a/contrib/meson/lib/meson.build b/contrib/meson/meson/lib/meson.build index e782334..131edcb 100644 --- a/contrib/meson/lib/meson.build +++ b/contrib/meson/meson/lib/meson.build @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# -lz4_root_dir = '../../..' +lz4_root_dir = '../../../..' liblz4_includes = [include_directories(join_paths(lz4_root_dir, 'lib'))] liblz4_sources = [join_paths(lz4_root_dir, 'lib/lz4.c'), diff --git a/contrib/meson/meson/meson.build b/contrib/meson/meson/meson.build new file mode 100644 index 0000000..387e7bd --- /dev/null +++ b/contrib/meson/meson/meson.build @@ -0,0 +1,118 @@ +# ############################################################################# +# 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). +# ############################################################################# + +cc = meson.get_compiler('c') +pkgconfig = import('pkgconfig') +python3 = import('python').find_installation() +c_std = get_option('c_std') +default_library = get_option('default_library') + +host_machine_os = host_machine.system() +os_windows = 'windows' +os_linux = 'linux' +os_darwin = 'darwin' +os_freebsd = 'freebsd' +os_sun = 'sunos' + +cc_id = cc.get_id() +compiler_gcc = 'gcc' +compiler_clang = 'clang' +compiler_msvc = 'msvc' + +lz4_version = meson.project_version() + +lz4_h_file = join_paths(meson.current_source_dir(), '../../../lib/lz4.h') +GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py') +r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file) +if r.returncode() == 0 + lz4_version = r.stdout().strip() + message('Project version is now: @0@'.format(lz4_version)) +else + error('Cannot find project version in @0@'.format(lz4_h_file)) +endif + +lz4_libversion = lz4_version + +# ============================================================================= +# Installation directories +# ============================================================================= + +lz4_prefix = get_option('prefix') +lz4_bindir = get_option('bindir') +lz4_datadir = get_option('datadir') +lz4_mandir = get_option('mandir') +lz4_docdir = join_paths(lz4_datadir, 'doc', meson.project_name()) + +# ============================================================================= +# Project options +# ============================================================================= + +buildtype = get_option('buildtype') + +# Built-in options +use_debug = get_option('debug') + +# Custom options +debug_level = get_option('debug_level') +use_backtrace = get_option('backtrace') + +bin_programs = get_option('bin_programs') +bin_contrib = get_option('bin_contrib') +bin_tests = get_option('bin_tests') +bin_examples = get_option('bin_examples') +#feature_multi_thread = get_option('multi_thread') + +# ============================================================================= +# Dependencies +# ============================================================================= + +#libm_dep = cc.find_library('m', required: bin_tests) +#thread_dep = dependency('threads', required: feature_multi_thread) +#use_multi_thread = thread_dep.found() + +# ============================================================================= +# Compiler flags +# ============================================================================= + +add_project_arguments(['-DXXH_NAMESPACE=LZ4_'], language: 'c') + +if [compiler_gcc, compiler_clang].contains(cc_id) + common_warning_flags = [] + # Should use Meson's own --werror build option + #common_warning_flags += ['-Werror'] + if c_std == 'c89' or c_std == 'gnu89' + common_warning_flags += ['-pedantic', '-Wno-long-long', '-Wno-variadic-macros'] + elif c_std == 'c99' or c_std == 'gnu99' + common_warning_flags += ['-pedantic'] + endif + cc_compile_flags = cc.get_supported_arguments(common_warning_flags) + add_project_arguments(cc_compile_flags, language: 'c') +endif + +# ============================================================================= +# Subdirs +# ============================================================================= + +subdir('lib') + +if bin_programs + subdir('programs') +endif + +if bin_tests + subdir('tests') +endif + +if bin_contrib + subdir('contrib') +endif + +if bin_examples + subdir('examples') +endif diff --git a/contrib/meson/programs/meson.build b/contrib/meson/meson/programs/meson.build index df64eb0..705dbf5 100644 --- a/contrib/meson/programs/meson.build +++ b/contrib/meson/meson/programs/meson.build @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# -lz4_root_dir = '../../..' +lz4_root_dir = '../../../..' lz4_includes = include_directories(join_paths(lz4_root_dir, 'programs')) lz4_sources = [join_paths(lz4_root_dir, 'programs/bench.c'), diff --git a/contrib/meson/tests/meson.build b/contrib/meson/meson/tests/meson.build index 392bcf2..7800475 100644 --- a/contrib/meson/tests/meson.build +++ b/contrib/meson/meson/tests/meson.build @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# -lz4_root_dir = '../../..' +lz4_root_dir = '../../../..' programs_dir_inc = include_directories(join_paths(lz4_root_dir, 'programs')) lib_dir_inc = include_directories(join_paths(lz4_root_dir, 'lib')) |