Skip to content

Commit ac8bd66

Browse files
committed
Initial iOS build work
1 parent e5d99d1 commit ac8bd66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2268
-214
lines changed

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ set(CMAKE_CXX_EXTENSIONS OFF)
66
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "")
77
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
88

9-
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")
9+
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
10+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")
11+
endif()
12+
13+
if(CMAKE_SYSTEM_NAME MATCHES "iOS")
14+
set(CMAKE_OSX_DEPLOYMENT_TARGET "15" CACHE STRING "Minimum iOS deployment version")
15+
endif()
1016

1117
# CMake 3.22 changes cmake_dependent_option from doing `if(${CONDITION})` to actually evaulating
1218
# The cmake code `if(<condition>)` using cmake_language(EVAL). That's a breaking change that warns
@@ -22,7 +28,11 @@ include(FeatureSummary)
2228
include(MetalShaderSupport)
2329
include(VcpkgToolchain)
2430

25-
project(Plasma)
31+
if(APPLE)
32+
project(Plasma LANGUAGES C CXX Swift)
33+
else()
34+
project(Plasma LANGUAGES C CXX)
35+
endif()
2636

2737
# Set up Product Identification parameters
2838
set(PRODUCT_BRANCH_ID "1" CACHE STRING "Branch ID")
@@ -117,7 +127,9 @@ find_package(OpenSSL REQUIRED)
117127
find_package(Opus)
118128
find_package(PhysX REQUIRED)
119129
find_package(PNG REQUIRED)
120-
find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter Development)
130+
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
131+
find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter Development)
132+
endif()
121133
find_package(Speex)
122134
find_package(string_theory 3.4 REQUIRED)
123135
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set(VCPKG_TARGET_ARCHITECTURE arm64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE static)
4+
set(VCPKG_DISABLE_COMPILER_TRACKING TRUE)
5+
6+
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
7+
set(VCPKG_OSX_ARCHITECTURES arm64)
8+
set(VCPKG_OSX_DEPLOYMENT_TARGET "15")
9+
10+
# This is a terrible hack because meson seems to suck.
11+
if(PORT STREQUAL cairo)
12+
set(VCPKG_LIBRARY_LINKAGE dynamic)
13+
set(VCPKG_BUILD_TYPE release)
14+
endif()
15+
16+
if(PORT STREQUAL python3)
17+
set(VCPKG_CONFIGURE_MAKE_OPTIONS "LDFLAGS_NODIST=-rpath ${CURRENT_INSTALLED_DIR}/lib")
18+
endif()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set -e
2+
3+
mkdir -p "$CODESIGNING_FOLDER_PATH/python/lib"
4+
if [ "$EFFECTIVE_PLATFORM_NAME" = "-iphonesimulator" ]; then
5+
echo "Installing Python modules for iOS Simulator"
6+
rsync -au --delete "$PROJECT_DIR/arm64-iphoneos/lib/" "$CODESIGNING_FOLDER_PATH/python/lib/"
7+
else
8+
echo "Installing Python modules for iOS Device"
9+
rsync -au --delete "$PROJECT_DIR/arm64-iphoneos/lib/" "$CODESIGNING_FOLDER_PATH/python/lib/"
10+
fi
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*==LICENSE==*
2+
3+
CyanWorlds.com Engine - MMOG client, server and tools
4+
Copyright (C) 2011 Cyan Worlds, Inc.
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Additional permissions under GNU GPL version 3 section 7
20+
21+
If you modify this Program, or any covered work, by linking or
22+
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
23+
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
24+
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
25+
(or a modified version of those libraries),
26+
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
27+
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
28+
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
29+
licensors of this Program grant you additional
30+
permission to convey the resulting work. Corresponding Source for a
31+
non-source form of such a combination shall include the source code for
32+
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
33+
work.
34+
35+
You can contact Cyan Worlds, Inc. by email legal@cyan.com
36+
or by snail mail at:
37+
Cyan Worlds, Inc.
38+
14617 N Newport Hwy
39+
Mead, WA 99021
40+
41+
*==LICENSE==*/
42+
43+
import SwiftUI
44+
45+
struct LoginView: View {
46+
47+
@State var credentials = PLSLoginParameters()
48+
var client: PLSClient
49+
@Binding var isLoggedIn: Bool
50+
@State var showAlert: Bool = false
51+
@State var alertType: AlertTypes = .loggingIn
52+
@State var status = PLSServerStatus()
53+
@State var statusString = ""
54+
55+
enum AlertTypes {
56+
case loginFailed
57+
case loggingIn
58+
}
59+
60+
var body: some View {
61+
Form {
62+
Section {
63+
TextField("Username", text: $credentials.username)
64+
SecureField("Password", text: $credentials.password)
65+
Toggle("Remember Password", isOn: $credentials.rememberPassword)
66+
} header: {
67+
Text(statusString)
68+
} footer: {
69+
Button {
70+
credentials.makeCurrent()
71+
showAlert = true
72+
alertType = .loggingIn
73+
PLSLoginController.attemptLogin { result in
74+
if result != 0 {
75+
alertType = .loginFailed
76+
showAlert = true
77+
return
78+
}
79+
credentials.save()
80+
client.initializeClient()
81+
showAlert = false
82+
isLoggedIn = true
83+
}
84+
} label: {
85+
Text("Login")
86+
.frame(maxWidth: .infinity)
87+
}
88+
.buttonStyle(.borderedProminent)
89+
.padding(.top)
90+
}
91+
}
92+
.onAppear {
93+
credentials.load()
94+
status.load()
95+
}
96+
.onReceive(status.publisher(for: \.serverStatusString), perform: { output in
97+
statusString = output ?? ""
98+
})
99+
.alert(isPresented: $showAlert) {
100+
switch alertType {
101+
case .loginFailed:
102+
Alert(title: Text("Authentication Failed"), message: Text("Please try again."))
103+
case .loggingIn:
104+
Alert(title: Text("Logging in to URU. Please wait..."), dismissButton: nil)
105+
}
106+
}
107+
}
108+
}
109+
110+
#Preview {
111+
var client = PLSClient()
112+
113+
LoginView(client: client, isLoggedIn: .constant(true))
114+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*==LICENSE==*
2+
3+
CyanWorlds.com Engine - MMOG client, server and tools
4+
Copyright (C) 2011 Cyan Worlds, Inc.
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Additional permissions under GNU GPL version 3 section 7
20+
21+
If you modify this Program, or any covered work, by linking or
22+
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
23+
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
24+
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
25+
(or a modified version of those libraries),
26+
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
27+
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
28+
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
29+
licensors of this Program grant you additional
30+
permission to convey the resulting work. Corresponding Source for a
31+
non-source form of such a combination shall include the source code for
32+
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
33+
work.
34+
35+
You can contact Cyan Worlds, Inc. by email legal@cyan.com
36+
or by snail mail at:
37+
Cyan Worlds, Inc.
38+
14617 N Newport Hwy
39+
Mead, WA 99021
40+
41+
*==LICENSE==*/
42+
43+
#import <Foundation/Foundation.h>
44+
#import <Metal/Metal.h>
45+
#import <QuartzCore/QuartzCore.h>
46+
#import "PLSView.h"
47+
#import "../Mac-Cocoa/PLSServerStatus.h"
48+
#import "../Mac-Cocoa/PLSLoginController.h"
49+
50+
NS_ASSUME_NONNULL_BEGIN
51+
52+
@interface PLSClient : NSObject <CAMetalDisplayLinkDelegate, PLSViewDelegate>
53+
54+
@property PLSView *view;
55+
56+
- (void)startClient;
57+
- (void)initializeClient;
58+
59+
@end
60+
61+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)