premake.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. project.name = "ode"
  2. -- We no longer support VC++ 6.0; too many incompatibilities
  3. if (options["target"] == "vs6") then
  4. error("Visual Studio 6 is no longer supported; please upgrade to Visual Studio 2005 C++ Express.")
  5. end
  6. -- Define the build configurations. You can also use the flags
  7. -- `--enable-shared-only` and `--enable-static-only` if you want to
  8. -- call these packages from within your own Premake-enabled project.
  9. if (options["enable-shared-only"]) then
  10. project.configs = { "DebugSingleDLL", "ReleaseSingleDLL", "DebugDoubleDLL", "ReleaseDoubleDLL" }
  11. elseif (options["enable-static-only"]) then
  12. project.configs = { "DebugSingleLib", "ReleaseSingleLib", "DebugDoubleLib", "ReleaseDoubleLib" }
  13. else
  14. project.configs = { "DebugSingleDLL", "ReleaseSingleDLL", "DebugSingleLib", "ReleaseSingleLib", "DebugDoubleDLL", "ReleaseDoubleDLL", "DebugDoubleLib", "ReleaseDoubleLib" }
  15. end
  16. -- Project options
  17. addoption("with-demos", "Builds the demo applications and DrawStuff library")
  18. addoption("with-tests", "Builds the unit test application")
  19. addoption("with-gimpact", "Use GIMPACT for trimesh collisions (experimental)")
  20. addoption("all-collis-libs", "Include sources of all collision libraries into the project")
  21. addoption("enable-static-only", "Only create static library (.lib) project configurations")
  22. addoption("enable-shared-only", "Only create dynamic library (.dll) project configurations")
  23. addoption("no-dif", "Exclude DIF (Dynamics Interchange Format) exports")
  24. addoption("no-trimesh", "Exclude trimesh collision geometry")
  25. addoption("no-alloca", "Use heap memory instead of the stack (experimental)")
  26. addoption("enable-ou", "Use TLS for global variables (experimental)")
  27. -- Output is placed in a directory named for the target toolset.
  28. project.path = options["target"]
  29. -- Set the output directories
  30. if (not options["enable-static-only"]) then
  31. project.config["DebugSingleDLL"].bindir = "../lib/DebugSingleDLL"
  32. project.config["DebugSingleDLL"].libdir = "../lib/DebugSingleDLL"
  33. project.config["ReleaseSingleDLL"].bindir = "../lib/ReleaseSingleDLL"
  34. project.config["ReleaseSingleDLL"].libdir = "../lib/ReleaseSingleDLL"
  35. project.config["DebugDoubleDLL"].bindir = "../lib/DebugDoubleDLL"
  36. project.config["DebugDoubleDLL"].libdir = "../lib/DebugDoubleDLL"
  37. project.config["ReleaseDoubleDLL"].bindir = "../lib/ReleaseDoubleDLL"
  38. project.config["ReleaseDoubleDLL"].libdir = "../lib/ReleaseDoubleDLL"
  39. end
  40. if (not options["enable-shared-only"]) then
  41. project.config["DebugSingleLib"].bindir = "../lib/DebugSingleLib"
  42. project.config["DebugSingleLib"].libdir = "../lib/DebugSingleLib"
  43. project.config["ReleaseSingleLib"].bindir = "../lib/ReleaseSingleLib"
  44. project.config["ReleaseSingleLib"].libdir = "../lib/ReleaseSingleLib"
  45. project.config["DebugDoubleLib"].bindir = "../lib/DebugDoubleLib"
  46. project.config["DebugDoubleLib"].libdir = "../lib/DebugDoubleLib"
  47. project.config["ReleaseDoubleLib"].bindir = "../lib/ReleaseDoubleLib"
  48. project.config["ReleaseDoubleLib"].libdir = "../lib/ReleaseDoubleLib"
  49. end
  50. -- Build packages
  51. if (options["with-demos"]) then
  52. dopackage("demos.lua")
  53. dopackage("drawstuff.lua")
  54. end
  55. if (options["with-tests"]) then
  56. dopackage("tests.lua")
  57. end
  58. dopackage("ode.lua")
  59. -- Remove all intermediate files
  60. function doclean(cmd, arg)
  61. docommand(cmd, arg)
  62. if (options["target"] == "") then
  63. os.remove("../ode/src/config.h")
  64. end
  65. os.rmdir("custom")
  66. os.rmdir("../lib/DebugSingleDLL")
  67. os.rmdir("../lib/DebugSingleLib")
  68. os.rmdir("../lib/ReleaseSingleDLL")
  69. os.rmdir("../lib/ReleaseSingleLib")
  70. os.rmdir("../lib/DebugDoubleDLL")
  71. os.rmdir("../lib/DebugDoubleLib")
  72. os.rmdir("../lib/ReleaseDoubleDLL")
  73. os.rmdir("../lib/ReleaseDoubleLib")
  74. os.rmdir("gnu/obj")
  75. os.rmdir("vs2002/obj")
  76. os.rmdir("vs2003/obj")
  77. os.rmdir("vs2005/obj")
  78. end
  79. -- Generate all toolsets in one go
  80. function domakeall(cmd, arg)
  81. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2002")
  82. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2003")
  83. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2005")
  84. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target gnu")
  85. end