Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/actions/make/test_make_pch.lua')
-rw-r--r--tests/actions/make/test_make_pch.lua50
1 files changed, 27 insertions, 23 deletions
diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua
index c471e09..75d9d9d 100644
--- a/tests/actions/make/test_make_pch.lua
+++ b/tests/actions/make/test_make_pch.lua
@@ -7,7 +7,7 @@
T.make_pch = { }
local suite = T.make_pch
local _ = premake.make.cpp
-
+
--
-- Setup and teardown
@@ -17,24 +17,25 @@
function suite.setup()
sln, prj = test.createsolution()
end
-
+
local function prepare()
premake.bake.buildconfigs()
+ prj = premake.getconfig(prj)
cfg = premake.getconfig(prj, "Debug")
end
-
+
--
-- Configuration block tests
--
-
+
function suite.NoConfig_OnNoHeaderSet()
prepare()
_.pchconfig(cfg)
test.capture [[]]
end
-
+
function suite.NoConfig_OnHeaderAndNoPCHFlag()
pchheader "include/myproject.h"
flags { NoPCH }
@@ -50,13 +51,12 @@
_.pchconfig(cfg)
test.capture [[
PCH = include/myproject.h
- GCH = $(OBJDIR)/myproject.h.gch
- ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/myproject.h
+ GCH = $(OBJDIR)/$(notdir $(PCH)).gch
]]
end
---
+--
-- Build rule tests
--
@@ -68,13 +68,7 @@
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
-ifeq (posix,$(SHELLTYPE))
- -$(SILENT) cp $< $(OBJDIR)
-else
- $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
-endif
- $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<"
-endif
+ $(SILENT) $(CXX) -x c++-header $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
]]
end
@@ -87,13 +81,23 @@ endif
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
-ifeq (posix,$(SHELLTYPE))
- -$(SILENT) cp $< $(OBJDIR)
-else
- $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
-endif
- $(SILENT) $(CC) $(ALL_CFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<"
-endif
+ $(SILENT) $(CC) -x c-header $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
]]
end
-
+
+--
+-- Ensure that PCH is included on all files that use it.
+--
+
+ function suite.includesPCH_onUse()
+ pchheader "include/myproject.h"
+ files { "main.cpp" }
+ prepare()
+ _.fileRules(prj)
+ test.capture [[
+$(OBJDIR)/main.o: main.cpp
+ @echo $(notdir $<)
+ $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+ ]]
+ end
+