premake.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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("enable-static-only", "Only create static library (.lib) project configurations")
  21. addoption("enable-shared-only", "Only create dynamic library (.dll) project configurations")
  22. addoption("no-dif", "Exclude DIF (Dynamics Interchange Format) exports")
  23. addoption("no-trimesh", "Exclude trimesh collision geometry")
  24. addoption("no-alloca", "Use heap memory instead of the stack (experimental)")
  25. addoption("enable-ou", "Use TLS for global variables (experimental)")
  26. -- Output is placed in a directory named for the target toolset.
  27. project.path = options["target"]
  28. -- Set the output directories
  29. if (not options["enable-static-only"]) then
  30. project.config["DebugSingleDLL"].bindir = "../lib/DebugSingleDLL"
  31. project.config["DebugSingleDLL"].libdir = "../lib/DebugSingleDLL"
  32. project.config["ReleaseSingleDLL"].bindir = "../lib/ReleaseSingleDLL"
  33. project.config["ReleaseSingleDLL"].libdir = "../lib/ReleaseSingleDLL"
  34. project.config["DebugDoubleDLL"].bindir = "../lib/DebugDoubleDLL"
  35. project.config["DebugDoubleDLL"].libdir = "../lib/DebugDoubleDLL"
  36. project.config["ReleaseDoubleDLL"].bindir = "../lib/ReleaseDoubleDLL"
  37. project.config["ReleaseDoubleDLL"].libdir = "../lib/ReleaseDoubleDLL"
  38. end
  39. if (not options["enable-shared-only"]) then
  40. project.config["DebugSingleLib"].bindir = "../lib/DebugSingleLib"
  41. project.config["DebugSingleLib"].libdir = "../lib/DebugSingleLib"
  42. project.config["ReleaseSingleLib"].bindir = "../lib/ReleaseSingleLib"
  43. project.config["ReleaseSingleLib"].libdir = "../lib/ReleaseSingleLib"
  44. project.config["DebugDoubleLib"].bindir = "../lib/DebugDoubleLib"
  45. project.config["DebugDoubleLib"].libdir = "../lib/DebugDoubleLib"
  46. project.config["ReleaseDoubleLib"].bindir = "../lib/ReleaseDoubleLib"
  47. project.config["ReleaseDoubleLib"].libdir = "../lib/ReleaseDoubleLib"
  48. end
  49. -- Build packages
  50. if (options["with-demos"]) then
  51. dopackage("demos.lua")
  52. dopackage("drawstuff.lua")
  53. end
  54. if (options["with-tests"]) then
  55. dopackage("tests.lua")
  56. end
  57. dopackage("ode.lua")
  58. -- Remove all intermediate files
  59. function doclean(cmd, arg)
  60. docommand(cmd, arg)
  61. if (options["target"] == "") then
  62. os.remove("../ode/src/config.h")
  63. end
  64. os.rmdir("custom")
  65. os.rmdir("../lib/DebugSingleDLL")
  66. os.rmdir("../lib/DebugSingleLib")
  67. os.rmdir("../lib/ReleaseSingleDLL")
  68. os.rmdir("../lib/ReleaseSingleLib")
  69. os.rmdir("../lib/DebugDoubleDLL")
  70. os.rmdir("../lib/DebugDoubleLib")
  71. os.rmdir("../lib/ReleaseDoubleDLL")
  72. os.rmdir("../lib/ReleaseDoubleLib")
  73. os.rmdir("gnu/obj")
  74. os.rmdir("vs2002/obj")
  75. os.rmdir("vs2003/obj")
  76. os.rmdir("vs2005/obj")
  77. end
  78. -- Generate all toolsets in one go
  79. function domakeall(cmd, arg)
  80. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2002")
  81. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2003")
  82. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2005")
  83. os.execute("premake --usetargetpath --with-demos --with-tests --clean --target gnu")
  84. end