test_gmake_cs.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --
  2. -- tests/test_gmake_cs.lua
  3. -- Automated test suite for GNU Make C/C++ project generation.
  4. -- Copyright (c) 2009 Jason Perkins and the Premake project
  5. --
  6. T.gmake_cs = { }
  7. --
  8. -- Configure a solution for testing
  9. --
  10. local sln, prj
  11. function T.gmake_cs.setup()
  12. _ACTION = "gmake"
  13. _OPTIONS.os = "linux"
  14. sln = solution "MySolution"
  15. configurations { "Debug", "Release" }
  16. platforms { "native" }
  17. prj = project "MyProject"
  18. language "C#"
  19. kind "ConsoleApp"
  20. end
  21. local function prepare()
  22. premake.bake.buildconfigs()
  23. end
  24. --
  25. -- Test configuration blocks
  26. --
  27. function T.gmake_cs.BasicCfgBlock()
  28. prepare()
  29. local cfg = premake.getconfig(prj, "Debug")
  30. premake.gmake_cs_config(cfg, premake.dotnet, {[cfg]={}})
  31. test.capture [[
  32. ifneq (,$(findstring debug,$(config)))
  33. TARGETDIR := .
  34. OBJDIR := obj/Debug
  35. DEPENDS :=
  36. REFERENCES :=
  37. FLAGS +=
  38. define PREBUILDCMDS
  39. endef
  40. define PRELINKCMDS
  41. endef
  42. define POSTBUILDCMDS
  43. endef
  44. endif
  45. ]]
  46. end
  47. function T.gmake_cs.OnBuildOptions()
  48. buildoptions { "/define:SYMBOL" }
  49. prepare()
  50. local cfg = premake.getconfig(prj, "Debug")
  51. premake.gmake_cs_config(cfg, premake.dotnet, {[cfg]={}})
  52. test.capture [[
  53. ifneq (,$(findstring debug,$(config)))
  54. TARGETDIR := .
  55. OBJDIR := obj/Debug
  56. DEPENDS :=
  57. REFERENCES :=
  58. FLAGS += /define:SYMBOL
  59. define PREBUILDCMDS
  60. endef
  61. define PRELINKCMDS
  62. endef
  63. define POSTBUILDCMDS
  64. endef
  65. endif
  66. ]]
  67. end