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

@@ -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,20 +337,51 @@ 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"];
for (file in System.readDirectory(applicationDirectory))
var command:Array<String> = null;
if (project.targetFlags.exists("gcc"))
{
switch Path.extension(file)
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))
{
case "dll", "hdll":
// ensure the executable knows about every library
command.push(file);
default:
switch Path.extension(file)
{
case "dll", "hdll":
// ensure the executable knows about every library
command.push(file);
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)