[Cogl] [Patch][Cogl-1.18]: cogl-sdl.h: MSVC Builds: Don't Link to the SDL libraries automatically

Fan Chun-wei fanc999 at yahoo.com.tw
Sun Apr 6 22:50:52 PDT 2014


Hi,

In a previous patch of mine, #pragma directives were added in cogl-sdl.h 
to link to the SDL libraries, so that Visual Studio builds using Cogl 
built with the SDL winsys would build and link properly.  As the current 
Cogl codebase supports the SDL winsys being built against SDL-1.x and 
SDL-2.x, this becomes suboptimal as the libraries that need to be linked 
are by default named differently on SDL-1.x and SDL-2.x.  This patch 
removes the #pragma directives for Visual Studio builds to link to the 
SDL libraries, instead people that aren't using SDL directly in their 
Cogl-using code can define SDL_MAIN_HANDLED in their build flags (i.e. 
CFLAGS) to avoid an implicit dependency on the SDL/SDL2 libraries.  I 
will update the Cogl Visual Studio builds files (as well as Clutter's) 
to reflect on this change as soon this patch is deemed OK for going in.

With blessings, thank you!
-------------- next part --------------
From bedfa1c1ba8dbc881f3a6fd012b7a6d2f435ced3 Mon Sep 17 00:00:00 2001
From: Chun-wei Fan <fanchunwei at src.gnome.org>
Date: Mon, 7 Apr 2014 13:44:36 +0800
Subject: [PATCH] MSVC Builds: Don't Link to SDL Automatically

Remove #pragma directives that causes any applications that use Cogl to
link to the SDL libraries when Cogl was built with the SDL winsys.  This is
mainly due to the availability of both SDL-1.x and SDL-2.x support in the
SDL winsys, where different libraries are linked for SDL-1.x and SDL-2.x.

To avoid having to link to the SDL/SDL2 libraries when the application code
is not directly using SDL/SDL2, define SDL_MAIN_HANDLED in the CFLAGS so
that SDL's wrapper main() implementation will not be used when the
application is being built.
---
 cogl/cogl-sdl.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/cogl/cogl-sdl.h b/cogl/cogl-sdl.h
index 220e004..44d308d 100644
--- a/cogl/cogl-sdl.h
+++ b/cogl/cogl-sdl.h
@@ -52,15 +52,6 @@
 #include <cogl/cogl-onscreen.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
-
 COGL_BEGIN_DECLS
 
 /**
-- 
1.8.3.msysgit.0



More information about the Cogl mailing list