Skip to content

Commit

Permalink
Meson improvement (#620)
Browse files Browse the repository at this point in the history
* meson improvement

* fix warning

* more improvement

* fix meson.build

* code cov runs on ubuntu-2204
  • Loading branch information
lidaobing authored Jul 7, 2024
1 parent dedf3c0 commit 147c087
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ jobs:
xvfb-run -a meson test -C build --verbose --no-stdsplit
codecov:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: apt install
run: >-
sudo apt update &&
sudo apt install libunwind-dev &&
sudo apt install -y lcov ${{ env.DEB_PKGS }} ${{ env.DEB_TEST_PKGS }}
- name: meson
run: meson setup -D b_coverage=true build
Expand Down
42 changes: 42 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project('iptux', 'cpp',
license: 'GPL2+',
version: '0.9.3',
meson_version: '>=0.53',
default_options: ['warning_level=3', 'cpp_std=c++14'])
add_global_arguments('-Werror=format', language : 'cpp')
if get_option('sanitize-address')
Expand All @@ -14,3 +15,44 @@ subdir('share')
subdir('po')
subdir('examples')
subdir('scripts')

if meson.version().version_compare('>=0.57')
summary({
'prefix': get_option('prefix'),
'bindir': get_option('bindir'),
'libdir': get_option('libdir'),
'data': get_option('datadir'),
}, section: 'Directories:')

summary_deps = {
'meson': meson.version(),
'glib-2.0': glib_dep,
'gtk+-3.0': gtk_dep,
'jsoncpp': jsoncpp_dep,
'libglog': glog_dep,
'gflags': gflags_dep,
'sigc++-2.0': sigc_dep,
}

if host_machine.system() == 'darwin'
summary_deps += {'gtk-mac-integration-gtk3': gtk_mac_integration_dep}
endif

if host_machine.system() == 'linux'
summary_deps += {'ayatana-appindicator3-0.1': appindicator_dep}
endif

summary_deps += {
'glib-compile-resources': glib_compile_resources,
'appstreamcli': ascli_exe,
}

summary(summary_deps, section: 'Dependencies:')

summary({
'dev': get_option('dev'),
'static-link': get_option('static-link'),
'appindicator': appindicator_dep.found(),
'sanitize-address': get_option('sanitize-address'),
}, section: 'Options:')
endif
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ option(
option(
'sanitize-address',
type: 'boolean',
value: 'false',
value: false,
description: 'enable -fsanitize=address compile/link flag',
)
4 changes: 2 additions & 2 deletions share/metainfo/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ metainfo_i18n = i18n.merge_file(
input: metainfo_with_relinfo,
output: 'io.github.iptux_src.iptux.metainfo.xml',
type: 'xml',
po_dir: join_paths(meson.source_root(), 'po'),
po_dir: meson.source_root() / 'po',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'),
install_dir: get_option('datadir') / 'metainfo',
)

desktop_file = custom_target(
Expand Down
10 changes: 7 additions & 3 deletions src/iptux-core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ else
description: 'Communicate and Share File in LAN',
name: 'iptux-core',
version: so_version,
requires: ['jsoncpp >= 1.0', 'glib-2.0 >= 2.35', 'sigc++-2.0'],
requires_private: ['libglog', 'gflags'],
requires: [jsoncpp_dep, glib_dep, sigc_dep, thread_dep],
requires_private: [glog_dep, gflags_dep],
libraries: [libiptux_core, glog_dep],
)
endif
Expand Down Expand Up @@ -90,4 +90,8 @@ libiptux_core_test = executable('libiptux_core_test',
link_with: [libiptux_core, libgtest, libiptux_core_test_helper],
include_directories: [inc, gtest_inc]
)
test('iptux core unit test', libiptux_core_test, is_parallel : false)
if meson.version().version_compare('>=0.55')
test('core', libiptux_core_test, is_parallel : false, protocol: 'gtest')
else
test('core', libiptux_core_test, is_parallel : false)
endif
7 changes: 6 additions & 1 deletion src/iptux-utils/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ libiptux_utils_test = executable('libiptux_utils_test',
link_with: [libiptux_utils, libgtest, libiptux_utils_test_helper],
include_directories: [inc, gtest_inc]
)
test('iptux utils unit test', libiptux_utils_test)

if meson.version().version_compare('>=0.55')
test('utils', libiptux_utils_test, protocol: 'gtest')
else
test('utils', libiptux_utils_test)
endif
7 changes: 6 additions & 1 deletion src/iptux/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,9 @@ libiptux_test = executable('libiptux_test',
link_with: [libiptux, libgtest,libiptux_core_test_helper],
include_directories: [inc, gtest_inc]
)
test('iptux ui unit test', libiptux_test, is_parallel : false)

if meson.version().version_compare('>=0.55')
test('gui', libiptux_test, is_parallel : false, protocol: 'gtest')
else
test('gui', libiptux_test, is_parallel : false)
endif

0 comments on commit 147c087

Please sign in to comment.