[devhelp] build: rework the build for the main source code
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] build: rework the build for the main source code
- Date: Sat, 4 Apr 2020 23:02:31 +0000 (UTC)
commit 412802c45821f4f014d10fe14bcb93aaaa3c3612
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Apr 5 00:25:52 2020 +0200
build: rework the build for the main source code
I've implemented it more recently in Tepl, and I think it's better done
in Tepl, so do the same in Devhelp.
devhelp/meson.build | 68 ++++++++++++++++++++++------------------------
docs/reference/meson.build | 2 +-
src/meson.build | 3 +-
unit-tests/meson.build | 14 ++++------
4 files changed, 40 insertions(+), 47 deletions(-)
---
diff --git a/devhelp/meson.build b/devhelp/meson.build
index fea31544..cae9bcca 100644
--- a/devhelp/meson.build
+++ b/devhelp/meson.build
@@ -60,83 +60,79 @@ libdevhelp_private_c_files = [
'dh-util-lib.c'
]
-install_headers_first_subdir = 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION)
-install_headers_subdir = install_headers_first_subdir / 'devhelp'
-install_headers_fulldir = get_option('prefix') / get_option('includedir') / install_headers_subdir
+headers_install_dir = get_option('includedir') / 'devhelp-@0@/devhelp/'.format(LIBDEVHELP_API_VERSION)
+install_headers(
+ libdevhelp_public_headers,
+ install_dir: headers_install_dir
+)
-libdevhelp_enums = GNOME.mkenums_simple(
+libdevhelp_enum_types = GNOME.mkenums_simple(
'dh-enum-types',
sources: libdevhelp_public_headers,
install_header: true,
- install_dir: install_headers_fulldir
+ install_dir: headers_install_dir
)
-libdevhelp_enum_header = libdevhelp_enums[1]
-libdevhelp_static = static_library(
+libdevhelp_static_lib = static_library(
'devhelp-static',
[libdevhelp_public_c_files,
libdevhelp_private_c_files,
- libdevhelp_enums],
+ libdevhelp_enum_types],
+ pic: true, # libdevhelp_static_lib is linked in a shared library.
include_directories: ROOT_INCLUDE_DIR,
dependencies: LIBDEVHELP_DEPS
)
# For unit tests, to be able to test private functions.
-STATIC_LIBDEVHELP_DECLARED_DEP = declare_dependency(
- sources: libdevhelp_enum_header,
- link_with: libdevhelp_static,
- include_directories: [ROOT_INCLUDE_DIR],
+LIBDEVHELP_STATIC_DEP = declare_dependency(
+ include_directories: ROOT_INCLUDE_DIR,
+ link_with: libdevhelp_static_lib,
+ sources: libdevhelp_enum_types[1],
dependencies: LIBDEVHELP_DEPS
)
symbol_map = meson.current_source_dir() / 'symbol.map'
-libdevhelp = shared_library(
+libdevhelp_shared_lib = shared_library(
'devhelp-@0@'.format(LIBDEVHELP_API_VERSION),
- link_whole: libdevhelp_static,
+ link_whole: libdevhelp_static_lib,
link_args: '-Wl,--version-script,' + symbol_map,
link_depends: symbol_map,
version: LIBDEVHELP_LT_VERSION,
install: true
)
-SHARED_LIBDEVHELP_DECLARED_DEP = declare_dependency(
- sources: libdevhelp_enum_header,
- link_with: libdevhelp,
- include_directories: [ROOT_INCLUDE_DIR, include_directories('.')],
+LIBDEVHELP_SHARED_LIB_DEP = declare_dependency(
+ include_directories: ROOT_INCLUDE_DIR,
+ link_with: libdevhelp_shared_lib,
+ sources: libdevhelp_enum_types[1],
dependencies: LIBDEVHELP_DEPS
)
-install_headers(
- libdevhelp_public_headers,
- subdir: install_headers_subdir
-)
-
PKG_CONFIG.generate(
filebase: 'libdevhelp-@0@'.format(LIBDEVHELP_API_VERSION_FULL),
name: meson.project_name(),
description: meson.project_name(),
- version: meson.project_version(),
- libraries: libdevhelp,
+ libraries: libdevhelp_shared_lib,
libraries_private: '-lm',
- subdirs: install_headers_first_subdir,
+ subdirs: 'devhelp-@0@'.format(LIBDEVHELP_API_VERSION),
requires: LIBDEVHELP_PUBLIC_DEPS,
requires_private: LIBDEVHELP_PRIVATE_DEPS
)
GNOME.generate_gir(
- libdevhelp,
+ libdevhelp_shared_lib,
export_packages: 'libdevhelp-@0@'.format(LIBDEVHELP_API_VERSION_FULL),
+ header: 'devhelp/devhelp.h',
+ identifier_prefix: 'Dh',
+ include_directories: ROOT_INCLUDE_DIR,
+ includes: ['Gtk-3.0', 'WebKit2-4.0'],
+ install: true,
+ namespace: 'Devhelp',
+ nsversion: LIBDEVHELP_API_VERSION_FULL,
sources: [
libdevhelp_public_headers,
libdevhelp_public_c_files,
- libdevhelp_enums
- ],
- namespace: 'Devhelp',
- nsversion: LIBDEVHELP_API_VERSION_FULL,
- identifier_prefix: 'Dh',
- includes: ['Gtk-3.0', 'WebKit2-4.0'],
- header: 'devhelp/devhelp.h',
- include_directories: ROOT_INCLUDE_DIR,
- install: true
+ libdevhelp_enum_types
+ ]
)
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 8099d7af..9d8f92b4 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -19,7 +19,7 @@ GNOME.gtkdoc(
gtkdoc_module_name,
main_xml: 'devhelp-docs.xml',
src_dir: include_directories('../../devhelp/'),
- dependencies: SHARED_LIBDEVHELP_DECLARED_DEP,
+ dependencies: LIBDEVHELP_SHARED_LIB_DEP,
scan_args: ['--rebuild-types'],
gobject_typesfile: 'devhelp-@0@.types'.format(LIBDEVHELP_API_VERSION),
fixxref_args: [
diff --git a/src/meson.build b/src/meson.build
index 341e2d9f..17050741 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -19,7 +19,6 @@ devhelp_app_sources += GNOME.compile_resources(
executable(
'devhelp',
devhelp_app_sources,
- include_directories: ROOT_INCLUDE_DIR,
- dependencies: [DEVHELP_APP_DEPS, SHARED_LIBDEVHELP_DECLARED_DEP],
+ dependencies: [DEVHELP_APP_DEPS, LIBDEVHELP_SHARED_LIB_DEP],
install: true
)
diff --git a/unit-tests/meson.build b/unit-tests/meson.build
index 44b7ac7d..dac63804 100644
--- a/unit-tests/meson.build
+++ b/unit-tests/meson.build
@@ -8,13 +8,11 @@ unit_tests = [
'test-util'
]
-foreach unit_test : unit_tests
- exe = executable(
- unit_test,
- unit_test + '.c',
- include_directories: ROOT_INCLUDE_DIR,
- dependencies: [LIBDEVHELP_DEPS, STATIC_LIBDEVHELP_DECLARED_DEP]
+foreach test_name : unit_tests
+ test_exe = executable(
+ test_name,
+ test_name + '.c',
+ dependencies: LIBDEVHELP_STATIC_DEP
)
-
- test(unit_test, exe)
+ test(test_name, test_exe)
endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]