diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-04-19 09:20:46 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-04-19 12:33:41 (GMT) |
commit | 32444b8b7cff886e79579891a82bf70aab6f207a (patch) | |
tree | f9d6f6f08ae766183ba29a06115142019d6213a0 | |
parent | 8ec81c322186e7ac0f053061ee61d5e371417efb (diff) | |
download | swift-contrib-32444b8b7cff886e79579891a82bf70aab6f207a.zip swift-contrib-32444b8b7cff886e79579891a82bf70aab6f207a.tar.bz2 |
Fixed OS X ProxyProvider compilation.
-rw-r--r-- | 3rdParty/Boost/SConscript | 6 | ||||
-rw-r--r-- | BuildTools/SCons/SConstruct | 4 | ||||
-rw-r--r-- | QA/UnitTest/SConscript | 3 | ||||
-rw-r--r-- | SwifTools/Application/SConscript | 7 | ||||
-rw-r--r-- | Swiften/Base/Platform.h | 4 | ||||
-rw-r--r-- | Swiften/Network/MacOSXProxyProvider.cpp | 55 | ||||
-rw-r--r-- | Swiften/Network/MacOSXProxyProvider.h | 5 | ||||
-rw-r--r-- | Swiften/Network/NullProxyProvider.cpp | 20 | ||||
-rw-r--r-- | Swiften/Network/NullProxyProvider.h | 19 | ||||
-rw-r--r-- | Swiften/Network/SConscript | 3 |
10 files changed, 92 insertions, 34 deletions
diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript index 562b1b0..fc53b45 100644 --- a/3rdParty/Boost/SConscript +++ b/3rdParty/Boost/SConscript @@ -90,7 +90,6 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/program_options/src/config_file.cpp", "src/libs/program_options/src/convert.cpp", "src/libs/program_options/src/options_description.cpp", - "src/libs/program_options/src/parsers.cpp", "src/libs/program_options/src/positional_options.cpp", "src/libs/program_options/src/split.cpp", "src/libs/program_options/src/program_options_utf8_codecvt_facet.cpp", @@ -98,6 +97,11 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/program_options/src/variables_map.cpp", "src/libs/program_options/src/winmain.cpp"] + if env["PLATFORM"] != "darwin" or env["target"] == "native" : + sources += [ + "src/libs/program_options/src/parsers.cpp", + ] + if env["PLATFORM"] != "win32" : sources += [ "src/libs/thread/src/pthread/once.cpp", diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index 7229a31..e808ddd 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -239,12 +239,12 @@ if target in ["iphone-device", "iphone-simulator", "xcode"] : # Hard code values env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin" if target == "iphone-device": - env["XCODE_ARCH_FLAGS"] = ["-arch", "armv6"] + env["XCODE_ARCH_FLAGS"] = ["-arch", "armv6", "-arch", "armv7"] sdkPart = "iPhoneOS" else : env["XCODE_ARCH_FLAGS"] = ["-arch", "i386"] sdkPart = "iPhoneSimulator" - sdkVer = "4.0" + sdkVer = "4.3" env["XCODE_SDKROOT"] = "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk" # Set the build flags diff --git a/QA/UnitTest/SConscript b/QA/UnitTest/SConscript index 3876919..e5923ce 100644 --- a/QA/UnitTest/SConscript +++ b/QA/UnitTest/SConscript @@ -27,7 +27,8 @@ if env["TEST"] : if env.get("HAVE_EXPAT") : myenv.Append(CPPDEFINES = ["HAVE_EXPAT"]) if env["TEST_CREATE_LIBRARIES"] : - myenv.StaticLibrary("Swift_UnitTests", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"]) + lib = myenv.StaticLibrary("Swift_UnitTests", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"]) + myenv.Program("checker", lib) else : checker = myenv.Program("checker", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"]) for i in ["HOME", "USERPROFILE", "APPDATA"]: diff --git a/SwifTools/Application/SConscript b/SwifTools/Application/SConscript index 0097bca..32924fc 100644 --- a/SwifTools/Application/SConscript +++ b/SwifTools/Application/SConscript @@ -21,6 +21,7 @@ else : objects = swiftools_env.StaticObject(sources) swiftools_env.Append(SWIFTOOLS_OBJECTS = [objects]) -env.Append(UNITTEST_SOURCES = [ - File("UnitTest/ApplicationPathProviderTest.cpp") - ]) +if swiftools_env["PLATFORM"] != "darwin" or swiftools_env["target"] == "native" : + env.Append(UNITTEST_SOURCES = [ + File("UnitTest/ApplicationPathProviderTest.cpp") + ]) diff --git a/Swiften/Base/Platform.h b/Swiften/Base/Platform.h index 6cdb667..395747c 100644 --- a/Swiften/Base/Platform.h +++ b/Swiften/Base/Platform.h @@ -25,6 +25,10 @@ #define SWIFTEN_PLATFORM_BEOS #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) #define SWIFTEN_PLATFORM_MACOSX +#include <TargetConditionals.h> +# if defined(TARGET_OS_IPHONE) +# define SWIFTEN_PLATFORM_IPHONE +# endif #elif defined(__IBMCPP__) || defined(_AIX) #define SWIFTEN_PLATFORM_AIX #elif defined(__amigaos__) diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp index babcc7f..cd994e1 100644 --- a/Swiften/Network/MacOSXProxyProvider.cpp +++ b/Swiften/Network/MacOSXProxyProvider.cpp @@ -4,35 +4,21 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +#include <Swiften/Base/Platform.h> +#include <Swiften/Network/MacOSXProxyProvider.h> + #include <stdio.h> #include <stdlib.h> #include <iostream> #include <utility> -#include "Swiften/Network/MacOSXProxyProvider.h" +#ifdef SWIFTEN_PLATFORM_IPHONE #include <SystemConfiguration/SystemConfiguration.h> +#endif -namespace Swift { - -MacOSXProxyProvider::MacOSXProxyProvider() -: ProxyProvider() -{ - CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL); - if(proxies != NULL) { - socksProxy = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort); - httpProxy = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort); - } -} - -HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const { - return httpProxy; -} -HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const { - return socksProxy; -} - -HostAddressPort MacOSXProxyProvider::getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) { +#ifndef SWIFTEN_PLATFORM_IPHONE +static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) { CFNumberRef numberValue = NULL; HostAddressPort ret = HostAddressPort(HostAddress(), 0); @@ -79,5 +65,32 @@ HostAddressPort MacOSXProxyProvider::getFromDictionary(CFDictionaryRef dict, CFS } return ret; } +#endif +namespace Swift { + +MacOSXProxyProvider::MacOSXProxyProvider() { +} + +HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const { + HostAddressPort result; +#ifndef SWIFTEN_PLATFORM_IPHONE + CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL); + if(proxies != NULL) { + result = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort); + } +#endif + return result; +} + +HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const { + HostAddressPort result; +#ifndef SWIFTEN_PLATFORM_IPHONE + CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL); + if(proxies != NULL) { + result = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort); + } +#endif + return result; +} } diff --git a/Swiften/Network/MacOSXProxyProvider.h b/Swiften/Network/MacOSXProxyProvider.h index 1cb001f..5e7ff8a 100644 --- a/Swiften/Network/MacOSXProxyProvider.h +++ b/Swiften/Network/MacOSXProxyProvider.h @@ -14,10 +14,5 @@ namespace Swift { MacOSXProxyProvider(); virtual HostAddressPort getHTTPConnectProxy() const; virtual HostAddressPort getSOCKS5Proxy() const; - - private: - HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey); - HostAddressPort socksProxy; - HostAddressPort httpProxy; }; } diff --git a/Swiften/Network/NullProxyProvider.cpp b/Swiften/Network/NullProxyProvider.cpp new file mode 100644 index 0000000..3b9d94d --- /dev/null +++ b/Swiften/Network/NullProxyProvider.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2011 Remko Tronçon + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include <Swiften/Network/NullProxyProvider.h> + +using namespace Swift; + +NullProxyProvider::NullProxyProvider() { +} + +HostAddressPort NullProxyProvider::getHTTPConnectProxy() const { + return HostAddressPort(); +} + +HostAddressPort NullProxyProvider::getSOCKS5Proxy() const { + return HostAddressPort(); +} diff --git a/Swiften/Network/NullProxyProvider.h b/Swiften/Network/NullProxyProvider.h new file mode 100644 index 0000000..544bea2 --- /dev/null +++ b/Swiften/Network/NullProxyProvider.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2011 Remko Tronçon + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Network/ProxyProvider.h> + +namespace Swift { + class NullProxyProvider : public ProxyProvider { + public: + NullProxyProvider(); + + virtual HostAddressPort getHTTPConnectProxy() const; + virtual HostAddressPort getSOCKS5Proxy() const; + }; +} diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript index ecfc66a..183d09c 100644 --- a/Swiften/Network/SConscript +++ b/Swiften/Network/SConscript @@ -37,7 +37,8 @@ sourceList = [ "BoostNetworkFactories.cpp", "Timer.cpp", "BoostTimer.cpp", - "ProxyProvider.cpp" + "ProxyProvider.cpp", + "NullProxyProvider.cpp" ] if myenv.get("HAVE_CARES", False) : |