mirror of
https://github.com/xenia-project/build-tools.git
synced 2024-11-23 03:29:45 +00:00
Force to c.
This commit is contained in:
parent
e28427bd7d
commit
8b40c477f7
@ -1,4 +1,5 @@
|
||||
include("scripts/build_paths.lua")
|
||||
include("scripts/force_compile_as_c.lua")
|
||||
include("scripts/force_compile_as_cc.lua")
|
||||
include("scripts/platform_files.lua")
|
||||
include("scripts/test_suite.lua")
|
||||
|
28
scripts/force_compile_as_c.lua
Normal file
28
scripts/force_compile_as_c.lua
Normal file
@ -0,0 +1,28 @@
|
||||
if premake.override then
|
||||
local forced_c_files = {}
|
||||
|
||||
-- Forces all of the given .c and .cc files to be compiled as if they were C.
|
||||
function force_compile_as_c(files)
|
||||
for _, val in ipairs(files) do
|
||||
for _, fname in ipairs(os.matchfiles(val)) do
|
||||
table.insert(forced_c_files, path.getabsolute(fname))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- for gmake
|
||||
premake.override(path, "iscfile", function(base, fname)
|
||||
if table.contains(forced_c_files, fname) then
|
||||
return true
|
||||
else
|
||||
return base(fname)
|
||||
end
|
||||
end)
|
||||
-- for msvc
|
||||
premake.override(premake.vstudio.vc2010, "additionalCompileOptions", function(base, cfg, condition)
|
||||
if cfg.abspath and table.contains(forced_c_files, cfg.abspath) then
|
||||
_p(3,'<CompileAs %s>CompileAsC</CompileAs>', condition)
|
||||
end
|
||||
return base(cfg, condition)
|
||||
end)
|
||||
end
|
Loading…
Reference in New Issue
Block a user