1gnome = import('gnome') 2 3sources = [ 4 'gd.h', 5 'gd-types-catalog.c' 6] 7built_sources = [] 8c_args = [] 9private_c_args = [ 10 '-DG_LOG_DOMAIN="libgd"', 11 '-DG_DISABLE_DEPRECATED', 12] 13 14if (get_option('with-gtk-hacks') or 15 get_option('with-main-box') or 16 get_option('with-main-icon-box') or 17 get_option('with-main-view')) 18 sources += [ 19 'gd-icon-utils.c', 20 'gd-icon-utils.h', 21 ] 22 c_args += '-DLIBGD_GTK_HACKS=1' 23endif 24 25if (get_option('with-main-box') or 26 get_option('with-main-icon-box')) 27 sources += [ 28 'gd-main-box-child.c', 29 'gd-main-box-child.h', 30 'gd-main-box-generic.c', 31 'gd-main-box-generic.h', 32 'gd-main-box-item.c', 33 'gd-main-box-item.h' 34 ] 35 c_args += '-DLIBGD__BOX_COMMON=1' 36 37 if (get_option('with-main-box') or 38 get_option('with-main-icon-box')) 39 sources += [ 40 'gd-main-icon-box.c', 41 'gd-main-icon-box.h', 42 'gd-main-icon-box-child.c', 43 'gd-main-icon-box-child.h', 44 'gd-main-icon-box-icon.c', 45 'gd-main-icon-box-icon.h', 46 'gd-icon-utils.c', 47 'gd-icon-utils.h', 48 ] 49 c_args += '-DLIBGD_MAIN_ICON_BOX=1' 50 endif 51 52 if get_option('with-main-box') 53 sources += [ 54 'gd-main-box.c', 55 'gd-main-box.h', 56 ] 57 c_args += '-DLIBGD_MAIN_BOX=1' 58 endif 59endif 60 61if (get_option('with-main-icon-view') or 62 get_option('with-main-list-view') or 63 get_option('with-main-view')) 64 sources += [ 65 'gd-main-view-generic.c', 66 'gd-main-view-generic.h', 67 'gd-styled-text-renderer.c', 68 'gd-styled-text-renderer.h', 69 'gd-two-lines-renderer.c', 70 'gd-two-lines-renderer.h', 71 ] 72 c_args += '-DLIBGD__VIEW_COMMON=1' 73 74 if (get_option('with-main-icon-view') or 75 get_option('with-main-view')) 76 sources += [ 77 'gd-main-icon-view.c', 78 'gd-main-icon-view.h', 79 'gd-toggle-pixbuf-renderer.c', 80 'gd-toggle-pixbuf-renderer.h' 81 ] 82 c_args += '-DLIBGD_MAIN_ICON_VIEW=1' 83 endif 84 85 if (get_option('with-main-list-view') or 86 get_option('with-main-view')) 87 sources += [ 88 'gd-main-list-view.c', 89 'gd-main-list-view.h', 90 ] 91 c_args += '-DLIBGD_MAIN_LIST_VIEW=1' 92 endif 93 94 if get_option('with-main-view') 95 sources += [ 96 'gd-main-view.c', 97 'gd-main-view.h', 98 ] 99 c_args += '-DLIBGD_MAIN_VIEW=1' 100 endif 101endif 102 103if get_option('with-margin-container') 104 sources += [ 105 'gd-margin-container.c', 106 'gd-margin-container.h', 107 ] 108 c_args += '-DLIBGD_MARGIN_CONTAINER=1' 109endif 110 111if get_option('with-tagged-entry') 112 sources += [ 113 'gd-tagged-entry.c', 114 'gd-tagged-entry.h', 115 ] 116 c_args += '-DLIBGD_TAGGED_ENTRY=1' 117endif 118 119if get_option('with-notification') 120 sources += [ 121 'gd-notification.c', 122 'gd-notification.h', 123 ] 124 c_args += '-DLIBGD_NOTIFICATION=1' 125endif 126 127if sources.length() == 2 128 error('You must include a feature to be built!') 129endif 130 131# --------- Building ----------- 132 133static = get_option('static') 134install_introspection = get_option('with-introspection') 135with_vapi = get_option('with-vapi') 136 137if static 138 libgd_lib = static_library('gd', sources, 139 dependencies: [libgtk, libm], 140 include_directories: libgd_include, 141 c_args: c_args + private_c_args 142 ) 143endif 144 145# Currently in Meson building gir requires a shared library 146if not static or (install_introspection or with_vapi) 147 if not static and pkglibdir == '' 148 error('Installing shared library but pkglibdir is unset!') 149 endif 150 151 libgd_shared_lib = shared_library('gd', sources, 152 dependencies: [libgtk, libm], 153 include_directories: libgd_include, 154 c_args: c_args + private_c_args, 155 install: not static, 156 install_dir: pkglibdir 157 ) 158 159 if not static 160 libgd_lib = libgd_shared_lib 161 endif 162endif 163 164if install_introspection or with_vapi 165 if install_introspection 166 if pkgdatadir == '' 167 error('Installing introspection but pkgdatadir is unset!') 168 elif pkglibdir == '' 169 error('Installing introspection but pkglibdir is unset!') 170 endif 171 endif 172 173 libgd_gir = gnome.generate_gir(libgd_shared_lib, 174 sources : sources, 175 nsversion : '1.0', 176 namespace : 'Gd', 177 symbol_prefix : 'gd', 178 identifier_prefix : 'Gd', 179 includes : 'Gtk-3.0', 180 include_directories: libgd_include, 181 install: install_introspection, 182 install_dir_gir: join_paths(pkgdatadir, 'gir-1.0'), 183 install_dir_typelib: join_paths(pkglibdir, 'girepository-1.0'), 184 extra_args: [ 185 '--c-include=libgd/gd.h', 186 ] 187 ) 188 built_sources += libgd_gir 189 190 if get_option('with-vapi') 191 libgd_vapi_dep = gnome.generate_vapi('gd-1.0', 192 sources: libgd_gir[0], 193 packages: ['gtk+-3.0'] 194 ) 195 endif 196endif 197 198libgd_dep = declare_dependency( 199 link_with: libgd_lib, 200 include_directories: libgd_include, 201 dependencies: libgtk, 202 compile_args: c_args, 203 sources: built_sources 204) 205