From ba2e7b151bb0ee97c136a44c62555a1b7be80371 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 19 Jan 2017 18:41:40 +0000 Subject: [PATCH] build: Explicitly link against gdi32 We need to explicitly link against gdi32 in order to access SetPixelFormat and ChoosetPixelFormat, and the order of the linking is relevant when using static libraries. This is a slight workaround to the order of compiler arguments generated by Meson, and it's supposed to go away in the near future. --- meson.build | 14 ++++++++++++++ src/meson.build | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a0c9554..df87110 100644 --- a/meson.build +++ b/meson.build @@ -102,6 +102,20 @@ x11_dep = dependency('x11', required: false) gles1_dep = cc.find_library('libGLESv1_CM', required: false) gles2_dep = cc.find_library('libGLESv2', required: false) +# On windows, the DLL has to have all of its functions +# resolved at link time, so we have to link directly aginst +# opengl32. But that's the only GL provider, anyway. +if host_system == 'windows' + opengl32_dep = cc.find_library('opengl32', required: true) + + # When building against static libraries, we need to control + # the order of the dependencies, and gdi32 provides symbols + # needed when using opengl32, like SetPixelFormat and + # ChoosePixelFormat. This is mostly a workaround for older + # versions of Meson. + gdi32_dep = cc.find_library('gdi32', required: true) +endif + # PkgConfig file pkgconf = configuration_data() pkgconf.set('prefix', epoxy_prefix) diff --git a/src/meson.build b/src/meson.build index c47a674..05d4f7b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -91,8 +91,7 @@ endif epoxy_deps = [ dl_dep, ] if host_system == 'windows' - ogl_dep = cc.find_library('opengl32', required: true) - epoxy_deps += [ ogl_dep, ] + epoxy_deps += [ opengl32_dep, gdi32_dep ] endif # Allow building a static version of epoxy