Skip to content

Commit

Permalink
Add meson build system
Browse files Browse the repository at this point in the history
Co-authored-by: Félix Piédallu <[email protected]>
Co-authored-by: Jan Tojnar <[email protected]>
  • Loading branch information
3 people committed Feb 6, 2024
1 parent a3f3c9d commit 8af70db
Show file tree
Hide file tree
Showing 11 changed files with 639 additions and 18 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
- pull_request

jobs:
linux:
name: Linux
linux-autotools:
name: Linux Autotools
runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down Expand Up @@ -35,3 +35,35 @@ jobs:
make
- name: "Run tests"
run: make distcheck

linux-meson:
name: Linux Meson
runs-on: ubuntu-22.04
strategy:
matrix:
configureFlags:
- "-Dintrospection=false -Dglib=disabled"
- "-Dglib=disabled"
- "-Dgegl=enabled"
include:
- configureFlags: "-Dglib=enabled"
extraDeps: "libgirepository1.0-dev"
- configureFlags: "-Dgegl=enabled"
extraDeps: "libgegl-dev"
steps:
- uses: actions/checkout@v4
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install -y \
libjson-c-dev \
meson \
ninja-build \
gettext \
${{ matrix.extraDeps }}
- name: "Build"
run: |
meson setup _build --buildtype=release -Dauto_features=disabled
meson compile -C _build
- name: "Run tests"
run: meson dist -C _build
49 changes: 34 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ compiler:
- gcc

sudo: required
services: docker

dist: trusty

Expand All @@ -15,18 +16,36 @@ addons:
- libgirepository1.0-dev
- libgegl-dev

script:
- ./autogen.sh
- ./configure
- make
- make clean
- make distcheck
- make maintainer-clean
- ./autogen.sh
- ./configure --with-introspection
- make
- make maintainer-clean
- ./autogen.sh
- ./configure --with-gegl
- make
- make maintainer-clean
jobs:
include:
- stage: "Build"
name: "Autotools build"
script:
- ./autogen.sh
- ./configure
- make
- make clean
- make distcheck
- make maintainer-clean
- ./autogen.sh
- ./configure --with-introspection
- make
- make maintainer-clean
- ./autogen.sh
- ./configure --with-gegl
- make
- make maintainer-clean

- name: "Meson build"
script:
- sudo docker pull ubuntu:disco
- sudo docker run -t -v $(pwd):/sources ubuntu:disco /bin/bash -ec "
apt update -y
&& apt install -y meson gettext libjson-c-dev libgirepository1.0-dev libgegl-dev git
&& meson /sources _build --buildtype=release
&& ninja -C _build test
&& ninja -C _build dist
&& meson /sources _build_gegl --buildtype=release -Dgegl=true
&& ninja -C _build_gegl test
&& ninja -C _build_gegl dist
"
9 changes: 8 additions & 1 deletion appveyor_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pacman --noconfirm -S --needed \
base-devel \
${PKG_PREFIX}-json-c \
${PKG_PREFIX}-glib2 \
${PKG_PREFIX}-gobject-introspection
${PKG_PREFIX}-gobject-introspection \
${PKG_PREFIX}-meson \
git


# Add m4 directories to the ACLOCAL_PATH
Expand All @@ -30,6 +32,11 @@ done
export ACLOCAL_PATH
export PWD="$APPVEYOR_BULD_FOLDER"

# Meson build, we need a way to parallel this with Autotools
meson setup _build --buildtype=release -Dgegl=false -Ddocs=false
meson dist -C _build
rm -rf _build

./autogen.sh
./configure
make distcheck
37 changes: 37 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
doc_conf = configuration_data()
doc_conf.merge_from(conf)

doc_conf.set('DOXYGEN_SOURCE_ROOT', meson.project_source_root())
doc_conf.set('DOXYXML_BUILD_PATH', meson.current_build_dir())
doc_conf.set('DOXYGEN_EXCLUDED', '')

doxyfile = configure_file(
input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: doc_conf,
)

doxygen_index = custom_target(
'doxygen',
input: doxyfile,
output: 'index.xml',
command: [
doxygen,
'@INPUT@',
],
)

subdir('source')

run_target(
'sphinx',
depends: [
doxygen_index,
],
command: [
sphinx_build,
'-c', meson.current_build_dir() / 'source',
meson.current_source_dir() / 'source',
meson.current_build_dir() / 'build',
],
)
5 changes: 5 additions & 0 deletions doc/source/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx_conf_file = configure_file(
input: 'conf.py.in',
output: 'conf.py',
configuration: doc_conf,
)
66 changes: 66 additions & 0 deletions gegl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
libmypaint_gegl_inc = include_directories('.')

libmypaint_gegl_sources = [
'../glib/mypaint-gegl-glib.c',
'mypaint-gegl-surface.c',
]

libmypaint_gegl_headers = [
'../glib/mypaint-gegl-glib.h',
'mypaint-gegl-surface.h',
]

libmypaint_gegl = library(
f'mypaint-gegl-@api_platform_version@',
libmypaint_gegl_sources,
include_directories: toplevel_inc,
link_with: libmypaint,
dependencies: [
json,
gobject,
gegl,
],
version: abi_version_info,
install: true,
)

install_headers(
libmypaint_gegl_headers,
subdir: 'libmypaint-gegl',
)


if get_option('introspection')
gnome = import('gnome')

libmypaint_gegl_gir = gnome.generate_gir(
libmypaint_gegl,
namespace: 'MyPaintGegl',
nsversion: api_platform_version,

sources: libmypaint_gegl_sources + libmypaint_gegl_headers,
symbol_prefix: 'mypaint_gegl',
identifier_prefix: 'MyPaintGegl',

includes: [
'GObject-2.0',
gegl_gir,
libmypaint_gir[0],
],
install: true,
)
endif


pkgconfig.generate(
libmypaint_gegl,
name: meson.project_name() + '-gegl-' + api_platform_version,
version: version_full,
description: 'MyPaint brush engine library, with GEGL integration',
requires: [
libmypaint,
gegl,
],
url: project_url,
subdirs: 'libmypaint-gegl',
)
Loading

0 comments on commit 8af70db

Please sign in to comment.