summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-02 10:15:30 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-02 14:11:00 (GMT)
commit1e55d19a900dae82947e18387cc695262b10ce26 (patch)
tree4ae56742430f399d7b68e5b411273830fc97b697
parentc1b98cacaf627481d13f974e3cd6653feabf41f7 (diff)
downloadswift-contrib-1e55d19a900dae82947e18387cc695262b10ce26.zip
swift-contrib-1e55d19a900dae82947e18387cc695262b10ce26.tar.bz2
Adding iPhone compilation
-rw-r--r--QA/UnitTest/SConscript2
-rw-r--r--SConstruct43
-rw-r--r--Swift/SConscript4
-rw-r--r--Swiften/Application/SConscript2
-rw-r--r--Swiften/EventLoop/SConscript2
-rw-r--r--Swiften/Examples/SConscript7
-rw-r--r--Swiften/History/SConscript3
-rw-r--r--Swiften/Network/SConscript16
-rw-r--r--Swiften/QA/ClientTest/SConscript2
9 files changed, 62 insertions, 19 deletions
diff --git a/QA/UnitTest/SConscript b/QA/UnitTest/SConscript
index 1cd92a3..a1d5a60 100644
--- a/QA/UnitTest/SConscript
+++ b/QA/UnitTest/SConscript
@@ -11,7 +11,7 @@ myenv.MergeFlags(env["SWIFTEN_FLAGS"])
myenv.MergeFlags(env["CPPUNIT_FLAGS"])
myenv.MergeFlags(env["LIBIDN_FLAGS"])
myenv.MergeFlags(env["BOOST_FLAGS"])
-myenv.MergeFlags(env["SQLITE_FLAGS"])
+myenv.MergeFlags(env.get("SQLITE_FLAGS", ""))
myenv.MergeFlags(env.get("LIBXML_FLAGS", ""))
myenv.MergeFlags(env.get("EXPAT_FLAGS", ""))
myenv.MergeFlags(env["ZLIB_FLAGS"])
diff --git a/SConstruct b/SConstruct
index d90b712..3e9b178 100644
--- a/SConstruct
+++ b/SConstruct
@@ -15,11 +15,12 @@ vars.Add(BoolVariable("debug", "Compile with debug information", "yes" if os.nam
vars.Add(BoolVariable("warnings", "Compile with warnings turned on",
"yes" if os.name != "nt" else "no"))
vars.Add(BoolVariable("max_jobs", "Build with maximum number of parallel jobs", "no"))
+vars.Add(EnumVariable("target", "Choose a target platform for compilation", "native", ["native", "iphone-simulator", "iphone-device"]))
if os.name != "nt" :
vars.Add(BoolVariable("coverage", "Compile with coverage information", "no"))
if os.name == "posix" :
vars.Add(BoolVariable("valgrind", "Run tests with valgrind", "no"))
-if os.name == "mac" :
+if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"):
vars.Add(BoolVariable("universal", "Create universal binaries", "no"))
if os.name == "nt" :
vars.Add(PathVariable("vcredist", "MSVC redistributable dir", "", PathVariable.PathAccept))
@@ -126,6 +127,34 @@ if env.get("valgrind", 0) :
if ARGUMENTS.get("SWIFT_INSTALLDIR", "") :
env["SWIFT_INSTALLDIR"] = Dir(ARGUMENTS["SWIFT_INSTALLDIR"]).abspath
+# cross-compiling
+target = env["target"]
+if target in ("iphone-device", "iphone-simulator"):
+ if target == "iphone-device":
+ sdkPart = "iPhoneOS"
+ env["CC"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1"
+ env["CXX"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1"
+ env["PATH"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/"
+ env["LD"] = env["CC"]
+# env["openssl"] = "3rdParty/openssl-0.9.8l-arm"
+ targetIncludesArch = "arm"
+
+ if target == "iphone-simulator":
+ sdkPart = "iPhoneSimulator"
+ env.Append(CCFLAGS = ["-arch", "i386"])
+ env.Append(LINKFLAGS = ["-arch", "i386"])
+ targetIncludesArch = "i686"
+
+ sdkVer = "3.0"
+ sdk = "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
+
+ env["FRAMEWORKS"] = ["CoreFoundation", "Foundation", "UIKit", "CoreGraphics"]
+ env.Append(LINKFLAGS = ["-L\"" + sdk + "/usr/lib\"", "-F\"" + sdk + "/System/Library/Frameworks\"", "-F\"" + sdk + "/System/Library/PrivateFrameworks\""])
+ env["CPPPATH"] = ["/Users/kismith/devel/swift/iPhone/Swiftly/swift/", "/Developer/Platforms/" + sdkPart + ".platform/Developer/usr/lib/gcc/" + targetIncludesArch + "-apple-darwin9/4.0.1/include/", sdk + "/usr/include", sdk + "/usr/include/c++/4.0.0/" + targetIncludesArch + "-apple-darwin9", sdk + "/usr/include/c++/4.0.0", "/Developer/Platforms/" + sdkPart + ".platform/Developer/usr/include/"]
+
+# end cross compiling stuff
+
+
conf_env = env.Clone()
Export("env")
@@ -326,12 +355,14 @@ elif env.get("bonjour", False) :
################################################################################
# Third-party modules
-SConscript(dirs = [
- "3rdParty/CppUnit",
+third_party_dirs = ["3rdParty/CppUnit",
"3rdParty/Boost",
- "3rdParty/LibIDN",
- "3rdParty/CAres",
- "3rdParty/SQLite"])
+ "3rdParty/LibIDN"]
+if env.get("target", 0) == "native":
+ third_party_dirs += ["3rdParty/CAres",
+ "3rdParty/SQLite"]
+
+SConscript(dirs=third_party_dirs)
# Checker
SConscript(dirs = ["QA/Checker"], test_only = True)
diff --git a/Swift/SConscript b/Swift/SConscript
index 32f9b64..1460091 100644
--- a/Swift/SConscript
+++ b/Swift/SConscript
@@ -10,4 +10,6 @@ if not GetOption("help") and not env.get("HAVE_OPENSSL", 0) :
env["SWIFT_VERSION"] = "0.9.9." + datetime.date.today().strftime("%Y%m%d")
SConscript("Controllers/SConscript")
-SConscript("QtUI/SConscript")
+
+if env["target"] == "native":
+ SConscript("QtUI/SConscript")
diff --git a/Swiften/Application/SConscript b/Swiften/Application/SConscript
index 7696bd7..78b3a34 100644
--- a/Swiften/Application/SConscript
+++ b/Swiften/Application/SConscript
@@ -5,7 +5,7 @@ sources = [
"ApplicationMessageDisplay.cpp",
]
-if swiften_env["PLATFORM"] == "darwin" :
+if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" :
sources += [
"MacOSX/MacOSXApplication.cpp",
"MacOSX/MacOSXApplicationMessageDisplay.mm",
diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript
index 93341a3..5d1c3cb 100644
--- a/Swiften/EventLoop/SConscript
+++ b/Swiften/EventLoop/SConscript
@@ -7,7 +7,7 @@ sources = [
"SimpleEventLoop.cpp",
]
-if swiften_env["PLATFORM"] == "darwin" :
+if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native":
sources += [
"Cocoa/CocoaEventLoop.mm",
"Cocoa/CocoaEvent.mm"
diff --git a/Swiften/Examples/SConscript b/Swiften/Examples/SConscript
index 4ab80c2..a4d5998 100644
--- a/Swiften/Examples/SConscript
+++ b/Swiften/Examples/SConscript
@@ -1,3 +1,8 @@
-SConscript(dirs = [
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+
+if myenv["target"] == "native":
+ SConscript(dirs = [
"SendMessage"
])
diff --git a/Swiften/History/SConscript b/Swiften/History/SConscript
index 328ce1c..bc80780 100644
--- a/Swiften/History/SConscript
+++ b/Swiften/History/SConscript
@@ -1,7 +1,8 @@
Import("swiften_env")
myenv = swiften_env.Clone()
-myenv.MergeFlags(swiften_env["SQLITE_FLAGS"])
+if myenv["target"] == "native":
+ myenv.MergeFlags(swiften_env["SQLITE_FLAGS"])
objects = myenv.StaticObject([
"HistoryManager.cpp",
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index 767eee2..937ab0c 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -2,9 +2,10 @@ Import("swiften_env")
myenv = swiften_env.Clone()
myenv.MergeFlags(myenv["LIBIDN_FLAGS"])
-myenv.MergeFlags(myenv["CARES_FLAGS"])
+if myenv["target"] == "native":
+ myenv.MergeFlags(myenv["CARES_FLAGS"])
-objects = myenv.StaticObject([
+sourceList = [
"BoostConnection.cpp",
"BoostConnectionFactory.cpp",
"BoostConnectionServer.cpp",
@@ -12,7 +13,7 @@ objects = myenv.StaticObject([
"BoostIOServiceThread.cpp",
"ConnectionFactory.cpp",
"ConnectionServer.cpp",
- "Connector.cpp",
+ "Connector.cpp",
"TimerFactory.cpp",
"DummyTimerFactory.cpp",
"BoostTimerFactory.cpp",
@@ -21,10 +22,13 @@ objects = myenv.StaticObject([
"DomainNameServiceQuery.cpp",
"PlatformDomainNameResolver.cpp",
"PlatformDomainNameServiceQuery.cpp",
- "CAresDomainNameResolver.cpp",
"StaticDomainNameResolver.cpp",
"HostAddress.cpp",
"Timer.cpp",
- "BoostTimer.cpp",
- ])
+ "BoostTimer.cpp"]
+if myenv["target"] == "native":
+ sourceList.append("CAresDomainNameResolver.cpp")
+
+
+objects = myenv.StaticObject(sourceList)
swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/QA/ClientTest/SConscript b/Swiften/QA/ClientTest/SConscript
index f22e89d..bc9cf95 100644
--- a/Swiften/QA/ClientTest/SConscript
+++ b/Swiften/QA/ClientTest/SConscript
@@ -8,7 +8,7 @@ if env["TEST"] :
myenv.MergeFlags(myenv["CPPUNIT_FLAGS"])
myenv.MergeFlags(myenv["LIBIDN_FLAGS"])
myenv.MergeFlags(myenv["BOOST_FLAGS"])
- myenv.MergeFlags(myenv["SQLITE_FLAGS"])
+ myenv.MergeFlags(myenv.get("SQLITE_FLAGS", ""))
myenv.MergeFlags(myenv["ZLIB_FLAGS"])
myenv.MergeFlags(myenv["OPENSSL_FLAGS"])
myenv.MergeFlags(myenv.get("LIBXML_FLAGS", ""))