summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorntoskrnl <ntoskrnl11@yahoo.com>2012-07-29 15:55:26 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-02 14:20:14 (GMT)
commit87dfc47c9785f834e61eef4545c503071d1665fc (patch)
tree558c8c24c064a6f24cb5ee1fa0ab38e81e2aaadb
parentcbefea85d717bd599fa0559f091b051e904d9e2f (diff)
downloadpowder-87dfc47c9785f834e61eef4545c503071d1665fc.zip
powder-87dfc47c9785f834e61eef4545c503071d1665fc.tar.gz
Separate operating system and architecture preprocessor definitions
Conflicts: SConscript
-rw-r--r--SConscript22
-rw-r--r--src/Config.h8
-rw-r--r--src/Misc.cpp17
-rw-r--r--src/PowderToySDL.cpp4
-rw-r--r--src/bson/BSON.h2
5 files changed, 25 insertions, 28 deletions
diff --git a/SConscript b/SConscript
index 3173279..5c64985 100644
--- a/SConscript
+++ b/SConscript
@@ -26,9 +26,9 @@ def SetupSpawn( env ):
AddOption('--opengl-renderer',dest="opengl-renderer",action='store_true',default=False,help="Build with OpenGL renderer support. (requires --opengl)")
AddOption('--opengl',dest="opengl",action='store_true',default=False,help="Build with OpenGL interface support.")
AddOption('--win32',dest="win32",action='store_true',default=False,help="32bit Windows platform target.")
-AddOption('--lin32',dest="lin32",action='store_true',default=False,help="32bit Linux platform target")
-AddOption('--lin64',dest="lin64",action='store_true',default=False,help="64bit Linux platform target")
+AddOption('--lin',dest="lin",action='store_true',default=False,help="Linux platform target")
AddOption('--macosx',dest="macosx",action='store_true',default=False,help="Mac OS X platform target")
+AddOption('--64bit',dest="_64bit",action='store_true',default=False,help="64-bit platform target (Linux only at the moment)")
AddOption('--static',dest="static",action="store_true",default=False,help="Static linking, reduces external library dependancies but increased file size")
AddOption('--pthreadw32-static',dest="ptw32-static",action="store_true",default=False,help="Use PTW32_STATIC_LIB for pthreadw32 headers")
AddOption('--release',dest="release",action='store_true',default=False,help="Enable optimisations (Will slow down compiling)")
@@ -47,7 +47,7 @@ AddOption('--minor-version',dest="minor-version",default=False,help="Minor versi
AddOption('--build-number',dest="build-number",default=False,help="Build number.")
AddOption('--snapshot',dest="snapshot",default=False,help="Snapshot build.")
-if((not GetOption('lin32')) and (not GetOption('lin64')) and (not GetOption('win32')) and (not GetOption('macosx'))):
+if((not GetOption('lin')) and (not GetOption('win32')) and (not GetOption('macosx'))):
print "You must specify a platform to target"
raise SystemExit(1)
@@ -114,17 +114,17 @@ if(GetOption('win32')):
env.Append(LIBS=['winmm', 'gdi32'])
env.Append(CPPDEFINES=["WIN32"])
env.Append(LINKFLAGS=['-mwindows'])
-if(GetOption('lin32') or GetOption('lin64')):
+if(GetOption('lin'):
openGLLibs = ['GL']
env.Append(LIBS=['X11', 'rt'])
- if GetOption('lin32'):
+ env.Append(CPPDEFINES=["LIN"])
+ if GetOption('_64bit'):
+ env.Append(CPPDEFINES=["_64BIT"])
+ env.Append(LINKFAGS=['-m64'])
+ env.Append(CCFLAGS=['-m64'])
+ else:
env.Append(LINKFLAGS=['-m32'])
env.Append(CCFLAGS=['-m32'])
- env.Append(CPPDEFINES=["LIN32"])
- else:
- env.Append(LINKFLAGS=['-m64'])
- env.Append(CCFLAGS=['-m64'])
- env.Append(CPPDEFINES=["LIN64"])
if(GetOption('beta')):
env.Append(CPPDEFINES='BETA')
@@ -190,7 +190,7 @@ programName = "powder"
if(GetOption('win32')):
programName = "Powder"
-if(GetOption('lin64')):
+if(GetOption('_64bit')):
programName += "64"
if(not (GetOption('sse2') or GetOption('sse3'))):
diff --git a/src/Config.h b/src/Config.h
index ccca4b0..52e5ae8 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -48,11 +48,13 @@
#define IDENT_PLATFORM "WIN32"
#elif defined(MACOSX)
#define IDENT_PLATFORM "MACOSX"
-#elif defined(LIN32)
-#define IDENT_PLATFORM "LIN32"
-#elif defined(LIN64)
+#elif defined(LIN)
+#if defined(_64BIT)
#define IDENT_PLATFORM "LIN64"
#else
+#define IDENT_PLATFORM "LIN32"
+#endif
+#else
#define IDENT_PLATFORM "UNKNOWN"
#endif
diff --git a/src/Misc.cpp b/src/Misc.cpp
index 4451c4a..2c4f2e5 100644
--- a/src/Misc.cpp
+++ b/src/Misc.cpp
@@ -49,7 +49,7 @@ std::string URLEscape(std::string source)
return finalString;
}
-#if defined(USE_SDL) && (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
+#if defined(USE_SDL) && defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
#include <SDL/SDL_syswm.h>
SDL_SysWMinfo sdl_wminfo;
Atom XA_CLIPBOARD, XA_TARGETS;
@@ -395,7 +395,7 @@ void clipboard_push_text(char * text)
SetClipboardData(CF_TEXT, cbuffer);
CloseClipboard();
}
-#elif (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
+#elif defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
if (clipboard_text!=NULL) {
free(clipboard_text);
clipboard_text = NULL;
@@ -430,7 +430,7 @@ char * clipboard_pull_text()
return "";
}
}
-#elif (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
+#elif defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
printf("Not implemented: get text from clipboard\n");
#else
printf("Not implemented: get text from clipboard\n");
@@ -554,7 +554,7 @@ int register_extension()
if(currentfilename) free(currentfilename);
return returnval;
-#elif defined(LIN32) || defined(LIN64)
+#elif defined(LIN)
char *currentfilename = exe_name();
FILE *f;
char *mimedata =
@@ -663,17 +663,12 @@ void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255(0-360 for
void OpenURI(std::string uri) {
#ifdef WIN32
ShellExecute(0, "OPEN", uri.c_str(), NULL, NULL, 0);
-#elif MACOSX
+#elif defined(MACOSX)
char *cmd = (char*)malloc(7+uri.length());
strcpy(cmd, "open ");
strappend(cmd, (char*)uri.c_str());
system(cmd);
-#elif LIN32
- char *cmd = (char*)malloc(11+uri.length());
- strcpy(cmd, "xdg-open ");
- strappend(cmd, (char*)uri.c_str());
- system(cmd);
-#elif LIN64
+#elif defined(LIN)
char *cmd = (char*)malloc(11+uri.length());
strcpy(cmd, "xdg-open ");
strappend(cmd, (char*)uri.c_str());
diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp
index abfaaac..f9901c1 100644
--- a/src/PowderToySDL.cpp
+++ b/src/PowderToySDL.cpp
@@ -12,7 +12,7 @@
#include <string>
#include "Config.h"
#include "graphics/Graphics.h"
-#if defined(LIN32) || defined(LIN64)
+#if defined(LIN)
#include "icon.h"
#endif
@@ -105,7 +105,7 @@ SDL_Surface * SDLOpen()
HICON hIconBig = (HICON)LoadImage(reinterpret_cast<HMODULE>(&__ImageBase), MAKEINTRESOURCE(101), IMAGE_ICON, 32, 32, LR_SHARED);
SendMessage(WindowHandle, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall);
SendMessage(WindowHandle, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
-#elif defined(LIN32) || defined(LIN32)
+#elif defined(LIN)
SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 64, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
SDL_WM_SetIcon(icon, NULL);
#endif
diff --git a/src/bson/BSON.h b/src/bson/BSON.h
index 960eea1..ff3aa8a 100644
--- a/src/bson/BSON.h
+++ b/src/bson/BSON.h
@@ -28,7 +28,7 @@
#include <stdarg.h>
#include "Config.h"
-#if defined(LIN64) || defined(LIN32) || defined(USE_STDINT)
+#if defined(LIN) || defined(USE_STDINT)
#include <sys/types.h>
#include <stdint.h>
#else