Initial support for windows resource file.

This commit is contained in:
MAJigsaw77
2025-02-10 23:36:19 +02:00
parent d3aeb9f748
commit dcbee9d54a
2 changed files with 63 additions and 4 deletions

View File

@@ -0,0 +1,33 @@
#include "winres.h"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
VS_VERSION_INFO VERSIONINFO
FILEVERSION ::VERSION_NUMBER::
PRODUCTVERSION ::VERSION_NUMBER::
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "::APP_COMPANY::"
VALUE "FileDescription", "::APP_DESCRIPTION::"
VALUE "FileVersion", "::FILE_VERSION::"
VALUE "InternalName", "::APP_FILE::"
VALUE "LegalCopyright", "Copyright (C) ::COPYRIGHT_YEARS:: ::APP_COMPANY::"
VALUE "OriginalFilename", "::APP_FILE::"
VALUE "ProductName", "::APP_PACKAGE::"
VALUE "ProductVersion", "::FILE_VERSION::"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -549,8 +549,8 @@ class WindowsPlatform extends PlatformTarget
}
else
{
var haxeArgs = [hxml];
var flags = [];
var haxeArgs = [hxml, "-D", "resourceFile=ApplicationMain.rc"];
var flags = ["-DresourceFile=ApplicationMain.rc"];
if (is64)
{
@@ -679,6 +679,27 @@ class WindowsPlatform extends PlatformTarget
}
else
{
if (targetType == "cpp")
{
if (context.APP_DESCRIPTION == null || context.APP_DESCRIPTION == "")
{
context.APP_DESCRIPTION = project.meta.title;
}
var versionParts = project.meta.version.split(".");
if (versionParts.length == 3)
{
versionParts.push("0");
}
context.FILE_VERSION = versionParts.join(".");
context.VERSION_NUMBER = versionParts.join(",");
// TODO: Implement this properly.
context.COPYRIGHT_YEARS = Std.string(Date.now().getFullYear());
}
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js";
context.HL_FILE = targetDirectory + "/obj/ApplicationMain" + (project.defines.exists("hlc") ? ".c" : ".hl");
@@ -987,9 +1008,14 @@ class WindowsPlatform extends PlatformTarget
ProjectHelper.recursiveSmartCopyTemplate(project, "winrt/temp", targetDirectory + "/haxe/temp", context, false, true);
ProjectHelper.recursiveSmartCopyTemplate(project, "winrt/scripts", targetDirectory + "/scripts", context, true, true);
}
else if (targetType == "cpp" && project.targetFlags.exists("static"))
else if (targetType == "cpp")
{
ProjectHelper.recursiveSmartCopyTemplate(project, "cpp/static", targetDirectory + "/obj", context);
ProjectHelper.recursiveSmartCopyTemplate(project, "windows/resource", targetDirectory + "/obj", context);
if (project.targetFlags.exists("static"))
{
ProjectHelper.recursiveSmartCopyTemplate(project, "cpp/static", targetDirectory + "/obj", context);
}
}
/*if (IconHelper.createIcon (project.icons, 32, 32, Path.combine (applicationDirectory, "icon.png"))) {