summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-04 19:38:28 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-18 19:11:40 (GMT)
commit36c2dbefc06607483eb0d309e3a9a4ad1f4f8f73 (patch)
treef5aa249062b3f65318ead9cb6891980688754d43
parentf51dbfa74459b07487a4f13bf037564ebb8cd506 (diff)
downloadswift-36c2dbefc06607483eb0d309e3a9a4ad1f4f8f73.zip
swift-36c2dbefc06607483eb0d309e3a9a4ad1f4f8f73.tar.bz2
Compile Lua as C++ to avoid setjmp/longjmp & exception conflicts.
-rw-r--r--3rdParty/Lua/SConscript4
-rwxr-xr-xBuildTools/Copyrighter.py2
-rw-r--r--Sluift/Lua/Value.cpp4
-rw-r--r--Sluift/SConscript4
-rw-r--r--Sluift/sluift.cpp6
-rw-r--r--Swiftob/LuaCommands.h3
-rw-r--r--Swiftob/SConscript2
-rw-r--r--Swiftob/linit.cpp (renamed from Swiftob/linit.c)0
8 files changed, 13 insertions, 12 deletions
diff --git a/3rdParty/Lua/SConscript b/3rdParty/Lua/SConscript
index 3baa2d8..68f4e36 100644
--- a/3rdParty/Lua/SConscript
+++ b/3rdParty/Lua/SConscript
@@ -30,6 +30,10 @@ if env.get("LUA_BUNDLED", False) :
if env["SCONS_STAGE"] == "build" :
myenv = env.Clone()
+ if env["PLATFORM"] == "win32" :
+ myenv.Append(CFLAGS = ["/TP"])
+ else :
+ myenv.Append(CFLAGS = ["-x", "c++"])
# Remove warn flags
myenv.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]])
diff --git a/BuildTools/Copyrighter.py b/BuildTools/Copyrighter.py
index ec6220e..589459d 100755
--- a/BuildTools/Copyrighter.py
+++ b/BuildTools/Copyrighter.py
@@ -136,7 +136,7 @@ elif sys.argv[1] == "check-all-copyrights" :
for (path, dirs, files) in os.walk(".") :
if "3rdParty" in path or ".sconf" in path or "Swift.app" in path :
continue
- for filename in [os.path.join(path, file) for file in files if (file.endswith(".cpp") or file.endswith(".h")) and not "ui_" in file and not "moc_" in file and not "qrc_" in file and not "BuildVersion.h" in file and not "Swiften.h" in file and not "swiften-config.h" in file] :
+ for filename in [os.path.join(path, file) for file in files if (file.endswith(".cpp") or file.endswith(".h")) and not "ui_" in file and not "moc_" in file and not "qrc_" in file and not "BuildVersion.h" in file and not "Swiften.h" in file and not "swiften-config.h" in file and not "linit.cpp" in file ] :
ok &= check_copyright(filename)
if not ok :
sys.exit(-1)
diff --git a/Sluift/Lua/Value.cpp b/Sluift/Lua/Value.cpp
index c03e633..3164ec6 100644
--- a/Sluift/Lua/Value.cpp
+++ b/Sluift/Lua/Value.cpp
@@ -6,9 +6,7 @@
#include "Value.h"
-extern "C" {
- #include <lualib.h>
-}
+#include <lualib.h>
#include <boost/variant/apply_visitor.hpp>
#include <Swiften/Base/foreach.h>
diff --git a/Sluift/SConscript b/Sluift/SConscript
index 19255f1..6897f6d 100644
--- a/Sluift/SConscript
+++ b/Sluift/SConscript
@@ -22,6 +22,10 @@ if env["SCONS_STAGE"] == "build" :
myenv.Append(CPPDEFINES = ["SLUIFT_BUILD_DLL"])
elif myenv["PLATFORM"] == "darwin" :
myenv["SHLIBSUFFIX"] = ".so"
+ if env["PLATFORM"] == "win32" :
+ myenv.Append(CFLAGS = ["/TP"])
+ else :
+ myenv.Append(CFLAGS = ["-x", "c++"])
myenv["SLUIFT_VERSION"] = Version.getBuildVersion("sluift")
def patchLua(env, target, source) :
diff --git a/Sluift/sluift.cpp b/Sluift/sluift.cpp
index 2ef5f9e..260c923 100644
--- a/Sluift/sluift.cpp
+++ b/Sluift/sluift.cpp
@@ -4,10 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-extern "C" {
- #include "sluift.h"
- #include <lauxlib.h>
-}
+#include "sluift.h"
+#include <lauxlib.h>
#include <iostream>
#include <string>
diff --git a/Swiftob/LuaCommands.h b/Swiftob/LuaCommands.h
index dc8e36e..f506a70 100644
--- a/Swiftob/LuaCommands.h
+++ b/Swiftob/LuaCommands.h
@@ -9,12 +9,9 @@
#include <string>
#include <vector>
-extern "C" {
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
-}
-
#include <boost/filesystem/fstream.hpp>
#include <boost/noncopyable.hpp>
#include "Swiften/Network/NetworkFactories.h"
diff --git a/Swiftob/SConscript b/Swiftob/SConscript
index 3928ff0..e955a22 100644
--- a/Swiftob/SConscript
+++ b/Swiftob/SConscript
@@ -14,7 +14,7 @@ if env["SCONS_STAGE"] == "build":
myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
myenv.MergeFlags(myenv.get("LUA_FLAGS", {}))
sources = [
- "linit.c", # This is horrible!
+ "linit.cpp",
"Swiftob.cpp",
"Users.cpp",
"Commands.cpp",
diff --git a/Swiftob/linit.c b/Swiftob/linit.cpp
index 13c5b09..13c5b09 100644
--- a/Swiftob/linit.c
+++ b/Swiftob/linit.cpp