Skip to content

Commit

Permalink
FIx for DirectPInvoke on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
JCash committed Oct 14, 2024
1 parent 67427fa commit f51a653
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/src/main/java/com/defold/extender/Extender.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,11 +1078,24 @@ private List<File> buildExtensionInternal_CSharp(File manifest, Map<String, Obje
File sdkProject = new File(sdkCsdmSDKDir, "dmsdk.csproj");

Map<String, Object> context = createContext(manifestContext);

// Make sure the engine libraries isn't starting with "lib" (i.e. "libextension" -> "extension")
List<String> libs = (List<String>)context.get("engineLibs");
if (ExtenderUtil.isWindowsTarget(this.platform))
{
libs = new ArrayList<>();
for (String lib : (List<String>)context.get("engineLibs")) {
if (lib.startsWith("lib"))
lib = lib.substring(3);
libs.add(lib);
}
}

CSharpBuilder csBuilder = new CSharpBuilder(processExecutor, templateExecutor, context);
csBuilder.setSdkProject(sdkProject);
csBuilder.setSourceDirectory(extDir);
csBuilder.setOutputDirectory(new File(buildDirectory, extDir.getName()));
csBuilder.setEngineLibraries((List<String>)context.get("engineLibs"));
csBuilder.setEngineLibraries(libs);
csBuilder.setOutputFile(library);
csBuilder.setOutputName(name);
csBuilder.setPlatform(this.platform);
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/java/com/defold/extender/ExtenderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ public static boolean isWebTarget(String platform) {
platform.equals("js-web");
}

public static boolean isWindowsTarget(String platform) {
return platform.equals("x86_64-win32") ||
platform.equals("x86-win32");
}

@SuppressWarnings("unchecked")
public static <V> V get(Object object, String fieldName) {
Expand Down

0 comments on commit f51a653

Please sign in to comment.