Skip to content

Windows: improve path handling, x86 address space and build time - #935

Open
clang-clang-clang wants to merge 1 commit into
coronalabs:masterfrom
dianchu:fix-windows-misc
Open

Windows: improve path handling, x86 address space and build time#935
clang-clang-clang wants to merge 1 commit into
coronalabs:masterfrom
dianchu:fix-windows-misc

Conversation

@clang-clang-clang

Copy link
Copy Markdown
Contributor

This PR improves long/non-ASCII path handling for the Windows tools, allows Win32 apps to use addresses/memory above 2GB, and enables parallel compilation for Windows build.

Manifest, long path aware & code-page

A shared application manifest enables longPathAware and sets the process code page to UTF-8. The manifest currently apply for executables only, not the DLLs or libs.

Note: long paths can be enable through registry value in Windows 10, version 1607, and later, with App manifest of course. And the activeCodePage effect starting at Windows Version 1903 (May 2019 Update).

ASCII paths keep working as-is since ASCII is a subset of UTF-8. The code-page change mainly affects narrow-character entry points, such as the command-line arguments used by lua.exe and luac.exe, allowing their existing UTF-8 file handling to receive non-ASCII paths correctly.

Corona Simulator already handles paths as UTF-8/UTF-16, so the code-page setting does not change its existing path behavior. It still gets the long-path opt-in from the shared manifest.

Extended memory limit from 2GB to 4GB on 32-bit Apps

/LARGEADDRESSAWARE is enabled for the Win32 executables, including the App Template.

This is enabled by default for 64-bit compiler, so if Solar2D migrates to a 64-bit windows build in the future it will have no effect or can be removed.

Build in parallel

/MP is enabled across the Windows build chain. The old /Gm (Minimal Rebuild) setting in the luafilesystem_dll Debug configuration is disabled due to deprecated, and it is incompatible with /MP.

App Template

The App Template has the same manifest, compiler, and linker settings, so generated Windows apps are covered as well.

Test

Tested on Windows:

  • With registry value LongPathsEnabled=1, Corona Simulator loaded a file with a 255-character filename and an absolute path of about 335 characters. luac also processed the same long path. The same case failed with the old build.
  • With the system-wide "Beta: Use Unicode UTF-8 for worldwide language support" option disabled, non-ASCII Lua paths worked.
  • Dev env tool mt.exe exported xml from target exe shows longPathAware is true and activeCodePage is set to UTF-8.
  • dumpbin /headers confirmed target exe has "Application can handle large (>2GB) addresses" per comment https://discord.com/channels/721785436195782677/724637134115438714/1047633649438294167
  • The App Template was checked for those 3 configs
  • With the endless spawn Fishies sample, the old Win32 build terminated at about 1.4GB of memory usage shows at process-explorer, while the updated build reached about 3.7 GB.
  • On my i7 Oct-core machine, building the Corona Simulator solution took about 5m without /MP and 2m30s with /MP when rebuild. YMMV depending on CPU, RAM, disk, and build cache.

Any suggestions are welcome. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant