summaryrefslogtreecommitdiffstats
path: root/autoconf/clang.lua
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-19 10:47:03 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-19 10:47:03 +0200
commit136b25133d67e9765a954a576ea272c4a0185c52 (patch)
tree654021d86604d114e8d2bc34b5c535406541d04c /autoconf/clang.lua
parentdisable movies by default; update librw (diff)
parentAdd AUDIO_REVERB define (diff)
downloadre3-136b25133d67e9765a954a576ea272c4a0185c52.tar
re3-136b25133d67e9765a954a576ea272c4a0185c52.tar.gz
re3-136b25133d67e9765a954a576ea272c4a0185c52.tar.bz2
re3-136b25133d67e9765a954a576ea272c4a0185c52.tar.lz
re3-136b25133d67e9765a954a576ea272c4a0185c52.tar.xz
re3-136b25133d67e9765a954a576ea272c4a0185c52.tar.zst
re3-136b25133d67e9765a954a576ea272c4a0185c52.zip
Diffstat (limited to 'autoconf/clang.lua')
-rw-r--r--autoconf/clang.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/autoconf/clang.lua b/autoconf/clang.lua
new file mode 100644
index 00000000..fdb5f405
--- /dev/null
+++ b/autoconf/clang.lua
@@ -0,0 +1,27 @@
+---
+-- Autoconfiguration.
+-- Copyright (c) 2016 Blizzard Entertainment
+---
+local p = premake
+local clang = p.tools.clang
+
+function clang.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('clang "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then
+ return outFile
+ else
+ return nil
+ end
+end