1# Configuration file 2configure_file(output: 'config.h', configuration: conf) 3 4# List of generated sources: 5# - name of the generated file 6# - registry source file 7# - additional sources 8generated_sources = [ 9 [ 'gl_generated_dispatch.c', gl_registry, [ 'dispatch_common.c', 'dispatch_common.h' ] ] 10] 11 12if build_egl 13 generated_sources += [ [ 'egl_generated_dispatch.c', egl_registry, 'dispatch_egl.c' ] ] 14endif 15 16if build_glx 17 generated_sources += [ [ 'glx_generated_dispatch.c', glx_registry, 'dispatch_glx.c' ] ] 18endif 19 20if build_wgl 21 generated_sources += [ [ 'wgl_generated_dispatch.c', wgl_registry, 'dispatch_wgl.c' ] ] 22endif 23 24gen_sources = [ ] 25sources = [ ] 26 27foreach g: generated_sources 28 gen_source = g[0] 29 registry = g[1] 30 source = g[2] 31 32 generated = custom_target(gen_source, 33 input: registry, 34 output: [ gen_source ], 35 command: [ 36 gen_dispatch_py, 37 '--source', 38 '--no-header', 39 '--outputdir=@OUTDIR@', 40 '@INPUT@', 41 ]) 42 43 gen_sources += [ generated ] 44 sources += [ source ] 45endforeach 46 47epoxy_sources = sources + gen_sources 48 49common_ldflags = [] 50 51if host_system == 'linux' and cc.get_id() == 'gcc' 52 common_ldflags += cc.get_supported_link_arguments([ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro' ]) 53endif 54 55# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108 56darwin_versions = [1, '1.0'] 57 58epoxy_deps = [ dl_dep, ] 59if host_system == 'windows' 60 epoxy_deps += [ opengl32_dep, gdi32_dep ] 61endif 62if enable_x11 63 epoxy_deps += [ x11_headers_dep, ] 64endif 65if build_egl 66 epoxy_deps += [ elg_headers_dep, ] 67endif 68 69libepoxy = library( 70 'epoxy', 71 sources: epoxy_sources + epoxy_headers, 72 version: '0.0.0', 73 darwin_versions: darwin_versions, 74 install: true, 75 dependencies: epoxy_deps, 76 include_directories: libepoxy_inc, 77 c_args: common_cflags + visibility_cflags, 78 link_args: common_ldflags, 79) 80 81epoxy_has_glx = build_glx ? '1' : '0' 82epoxy_has_egl = build_egl ? '1' : '0' 83epoxy_has_wgl = build_wgl ? '1' : '0' 84 85libepoxy_dep = declare_dependency( 86 link_with: libepoxy, 87 include_directories: libepoxy_inc, 88 dependencies: epoxy_deps, 89 sources: epoxy_headers, 90 variables: { 91 'epoxy_has_glx': epoxy_has_glx, 92 'epoxy_has_egl': epoxy_has_egl, 93 'epoxy_has_wgl': epoxy_has_wgl, 94 }, 95) 96 97# We don't want to add these dependencies to the library, as they are 98# not needed when building Epoxy; we do want to add them to the generated 99# pkg-config file, for consumers of Epoxy 100gl_reqs = [] 101if gl_dep.found() and gl_dep.type_name() == 'pkgconfig' 102 gl_reqs += 'gl' 103endif 104if build_egl and egl_dep.found() and egl_dep.type_name() == 'pkgconfig' 105 gl_reqs += 'egl' 106endif 107 108pkg = import('pkgconfig') 109pkg.generate( 110 libraries: libepoxy, 111 name: 'epoxy', 112 description: 'GL dispatch library', 113 version: meson.project_version(), 114 variables: [ 115 'epoxy_has_glx=@0@'.format(epoxy_has_glx), 116 'epoxy_has_egl=@0@'.format(epoxy_has_egl), 117 'epoxy_has_wgl=@0@'.format(epoxy_has_wgl), 118 ], 119 filebase: 'epoxy', 120 requires_private: ' '.join(gl_reqs), 121) 122