diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-08-16 18:07:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 18:07:03 +0200 |
commit | e73e965d5b1e29dec28642ecd905e591ee10b3b6 (patch) | |
tree | f1fbe809516d5e822c568d90f3719a4b8068061c /autoconf/clang.lua | |
parent | Merge branch 'master' into miami (diff) | |
parent | Auto-detect X11 dependency (diff) | |
download | re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar.gz re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar.bz2 re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar.lz re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar.xz re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.tar.zst re3-e73e965d5b1e29dec28642ecd905e591ee10b3b6.zip |
Diffstat (limited to 'autoconf/clang.lua')
-rw-r--r-- | autoconf/clang.lua | 27 |
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 |