From 00a26ca1c2d3f753599d5608b18726996beeb4b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Mon, 16 Aug 2010 16:54:18 +0200
Subject: Some build system fixes.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 8cdd81a..8bb3bdd 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -169,11 +169,9 @@ if target in ("iphone-device", "iphone-simulator"):
    sdkVer = iOSVersion
    sdk = "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
 
-   env["FRAMEWORKS"] = ["CoreFoundation", "Foundation", "UIKit", "CoreGraphics"]
+   env.Append(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
+   env.Append(CPPFLAGS = ["-isysroot", sdk])
 
 
 conf_env = env.Clone()
@@ -408,6 +406,12 @@ elif env.get("bonjour", False) :
 		env["BONJOUR_FLAGS"]["LIBS"] = ["dnssd"]
 	bonjour_conf.Finish()
 
+# Cocoa
+if env["PLATFORM"] == "darwin" :
+	cocoa_conf = Configure(conf_env)
+	if cocoa_conf.CheckCHeader("Cocoa/Cocoa.h") :
+		env["HAVE_COCOA"] = True
+	cocoa_conf.Finish()
 
 ################################################################################
 # DocBook setup
diff --git a/Swiften/EventLoop/Cocoa/CocoaEvent.h b/Swiften/EventLoop/Cocoa/CocoaEvent.h
index b3c3661..bede7ff 100644
--- a/Swiften/EventLoop/Cocoa/CocoaEvent.h
+++ b/Swiften/EventLoop/Cocoa/CocoaEvent.h
@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <Cocoa/Cocoa.h>
+#include <Foundation/Foundation.h>
 
 namespace Swift {
 	class Event;
diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript
index 5d1c3cb..990b91b 100644
--- a/Swiften/EventLoop/SConscript
+++ b/Swiften/EventLoop/SConscript
@@ -7,11 +7,14 @@ sources = [
 		"SimpleEventLoop.cpp",
 	]
 
-if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native":
-	sources += [
-			"Cocoa/CocoaEventLoop.mm",
-			"Cocoa/CocoaEvent.mm"
-		]
-
 objects = swiften_env.StaticObject(sources)
 swiften_env.Append(SWIFTEN_OBJECTS = [objects])
+
+if swiften_env["PLATFORM"] == "darwin" :
+	myenv = swiften_env.Clone()
+	myenv.Append(CXXFLAGS = ["-fobjc-abi-version=2", "-fobjc-legacy-dispatch"])
+	objects = myenv.StaticObject([
+			"Cocoa/CocoaEventLoop.mm",
+			"Cocoa/CocoaEvent.mm"
+		])
+	swiften_env.Append(SWIFTEN_OBJECTS = [objects])
-- 
cgit v0.10.2-6-g49f6