summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2021-10-22 12:29:10 -0300
committerRichard Hughes <richard@hughsie.com>2021-10-22 16:39:52 +0100
commit9006c04021018368cd79b2feda962ee5a5370c64 (patch)
tree0007978c49c9bb6c264784c978b30ad0bfe79e97
parentce096b5fa63a1c99d123248d4679969c032f06f4 (diff)
downloadcolord-gtk-9006c04021018368cd79b2feda962ee5a5370c64.tar.gz
build: Make GTK3 build optional too
This allows pure GTK4 builds of the library. The conversion tool (cd-convert) isn't built when the GTK3 build is disabled.
-rw-r--r--libcolord-gtk/meson.build213
-rw-r--r--meson.build9
-rw-r--r--meson_options.txt1
3 files changed, 116 insertions, 107 deletions
diff --git a/libcolord-gtk/meson.build b/libcolord-gtk/meson.build
index 5815f2a..351cbb9 100644
--- a/libcolord-gtk/meson.build
+++ b/libcolord-gtk/meson.build
@@ -25,89 +25,7 @@ install_headers([
subdir : 'colord-1/colord-gtk',
)
-colord_gtk = shared_library(
- 'colord-gtk',
- sources : [
- 'cd-sample-widget.c',
- 'cd-sample-window.c',
- 'cd-window.c',
- 'cd-window-sync.c',
- ],
- soversion : lt_current,
- version : lt_version,
- dependencies : [
- glib,
- gio,
- gtk3,
- colord,
- ],
- c_args : [
- cargs,
- ],
- include_directories : [
- root_incdir,
- ],
- install : true
-)
-
pkgg = import('pkgconfig')
-pkgg.generate(
- libraries : colord_gtk,
- requires : [ 'colord', 'gtk+-3.0' ],
- subdirs : 'colord-1',
- version : meson.project_version(),
- name : 'colord-gtk',
- filebase : 'colord-gtk',
- description : 'colord-gtk is GTK integration for libcolord',
-)
-
-if get_option('introspection')
-libcolord_gtk_gir = gnome.generate_gir(
- colord_gtk,
- sources : [
- 'cd-sample-widget.c',
- 'cd-sample-widget.h',
- 'cd-sample-window.c',
- 'cd-sample-window.h',
- 'cd-window.c',
- 'cd-window.h',
- 'cd-window-sync.c',
- 'cd-window-sync.h',
- colord_gtk_version_h,
- ],
- nsversion : '1.0',
- namespace : 'ColordGtk',
- symbol_prefix : 'cd',
- identifier_prefix : 'Cd',
- export_packages : 'colord-gtk',
- extra_args : [
- '--c-include=colord-gtk.h',
- '-DCD_COMPILATION',
- ],
- dependencies : [
- glib,
- gio,
- gtk3,
- colord,
- ],
- includes : [
- 'GObject-2.0',
- 'Gio-2.0',
- 'Gtk-3.0',
- 'Colord-1.0',
- ],
- install : true
-)
-endif
-
-if get_option('vapi')
- gnome.generate_vapi(
- 'colord-gtk',
- sources: libcolord_gtk_gir[0],
- packages: [ 'glib-2.0', 'gio-2.0', 'gtk+-3.0', 'colord' ],
- install: true,
- )
-endif
if get_option('gtk2')
colord_gtk2 = shared_library(
@@ -144,6 +62,114 @@ if get_option('gtk2')
)
endif
+if get_option('gtk3')
+ colord_gtk = shared_library(
+ 'colord-gtk',
+ sources : [
+ 'cd-sample-widget.c',
+ 'cd-sample-window.c',
+ 'cd-window.c',
+ 'cd-window-sync.c',
+ ],
+ soversion : lt_current,
+ version : lt_version,
+ dependencies : [
+ glib,
+ gio,
+ gtk3,
+ colord,
+ ],
+ c_args : [
+ cargs,
+ ],
+ include_directories : [
+ root_incdir,
+ ],
+ install : true
+ )
+
+ pkgg.generate(
+ libraries : colord_gtk,
+ requires : [ 'colord', 'gtk+-3.0' ],
+ subdirs : 'colord-1',
+ version : meson.project_version(),
+ name : 'colord-gtk',
+ filebase : 'colord-gtk',
+ description : 'colord-gtk is GTK integration for libcolord',
+ )
+
+ if get_option('introspection')
+ libcolord_gtk_gir = gnome.generate_gir(
+ colord_gtk,
+ sources : [
+ 'cd-sample-widget.c',
+ 'cd-sample-widget.h',
+ 'cd-sample-window.c',
+ 'cd-sample-window.h',
+ 'cd-window.c',
+ 'cd-window.h',
+ 'cd-window-sync.c',
+ 'cd-window-sync.h',
+ colord_gtk_version_h,
+ ],
+ nsversion : '1.0',
+ namespace : 'ColordGtk',
+ symbol_prefix : 'cd',
+ identifier_prefix : 'Cd',
+ export_packages : 'colord-gtk',
+ extra_args : [
+ '--c-include=colord-gtk.h',
+ '-DCD_COMPILATION',
+ ],
+ dependencies : [
+ glib,
+ gio,
+ gtk3,
+ colord,
+ ],
+ includes : [
+ 'GObject-2.0',
+ 'Gio-2.0',
+ 'Gtk-3.0',
+ 'Colord-1.0',
+ ],
+ install : true
+ )
+ endif
+
+ if get_option('vapi')
+ gnome.generate_vapi(
+ 'colord-gtk',
+ sources: libcolord_gtk_gir[0],
+ packages: [ 'glib-2.0', 'gio-2.0', 'gtk+-3.0', 'colord' ],
+ install: true,
+ )
+ endif
+
+ if get_option('tests')
+ e = executable(
+ 'colord-gtk-test',
+ sources : [
+ 'cd-self-test.c',
+ ],
+ include_directories : [
+ root_incdir,
+ ],
+ dependencies : [
+ glib,
+ gio,
+ gtk3,
+ colord,
+ ],
+ link_with : colord_gtk,
+ c_args : [
+ cargs,
+ ]
+ )
+ test('colord-test-private', e)
+ endif
+endif
+
if get_option('gtk4')
colord_gtk4 = shared_library(
'colord-gtk4',
@@ -205,26 +231,3 @@ if get_option('gtk4')
endif
endif
-
-if get_option('tests')
- e = executable(
- 'colord-gtk-test',
- sources : [
- 'cd-self-test.c',
- ],
- include_directories : [
- root_incdir,
- ],
- dependencies : [
- glib,
- gio,
- gtk3,
- colord,
- ],
- link_with : colord_gtk,
- c_args : [
- cargs,
- ]
- )
-test('colord-test-private', e)
-endif
diff --git a/meson.build b/meson.build
index e947c84..118257e 100644
--- a/meson.build
+++ b/meson.build
@@ -94,7 +94,6 @@ endforeach
glib = dependency('glib-2.0', version : '>= 2.28.0')
gio = dependency('gio-2.0', version : '>= 2.25.9Z')
-gtk3 = dependency('gtk+-3.0')
colord = dependency('colord', version : '>= 0.1.27')
if get_option('gtk2')
@@ -102,6 +101,10 @@ if get_option('gtk2')
conf.set('HAVE_GTK2', '1')
endif
+if get_option('gtk3')
+ gtk3 = dependency('gtk+-3.0')
+endif
+
if get_option('gtk4')
gtk4 = dependency('gtk4', version : '>= 4.4')
endif
@@ -144,7 +147,9 @@ root_incdir = include_directories('.')
subdir('libcolord-gtk')
subdir('po')
-subdir('client')
+if get_option('gtk3')
+ subdir('client')
+endif
if get_option('docs')
subdir('doc')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 53a03ea..87bf7c0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,5 @@
option('gtk4', type : 'boolean', value : true, description : 'Build Gtk4 library')
+option('gtk3', type : 'boolean', value : true, description : 'Build Gtk3 library')
option('gtk2', type : 'boolean', value : false, description : 'Build Gtk2 library')
option('introspection', type : 'boolean', value : true, description : 'Build gobject-introspection typelib files')
option('vapi', type : 'boolean', value : false, description : 'Build vala bindings')