Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gframe/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ project "YGOPro"
links { "IrrKlang" }
linkoptions{ IRRKLANG_LINK_RPATH }
end
if GLIBC_VERSION < ((2 << 16) | (34 << 8)) then -- glibc less than 2.34
links { "dl", "pthread" }
end
24 changes: 24 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,30 @@ if os.istarget("macosx") then
end
end

function getGlibcVersion()
local output = os.outputof("getconf GNU_LIBC_VERSION")
local major, minor, patch = output:match("glibc (%d+)%.(%d+)%.?(%d*)")

if major and minor then
major = tonumber(major)
minor = tonumber(minor)
patch = tonumber(patch) or 0
return (major << 16) | (minor << 8) | patch
end

return nil
Comment thread
mercury233 marked this conversation as resolved.
Outdated
end

GLIBC_VERSION=0
if os.ishost("linux") then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

istarget?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

istarget may not work, because there may not be getconf GNU_LIBC_VERSION on non-Linux OSes. WIndows / Mac generating Linux would still not call this method.

if Linux generating other OSes, this function still works.

GLIBC_VERSION = getGlibcVersion()
if GLIBC_VERSION>0 then
print("Detected glibc version: " .. string.format("%d.%d.%d", GLIBC_VERSION >> 16, (GLIBC_VERSION >> 8) & 0xFF, GLIBC_VERSION & 0xFF))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.34.0 is not actual version, it should be 2.34. btw I don't think it is necessary to print this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not interested in detailed format, and this is for debugging only, just as the Rosetta thing.

else
print("Could not detect glibc version, assuming it is sufficient.")
Comment thread
mercury233 marked this conversation as resolved.
Outdated
end
end

workspace "YGOPro"
location "build"
language "C++"
Expand Down