Skip to content

Commit ea343ce

Browse files
committed
+ ios podspec
1 parent f53e943 commit ea343ce

21 files changed

Lines changed: 1149 additions & 618 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
/packages
1010
/Test
1111
/back
12-
.vs
12+
.vs
13+
DemoProject/Bin
14+
ScriptEngine/Managed

DemoProject/Assets/Plugins/PureScript/ScriptEngine/ios.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Uncomment the next line to define a global platform for your project
2+
platform :ios, '10.1'
3+
# use_frameworks!
4+
# inhibit_all_warnings!
5+
use_modular_headers!
6+
target 'Unity-iPhone' do
7+
8+
# Pods for Unity-iPhone
9+
target 'Unity-iPhone Tests' do
10+
inherit! :search_paths
11+
# Pods for testing
12+
end
13+
14+
end
15+
16+
target 'UnityFramework' do
17+
18+
inherit! :search_paths
19+
pod 'PureScript', :path => '/Users/***/Documents/Project/PureScript/ScriptEngine'
20+
# Pods for UnityFramework
21+
22+
end
23+
24+
post_install do |installer|
25+
installer.pods_project.targets.each do |target|
26+
27+
target.build_configurations.each do |config|
28+
config.build_settings['ARCHS'] = 'arm64'
29+
end
30+
31+
end
32+
end

DemoProject/Assets/Scripts/Lancher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using PureScript;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.IO;
45
using System.Runtime.InteropServices;
56
using UnityEngine;
67

@@ -13,7 +14,7 @@ public class Lancher : MonoBehaviour
1314
// Start is called before the first frame update
1415
void Start()
1516
{
16-
BundleDir = @"F:\Project\UnityBind\PureScript\DemoProject"; // Application.dataPath.Replace("Assets", "Managed");
17+
BundleDir = Path.Combine(Application.streamingAssetsPath , "assembly");
1718
}
1819

1920
void OnGUI()

DemoProject/Assets/StreamingAssets.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DemoProject/EngineAdapter.csproj

Lines changed: 245 additions & 287 deletions
Large diffs are not rendered by default.

DemoProject/MonoTest/EngineTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public static void Main(string[] args)
2323

2424
static void StartTest()
2525
{
26-
//var ptr = ScriptEngine.GetFuncPointer();
27-
//MonoBind.InitBind(ptr);
26+
var ptr = ScriptEngine.GetFuncPointer();
27+
MonoBind.InitBind(ptr);
2828

29-
//DebugHelper.InitLog(true);
29+
DebugHelper.InitLog(true);
3030

3131
Debug.LogError(" ========223 中午 ==== +-*x&!@$#$()_+<>?{}|ff ~");
3232

DemoProject/PureScript.csproj

Lines changed: 245 additions & 287 deletions
Large diffs are not rendered by default.

ScriptEngine/PureScript.podspec

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
Pod::Spec.new do |spec|
3+
4+
spec.name = "PureScript"
5+
spec.version = "0.1.0"
6+
spec.summary = "ScriptEngine module of [PureScript]"
7+
spec.description = "ScriptEngine module of [PureScript]"
8+
9+
spec.homepage = "https://github.com/loonly/PureScript"
10+
spec.license = "MIT"
11+
spec.author = { "loonly" => "https://github.com/loonly/PureScript" }
12+
spec.platform = :ios, '10.1'
13+
14+
spec.source = { :git => "https://github.com/loonly/PureScript.git", :tag => "#{spec.version}" }
15+
16+
17+
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
18+
#
19+
# CocoaPods is smart about how it includes source code. For source files
20+
# giving a folder will include any swift, h, m, mm, c & cpp files.
21+
# For header files it will include any header in the folder.
22+
# Not including the public_header_files will make all headers public.
23+
#
24+
25+
spec.source_files = "generated/*.{h,m,c,cpp}","lib/include/**/*.h"
26+
#,"ScriptEngine.c","main/*.{h,m,c,cpp}", "custom/*.{h,m,c,cpp}"
27+
28+
#spec.exclude_files = "Classes/Exclude"
29+
30+
# spec.public_header_files = "Classes/**/*.h"
31+
32+
33+
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
34+
#
35+
# A list of resources included with the Pod. These are copied into the
36+
# target bundle with a build phase script. Anything else will be cleaned.
37+
# You can preserve files from being cleaned, please don't preserve
38+
# non-essential files like tests, examples and documentation.
39+
#
40+
41+
spec.resources = "Managed"
42+
#"Managed/*.{dll,aotdata,exe}"
43+
44+
#spec.resource_bundles = {'Managed' => ['Managed/*.{dll,aotdata,exe}']}
45+
46+
# spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
47+
48+
49+
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
50+
#
51+
# Link your library with frameworks, or libraries. Libraries do not include
52+
# the lib prefix of their name.
53+
#
54+
55+
# spec.framework = "SomeFramework"
56+
spec.frameworks = "GSS", "UIKit","Foundation"
57+
58+
# spec.library = "iconv"
59+
spec.libraries = "iconv", "z"
60+
#,"il2cpp","iPhone-lib"
61+
62+
spec.static_framework = true
63+
64+
root_path = File.dirname(__FILE__)
65+
flag_array = Array.new
66+
67+
flag_array.push("-L#{root_path}/lib")
68+
flag_array.push("-L#{root_path}/aot")
69+
70+
flag_array.push("-lObjC")
71+
flag_array.push("-force_load #{root_path}/lib/libmono-native-unified.a")
72+
flag_array.push("-force_load #{root_path}/lib/libScriptEngine.a")
73+
74+
libdir = Dir::open("lib")
75+
libdir.each do |f|
76+
if f.include?(".a")
77+
fname = f.sub(".a","").sub("lib","")
78+
flag_array.push(%Q[-l"#{fname}"])
79+
end
80+
end
81+
82+
aotdir = Dir::open("aot")
83+
aotdir.each do |f|
84+
if f.include?(".a")
85+
fname = f.sub(".a","").sub("lib","")
86+
flag_array.push(%Q[-l"#{fname}"])
87+
end
88+
end
89+
90+
flag_array.push(%Q[-l"iconv"])
91+
flag_array.push(%Q[-l"z"])
92+
93+
flag_array.push("$(inherited)")
94+
95+
spec.vendored_libraries = "lib/*.a", "aot/*.a"
96+
#spec.header_dir = "lib/include"
97+
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
98+
#
99+
# If your library depends on compiler flags you can set them in the xcconfig hash
100+
# where they will only apply to your library. If you depend on other Podspecs
101+
# you can include multiple dependencies to ensure it works.
102+
103+
# spec.requires_arc = true
104+
105+
spec.xcconfig = { "ENABLE_BITCODE" => "NO",
106+
"HEADER_SEARCH_PATHS" => ["${PODS_TARGET_SRCROOT}/lib/include","${PODS_ROOT}/../Libraries/libil2cpp/include"] ,
107+
"OTHER_LDFLAGS" => flag_array,
108+
"GCC_PREPROCESSOR_DEFINITIONS" => "RUNTIME_IOS=1",
109+
"LIBRARY_SEARCH_PATHS" => ["${PURESCRIPT_DIR}/lib","${PURESCRIPT_DIR}/aot"] #"${PODS_ROOT}/../Libraries"
110+
}
111+
# spec.dependency "JSONKit", "~> 1.4"
112+
113+
end

0 commit comments

Comments
 (0)