@@ -22,7 +22,7 @@ string getTargetArchitecture(bool isSimulator)
2222string getExtraCommand (string type)
2323{
2424 if (type == " simulator" ) return " -sdk iphonesimulator " ;
25- return " " ;
25+ return " -sdk iphoneos " ;
2626}
2727
2828
@@ -100,6 +100,7 @@ unittest
100100
101101private string getDestination ()
102102{
103+ // return "-destination 'generic/platform=iOS' ";
103104 return " -destination 'platform=iOS Simulator,name=" ~
104105 configs[" iosDevice" ].str ~
105106 " ,OS=" ~ configs[" iosVersions" ].array[0 ].integer.versionFromInt ~ " ' " ;
@@ -113,7 +114,21 @@ private string getIosTriple(string arch, bool isSimulator)
113114 return " arm64-apple-ios14.0-simulator" ;
114115 }
115116 return arch~ " -apple-ios14.0" ;
116-
117+ }
118+
119+ string getIosLibFolder (bool isSimulator)
120+ {
121+ version (X86_64 )
122+ {
123+ if (isSimulator)
124+ return " ios-x86_64" ;
125+ }
126+ else
127+ {
128+ if (isSimulator)
129+ return " ios-arm64-simulator" ;
130+ }
131+ return " ios-arm64" ;
117132}
118133ChoiceResult putInstalledDeviceInformation (ref Terminal t)
119134{
@@ -163,17 +178,16 @@ ChoiceResult putInstalledDeviceInformation(ref Terminal t)
163178 updateConfigFile();
164179
165180 return ChoiceResult.Continue;
166-
167-
168181}
169182
170183ChoiceResult prepareiOS (Choice* c, ref Terminal t, ref RealTimeConsoleInput input, in CompilationOptions cOpts)
171184{
172- string arch = getTargetArchitecture(TARGET_TYPE == " simulator" );
185+ bool isSimulator = TARGET_TYPE == " simulator" ;
186+ string arch = getTargetArchitecture(isSimulator);
173187 prepareAppleOSBase(c,t,input);
174188
175189 string out_extraLinkerFlags;
176- setupPerCompiler(t, " ldc2" , " ios- " ~ arch , out_extraLinkerFlags);
190+ setupPerCompiler(t, " ldc2" , getIosLibFolder(isSimulator) , out_extraLinkerFlags);
177191 injectLinkerFlagsOnXcode(t, input, out_extraLinkerFlags);
178192 if (! (" lastUser" in configs))
179193 {
@@ -197,7 +211,7 @@ ChoiceResult prepareiOS(Choice* c, ref Terminal t, ref RealTimeConsoleInput inpu
197211 cleanAppleOSLibFolder();
198212 ProjectDetails d;
199213 if (waitRedub(t, DubArguments().
200- command(" build" ).configuration(" ios" ).arch(getIosTriple(arch, TARGET_TYPE == " simulator " )).compiler(" ldc2" ).opts(cOpts),
214+ command(" build" ).configuration(" ios" ).arch(getIosTriple(arch, isSimulator )).compiler(" ldc2" ).opts(cOpts),
201215 d,
202216 getHipPath(" build" , " appleos" , XCodeDFolder, " libs" )) != 0 )
203217 {
@@ -213,15 +227,20 @@ ChoiceResult prepareiOS(Choice* c, ref Terminal t, ref RealTimeConsoleInput inpu
213227 clean ~
214228 " build CONFIGURATION_BUILD_DIR=\" bin\" " ~
215229 codeSignCommand ~ extraCommands ~
216- getDestination() ~
217- " && cd bin && HipremeEngine.app/Contents/iOS/HipremeEngine" )
218- );
230+ getDestination()
231+ ));
232+
233+ t.wait(spawnShell(
234+ " open -a Simulator && " ~
235+ " xcrun simctl install booted " ~ getHipPath(" build" , " appleos" , " bin" , " HipremeEngine.app" ) ~ " && " ~
236+ " xcrun simctl launch booted hipreme.HipremeEngine"
237+ ));
219238 }
220239 }
221240 if (configs[" firstiOSRun" ].boolean)
222241 {
223242 configs[" firstiOSRun" ] = false ;
224243 updateConfigFile();
225244 }
226- return ChoiceResult.Continue ;
245+ return ChoiceResult.None ;
227246}
0 commit comments