Patch 3337372: Improved precompiled header support (Anders Ericsson)

This commit is contained in:
Jason Perkins 2011-10-25 18:06:53 -04:00
parent b7fac3f46e
commit ac6867c35b
4 changed files with 19 additions and 2 deletions

View File

@ -26,3 +26,7 @@ Makefile
*.project
*.tags
*.bbprojectsettings
Scratchpad.txt
Unix Worksheet.worksheet
project.bbprojectdata

View File

@ -35,6 +35,7 @@
* Patch 3367641: Remove warnings in Xcode 4
* Patch 3372345: Gmake action's PCHs don't work with Mingw (Martin Ridgers)
* Patch 3317329: Support vstudio CompileAs for mixed-language projects (xpol)
* Patch 3337372: Improved precompiled header support (Anders Ericsson)
-------

View File

@ -269,6 +269,18 @@
--
function cpp.pchconfig(cfg)
-- GCC needs the full path to the PCH, while Visual Studio needs
-- only the name (or rather, the name as specified in the #include
-- statement). Try to locate the PCH in the project.
local pchheader = cfg.pchheader
for _, incdir in ipairs(cfg.includedirs) do
local testname = path.join(incdir, cfg.pchheader)
if os.isfile(testname) then
pchheader = testname
break
end
end
if not cfg.flags.NoPCH and cfg.pchheader then
_p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))
_p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader)))

View File

@ -154,7 +154,7 @@
local function precompiled_header(cfg)
if not cfg.flags.NoPCH and cfg.pchheader then
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))
_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
else
_p(3,'<PrecompiledHeader></PrecompiledHeader>')
end