[Scummvm-cvs-logs] scummvm master -> 6cb0a4c1b0b2cb65ae8f3bfb122edead0e94f3fc

bluegr bluegr at gmail.com
Fri Mar 6 01:58:32 CET 2015


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9a49493656 DEVTOOLS: Add support for linking with SDL 2.0 in create_project
6cb0a4c1b0 SDL: Fix compilation with SDL 2.0 under MSVC


Commit: 9a494936561a5351f5bfb9e840d70c05684239c3
    https://github.com/scummvm/scummvm/commit/9a494936561a5351f5bfb9e840d70c05684239c3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-03-06T02:39:57+02:00

Commit Message:
DEVTOOLS: Add support for linking with SDL 2.0 in create_project

This is handled with the new command-line option, --sdl2

Changed paths:
    devtools/create_project/create_project.cpp



diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index e71816f..34d30e1 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -125,6 +125,7 @@ int main(int argc, char *argv[]) {
 
 	ProjectType projectType = kProjectNone;
 	int msvcVersion = 9;
+	bool useSDL2 = false;
 
 	// Parse command line arguments
 	using std::cout;
@@ -267,6 +268,8 @@ int main(int argc, char *argv[]) {
 			setup.devTools = true;
 		} else if (!std::strcmp(argv[i], "--tests")) {
 			setup.tests = true;
+		} else if (!std::strcmp(argv[i], "--sdl2")) {
+			useSDL2 = true;
 		} else {
 			std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n";
 			return -1;
@@ -335,7 +338,13 @@ int main(int argc, char *argv[]) {
 	// Windows only has support for the SDL backend, so we hardcode it here (along with winmm)
 	setup.defines.push_back("WIN32");
 	setup.defines.push_back("SDL_BACKEND");
-	setup.libraries.push_back("sdl");
+	if (!useSDL2) {
+		cout << "\nLinking to SDL 1.2\n\n";
+		setup.libraries.push_back("sdl");
+	} else {
+		cout << "\nLinking to SDL 2.0\n\n";
+		setup.libraries.push_back("sdl2");
+	}
 	setup.libraries.push_back("winmm");
 
 	// Add additional project-specific library
@@ -645,6 +654,9 @@ void displayHelp(const char *exe) {
 	        "Optional features settings:\n"
 	        " --enable-<name>          enable inclusion of the feature \"name\"\n"
 	        " --disable-<name>         disable inclusion of the feature \"name\"\n"
+			"\n"
+			"SDL settings:\n"
+			" --sdl2                   link to SDL 2.0, instead of SDL 1.2\n"
 	        "\n"
 	        " There are the following features available:\n"
 	        "\n";


Commit: 6cb0a4c1b0b2cb65ae8f3bfb122edead0e94f3fc
    https://github.com/scummvm/scummvm/commit/6cb0a4c1b0b2cb65ae8f3bfb122edead0e94f3fc
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-03-06T02:57:09+02:00

Commit Message:
SDL: Fix compilation with SDL 2.0 under MSVC

In SDL 2.0, intrin.h is now included in SDL_cpuinfo.h, which includes
setjmp.h. SDL_cpuinfo.h is included from SDL.h and SDL_syswm.h.
Thus, we remove the exceptions for setjmp and longjmp before these two
includes.

Changed paths:
    backends/platform/sdl/sdl-sys.h



diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h
index 5995232..67ad84e 100644
--- a/backends/platform/sdl/sdl-sys.h
+++ b/backends/platform/sdl/sdl-sys.h
@@ -60,6 +60,25 @@ typedef struct { int FAKE; } FAKE_FILE;
 #undef ARRAYSIZE
 #endif
 
+// HACK to fix compilation with SDL 2.0 in MSVC.
+// In SDL 2.0, intrin.h is now included in SDL_cpuinfo.h, which includes
+// setjmp.h. SDL_cpuinfo.h is included from SDL.h and SDL_syswm.h.
+// Thus, we remove the exceptions for setjmp and longjmp before these two
+// includes. Unfortunately, we can't use SDL_VERSION_ATLEAST here, as SDL.h
+// hasn't been included yet at this point.
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && defined(_MSC_VER)
+// We unset any fake definitions of setjmp/longjmp here
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
+#undef setjmp
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_longjmp
+#undef longjmp
+#endif
+
+#endif
+
 #if defined(__SYMBIAN32__)
 #include <esdl\SDL.h>
 #else
@@ -67,6 +86,22 @@ typedef struct { int FAKE; } FAKE_FILE;
 #endif
 
 #include <SDL_syswm.h>
+
+// Restore the forbidden exceptions from the hack above
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && defined(_MSC_VER)
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
+#undef setjmp
+#define setjmp(a)	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_longjmp
+#undef longjmp
+#define longjmp(a,b)	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#endif
+
 // SDL_syswm.h will include windows.h on Win32. We need to undefine its
 // ARRAYSIZE definition because we supply our own.
 #undef ARRAYSIZE






More information about the Scummvm-git-logs mailing list