1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

[iOS] remove everything related to server app

This commit is contained in:
Andrey Filipenkov 2022-07-26 16:09:30 +03:00
parent c6e51852d0
commit e61e283b75
20 changed files with 1 additions and 338 deletions

View File

@ -16,10 +16,6 @@ set(server_HEADERS
CVCMIServer.h
)
if(APPLE_IOS)
set(server_SRCS ${server_SRCS} ios/main.mm)
endif(APPLE_IOS)
assign_source_group(${server_SRCS} ${server_HEADERS})
if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
@ -36,8 +32,6 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
set(server_LIBS execinfo ${server_LIBS})
elseif(APPLE_IOS)
set(server_LIBS ${server_LIBS} "-framework UIKit")
endif()
target_link_libraries(vcmiserver PRIVATE ${server_LIBS} minizip::minizip)
@ -51,34 +45,11 @@ if(WIN32)
OUTPUT_NAME "VCMI_server"
PROJECT_LABEL "VCMI_server"
)
elseif(APPLE_IOS)
set(ENTITLEMENTS_OUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/VCMI.entitlements)
configure_file(ios/Entitlements.in ${ENTITLEMENTS_OUT_PATH} @ONLY)
set_target_properties(vcmiserver PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist"
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks"
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "$(CODE_SIGNING_ALLOWED_FOR_APPS)"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH}
)
# TODO: move to a common dir / add macro?
target_sources(vcmiserver PRIVATE ${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard)
set_source_files_properties(${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
target_sources(vcmiserver PRIVATE ios/Images.xcassets)
set_source_files_properties(ios/Images.xcassets PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()
vcmi_set_output_dir(vcmiserver "")
enable_pch(vcmiserver)
if(APPLE_IOS)
# TODO: move to a common dir / add macro?
add_custom_command(TARGET vcmiserver POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component core --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiserver>"
COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh
)
else()
if(NOT BUILD_SINGLE_APP)
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
endif()

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.@BUNDLE_IDENTIFIER_PREFIX@.vcmi</string>
</array>
</dict>
</plist>

View File

@ -1,121 +0,0 @@
{
"images" : [
{
"filename" : "Icon-App-20x20@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-App-20x20@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "Icon-App-29x29@1x.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "Icon-App-40x40@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-App-40x40@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "Icon-App-60x60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "Icon-App-60x60@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "Icon-App-20x20@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "Icon-App-20x20@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-App-29x29@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-App-40x40@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "Icon-App-40x40@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-App-76x76@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "Icon-App-76x76@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "Icon-App-83.5x83.5@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>VCMI server</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>

View File

@ -1,119 +0,0 @@
/*
* main_ios.mm, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#import <UIKit/UIKit.h>
#include "../Global.h"
#include "CVCMIServer.h"
#import "../lib/CIOSUtils.h"
@interface ViewController : UIViewController
@property (nonatomic, copy) NSArray<NSURL *> *dataDirsInDocuments;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
auto startServerButton = [UIButton buttonWithType:UIButtonTypeSystem];
[startServerButton setTitle:@"Start Server" forState:UIControlStateNormal];
[startServerButton addTarget:self action:@selector(startServer:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:startServerButton];
startServerButton.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[startServerButton.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[startServerButton.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor],
]];
auto fm = NSFileManager.defaultManager;
auto sharedGameDataUrl = sharedGameDataURL();
if (!sharedGameDataUrl || [fm fileExistsAtPath:sharedGameDataUrl.path])
return;
auto documentsURL = [fm URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nullptr];
auto dirEnumerator = [fm enumeratorAtURL:documentsURL includingPropertiesForKeys:@[NSURLNameKey] options:NSDirectoryEnumerationSkipsSubdirectoryDescendants errorHandler:nil];
auto dataDirs = [NSMutableArray<NSURL *> arrayWithCapacity:3];
for (NSURL *fileURL in dirEnumerator)
{
NSString *filename;
if (![fileURL getResourceValue:&filename forKey:NSURLNameKey error:nullptr])
continue;
if ([filename caseInsensitiveCompare:@"data"] == NSOrderedSame || [filename caseInsensitiveCompare:@"maps"] == NSOrderedSame || [filename caseInsensitiveCompare:@"mp3"] == NSOrderedSame)
[dataDirs addObject:fileURL];
}
if (dataDirs.count < 3)
return;
self.dataDirsInDocuments = dataDirs;
auto moveDataButton = [UIButton buttonWithType:UIButtonTypeSystem];
[moveDataButton setTitle:@"Move data to shared dir" forState:UIControlStateNormal];
[moveDataButton addTarget:self action:@selector(moveDataToSharedDir:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:moveDataButton];
moveDataButton.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[moveDataButton.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[moveDataButton.topAnchor constraintEqualToAnchor:startServerButton.bottomAnchor constant:10],
]];
}
- (void)startServer:(UIButton *)button
{
button.enabled = NO;
[NSThread detachNewThreadWithBlock:^{
NSThread.currentThread.name = @"CVCMIServer";
CVCMIServer::create();
dispatch_sync(dispatch_get_main_queue(), ^{
button.enabled = YES;
});
}];
}
- (void)moveDataToSharedDir:(UIButton *)button
{
[button removeFromSuperview];
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
auto fm = NSFileManager.defaultManager;
auto destinationURL = sharedGameDataURL();
[fm createDirectoryAtURL:destinationURL withIntermediateDirectories:YES attributes:nil error:nullptr];
for (NSURL *dirURL in self.dataDirsInDocuments)
[fm moveItemAtURL:dirURL toURL:[destinationURL URLByAppendingPathComponent:dirURL.lastPathComponent] error:nullptr];
});
}
@end
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.rootViewController = [ViewController new];
[self.window makeKeyAndVisible];
return YES;
}
@end
int main(int argc, char * argv[])
{
@autoreleasepool
{
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}