Skip to content

Commit

Permalink
Update Extender.java
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Oct 19, 2023
1 parent 165e29c commit add3bac
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions server/src/main/java/com/defold/extender/Extender.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,13 +552,35 @@ private List<String> getIncludeDirs(File extDir) {
return pruneNonExisting(includes);
}

private void emitSwiftHeaders(PodSpec pod, Map<String, Object> manifestContext, List<String> commands) throws IOException, InterruptedException, ExtenderException {
//"{{env.PLATFORMSDK_DIR}}/XcodeDefault{{env.XCODE_VERSION}}.xctoolchain/usr/lib/swift-{{env.SWIFT_VERSION}}/iphonesimulator"

private String getSwiftTargetFromPlatform(String platform) {
switch (platform) {
case "arm64-ios":
return "arm64-apple-ios11.0";
// return "arm-apple-darwin19"; // from build.yml
case "x86_64-ios":
return "x86_64-apple-darwin19"; // from build.yml
// return "x86_64-apple-ios11.0-simulator";
// return "arm64-apple-ios11.0-simulator";
case "osx":
case "x86-osx":
case "x86_64-osx":
return "x86_64-apple-darwin19";
case "arm64-osx":
return "arm-apple-darwin19";
default:
return null;
}
}

private void emitSwiftHeaders(PodSpec pod, Map<String, Object> manifestContext, List<String> commands) throws IOException, InterruptedException, ExtenderException {
File moduleMap = new File(pod.iosModuleMap);
File swiftModulePath = new File(pod.generatedDir, pod.moduleName + ".swiftmodule");
File objcHeaderPath = new File(pod.generatedDir, pod.moduleName + "-Swift.h");

final String target = getSwiftTargetFromPlatform(platform);
LOGGER.info("emitSwiftHeaders for platform " + platform + " -> " + target);

String cmd = "swiftc";

// Emit object file(s) (-c)
Expand Down Expand Up @@ -591,7 +613,7 @@ private void emitSwiftHeaders(PodSpec pod, Map<String, Object> manifestContext,

// Generate code for the given target <triple>, such as x86_64-apple-macos10.9
// cmd += " -target arm-apple-darwin19";
cmd += " -target arm64-apple-ios10.0";
cmd += " -target " + getSwiftTargetFromPlatform(platform);

// Enable the use of forward slash regular-expression literal syntax
// https://developer.apple.com/documentation/xcode/build-settings-reference#Enable-Bare-Slash-Regex-Literals
Expand Down Expand Up @@ -678,7 +700,7 @@ private void emitSwiftModule(PodSpec pod, Map<String, Object> manifestContext, L

// Generate code for the given target <triple>, such as x86_64-apple-macos10.9
// cmd += " -target arm-apple-darwin19";
cmd += " -target arm64-apple-ios10.0";
cmd += " -target " + getSwiftTargetFromPlatform(platform);

// Enable the use of forward slash regular-expression literal syntax
// https://developer.apple.com/documentation/xcode/build-settings-reference#Enable-Bare-Slash-Regex-Literals
Expand Down Expand Up @@ -769,7 +791,7 @@ private File addCompileFileSwiftStatic(PodSpec pod, int index, File src, Map<Str

// Generate code for the given target <triple>, such as x86_64-apple-macos10.9
// cmd += " -target arm-apple-darwin19";
cmd += " -target arm64-apple-ios10.0";
cmd += " -target " + getSwiftTargetFromPlatform(platform);

// Enable the use of forward slash regular-expression literal syntax
// https://developer.apple.com/documentation/xcode/build-settings-reference#Enable-Bare-Slash-Regex-Literals
Expand Down Expand Up @@ -1473,6 +1495,7 @@ private List<File> linkEngine(List<String> symbols, Map<String, Object> linkCont

for (String template : commands) {
String command = templateExecutor.execute(template, context);
LOGGER.info("LINK COMMAND " + command);

// WINE->clang transition pt2: Replace any redundant ".lib.lib"
command = command.replace(".lib.lib", ".lib").replace(".Lib.lib", ".lib").replace(".LIB.lib", ".lib");
Expand Down

0 comments on commit add3bac

Please sign in to comment.