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