summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2012-08-17 11:30:17 +0800
committerRobert Bragg <robert@linux.intel.com>2012-09-24 13:35:18 +0100
commit7253c5ca297f4ae18ce1ed2c63fcf4b57f39cf7a (patch)
tree4e2bd5a3ab0316588c9a45bb0a268a280e44beae
parente3e53f2c708def782578ad05834ac0fd66a5858b (diff)
downloadcogl-7253c5ca297f4ae18ce1ed2c63fcf4b57f39cf7a.tar.gz
Bug 682071-cogl/cogl-sdl.h: MSVC: Link to SDL when apps are built
Link to SDL.lib and SDLmain.lib if Cogl was built with the SDL winsys. Recent changes to the SDL winsys introduced a direct dependency to SDLmain.lib (and hence SDL.lib) when programs are built, causing linker errors to appear when any programs using cogl (with the SDL winsys built in) are built. Since we cannot determine whether a Cogl build is built with the SDL winsys at build time easily, we could use #pragma comment (lib, ...) whenever cogl-sdl.h is included by cogl.h so that SDLmain.lib and SDL.lib is linked into the resulting binary, so that the program can link and run correctly. This does not add any external dependencies as the Cogl DLL already depends on SDL.dll when it is built with the SDL winsys. https://bugzilla.gnome.org/show_bug.cgi?id=682071 (cherry picked from commit 2921d2a4d9c79f1ca7530171e0dfa8c945607bc7)
-rw-r--r--cogl/cogl-sdl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/cogl/cogl-sdl.h b/cogl/cogl-sdl.h
index 732beaf1..6e9c079b 100644
--- a/cogl/cogl-sdl.h
+++ b/cogl/cogl-sdl.h
@@ -31,6 +31,15 @@
#include <cogl/cogl-context.h>
#include <SDL.h>
+#ifdef _MSC_VER
+/* We need to link to SDL.lib/SDLmain.lib
+ * if we are using Cogl
+ * that uses the SDL winsys
+ */
+#pragma comment (lib, "SDL.lib")
+#pragma comment (lib, "SDLmain.lib")
+#endif
+
G_BEGIN_DECLS
/**