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