From e0ecbeee39e605cf2ee06e3632f4931d03606ce7 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sun, 15 Aug 2021 21:24:20 +0300 Subject: Auto-detect X11 dependency --- autoconf/gcc.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 autoconf/gcc.lua (limited to 'autoconf/gcc.lua') diff --git a/autoconf/gcc.lua b/autoconf/gcc.lua new file mode 100644 index 00000000..34520139 --- /dev/null +++ b/autoconf/gcc.lua @@ -0,0 +1,27 @@ +--- +-- Autoconfiguration. +-- Copyright (c) 2016 Blizzard Entertainment +--- +local p = premake +local gcc = p.tools.gcc + +function gcc.try_compile(cfg, text, parameters) + -- write the text to a temporary file. + local cppFile = path.join(cfg.objdir, "temp.cpp") + if not io.writefile(cppFile, text) then + return nil + end + + if parameters == nil then + parameters = "" + end + + local outFile = path.join(cfg.objdir, "temp.out") + + -- compile that text file. + if os.execute('gcc "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then + return outFile + else + return nil + end +end -- cgit v1.2.3