Skip to content

Commit

Permalink
iOS: initial release of iFreeRDP
Browse files Browse the repository at this point in the history
This is the initial release of iFreeRDP the FreeRDP iOS client.
Build instructions can be found in docs/README.ios.
  • Loading branch information
bmiklautz committed Feb 14, 2013
1 parent e168da4 commit e5cf8ff
Show file tree
Hide file tree
Showing 183 changed files with 18,818 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CPackConfig.cmake
CPackSourceConfig.cmake
DartConfiguration.tcl
_CPack_Packages
external/*
!external/README

# Packages
*.zip
Expand Down
57 changes: 32 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,27 @@ else()
endif()

# Allow to search the host machine for git
if(ANDROID)
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, BOTH)
endif(ANDROID)
endif(ANDROID OR IOS)
include(GetGitRevisionDescription)
if(ANDROID)
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, ONLY)
endif(ANDROID)
endif(ANDROID OR IOS)

git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always)
message(STATUS "Git Revision ${GIT_REVISION}")

# Turn on solution folders (2.8.4+)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)


# Default to release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

if(NOT DEFINED BUILD_SHARED_LIBS)
if(ANDROID)
if(ANDROID OR IOS)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
Expand Down Expand Up @@ -167,6 +166,10 @@ if(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()

if(IOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isysroot ${CMAKE_IOS_SDK_ROOT}")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")

Expand All @@ -183,14 +186,21 @@ check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)

# Mac OS X
if(APPLE)
if(IS_DIRECTORY /opt/local/include)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
endif()
if(WITH_CLANG)
set(CMAKE_C_COMPILER "clang")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.4")
if(IOS)
if (NOT FREERDP_IOS_EXTERNAL_SSL_PATH)
message(STATUS "FREERDP_IOS_EXTERNAL_SSL_PATH not set! Required if openssl is not found in the iOS SDK (which usually isn't")
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_IOS_EXTERNAL_SSL_PATH})
else()
if(IS_DIRECTORY /opt/local/include)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.4")
endif()
if(WITH_CLANG)
set(CMAKE_C_COMPILER "clang")
endif()
endif()

# Android
Expand Down Expand Up @@ -272,6 +282,14 @@ endif()
if(APPLE)
set(DIRECTFB_FEATURE_TYPE "DISABLED")
set(FFMPEG_FEATURE_TYPE "OPTIONAL")
if(IOS)
set(X11_FEATURE_TYPE "DISABLED")
set(ALSA_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
set(CUPS_FEATURE_TYPE "DISABLED")
set(PCSC_FEATURE_TYPE "DISABLED")
set(GSTREAMER_FEATURE_TYPE "DISABLED")
endif()
endif()

if(ANDROID)
Expand All @@ -285,17 +303,6 @@ if(ANDROID)
set(GSTREAMER_FEATURE_TYPE "DISABLED")
endif()

if(IOS)
set(X11_FEATURE_TYPE "DISABLED")
set(DIRECTFB_FEATURE_TYPE "DISABLED")
set(ALSA_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
set(CUPS_FEATURE_TYPE "DISABLED")
set(PCSC_FEATURE_TYPE "DISABLED")
set(FFMPEG_FEATURE_TYPE "DISABLED")
set(GSTREAMER_FEATURE_TYPE "DISABLED")
endif()

find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION})
find_feature(DirectFB ${DIRECTFB_FEATURE_TYPE} ${DIRECTFB_FEATURE_PURPOSE} ${DIRECTFB_FEATURE_DESCRIPTION})

Expand Down
1 change: 0 additions & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
iOS
11 changes: 9 additions & 2 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ if(WITH_X11)
add_subdirectory(X11)
endif()

if(APPLE AND (NOT IOS))
add_subdirectory(Mac)
if(APPLE)
if(IOS)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/iOS")
message(STATUS "Adding iOS client")
add_subdirectory(iOS)
endif()
else()
add_subdirectory(Mac)
endif()
endif()

if(ANDROID)
Expand Down
7 changes: 7 additions & 0 deletions client/iOS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# XCode files
project.xcworkspace/
xcuserdata/
bin/
build/
project.pbxproj
!iFreeRDP.xcodeproj/
40 changes: 40 additions & 0 deletions client/iOS/Additions/OrderedDictionary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// OrderedDictionary.h
// OrderedDictionary
//
// Modified version (Added indexForKey/Value functions)
//
// Created by Matt Gallagher on 19/12/08.
// Copyright 2008 Matt Gallagher. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software. Permission is granted to anyone to
// use this software for any purpose, including commercial applications, and to
// alter it and redistribute it freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source
// distribution.
//

#import <Foundation/Foundation.h>

@interface OrderedDictionary : NSMutableDictionary
{
NSMutableDictionary *dictionary;
NSMutableArray *array;
}

- (void)insertObject:(id)anObject forKey:(id)aKey atIndex:(NSUInteger)anIndex;
- (id)keyAtIndex:(NSUInteger)anIndex;
- (NSUInteger)indexForValue:(id)value;
- (NSUInteger)indexForKey:(id)key;
- (NSEnumerator *)reverseKeyEnumerator;

@end
168 changes: 168 additions & 0 deletions client/iOS/Additions/OrderedDictionary.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
//
// OrderedDictionary.m
// OrderedDictionary
//
// Modified version (Added indexForKey/Value functions)
//
// Created by Matt Gallagher on 19/12/08.
// Copyright 2008 Matt Gallagher. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software. Permission is granted to anyone to
// use this software for any purpose, including commercial applications, and to
// alter it and redistribute it freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source
// distribution.
//

#import "OrderedDictionary.h"

NSString *DescriptionForObject(NSObject *object, id locale, NSUInteger indent)
{
NSString *objectString;
if ([object isKindOfClass:[NSString class]])
{
objectString = (NSString *)[[object retain] autorelease];
}
else if ([object respondsToSelector:@selector(descriptionWithLocale:indent:)])
{
objectString = [(NSDictionary *)object descriptionWithLocale:locale indent:indent];
}
else if ([object respondsToSelector:@selector(descriptionWithLocale:)])
{
objectString = [(NSSet *)object descriptionWithLocale:locale];
}
else
{
objectString = [object description];
}
return objectString;
}

@implementation OrderedDictionary

- (id)init
{
return [self initWithCapacity:0];
}

- (id)initWithCapacity:(NSUInteger)capacity
{
self = [super init];
if (self != nil)
{
dictionary = [[NSMutableDictionary alloc] initWithCapacity:capacity];
array = [[NSMutableArray alloc] initWithCapacity:capacity];
}
return self;
}

- (void)dealloc
{
[dictionary release];
[array release];
[super dealloc];
}

- (id)copy
{
return [self mutableCopy];
}

- (void)setObject:(id)anObject forKey:(id)aKey
{
if (![dictionary objectForKey:aKey])
{
[array addObject:aKey];
}
[dictionary setObject:anObject forKey:aKey];
}

- (void)removeObjectForKey:(id)aKey
{
[dictionary removeObjectForKey:aKey];
[array removeObject:aKey];
}

- (NSUInteger)count
{
return [dictionary count];
}

- (id)objectForKey:(id)aKey
{
return [dictionary objectForKey:aKey];
}

- (NSEnumerator *)keyEnumerator
{
return [array objectEnumerator];
}

- (NSEnumerator *)reverseKeyEnumerator
{
return [array reverseObjectEnumerator];
}

- (void)insertObject:(id)anObject forKey:(id)aKey atIndex:(NSUInteger)anIndex
{
if ([dictionary objectForKey:aKey])
{
[self removeObjectForKey:aKey];
}
[array insertObject:aKey atIndex:anIndex];
[dictionary setObject:anObject forKey:aKey];
}

- (id)keyAtIndex:(NSUInteger)anIndex
{
return [array objectAtIndex:anIndex];
}

- (NSUInteger)indexForKey:(id)key
{
return [array indexOfObject:key];
}

- (NSUInteger)indexForValue:(id)value
{
NSArray* keys = [self allKeysForObject:value];
if ([keys count] > 0)
{
return [self indexForKey:[keys objectAtIndex:0]];
}

return NSNotFound;
}

- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level
{
NSMutableString *indentString = [NSMutableString string];
NSUInteger i, count = level;
for (i = 0; i < count; i++)
{
[indentString appendFormat:@" "];
}

NSMutableString *description = [NSMutableString string];
[description appendFormat:@"%@{\n", indentString];
for (NSObject *key in self)
{
[description appendFormat:@"%@ %@ = %@;\n",
indentString,
DescriptionForObject(key, locale, level),
DescriptionForObject([self objectForKey:key], locale, level)];
}
[description appendFormat:@"%@}\n", indentString];
return description;
}

@end
30 changes: 30 additions & 0 deletions client/iOS/Additions/TSXAdditions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Additions to Cocoa touch classes
Copyright 2013 Thinstuff Technologies GmbH, Authors: Dorian Johnson, Martin Fleisz
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

#import <Foundation/Foundation.h>

@interface NSObject (TSXAdditions)
- (void)setValuesForKeyPathsWithDictionary:(NSDictionary *)keyedValues;
@end

#pragma mark -
@interface NSString (TSXAdditions)
+ (NSString*)stringWithUUID;
- (NSData*)dataFromHexString;
+ (NSString*)hexStringFromData:(const unsigned char *)data ofSize:(unsigned int)size withSeparator:(NSString *)sep afterNthChar:(int)sepnth;
@end

@interface NSDictionary (TSXAdditions)
- (id)mutableDeepCopy;
@end

@interface NSData (TSXAdditions)
- (NSString *)hexadecimalString;
- (NSString *)base64EncodedString;
@end
Loading

0 comments on commit e5cf8ff

Please sign in to comment.