WindowsPlatform: Visual Studio HashLink/C build

Currently required to run in Visual Studio Developer command prompt
This commit is contained in:
Josh Tynjala
2023-11-17 15:15:21 -08:00
parent c81591c887
commit 0a83f5c61f
2 changed files with 46 additions and 8 deletions

View File

@@ -98,8 +98,13 @@ class HashlinkHelper
{
switch Path.extension(file)
{
case "hash", "lib", "pdb", "ilk", "exp":
case "hash", "pdb", "ilk", "exp":
System.deleteFile(file);
case "lib":
if (platform != WINDOWS)
{
System.deleteFile(file);
}
default:
}
}

View File

@@ -297,6 +297,8 @@ class WindowsPlatform extends PlatformTarget
{
ProjectHelper.copyLibrary(project, ndll, "Windows" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project.debug,
targetSuffix);
ProjectHelper.copyLibrary(project, ndll, "Windows" + (is64 ? "64" : ""), "", ".lib", applicationDirectory, project.debug,
".lib");
}
else
{
@@ -335,7 +337,10 @@ class WindowsPlatform extends PlatformTarget
if (project.targetFlags.exists("hlc"))
{
var command = ["gcc", "-O3", "-o", executablePath, "-std=c11", "-Wl,-subsystem,windows", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c"), "C:/Windows/System32/dbghelp.dll"];
var command:Array<String> = null;
if (project.targetFlags.exists("gcc"))
{
command = ["gcc", "-O3", "-o", executablePath, "-std=c11", "-Wl,-subsystem,windows", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c"), "C:/Windows/System32/dbghelp.dll"];
for (file in System.readDirectory(applicationDirectory))
{
switch Path.extension(file)
@@ -346,9 +351,37 @@ class WindowsPlatform extends PlatformTarget
default:
}
}
}
else
{
command = ["cl.exe", "/Ox", "/Fe:" + executablePath, "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")];
for (file in System.readDirectory(applicationDirectory))
{
switch Path.extension(file)
{
case "lib":
// ensure the executable knows about every library
command.push(file);
default:
}
}
command.push("/link");
command.push("/subsystem:windows");
}
System.runCommand("", command.shift(), command);
}
for (file in System.readDirectory(applicationDirectory))
{
switch Path.extension(file)
{
case "lib":
// lib files required only for hlc compilation
System.deleteFile(file);
default:
}
}
var iconPath = Path.combine(applicationDirectory, "icon.ico");
if (IconHelper.createWindowsIcon(icons, iconPath) && System.hostPlatform == WINDOWS)