mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-20 07:01:27 +02:00
Separate operating system and architecture preprocessor definitions
Conflicts: SConscript
This commit is contained in:
committed by
Simon Robertshaw
parent
cbefea85d7
commit
87dfc47c97
22
SConscript
22
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-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('--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('--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('--lin',dest="lin",action='store_true',default=False,help="Linux platform target")
|
||||||
AddOption('--lin64',dest="lin64",action='store_true',default=False,help="64bit Linux platform target")
|
|
||||||
AddOption('--macosx',dest="macosx",action='store_true',default=False,help="Mac OS X 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('--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('--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)")
|
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('--build-number',dest="build-number",default=False,help="Build number.")
|
||||||
AddOption('--snapshot',dest="snapshot",default=False,help="Snapshot build.")
|
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"
|
print "You must specify a platform to target"
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
@@ -114,17 +114,17 @@ if(GetOption('win32')):
|
|||||||
env.Append(LIBS=['winmm', 'gdi32'])
|
env.Append(LIBS=['winmm', 'gdi32'])
|
||||||
env.Append(CPPDEFINES=["WIN32"])
|
env.Append(CPPDEFINES=["WIN32"])
|
||||||
env.Append(LINKFLAGS=['-mwindows'])
|
env.Append(LINKFLAGS=['-mwindows'])
|
||||||
if(GetOption('lin32') or GetOption('lin64')):
|
if(GetOption('lin'):
|
||||||
openGLLibs = ['GL']
|
openGLLibs = ['GL']
|
||||||
env.Append(LIBS=['X11', 'rt'])
|
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(LINKFLAGS=['-m32'])
|
||||||
env.Append(CCFLAGS=['-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')):
|
if(GetOption('beta')):
|
||||||
env.Append(CPPDEFINES='BETA')
|
env.Append(CPPDEFINES='BETA')
|
||||||
@@ -190,7 +190,7 @@ programName = "powder"
|
|||||||
if(GetOption('win32')):
|
if(GetOption('win32')):
|
||||||
programName = "Powder"
|
programName = "Powder"
|
||||||
|
|
||||||
if(GetOption('lin64')):
|
if(GetOption('_64bit')):
|
||||||
programName += "64"
|
programName += "64"
|
||||||
|
|
||||||
if(not (GetOption('sse2') or GetOption('sse3'))):
|
if(not (GetOption('sse2') or GetOption('sse3'))):
|
||||||
|
@@ -48,11 +48,13 @@
|
|||||||
#define IDENT_PLATFORM "WIN32"
|
#define IDENT_PLATFORM "WIN32"
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
#define IDENT_PLATFORM "MACOSX"
|
#define IDENT_PLATFORM "MACOSX"
|
||||||
#elif defined(LIN32)
|
#elif defined(LIN)
|
||||||
#define IDENT_PLATFORM "LIN32"
|
#if defined(_64BIT)
|
||||||
#elif defined(LIN64)
|
|
||||||
#define IDENT_PLATFORM "LIN64"
|
#define IDENT_PLATFORM "LIN64"
|
||||||
#else
|
#else
|
||||||
|
#define IDENT_PLATFORM "LIN32"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#define IDENT_PLATFORM "UNKNOWN"
|
#define IDENT_PLATFORM "UNKNOWN"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
17
src/Misc.cpp
17
src/Misc.cpp
@@ -49,7 +49,7 @@ std::string URLEscape(std::string source)
|
|||||||
return finalString;
|
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>
|
#include <SDL/SDL_syswm.h>
|
||||||
SDL_SysWMinfo sdl_wminfo;
|
SDL_SysWMinfo sdl_wminfo;
|
||||||
Atom XA_CLIPBOARD, XA_TARGETS;
|
Atom XA_CLIPBOARD, XA_TARGETS;
|
||||||
@@ -395,7 +395,7 @@ void clipboard_push_text(char * text)
|
|||||||
SetClipboardData(CF_TEXT, cbuffer);
|
SetClipboardData(CF_TEXT, cbuffer);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
}
|
}
|
||||||
#elif (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
|
#elif defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
|
||||||
if (clipboard_text!=NULL) {
|
if (clipboard_text!=NULL) {
|
||||||
free(clipboard_text);
|
free(clipboard_text);
|
||||||
clipboard_text = NULL;
|
clipboard_text = NULL;
|
||||||
@@ -430,7 +430,7 @@ char * clipboard_pull_text()
|
|||||||
return "";
|
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");
|
printf("Not implemented: get text from clipboard\n");
|
||||||
#else
|
#else
|
||||||
printf("Not implemented: get text from clipboard\n");
|
printf("Not implemented: get text from clipboard\n");
|
||||||
@@ -554,7 +554,7 @@ int register_extension()
|
|||||||
if(currentfilename) free(currentfilename);
|
if(currentfilename) free(currentfilename);
|
||||||
|
|
||||||
return returnval;
|
return returnval;
|
||||||
#elif defined(LIN32) || defined(LIN64)
|
#elif defined(LIN)
|
||||||
char *currentfilename = exe_name();
|
char *currentfilename = exe_name();
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *mimedata =
|
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) {
|
void OpenURI(std::string uri) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ShellExecute(0, "OPEN", uri.c_str(), NULL, NULL, 0);
|
ShellExecute(0, "OPEN", uri.c_str(), NULL, NULL, 0);
|
||||||
#elif MACOSX
|
#elif defined(MACOSX)
|
||||||
char *cmd = (char*)malloc(7+uri.length());
|
char *cmd = (char*)malloc(7+uri.length());
|
||||||
strcpy(cmd, "open ");
|
strcpy(cmd, "open ");
|
||||||
strappend(cmd, (char*)uri.c_str());
|
strappend(cmd, (char*)uri.c_str());
|
||||||
system(cmd);
|
system(cmd);
|
||||||
#elif LIN32
|
#elif defined(LIN)
|
||||||
char *cmd = (char*)malloc(11+uri.length());
|
|
||||||
strcpy(cmd, "xdg-open ");
|
|
||||||
strappend(cmd, (char*)uri.c_str());
|
|
||||||
system(cmd);
|
|
||||||
#elif LIN64
|
|
||||||
char *cmd = (char*)malloc(11+uri.length());
|
char *cmd = (char*)malloc(11+uri.length());
|
||||||
strcpy(cmd, "xdg-open ");
|
strcpy(cmd, "xdg-open ");
|
||||||
strappend(cmd, (char*)uri.c_str());
|
strappend(cmd, (char*)uri.c_str());
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#if defined(LIN32) || defined(LIN64)
|
#if defined(LIN)
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ SDL_Surface * SDLOpen()
|
|||||||
HICON hIconBig = (HICON)LoadImage(reinterpret_cast<HMODULE>(&__ImageBase), MAKEINTRESOURCE(101), IMAGE_ICON, 32, 32, LR_SHARED);
|
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_SMALL, (LPARAM)hIconSmall);
|
||||||
SendMessage(WindowHandle, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
|
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_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 64, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
|
||||||
SDL_WM_SetIcon(icon, NULL);
|
SDL_WM_SetIcon(icon, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(LIN64) || defined(LIN32) || defined(USE_STDINT)
|
#if defined(LIN) || defined(USE_STDINT)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user