From dca3b5926ffd2efc93f8bdce7fa818f9203bc685 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 5 Jun 2017 13:45:37 -0700 Subject: [PATCH] First pass at Windows64 builds (not enabled by default) (resolve #710) --- lime/tools/platforms/WindowsPlatform.hx | 40 +++++++++++++++++++------ project/src/backend/sdl/SDLWindow.cpp | 5 ++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx index 48f97f65b..f467f0f08 100644 --- a/lime/tools/platforms/WindowsPlatform.hx +++ b/lime/tools/platforms/WindowsPlatform.hx @@ -16,6 +16,7 @@ import lime.tools.helpers.NodeJSHelper; import lime.tools.helpers.PathHelper; import lime.tools.helpers.PlatformHelper; import lime.tools.helpers.ProcessHelper; +import lime.project.Architecture; import lime.project.Asset; import lime.project.AssetType; import lime.project.Haxelib; @@ -31,6 +32,7 @@ class WindowsPlatform extends PlatformTarget { private var applicationDirectory:String; private var executablePath:String; + private var is64:Bool; private var targetType:String; @@ -38,6 +40,16 @@ class WindowsPlatform extends PlatformTarget { super (command, _project, targetFlags); + for (architecture in project.architectures) { + + if (architecture == Architecture.X64) { + + is64 = true; + + } + + } + if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) { targetType = "neko"; @@ -56,7 +68,7 @@ class WindowsPlatform extends PlatformTarget { } - targetDirectory = project.app.path + "/windows/" + targetType + "/" + buildType; + targetDirectory = project.app.path + "/windows" + (is64 ? "64" : "") + "/" + targetType + "/" + buildType; applicationDirectory = targetDirectory + "/bin/"; executablePath = applicationDirectory + project.app.file + ".exe"; @@ -84,7 +96,7 @@ class WindowsPlatform extends PlatformTarget { for (ndll in project.ndlls) { - FileHelper.copyLibrary (project, ndll, "Windows", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug); + FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug); } @@ -115,7 +127,7 @@ class WindowsPlatform extends PlatformTarget { } NekoHelper.createWindowsExecutable (project.templatePaths, targetDirectory + "/obj/ApplicationMain.n", executablePath, iconPath); - NekoHelper.copyLibraries (project.templatePaths, "windows", applicationDirectory); + NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "nodejs") { @@ -123,8 +135,8 @@ class WindowsPlatform extends PlatformTarget { if (noOutput) return; - //NekoHelper.createExecutable (project.templatePaths, "windows", targetDirectory + "/obj/ApplicationMain.n", executablePath); - NekoHelper.copyLibraries (project.templatePaths, "windows", applicationDirectory); + //NekoHelper.createExecutable (project.templatePaths, "windows" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); + NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "cs") { @@ -143,7 +155,17 @@ class WindowsPlatform extends PlatformTarget { var haxeArgs = [ hxml ]; var flags = []; - flags.push ("-DHXCPP_M32"); + if (is64) { + + haxeArgs.push ("-D"); + haxeArgs.push ("HXCPP_M64"); + flags.push ("-DHXCPP_M64"); + + } else { + + flags.push ("-DHXCPP_M32"); + + } if (!project.environment.exists ("SHOW_CONSOLE")) { @@ -203,7 +225,7 @@ class WindowsPlatform extends PlatformTarget { public override function deploy ():Void { - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Windows"); + DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Windows" + (is64 ? "64" : "")); } @@ -229,7 +251,7 @@ class WindowsPlatform extends PlatformTarget { context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; context.CPP_DIR = targetDirectory + "/obj"; - context.BUILD_DIR = project.app.path + "/windows"; + context.BUILD_DIR = project.app.path + "/windows" + (is64 ? "64" : ""); return context; @@ -316,7 +338,7 @@ class WindowsPlatform extends PlatformTarget { if (ndll.path == null || ndll.path == "") { - context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "Windows", "lib", suffix, project.debug); + context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "Windows" + (is64 ? "64" : ""), "lib", suffix, project.debug); } diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index 3c16dc54e..0a2e9f4bb 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -134,7 +134,12 @@ namespace lime { if (SDL_GetWindowWMInfo (sdlWindow, &wminfo) == 1) { HWND hwnd = wminfo.info.win.window; + + #ifdef _WIN64 + ::SetClassLongPtr (hwnd, GCLP_HICON, reinterpret_cast(icon)); + #else ::SetClassLong (hwnd, GCL_HICON, reinterpret_cast(icon)); + #endif }