Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform detection on MinGW+Windows #65

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

Kriper1111
Copy link
Contributor

In the xmake config script, there is a platform check performed when the build system is MinGW.

UnityDoorstop/xmake.lua

Lines 49 to 57 in 5607be4

if is_plat("mingw") then
add_shflags("-nostdlib", "-nolibc", {force=true})
if is_arch("i386") then
add_shflags("-e _DllEntry", "-Wl,--enable-stdcall-fixup", {force=true})
elseif is_arch("x86_64") then
add_shflags("-e DllEntry", {force=true})
end
end

When running on my Windows machine under MinGW, neither branch is being taken and the library produced has no valid entrypoint.

Here's what xmake show tells on my machine:

> tools\xmake\xmake show
The information of xmake:
    version: 2.6.1+HEAD.666dc5479
    host: windows/x64
    programdir: E:\Coding\UnityDoorstop\tools\xmake
    programfile: E:\Coding\UnityDoorstop\tools\xmake\xmake.exe
    globaldir: C:\Users\%username%\AppData\Local\.xmake
    tmpdir: C:\Users\%username%\AppData\Local\Temp\.xmake\240817
    workingdir: E:\Coding\UnityDoorstop
    packagedir: C:\Users\%username%\AppData\Local\.xmake\packages
    packagedir(cache): C:\Users\%username%\AppData\Local\.xmake\cache\packages\2408

The information of project:
    plat: mingw
    arch: x64
    mode: release
    buildir: build
    configdir: E:\Coding\UnityDoorstop\.xmake\windows\x64
    projectdir: E:\Coding\UnityDoorstop
    projectfile: E:\Coding\UnityDoorstop\xmake.lua

The supplied fix fix for that changes the condition on line 54 to is_arch("x64", "x86_64"), as also suggested by xmake docs.

Considers both `x86_64` and `x64` as the 64 bit platform, allowing
xmake to set proper linker flags for mingw compiler and add the
entry point properly.
@ManlyMarco ManlyMarco merged commit 4b2d10a into NeighTools:master Jan 29, 2025
4 checks passed
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.

2 participants