[tepl/master.msvc] meson: Try to streamline building libtepl
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl/master.msvc] meson: Try to streamline building libtepl
- Date: Thu, 30 Apr 2020 03:04:08 +0000 (UTC)
commit a7a395b96f4cdab24fce35700c62be0f8179a0a6
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Apr 30 11:01:53 2020 +0800
meson: Try to streamline building libtepl
Stop building a static tepl-core library, but instead build only the main
Tepl library and use extract_all_objects() on the main Tepl library in order to
build and link the test programs that use internal APIs
tepl/meson.build | 36 +++++++++---------------------------
tests/meson.build | 4 +++-
testsuite/meson.build | 6 ++++--
3 files changed, 16 insertions(+), 30 deletions(-)
---
diff --git a/tepl/meson.build b/tepl/meson.build
index 7b03c3b..99381b4 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -104,47 +104,29 @@ tepl_enum_types = GNOME.mkenums_simple(
install_dir: headers_install_dir
)
-tepl_c_args = [ '-DTEPL_COMPILATION' ]
-if c_compiler.get_argument_syntax() == 'msvc'
- tepl_c_args += '-D_TEPL_EXTERN=__declspec(dllexport) extern'
-endif
-
-tepl_static_lib = static_library(
- 'tepl-static',
- [tepl_public_c_files,
- tepl_private_c_files,
- tepl_enum_types],
- pic: true, # tepl_static_lib is linked in a shared library.
- include_directories: ROOT_INCLUDE_DIR,
- dependencies: TEPL_DEPS,
- c_args: tepl_c_args
-)
-
-# For unit tests, to be able to test private functions.
-TEPL_STATIC_DEP = declare_dependency(
- include_directories: ROOT_INCLUDE_DIR,
- link_with: tepl_static_lib,
- sources: tepl_enum_types[1],
- dependencies: TEPL_DEPS
-)
-
symbol_map = []
+tepl_c_args = [ '-DTEPL_COMPILATION' ]
tepl_link_args = []
tepl_link_depends = []
-if c_compiler.get_argument_syntax() != 'msvc'
+if c_compiler.get_argument_syntax() == 'msvc'
+ tepl_c_args += '-D_TEPL_EXTERN=__declspec(dllexport) extern'
+else
symbol_map = meson.current_source_dir() / 'symbol.map'
tepl_link_args = '-Wl,--version-script,' + symbol_map
tepl_link_depends = symbol_map
endif
-
tepl_lib = library(
'tepl-@0@'.format(TEPL_API_VERSION),
+ tepl_public_c_files,
+ tepl_private_c_files,
+ tepl_enum_types,
+ c_args: tepl_c_args,
dependencies: TEPL_DEPS,
+ include_directories: ROOT_INCLUDE_DIR,
link_args: tepl_link_args,
link_depends: tepl_link_depends,
- objects: tepl_static_lib.extract_all_objects(),
version: TEPL_LT_VERSION,
install: true
)
diff --git a/tests/meson.build b/tests/meson.build
index ab9d15b..34e0cf1 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -11,6 +11,8 @@ interactive_tests = [
foreach test : interactive_tests
executable(
test[0], test[1],
- dependencies: TEPL_STATIC_DEP
+ dependencies: TEPL_DEPS,
+ include_directories: ROOT_INCLUDE_DIR,
+ objects: tepl_lib.extract_all_objects(),
)
endforeach
diff --git a/testsuite/meson.build b/testsuite/meson.build
index 0af9829..d1ea766 100644
--- a/testsuite/meson.build
+++ b/testsuite/meson.build
@@ -17,8 +17,10 @@ foreach test_name : unit_tests
test_exe = executable(
test_name,
test_name + '.c',
- dependencies: TEPL_STATIC_DEP,
- c_args: '-DUNIT_TESTS_SOURCE_DIR="@0@"'.format(meson.current_source_dir())
+ c_args: '-DUNIT_TESTS_SOURCE_DIR="@0@"'.format(meson.current_source_dir()),
+ dependencies: TEPL_DEPS,
+ include_directories: ROOT_INCLUDE_DIR,
+ objects: tepl_lib.extract_all_objects(),
)
test(test_name, test_exe)
endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]