[216] | 1 | project.name = "ode" |
---|
| 2 | |
---|
| 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 | |
---|
| 7 | |
---|
| 8 | -- Define the build configurations. You can also use the flags |
---|
| 9 | -- `--enable-shared-only` and `--enable-static-only` if you want to |
---|
| 10 | -- call these packages from within your own Premake-enabled project. |
---|
| 11 | |
---|
| 12 | if (not options["enable-shared-only"] and not options["enable-static-only"]) then |
---|
| 13 | project.configs = { "DebugDLL", "ReleaseDLL", "DebugLib", "ReleaseLib" } |
---|
| 14 | end |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | -- Project options |
---|
| 18 | |
---|
| 19 | addoption("with-doubles", "Use double instead of float as base numeric type") |
---|
| 20 | addoption("with-demos", "Builds the demo applications and DrawStuff library") |
---|
| 21 | addoption("with-tests", "Builds the unit test application") |
---|
| 22 | addoption("with-gimpact", "Use GIMPACT for trimesh collisions (experimental)") |
---|
| 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 | |
---|
| 27 | |
---|
| 28 | -- If the `--usetargetpath` flag is specified, each set of generated files |
---|
| 29 | -- be placed in a directory named for the target toolset. This flag is |
---|
| 30 | -- used by the `--makeall` command (see below). |
---|
| 31 | |
---|
| 32 | if (options["usetargetpath"]) then |
---|
| 33 | project.path = options["target"] |
---|
| 34 | end |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | -- Set the output directories |
---|
| 38 | |
---|
| 39 | if (options["enable-shared-only"] or options["enable-static-only"]) then |
---|
| 40 | project.config["Debug"].bindir = "../lib/debug" |
---|
| 41 | project.config["Debug"].libdir = "../lib/debug" |
---|
| 42 | project.config["Release"].bindir = "../lib/release" |
---|
| 43 | project.config["Release"].bindir = "../lib/release" |
---|
| 44 | else |
---|
| 45 | project.config["DebugDLL"].bindir = "../lib/DebugDLL" |
---|
| 46 | project.config["DebugDLL"].libdir = "../lib/DebugDLL" |
---|
| 47 | project.config["ReleaseDLL"].bindir = "../lib/ReleaseDLL" |
---|
| 48 | project.config["ReleaseDLL"].libdir = "../lib/ReleaseDLL" |
---|
| 49 | project.config["DebugLib"].bindir = "../lib/DebugLib" |
---|
| 50 | project.config["DebugLib"].libdir = "../lib/DebugLib" |
---|
| 51 | project.config["ReleaseLib"].bindir = "../lib/ReleaseLib" |
---|
| 52 | project.config["ReleaseLib"].libdir = "../lib/ReleaseLib" |
---|
| 53 | end |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | -- Build packages |
---|
| 57 | |
---|
| 58 | dopackage("ode.lua") |
---|
| 59 | |
---|
| 60 | if (options["with-demos"]) then |
---|
| 61 | dopackage("drawstuff.lua") |
---|
| 62 | dopackage("demos.lua") |
---|
| 63 | end |
---|
| 64 | |
---|
| 65 | if (options["with-tests"]) then |
---|
| 66 | dopackage("tests.lua") |
---|
| 67 | end |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | -- Remove all intermediate files |
---|
| 71 | |
---|
| 72 | function doclean(cmd, arg) |
---|
| 73 | docommand(cmd, arg) |
---|
| 74 | if (options["target"] == "") then |
---|
| 75 | os.remove("../include/ode/config.h") |
---|
| 76 | end |
---|
| 77 | os.rmdir("custom") |
---|
| 78 | os.rmdir("../lib/debug") |
---|
| 79 | os.rmdir("../lib/release") |
---|
| 80 | os.rmdir("../lib/DebugDLL") |
---|
| 81 | os.rmdir("../lib/DebugLib") |
---|
| 82 | os.rmdir("../lib/ReleaseDLL") |
---|
| 83 | os.rmdir("../lib/ReleaseLib") |
---|
| 84 | os.rmdir("gnu/obj") |
---|
| 85 | os.rmdir("vs2002/obj") |
---|
| 86 | os.rmdir("vs2003/obj") |
---|
| 87 | os.rmdir("vs2005/obj") |
---|
| 88 | end |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | -- Generate all toolsets in one go |
---|
| 92 | |
---|
| 93 | function domakeall(cmd, arg) |
---|
| 94 | os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2002") |
---|
| 95 | os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2003") |
---|
| 96 | os.execute("premake --usetargetpath --with-demos --with-tests --clean --target vs2005") |
---|
| 97 | os.execute("premake --usetargetpath --with-demos --with-tests --clean --target gnu") |
---|
| 98 | end |
---|