-
Notifications
You must be signed in to change notification settings - Fork 645
premake: add glibc detect and add dl back #2823
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 0 | ||
| end | ||
|
|
||
| GLIBC_VERSION=0 | ||
| if os.ishost("linux") then | ||
| 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)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 insufficient.") | ||
| end | ||
| end | ||
|
|
||
| workspace "YGOPro" | ||
| location "build" | ||
| language "C++" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
istarget?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
istargetmay not work, because there may not begetconf GNU_LIBC_VERSIONon non-Linux OSes. WIndows / Mac generating Linux would still not call this method.if Linux generating other OSes, this function still works.