Commit 29aa097a authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

buildapp examples: Add meson.build files

* examples/book/buildapp/README: Describe how to build with meson and ninja.
* examples/book/buildapp/step1/install-cmd.sh:
* examples/book/buildapp/step[1-9]/meson.build: New files
parent b4142408
......@@ -5,17 +5,25 @@
The examples in this directory are built with 'make check' alongside the rest of
the examples in gtkmm-documentation.
The examples in the step[1-9] directories can also be built independently,
by doing:
The examples in the step[1-9] directories can also be built separately.
You can then choose to build with make or with meson and ninja.
$ cd step1 # or step2, step3, etc.
$ make -f Makefile.example
or
$ cd step1 # or step2, step3, etc.
$ meson build # or another name for the build directory
$ cd build
$ ninja
To make gnome-shell use the desktop file and icon for one of the examples
while running it uninstalled, do the following:
$ cd step1 # or step2, step3, etc.
$ make -f Makefile.example install-desktop-file
or
$ cd step1/build # or step2/build, step3/build, etc.
$ ninja install-desktop-file
To make Gio::Settings find the preferences in step[5-9], they must be stored
where they can be found via one of the environment variables XDG_DATA_DIRS,
......@@ -23,6 +31,9 @@ XDG_DATA_HOME or GSETTINGS_SCHEMA_DIR. One way to achieve this is:
$ cd step5 # or step6, step7, etc.
$ export GSETTINGS_SCHEMA_DIR=.
or
$ cd step5/build # or step6/build, step7/build, etc.
$ export GSETTINGS_SCHEMA_DIR=.
But then the program can only be run from that directory. Alternatively,
set GSETTINGS_SCHEMA_DIR to an absolute path, such as
......@@ -33,4 +44,6 @@ and do the following:
$ cd step5 # or step6, step7, etc.
$ make -f Makefile.example install-gschema-file
or
$ cd step5/build # or step6/build, step7/build, etc.
$ ninja install-gschema-file
#!/bin/bash
# External command, intended to be called from
# ninja install-desktop-file
# and
# ninja install-gschema-file
cd $MESON_SOURCE_ROOT
if [ "x$1" = "xdesktop" ]; then
# ./install-cmd.sh desktop <program_name> <desktop_file> <icon_file>
mkdir -p ~/.local/share/applications
sed -e "s#@bindir@#$MESON_BUILD_ROOT#" "$3" > ~/.local/share/applications/$2.desktop
mkdir -p ~/.local/share/icons/hicolor/48x48/apps
cp "$4" ~/.local/share/icons/hicolor/48x48/apps
elif [ "x$1" = "xgschema" ]; then
# ./install-cmd.sh gschema <gschema_file>
if [ -n "$GSETTINGS_SCHEMA_DIR" -a "$GSETTINGS_SCHEMA_DIR" != . ]; then
mkdir -p "$GSETTINGS_SCHEMA_DIR"
cp "$2" "$GSETTINGS_SCHEMA_DIR"
glib-compile-schemas "$GSETTINGS_SCHEMA_DIR"
fi
else
echo Unknown subcommand: $*
exit 1
fi
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
]
executable(program_name,
cpp_sources,
dependencies: gtkmm_dep
)
install_cmd = './install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'exampleapp.desktop',
'exampleapp.png'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
executable(program_name,
cpp_sources, resources,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
executable(program_name,
cpp_sources, resources,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
executable(program_name,
cpp_sources, resources,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
'exampleappprefs.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
schemas = gnome.compile_schemas(depend_files: 'org.gtkmm.exampleapp.gschema.xml')
executable(program_name,
cpp_sources, resources, schemas,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
run_target('install-gschema-file',
command: [install_cmd, 'gschema',
'org.gtkmm.exampleapp.gschema.xml'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
'exampleappprefs.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
schemas = gnome.compile_schemas(depend_files: 'org.gtkmm.exampleapp.gschema.xml')
executable(program_name,
cpp_sources, resources, schemas,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
run_target('install-gschema-file',
command: [install_cmd, 'gschema',
'org.gtkmm.exampleapp.gschema.xml'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
'exampleappprefs.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
schemas = gnome.compile_schemas(depend_files: 'org.gtkmm.exampleapp.gschema.xml')
executable(program_name,
cpp_sources, resources, schemas,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
run_target('install-gschema-file',
command: [install_cmd, 'gschema',
'org.gtkmm.exampleapp.gschema.xml'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
'exampleappprefs.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
schemas = gnome.compile_schemas(depend_files: 'org.gtkmm.exampleapp.gschema.xml')
executable(program_name,
cpp_sources, resources, schemas,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
run_target('install-gschema-file',
command: [install_cmd, 'gschema',
'org.gtkmm.exampleapp.gschema.xml'
]
)
project('gtkmm exampleapp', 'c', 'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17'
]
)
gnome = import('gnome')
gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'exampleapp'
cpp_sources = [
'main.cc',
'exampleappwindow.cc',
'exampleapplication.cc',
'exampleappprefs.cc',
]
resources = gnome.compile_resources('resources',
'exampleapp.gresource.xml',
source_dir: '.')
schemas = gnome.compile_schemas(depend_files: 'org.gtkmm.exampleapp.gschema.xml')
executable(program_name,
cpp_sources, resources, schemas,
dependencies: gtkmm_dep
)
install_cmd = '../step1/install-cmd.sh'
run_target('install-desktop-file',
command: [install_cmd, 'desktop',
program_name,
'../step1/exampleapp.desktop',
'../step1/exampleapp.png'
]
)
run_target('install-gschema-file',
command: [install_cmd, 'gschema',
'org.gtkmm.exampleapp.gschema.xml'
]
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment