[babl] Added basic meson files
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] Added basic meson files
- Date: Sat, 16 Dec 2017 01:49:00 +0000 (UTC)
commit aba7c65a487a2bd7f07172c9f1e5f25030fa5006
Author: Félix Piédallu <felix piedallu me>
Date: Thu Nov 23 17:58:37 2017 +0100
Added basic meson files
babl/base/meson.build | 22 ++++
babl/git-version.h.in | 5 +
babl/meson.build | 85 +++++++++++++++
meson.build | 270 +++++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 6 +
5 files changed, 388 insertions(+), 0 deletions(-)
---
diff --git a/babl/base/meson.build b/babl/base/meson.build
new file mode 100644
index 0000000..c49aa78
--- /dev/null
+++ b/babl/base/meson.build
@@ -0,0 +1,22 @@
+bablBaseInclude = include_directories('.')
+
+babl_base_sources = [
+ 'babl-base.c',
+ 'formats.c',
+ 'model-gray.c',
+ 'model-rgb.c',
+ 'model-ycbcr.c',
+ 'pow-24.c',
+ 'type-float.c',
+ 'type-half.c',
+ 'type-u15.c',
+ 'type-u16.c',
+ 'type-u32.c',
+ 'type-u8.c',
+]
+
+babl_base = static_library('babl_base',
+ babl_base_sources,
+ include_directories: [ rootInclude, bablInclude, ],
+ dependencies: [ math, ],
+)
diff --git a/babl/git-version.h.in b/babl/git-version.h.in
new file mode 100644
index 0000000..e780e4f
--- /dev/null
+++ b/babl/git-version.h.in
@@ -0,0 +1,5 @@
+#pragma once
+
+#define BABL_GIT_VERSION "@BABL_GIT_VERSION@"
+#define BABL_GIT_VERSION_ABBREV "@BABL_GIT_VERSION_ABBREV@"
+#define BABL_GIT_LAST_COMMIT_YEAR "@BABL_GIT_LAST_COMMIT_YEAR@"
diff --git a/babl/meson.build b/babl/meson.build
new file mode 100644
index 0000000..59cb88c
--- /dev/null
+++ b/babl/meson.build
@@ -0,0 +1,85 @@
+bablInclude = include_directories('.')
+subdir('base')
+
+babl_version_h = configure_file(
+ input : 'babl-version.h.in',
+ output: 'babl-version.h',
+ configuration: conf,
+)
+
+gitversion_h1 = vcs_tag(
+ input : 'git-version.h.in',
+ output: 'git-version.h.in.1',
+ command: [ 'git', 'describe', '--always', ],
+ replace_string: '@BABL_GIT_VERSION@',
+ fallback: '',
+)
+gitversion_h2 = vcs_tag(
+ input : gitversion_h1,
+ output: 'git-version.h.in.2',
+ command: [ 'git', 'rev-parse', '--short', 'HEAD', ],
+ replace_string: '@BABL_GIT_VERSION_ABBREV@',
+ fallback: '',
+)
+gitversion_h = vcs_tag(
+ input : gitversion_h2,
+ output: 'git-version.h',
+ command: [ 'git', 'log', '-n1', '--date=format:%Y', '--pretty=%cd', ],
+ replace_string: '@BABL_GIT_LAST_COMMIT_YEAR@',
+ fallback: '',
+)
+
+babl_sources = [
+ 'babl-cache.c',
+ 'babl-component.c',
+ 'babl-conversion.c',
+ 'babl-core.c',
+ 'babl-cpuaccel.c',
+ 'babl-db.c',
+ 'babl-extension.c',
+ 'babl-fish-path.c',
+ 'babl-fish-reference.c',
+ 'babl-fish-simple.c',
+ 'babl-fish.c',
+ 'babl-format.c',
+ 'babl-hash-table.c',
+ 'babl-icc.c',
+ 'babl-image.c',
+ 'babl-internal.c',
+ 'babl-introspect.c',
+ 'babl-list.c',
+ 'babl-memory.c',
+ 'babl-model.c',
+ 'babl-mutex.c',
+ 'babl-palette.c',
+ 'babl-polynomial.c',
+ 'babl-ref-pixels.c',
+ 'babl-sampling.c',
+ 'babl-sanity.c',
+ 'babl-space.c',
+ 'babl-trc.c',
+ 'babl-type.c',
+ 'babl-util.c',
+ 'babl-version.c',
+ 'babl.c',
+ babl_version_h,
+ gitversion_h,
+]
+
+babl_headers = [
+ 'babl-introspect.h',
+ 'babl-macros.h',
+ 'babl-types.h',
+ 'babl.h',
+]
+
+install_headers(babl_headers,
+ subdir: join_paths(lib_name, 'babl')
+)
+
+babl = library('babl',
+ babl_sources,
+ include_directories: [ rootInclude, bablBaseInclude],
+ c_args: [ '-DLIBDIR="' + get_option('libdir') + '"', ],
+ cpp_args: [ '-DLIBDIR="' + get_option('libdir') + '"', ],
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..68aac9c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,270 @@
+# Meson build file
+
+# http://bugzilla.gnome.org/enter_bug.cgi?product=GIMP
+
+# Making releases on the stable branch:
+# BABL_MICRO_VERSION += 1;
+# BABL_INTERFACE_AGE += 1;
+# BABL_BINARY_AGE += 1;
+# if any functions have been added,
+# set BABL_INTERFACE_AGE to 0.
+# if backwards compatibility has been broken,
+# set BABL_BINARY_AGE _and_ BABL_INTERFACE_AGE to 0.
+
+project('babl', ['c', 'cpp'], version : '0.1.39',
+ meson_version : '>=0.40.0',
+ default_options : [
+ 'sysconfdir=/etc',
+ 'localstatedir=/var',
+ 'sharedstatedir=/var/lib'
+ ],
+)
+
+conf = configuration_data()
+
+pkgconfig = import('pkgconfig')
+i18n = import('i18n')
+gnome = import('gnome')
+
+cc = meson.get_compiler('c')
+cxx = meson.get_compiler('cpp')
+prefix = get_option('prefix')
+buildtype = get_option('buildtype')
+
+################################################################################
+# Projects infos
+
+version = meson.project_version()
+array_version = version.split('.')
+major_version = array_version[0].to_int()
+minor_version = array_version[1].to_int()
+micro_version = array_version[2].to_int()
+
+interface_age = 1
+binary_age = 100 * minor_version + micro_version
+
+lt_current = 100 * minor_version + micro_version - interface_age
+lt_revision = interface_age
+lt_age = binary_age - interface_age
+lt_current_minus_age = lt_current - lt_age
+
+api_version = '@0@.@1@'.format(major_version, minor_version)
+lib_version = '@0@:@1@:@2@'.format(lt_current, lt_revision, lt_age)
+lib_name = meson.project_name() + '-' + meson.project_version()
+
+stability_version_number = (major_version != 0 ? minor_version : micro_version)
+stable = (stability_version_number % 2 == 0)
+
+conf.set10('BABL_UNSTABLE', not stable)
+
+conf.set_quoted('BABL_MAJOR_VERSION', '@0@'.format(major_version))
+conf.set_quoted('BABL_MINOR_VERSION', '@0@'.format(minor_version))
+conf.set_quoted('BABL_MICRO_VERSION', '@0@'.format(micro_version))
+conf.set_quoted('BABL_INTERFACE_AGE', '@0@'.format(interface_age))
+conf.set_quoted('BABL_BINARY_AGE', '@0@'.format(binary_age))
+conf.set_quoted('BABL_VERSION', '@0@'.format(version))
+conf.set_quoted('BABL_REAL_VERSION', '@0@'.format(version))
+conf.set_quoted('BABL_API_VERSION', '@0@'.format(api_version))
+conf.set_quoted('BABL_RELEASE', '@0@'.format(api_version))
+conf.set_quoted('BABL_LIBRARY_VERSION', '@0@'.format(lib_version))
+conf.set_quoted('BABL_CURRENT_MINUS_AGE','@0@'.format(lt_current_minus_age))
+conf.set_quoted('BABL_LIBRARY', '@0@'.format(lib_name))
+
+conf.set_quoted('WEBSITE_HOST', 'pippin.gimp.org')
+conf.set_quoted('WEBSITE_LOCATION', 'public_html/babl')
+
+################################################################################
+# Host system detection
+
+host_cpu = host_machine.cpu()
+message('Architecture: ' + host_cpu)
+
+if host_cpu.startswith('i') and host_cpu.endswith('86')
+ have_x86 = true
+ conf.set10('ARCH_X86', true)
+elif host_cpu == 'x86_64'
+ have_x86 = true
+ conf.set10('ARCH_X86', true)
+ conf.set10('ARCH_X86_64', true)
+elif host_cpu == 'ppc' or host_cpu == 'powerpc'
+ have_ppc = true
+ conf.set10('ARCH_PPC', true)
+elif host_cpu == 'ppc64' or host_cpu == 'powerpc64'
+ have_ppc = true
+ conf.set10('ARCH_PPC', true)
+ conf.set10('ARCH_PPC64', true)
+else
+ error('Unknown host architecture')
+endif
+
+
+host_os = host_machine.system()
+message('Host os: ' + host_os)
+
+platform_win32 = (host_os.startswith('mingw') or host_os.startswith('cygwin'))
+# Is this native win32
+os_win32 = host_os.startswith('mingw')
+
+platform_osx = host_os.startswith('darwin')
+if platform_osx
+ if cc.get_id() != 'clang' or cxx.get_id() != 'clang'
+ error('You should use CLang++ on OSx.')
+ endif
+endif
+
+platform_android = host_os.contains('android')
+
+path_sep = ( os_win32 ? ';' : ':' )
+dirs_sep = ( os_win32 ? '\\' : '/' )
+conf.set('BABL_PATH_SEPARATOR', path_sep)
+conf.set('BABL_DIR_SEPARATOR', dirs_sep)
+
+################################################################################
+# Extra warnings
+
+extra_warnings_list = [
+ '-Wdeclaration-after-statement',
+ '-Winit-self',
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wold-style-definition',
+ '-Wpointer-arith',
+]
+extra_warnings = []
+foreach warning : extra_warnings_list
+ if cc.has_argument(warning)
+ extra_warnings += warning
+ endif
+endforeach
+
+
+################################################################################
+# Check for compiler CPU extensions
+
+have_tls_run = cc.run('int main() { static __thread char buf[1024]; return 0; }')
+have_tls = (have_tls_run.compiled() and have_tls_run.returncode() == 0)
+
+has_ssem = cc.has_argument('-mfpmath=sse')
+if has_ssem
+ add_project_arguments('-mfpmath=sse',
+ language: ['c', 'cxx'])
+endif
+
+has_mmx = cc.has_argument('-mmmx') and get_option('enable-mmx')
+if has_mmx
+ add_project_arguments( '-mmmx',
+ language: ['c', 'cxx'])
+endif
+
+has_sse = cc.has_argument('-msse') and get_option('enable-sse')
+if has_sse
+ add_project_arguments( '-msse',
+ language: ['c', 'cxx'])
+endif
+
+has_sse2 = cc.has_argument('-msse2') and get_option('enable-sse2')
+if has_sse2
+ add_project_arguments( '-msse2',
+ language: ['c', 'cxx'])
+endif
+
+has_sse41= cc.has_argument('-msse4.1') and get_option('enable-sse4_1')
+if has_sse41
+ add_project_arguments( '-msse4.1',
+ language: ['c', 'cxx'])
+endif
+
+had_f16c= cc.has_argument('-mf16c') and get_option('enable-f16c')
+if had_f16c
+ add_project_arguments( '-mf16c',
+ language: ['c', 'cxx'])
+endif
+
+have_dlfcn_h = cc.has_header('dlfcn.h')
+have_dl_h = cc.has_header('dl.h')
+if not (have_dlfcn_h or have_dl_h)
+ error('Header dlfcn.h or dl.h not provided. Please provide one of them.')
+endif
+
+conf.set10('HAVE_DLFCN_H', have_dlfcn_h)
+conf.set10('HAVE_DL_H', have_dl_h)
+
+
+shared_lib_ext = (platform_win32 ? '.dll' : '.so')
+conf.set_quoted('SHREXT', shared_lib_ext)
+
+################################################################################
+# Utilities
+
+rsvg_convert = find_program('rsvg-convert', required: false)
+w3m = find_program('w3m', required: false)
+
+
+
+################################################################################
+# Dependencies
+
+if os_win32
+ math = []
+ thread = []
+else
+ math = cc.find_library('m')
+ thread = cc.find_library('pthread')
+endif
+
+if platform_android
+ log = cc.find_library('log')
+else
+ log = []
+endif
+
+
+pkgconfig.generate(filebase: 'babl',
+ name: 'babl',
+ description: 'Dynamic, any to any, pixel format conversion library',
+ version: meson.project_version(),
+ libraries: [
+ '-L${libdir}',
+ '-l' + lib_name,
+ ],
+ libraries_private: [
+ '-lm', '-lpthread',
+ ],
+ subdirs: [
+ lib_name,
+ ],
+)
+
+configure_file(
+ output: 'config.h',
+ configuration: conf
+)
+
+
+################################################################################
+# Subdirs
+
+rootInclude = include_directories('.')
+
+subdir('babl')
+# subdir('extensions')
+# subdir('tests')
+# subdir('tools')
+if get_option('with-docs')
+ # subdir('docs')
+endif
+
+
+if w3m.found()
+ custom_target('README',
+ input : [ join_paths('docs', 'index.html'), ] ,
+ output: [ 'README' ] ,
+ command: [
+ w3m,
+ '-cols', '72',
+ '-dump',
+ '@INPUT@',
+ ],
+ capture: true,
+ )
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..51e5fdc
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('enable-mmx', type: 'boolean', value: true, description: 'enable MMX support')
+option('enable-sse', type: 'boolean', value: true, description: 'enable SSE support')
+option('enable-sse2', type: 'boolean', value: true, description: 'enable SSE2 support')
+option('enable-sse4_1', type: 'boolean', value: true, description: 'enable SSE4.1 support')
+option('enable-f16c', type: 'boolean', value: true, description: 'enable hardware half-float support')
+option('with-docs', type: 'boolean', value: true)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]