summaryrefslogtreecommitdiffstats
path: root/autoconf/gcc.lua
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-08-15 20:24:20 +0200
committererorcun <erorcunerorcun@hotmail.com.tr>2021-08-16 14:20:40 +0200
commit4e40c6f2ed74776b1e46d368199e10c7dc18c7b8 (patch)
treed8e6c017db17e6f1f39540d66580078af0fea2bb /autoconf/gcc.lua
parentMerge pull request #1295 from erorcun/miami (diff)
downloadre3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar.gz
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar.bz2
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar.lz
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar.xz
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.tar.zst
re3-4e40c6f2ed74776b1e46d368199e10c7dc18c7b8.zip
Diffstat (limited to 'autoconf/gcc.lua')
-rw-r--r--autoconf/gcc.lua27
1 files changed, 27 insertions, 0 deletions
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