From 1ba412d3bada6c0594559827c5d5bbad79b92a5a Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Tue, 2 Oct 2012 23:29:40 +0300 Subject: [PATCH 1/6] Add couple of missing header files needed by GCC 4.7. --- src/cat/LuaScriptInterface.cpp | 3 ++- src/simulation/StructProperty.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index fc00e246e..05b0c3f3b 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "Config.h" #include "Format.h" #include "LuaLuna.h" @@ -1703,4 +1704,4 @@ std::string LuaScriptInterface::FormatCommand(std::string command) LuaScriptInterface::~LuaScriptInterface() { delete legacy; -} \ No newline at end of file +} diff --git a/src/simulation/StructProperty.h b/src/simulation/StructProperty.h index 8debacad1..5c46c7ea3 100644 --- a/src/simulation/StructProperty.h +++ b/src/simulation/StructProperty.h @@ -10,6 +10,7 @@ #define The_Powder_Toy_StructProperty_h #include +#include struct StructProperty { From 0cd04ad8d94ec81fa2394a8c1d5040bed612af6c Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Tue, 2 Oct 2012 23:43:58 +0300 Subject: [PATCH 2/6] Fix a C spesific compiler flag to a C++ variant. --- SConscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SConscript b/SConscript index b65d02f1b..a09c3e41d 100644 --- a/SConscript +++ b/SConscript @@ -122,7 +122,7 @@ else: env.Append(LIBS=['z', 'bz2', 'fftw3f']) env.Append(CPPPATH=['src/', 'data/', 'generated/']) -env.Append(CCFLAGS=['-w', '-std=c99', '-fkeep-inline-functions']) +env.Append(CCFLAGS=['-w', '-std=c++98', '-fkeep-inline-functions']) env.Append(LIBS=['pthread', 'm']) env.Append(CPPDEFINES=["USE_SDL", "LUACONSOLE", "GRAVFFT", "_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"]) @@ -277,4 +277,4 @@ env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), "python generator.py tools $TARGETS $SOURCES") env.Decider('MD5') t=env.Program(target=programName, source=sources) -Default(t) \ No newline at end of file +Default(t) From c7ca6caf3087ab8927c98db645fa02d564f73a7e Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Wed, 3 Oct 2012 00:19:47 +0300 Subject: [PATCH 3/6] Use 'python2' instead of 'python'. --- SConscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SConscript b/SConscript index a09c3e41d..3073136a2 100644 --- a/SConscript +++ b/SConscript @@ -273,8 +273,8 @@ if(GetOption('win')): envCopy.Append(CCFLAGS=['-mincoming-stack-boundary=2']) sources+=envCopy.Object('src/simulation/Gravity.cpp') -env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob('src/simulation/elements/*.cpp'), "python generator.py elements $TARGETS $SOURCES") -env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), "python generator.py tools $TARGETS $SOURCES") +env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob('src/simulation/elements/*.cpp'), "python2 generator.py elements $TARGETS $SOURCES") +env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), "python2 generator.py tools $TARGETS $SOURCES") env.Decider('MD5') t=env.Program(target=programName, source=sources) Default(t) From ec413dd0571b664bcb38394b566643a80a5b9eaf Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Sat, 6 Oct 2012 19:52:48 +0300 Subject: [PATCH 4/6] Fix an error that prevents building on 64bit systems. --- src/pim/Machine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pim/Machine.cpp b/src/pim/Machine.cpp index aebe093c8..a954d31dc 100644 --- a/src/pim/Machine.cpp +++ b/src/pim/Machine.cpp @@ -424,20 +424,20 @@ namespace pim //Load value at base stack + offset into eax emit("8B 85"); //mov eax [ebp+ram+offset] - emit((int) (ram - argument.Integer)); + emit((intptr_t) (ram - argument.Integer)); //Store value in eax onto top of program stack emit("89 07"); //mov [edi], eax - emit((int) (ram)); + emit((intptr_t) (ram)); break; case Opcode::Store: //Load value on top of the program stack into eax emit("8B 07"); //mov eax [edi] - emit((int) (ram)); + emit((intptr_t) (ram)); //Load value in eax onto top of program stack emit("89 85"); //mov [ebp+ram+offset], eax - emit((int) (ram - argument.Integer)); + emit((intptr_t) (ram - argument.Integer)); emit("83 C7 04"); //add edi 4 break; @@ -634,4 +634,4 @@ namespace pim programCounter = entryPoint; Run(); } -} \ No newline at end of file +} From f3aa813b9887ccdc70becdaea4bff636ac96cc2e Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Sat, 6 Oct 2012 21:38:50 +0300 Subject: [PATCH 5/6] ElementClasses.cpp and ToolClasses.cpp need to be generated before being added to sources list. --- SConscript | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SConscript b/SConscript index 3073136a2..3f17bce4d 100644 --- a/SConscript +++ b/SConscript @@ -237,8 +237,6 @@ if(GetOption('win')): sources+=Glob("src/*/*.cpp") sources+=Glob("src/simulation/elements/*.cpp") sources+=Glob("src/simulation/tools/*.cpp") -sources+=Glob("generated/ToolClasses.cpp") -sources+=Glob("generated/ElementClasses.cpp") if(GetOption('win')): sources = filter(lambda source: str(source) != 'src/simulation/Gravity.cpp', sources) @@ -274,7 +272,11 @@ if(GetOption('win')): sources+=envCopy.Object('src/simulation/Gravity.cpp') env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob('src/simulation/elements/*.cpp'), "python2 generator.py elements $TARGETS $SOURCES") +sources+=Glob("generated/ElementClasses.cpp") + env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), "python2 generator.py tools $TARGETS $SOURCES") +sources+=Glob("generated/ToolClasses.cpp") + env.Decider('MD5') t=env.Program(target=programName, source=sources) Default(t) From b1d3ebacd29f1cd6bb09c9b204d6dae257413159 Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Sun, 7 Oct 2012 12:11:41 +0300 Subject: [PATCH 6/6] Windows doesn't have unistd.h, use only in unix platforms. --- src/cat/LuaScriptInterface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index 05b0c3f3b..5de7f46bd 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include "Config.h" #include "Format.h" #include "LuaLuna.h" @@ -40,6 +39,10 @@ #include "LuaSlider.h" #include "LuaProgressBar.h" +#ifdef __unix__ +#include +#endif + extern "C" { #ifdef WIN