1
0

premake5.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. --
  2. -- Requires: Premake 5 (https://premake.github.io/)
  3. -- Usage: premake5 --file=premake5.lua [project / makefile format, refer to premake5 --help] --target=[target from below]
  4. --
  5. -- target option
  6. tbl_target_values =
  7. {
  8. { "windows", "VS2015 projects targeting Windows 32/64 bits" },
  9. { "macosx", "Xcode4 projects targeting OS X" },
  10. }
  11. newoption
  12. {
  13. trigger = "target",
  14. description = "Build environment and target to generate projects for.",
  15. allowed = tbl_target_values
  16. }
  17. -- validation
  18. target_env = _OPTIONS["target"]
  19. if not target_env then
  20. print "Command-line option --target is required with one of the following values:"
  21. for _, v in ipairs(tbl_target_values) do
  22. print(v[1])
  23. end
  24. os.exit(1)
  25. end
  26. -- solution
  27. workspace "tinyxml2"
  28. tbl_platforms = {}
  29. if target_env == "windows" then
  30. tbl_platforms = {
  31. "x86",
  32. "x64",
  33. }
  34. elseif target_env == "macosx" then
  35. tbl_platforms = {
  36. "Universal64"
  37. }
  38. end
  39. platforms(tbl_platforms)
  40. tbl_configurations = {
  41. "Debug",
  42. "Release",
  43. }
  44. configurations(tbl_configurations)
  45. sln_location = ".projects/"..target_env
  46. location(sln_location)
  47. bin_location = ".artifacts/"..target_env
  48. obj_location = ".intermediate/"..target_env
  49. for _, p in ipairs(tbl_platforms) do
  50. for _, c in ipairs(tbl_configurations) do
  51. local pc = p.."-"..c
  52. filter{ "platforms:"..p, c }
  53. targetdir(bin_location.."/"..pc)
  54. libdirs(bin_location.."/"..pc)
  55. objdir(obj_location.."/"..pc)
  56. end
  57. end
  58. filter("not Release")
  59. optimize "Debug"
  60. symbols "On"
  61. filter{ "Release" }
  62. optimize "Full"
  63. filter{}
  64. -- projects
  65. project "tinyxml2"
  66. kind "staticlib"
  67. files {
  68. "tinyxml2.h",
  69. "tinyxml2.cpp"
  70. }
  71. project "xmltest"
  72. kind "consoleapp"
  73. links {
  74. "tinyxml2"
  75. }
  76. files {
  77. "xmltest.cpp"
  78. }