Use qmake to query Qt libexec directory to find moc. (#12870)

This commit is contained in:
Michael Cho 2024-10-12 11:23:12 -04:00 committed by GitHub
parent b54aefdaee
commit 14995fce18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,7 @@ end
function addlibfromstring(str) function addlibfromstring(str)
if (str==nil) then return end if (str==nil) then return end
for w in str:gmatch("%S+") do for w in str:gmatch("%S+") do
if string.starts(w,"-l")==true then if string.starts(w,"-l") then
links { links {
string.sub(w,3) string.sub(w,3)
} }
@ -27,7 +27,7 @@ end
function addoptionsfromstring(str) function addoptionsfromstring(str)
if (str==nil) then return end if (str==nil) then return end
for w in str:gmatch("%S+") do for w in str:gmatch("%S+") do
if string.starts(w,"-l")==false then if not string.starts(w,"-l") then
linkoptions { linkoptions {
w w
} }
@ -384,12 +384,16 @@ function qtdebuggerbuild()
if _OPTIONS["QT_HOME"]~=nil then if _OPTIONS["QT_HOME"]~=nil then
MOCTST = backtick(_OPTIONS["QT_HOME"] .. "/bin/moc --version 2>/dev/null") MOCTST = backtick(_OPTIONS["QT_HOME"] .. "/bin/moc --version 2>/dev/null")
if (MOCTST=='') then if (MOCTST=='') then
MOCTST = backtick(_OPTIONS["QT_HOME"] .. "/libexec/moc --version 2>/dev/null") local qt_host_libexecs = backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_HOST_LIBEXECS")
if (MOCTST=='') then if not string.starts(qt_host_libexecs,"/") then
qt_host_libexecs = _OPTIONS["QT_HOME"] .. "/libexec"
end
MOCTST = backtick(qt_host_libexecs .. "/moc --version 2>/dev/null")
if MOCTST=='' then
print("Qt's Meta Object Compiler (moc) wasn't found!") print("Qt's Meta Object Compiler (moc) wasn't found!")
os.exit(1) os.exit(1)
else else
MOC = _OPTIONS["QT_HOME"] .. "/libexec/moc" MOC = qt_host_libexecs .. "/moc"
end end
else else
MOC = _OPTIONS["QT_HOME"] .. "/bin/moc" MOC = _OPTIONS["QT_HOME"] .. "/bin/moc"
@ -399,7 +403,7 @@ function qtdebuggerbuild()
if (MOCTST=='') then if (MOCTST=='') then
MOCTST = backtick("which moc 2>/dev/null") MOCTST = backtick("which moc 2>/dev/null")
end end
if (MOCTST=='') then if MOCTST=='' then
print("Qt's Meta Object Compiler (moc) wasn't found!") print("Qt's Meta Object Compiler (moc) wasn't found!")
os.exit(1) os.exit(1)
end end