diff options
-rw-r--r-- | .hgignore | 4 | ||||
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | src/actions/make/make_cpp.lua | 14 | ||||
-rw-r--r-- | src/actions/vstudio/vs2010_vcxproj.lua | 2 |
4 files changed, 19 insertions, 2 deletions
@@ -26,3 +26,7 @@ Makefile *.project *.tags +*.bbprojectsettings +Scratchpad.txt +Unix Worksheet.worksheet +project.bbprojectdata
\ No newline at end of file diff --git a/CHANGES.txt b/CHANGES.txt index 4d4b23d..65ed451 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) ------- diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua index 2a4dc22..75d2ced 100644 --- a/src/actions/make/make_cpp.lua +++ b/src/actions/make/make_cpp.lua @@ -268,7 +268,19 @@ -- Precompiled header support -- - function cpp.pchconfig(cfg) + 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))) diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index d13b472..e2af121 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -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 |