1 | package.name = "ode" |
---|
2 | package.language = "c++" |
---|
3 | package.objdir = "obj/ode" |
---|
4 | |
---|
5 | |
---|
6 | -- Separate distribution files into toolset subdirectories |
---|
7 | |
---|
8 | if (options["usetargetpath"]) then |
---|
9 | package.path = options["target"] |
---|
10 | else |
---|
11 | package.path = "custom" |
---|
12 | end |
---|
13 | |
---|
14 | |
---|
15 | -- Write a custom <config.h> to include/ode, based on the specified flags |
---|
16 | |
---|
17 | io.input("config-default.h") |
---|
18 | local text = io.read("*a") |
---|
19 | |
---|
20 | if (options["with-doubles"]) then |
---|
21 | text = string.gsub(text, "#define dSINGLE", "/* #define dSINGLE */") |
---|
22 | text = string.gsub(text, "/%* #define dDOUBLE %*/", "#define dDOUBLE") |
---|
23 | end |
---|
24 | |
---|
25 | if (options["no-trimesh"]) then |
---|
26 | |
---|
27 | text = string.gsub(text, "#define dTRIMESH_ENABLED 1", "/* #define dTRIMESH_ENABLED 1 */") |
---|
28 | text = string.gsub(text, "#define dTRIMESH_OPCODE 1", "/* #define dTRIMESH_OPCODE 1 */") |
---|
29 | |
---|
30 | elseif (options["with-gimpact"]) then |
---|
31 | |
---|
32 | text = string.gsub(text, "#define dTRIMESH_OPCODE 1", "#define dTRIMESH_GIMPACT 1") |
---|
33 | |
---|
34 | end |
---|
35 | |
---|
36 | if (options["no-alloca"]) then |
---|
37 | text = string.gsub(text, "/%* #define dUSE_MALLOC_FOR_ALLOCA %*/", "#define dUSE_MALLOC_FOR_ALLOCA") |
---|
38 | end |
---|
39 | |
---|
40 | io.output("../include/ode/config.h") |
---|
41 | io.write(text) |
---|
42 | io.close() |
---|
43 | |
---|
44 | |
---|
45 | -- Package Build Settings |
---|
46 | |
---|
47 | if (options["enable-shared-only"]) then |
---|
48 | |
---|
49 | package.kind = "dll" |
---|
50 | table.insert(package.defines, "ODE_DLL") |
---|
51 | |
---|
52 | elseif (options["enable-static-only"]) then |
---|
53 | |
---|
54 | package.kind = "lib" |
---|
55 | table.insert(package.defines, "ODE_LIB") |
---|
56 | |
---|
57 | else |
---|
58 | |
---|
59 | package.config["DebugDLL"].kind = "dll" |
---|
60 | package.config["DebugLib"].kind = "lib" |
---|
61 | package.config["ReleaseDLL"].kind = "dll" |
---|
62 | package.config["ReleaseLib"].kind = "lib" |
---|
63 | |
---|
64 | table.insert(package.config["DebugDLL"].defines, "ODE_DLL") |
---|
65 | table.insert(package.config["ReleaseDLL"].defines, "ODE_DLL") |
---|
66 | table.insert(package.config["DebugLib"].defines, "ODE_LIB") |
---|
67 | table.insert(package.config["ReleaseLib"].defines, "ODE_LIB") |
---|
68 | |
---|
69 | end |
---|
70 | |
---|
71 | package.includepaths = |
---|
72 | { |
---|
73 | "../../include", |
---|
74 | "../../OPCODE", |
---|
75 | "../../GIMPACT/include" |
---|
76 | } |
---|
77 | |
---|
78 | if (windows) then |
---|
79 | table.insert(package.defines, "WIN32") |
---|
80 | end |
---|
81 | |
---|
82 | -- disable VS2005 CRT security warnings |
---|
83 | if (options["target"] == "vs2005") then |
---|
84 | table.insert(package.defines, "_CRT_SECURE_NO_DEPRECATE") |
---|
85 | end |
---|
86 | |
---|
87 | |
---|
88 | -- Build Flags |
---|
89 | |
---|
90 | package.config["DebugLib"].buildflags = { } |
---|
91 | package.config["DebugDLL"].buildflags = { } |
---|
92 | |
---|
93 | package.config["ReleaseDLL"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" } |
---|
94 | package.config["ReleaseLib"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" } |
---|
95 | |
---|
96 | if (options.target == "vs6" or options.target == "vs2002" or options.target == "vs2003") then |
---|
97 | table.insert(package.config.DebugLib.buildflags, "static-runtime") |
---|
98 | table.insert(package.config.ReleaseLib.buildflags, "static-runtime") |
---|
99 | end |
---|
100 | |
---|
101 | |
---|
102 | -- Libraries |
---|
103 | |
---|
104 | if (windows) then |
---|
105 | table.insert(package.links, "user32") |
---|
106 | end |
---|
107 | |
---|
108 | |
---|
109 | -- Files |
---|
110 | |
---|
111 | core_files = |
---|
112 | { |
---|
113 | matchfiles("../../include/ode/*.h"), |
---|
114 | matchfiles ("../../ode/src/*.h", "../../ode/src/*.c", "../../ode/src/*.cpp") |
---|
115 | } |
---|
116 | |
---|
117 | excluded_files = |
---|
118 | { |
---|
119 | "../../ode/src/collision_std.cpp", |
---|
120 | "../../ode/src/scrapbook.cpp", |
---|
121 | "../../ode/src/stack.cpp" |
---|
122 | } |
---|
123 | |
---|
124 | trimesh_files = |
---|
125 | { |
---|
126 | "../../ode/src/collision_trimesh_internal.h", |
---|
127 | "../../ode/src/collision_trimesh_opcode.cpp", |
---|
128 | "../../ode/src/collision_trimesh_gimpact.cpp", |
---|
129 | "../../ode/src/collision_trimesh_box.cpp", |
---|
130 | "../../ode/src/collision_trimesh_ccylinder.cpp", |
---|
131 | "../../ode/src/collision_cylinder_trimesh.cpp", |
---|
132 | "../../ode/src/collision_trimesh_distance.cpp", |
---|
133 | "../../ode/src/collision_trimesh_ray.cpp", |
---|
134 | "../../ode/src/collision_trimesh_sphere.cpp", |
---|
135 | "../../ode/src/collision_trimesh_trimesh.cpp", |
---|
136 | "../../ode/src/collision_trimesh_plane.cpp" |
---|
137 | } |
---|
138 | |
---|
139 | opcode_files = |
---|
140 | { |
---|
141 | matchrecursive("../../OPCODE/*.h", "../../OPCODE/*.cpp") |
---|
142 | } |
---|
143 | |
---|
144 | gimpact_files = |
---|
145 | { |
---|
146 | matchrecursive("../../GIMPACT/*.h", "../../GIMPACT/*.cpp") |
---|
147 | } |
---|
148 | |
---|
149 | dif_files = |
---|
150 | { |
---|
151 | "../../ode/src/export-dif.cpp" |
---|
152 | } |
---|
153 | |
---|
154 | package.files = { core_files } |
---|
155 | package.excludes = { excluded_files } |
---|
156 | |
---|
157 | if (options["no-dif"]) then |
---|
158 | table.insert(package.excludes, dif_files) |
---|
159 | end |
---|
160 | |
---|
161 | if (options["no-trimesh"]) then |
---|
162 | table.insert(package.excludes, trimesh_files) |
---|
163 | else |
---|
164 | table.insert(package.files, gimpact_files) |
---|
165 | table.insert(package.files, opcode_files) |
---|
166 | end |
---|