diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-19 20:32:14 +0530 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-12-19 11:55:42 -0500 |
commit | 12d23bc8fb0839df623599373c960947d3293b7e (patch) | |
tree | fd35cb3661cd7642ad6a67bfa46668e68f1ae269 | |
parent | fc4f5734ab2a9e50ef028794179a0f23a0dede6b (diff) | |
download | libgd-wip/meson.tar.gz |
meson: Move all generation and compilation to libgd/wip/meson
In the process, remove headers files from the list of sources. This is
not necessary with Meson.
The move is required for compiling resources with
gnome.compile_resources() which was also missing earlier
Also, just use '.' to include_directories since that resolves to both
the builddir and the srcdir, which is exactly what we want since some of
the headers we use are generated and hence in the builddir.
-rw-r--r-- | libgd/meson.build | 133 | ||||
-rw-r--r-- | meson.build | 152 |
2 files changed, 135 insertions, 150 deletions
diff --git a/libgd/meson.build b/libgd/meson.build index e69de29..6f113fa 100644 --- a/libgd/meson.build +++ b/libgd/meson.build @@ -0,0 +1,133 @@ +gnome = import('gnome') + +sources = [ 'gd.h', + 'gd-types-catalog.c' ] +built_sources = [] +c_args = [] + +if get_variable('libgd_gtk_hacks', false) + sources += [ 'gd-entry-focus-hack.c', + 'gd-icon-utils.c' ] + c_args += '-DLIBGD_GTK_HACKS=1' +endif + +build_view_generic = (get_variable('libgd_main_icon_view', false) or + get_variable('libgd_main_list_view', false) or + get_variable('libgd_main_view', false)) + +if build_view_generic + sources += [ 'gd-main-view-generic.c', + 'gd-styled-text-renderer.c', + 'gd-two-lines-renderer.c' ] + c_args += '-DLIBGD__VIEW_COMMON=1' +endif + +build_icon_view = (get_variable('libgd_main_icon_view', false) or + get_variable('libgd_main_view', false)) +if build_icon_view + sources += [ 'gd-main-icon-view.c', + 'gd-toggle-pixbuf-renderer.c' ] + c_args += '-DLIBGD_MAIN_ICON_VIEW=1' +endif + +build_list_view = (get_variable('libgd_main-list_view', false) or + get_variable('libgd_main_view', false)) +if build_list_view + sources += [ 'gd-main-list-view.c' ] + c_args += '-DLIBGD_MAIN_LIST_VIEW=1' +endif + +if get_variable('libgd_main_view', false) + sources += [ 'gd-main-view.c' ] + c_args += '-DLIBGD_MAIN_VIEW=1' +endif + +if get_variable('libgd_main_toolbar', false) + sources += [ 'gd-main-toolbar.c' ] + c_args += '-DLIBGD_MAIN_TOOLBAR=1' +endif + +if get_variable('libgd_header_bar', false) + sources += [ 'gd-header-bar.c' ] + c_args += '-DLIBGD_HEADER_BAR=1' +endif + +if get_variable('libgd_header_button', false) + sources += [ 'gd-header-button.c' ] + c_args += '-DLIBGD__HEADER_BUTTON=1' +endif + +if get_variable('libgd_margin_container', false) + sources += [ 'gd-margin-container.c' ] + c_args += '-DLIBGD_MARGIN_CONTAINER=1' +endif + +if get_variable('libgd_tagged_entry', false) + gdres = gnome.compile_resources('gd-tagged-entry-resources', + 'gd-tagged-entry.gresource.xml', + export : true, + sources_dir : 'libgd') + built_sources += [gdres] + sources += [ gdres, + 'gd-tagged-entry.c' ] + c_args += '-DLIBGD_TAGGED_ENTRY=1' +endif + +if get_variable('libgd_notification', false) + sources += [ 'gd-notification.c' ] + c_args += '-DLIBGD_NOTIFICATION=1' +endif + +if get_variable('libgd_revealer', false) + sources += [ 'gd-revealer.c' ] + c_args += '-DLIBGD_REVEALER=1' +endif + +if get_variable('libgd_stack', false) + sources += [ 'gd-stack.c', + 'gd-stack-switcher.c' ] + c_args += '-DLIBGD_STACK=1' +endif + +libgd = shared_library('gd', + sources, + include_directories: include, + dependencies: [gtk, libm], + c_args: c_args) +if get_variable('libgd_static', false) + libgd_lib = static_library('gd', + sources, + include_directories: include, + dependencies: [gtk, libm], + c_args: c_args) +else + libgd_lib = libgd +endif + +if get_variable('libgd_gir', false) or get_variable('libgd_vapi', false) + gir = gnome.generate_gir(libgd, + sources : sources, + nsversion : '1.0', + namespace : 'Gd', + symbol_prefix : 'gd', + identifier_prefix : 'Gd', + includes : 'Gtk-3.0') + built_sources += gir + + if get_variable('libgd_vapi', false) + vapigen = find_program('vapigen') + vapi = custom_target('gd-1.0.vapi', + output: 'gd-1.0.vapi', + input: gir, + command: [vapigen, '--library', 'gd-1.0', + '--pkg', 'gtk+-3.0', + '@INPUT@'], + install: false) + built_sources += vapi + endif +endif + +libgd_dep = declare_dependency(link_with: libgd_lib, + include_directories: include, + compile_args: c_args, + sources: built_sources) diff --git a/meson.build b/meson.build index e001e0c..597e6ca 100644 --- a/meson.build +++ b/meson.build @@ -21,154 +21,6 @@ gtk = dependency('gtk+-3.0') cc = meson.get_compiler('c') libm = cc.find_library('m', required: false) -sources = [ 'libgd/gd.h', - 'libgd/gd-types-catalog.c', - 'libgd/gd-types-catalog.h' ] +include = include_directories('.') -c_args = [] - -if get_variable('libgd_gtk_hacks', false) - sources += [ 'libgd/gd-entry-focus-hack.c', - 'libgd/gd-entry-focus-hack.h', - 'libgd/gd-icon-utils.c', - 'libgd/gd-icon-utils.h' ] - c_args += '-DLIBGD_GTK_HACKS=1' -endif - -build_view_generic = (get_variable('libgd_main_icon_view', false) or - get_variable('libgd_main_list_view', false) or - get_variable('libgd_main_view', false)) - -if build_view_generic - sources += [ 'libgd/gd-main-view-generic.c', - 'libgd/gd-main-view-generic.h', - 'libgd/gd-styled-text-renderer.c', - 'libgd/gd-styled-text-renderer.h', - 'libgd/gd-two-lines-renderer.c', - 'libgd/gd-two-lines-renderer.h' ] - c_args += '-DLIBGD__VIEW_COMMON=1' -endif - -build_icon_view = (get_variable('libgd_main_icon_view', false) or - get_variable('libgd_main_view', false)) -if build_icon_view - sources += [ 'libgd/gd-main-icon-view.c', - 'libgd/gd-main-icon-view.h', - 'libgd/gd-toggle-pixbuf-renderer.c', - 'libgd/gd-toggle-pixbuf-renderer.h' ] - c_args += '-DLIBGD_MAIN_ICON_VIEW=1' -endif - -build_list_view = (get_variable('libgd_main-list_view', false) or - get_variable('libgd_main_view', false)) -if build_list_view - sources += [ 'libgd/gd-main-list-view.c', - 'libgd/gd-main-list-view.h' ] - c_args += '-DLIBGD_MAIN_LIST_VIEW=1' -endif - -if get_variable('libgd_main_view', false) - sources += [ 'libgd/gd-main-view.c', - 'libgd/gd-main-view.h' ] - c_args += '-DLIBGD_MAIN_VIEW=1' -endif - -if get_variable('libgd_main_toolbar', false) - sources += [ 'libgd/gd-main-toolbar.c', - 'libgd/gd-main-toolbar.h' ] - c_args += '-DLIBGD_MAIN_TOOLBAR=1' -endif - -if get_variable('libgd_header_bar', false) - sources += [ 'libgd/gd-header-bar.c', - 'libgd/gd-header-bar.h' ] - c_args += '-DLIBGD_HEADER_BAR=1' -endif - -if get_variable('libgd_header_button', false) - sources += [ 'libgd/gd-header-button.c', - 'libgd/gd-header-button.h' ] - c_args += '-DLIBGD__HEADER_BUTTON=1' -endif - -if get_variable('libgd_margin_container', false) - sources += [ 'libgd/gd-margin-container.c', - 'libgd/gd-margin-container.h' ] - c_args += '-DLIBGD_MARGIN_CONTAINER=1' -endif - -if get_variable('libgd_tagged_entry', false) - sources += [ 'libgd/gd-tagged-entry.c', - 'libgd/gd-tagged-entry.h' ] - c_args += '-DLIBGD_TAGGED_ENTRY=1' -endif - -if get_variable('libgd_notification', false) - sources += [ 'libgd/gd-notification.c', - 'libgd/gd-notification.h' ] - c_args += '-DLIBGD_NOTIFICATION=1' -endif - -if get_variable('libgd_revealer', false) - sources += [ 'libgd/gd-revealer.c', - 'libgd/gd-revealer.h' ] - c_args += '-DLIBGD_REVEALER=1' -endif - -if get_variable('libgd_stack', false) - sources += [ 'libgd/gd-stack.c', - 'libgd/gd-stack.h', - 'libgd/gd-stack-switcher.c', - 'libgd/gd-stack-switcher.h' ] - c_args += '-DLIBGD_STACK=1' -endif - -libgd = shared_library('gd', - sources, - dependencies: [gtk, libm], - c_args: c_args) -if get_variable('libgd_static', false) - libgd_lib = static_library('gd', - sources, - dependencies: [gtk, libm], - c_args: c_args) -else - libgd_lib = libgd -endif - -built_sources = [] - -if get_variable('libgd_gir', false) or get_variable('libgd_vapi', false) - gnome = import('gnome') - gir = gnome.generate_gir(libgd, - sources : sources, - nsversion : '1.0', - namespace : 'Gd', - symbol_prefix : 'gd', - identifier_prefix : 'Gd', - includes : 'Gtk-3.0', - extra_args: ['-I' + meson.source_root(), - '-I' + meson.current_source_dir(), - '--c-include=libgd/gd.h']) - built_sources += gir - - if get_variable('libgd_vapi', false) - vapigen = find_program('vapigen') - vapi = custom_target('gd-1.0.vapi', - output: 'gd-1.0.vapi', - input: gir, - command: [vapigen, '--library', 'gd-1.0', - '--pkg', 'gtk+-3.0', - '@INPUT@'], - install: false) - built_sources += vapi - endif -endif - -include = include_directories(meson.source_root(), - meson.current_source_dir()) - -libgd_dep = declare_dependency(link_with: libgd_lib, - include_directories: include, - compile_args: c_args, - sources: built_sources) +subdir('libgd') |