aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/build/ode.lua
blob: 568cd260f1bcd484db8c727cc62577b0ea1ac581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package.name = "ode"
package.language = "c++"
package.objdir = "obj/ode"


-- Separate distribution files into toolset subdirectories

  if (options["usetargetpath"]) then
    package.path = options["target"]
  else
    package.path = "custom"
  end


-- Write a custom <config.h> to include/ode, based on the specified flags

  io.input("config-default.h")
  local text = io.read("*a")

  if (options["with-doubles"]) then
    text = string.gsub(text, "#define dSINGLE", "/* #define dSINGLE */")
    text = string.gsub(text, "/%* #define dDOUBLE %*/", "#define dDOUBLE")
  end

  if (options["no-trimesh"]) then
    
    text = string.gsub(text, "#define dTRIMESH_ENABLED 1", "/* #define dTRIMESH_ENABLED 1 */")
    text = string.gsub(text, "#define dTRIMESH_OPCODE 1", "/* #define dTRIMESH_OPCODE 1 */")
  
  elseif (options["with-gimpact"]) then

    text = string.gsub(text, "#define dTRIMESH_OPCODE 1", "#define dTRIMESH_GIMPACT 1")
  
  end
  
  if (options["no-alloca"]) then
    text = string.gsub(text, "/%* #define dUSE_MALLOC_FOR_ALLOCA %*/", "#define dUSE_MALLOC_FOR_ALLOCA")
  end

  io.output("../include/ode/config.h")
  io.write(text)
  io.close()


-- Package Build Settings

  if (options["enable-shared-only"]) then
  
    package.kind = "dll"
    table.insert(package.defines, "ODE_DLL")
  
  elseif (options["enable-static-only"]) then
  
    package.kind = "lib"
    table.insert(package.defines, "ODE_LIB")
  
  else
  
    package.config["DebugDLL"].kind = "dll"
    package.config["DebugLib"].kind = "lib"
    package.config["ReleaseDLL"].kind = "dll"
    package.config["ReleaseLib"].kind = "lib"

    table.insert(package.config["DebugDLL"].defines, "ODE_DLL")
    table.insert(package.config["ReleaseDLL"].defines, "ODE_DLL")
    table.insert(package.config["DebugLib"].defines, "ODE_LIB")
    table.insert(package.config["ReleaseLib"].defines, "ODE_LIB")
  
  end

  package.includepaths =
  {
    "../../include",
    "../../OPCODE",
    "../../GIMPACT/include"
  }

  if (windows) then
    table.insert(package.defines, "WIN32")
  end

  -- disable VS2005 CRT security warnings
  if (options["target"] == "vs2005") then
    table.insert(package.defines, "_CRT_SECURE_NO_DEPRECATE")
  end


-- Build Flags

	package.config["DebugLib"].buildflags   = { }
	package.config["DebugDLL"].buildflags   = { }

	package.config["ReleaseDLL"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }
	package.config["ReleaseLib"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }

	if (options.target == "vs6" or options.target == "vs2002" or options.target == "vs2003") then
		table.insert(package.config.DebugLib.buildflags, "static-runtime")
		table.insert(package.config.ReleaseLib.buildflags, "static-runtime")
	end


-- Libraries

  if (windows) then
    table.insert(package.links, "user32")
  end


-- Files

  core_files =
  {
    matchfiles("../../include/ode/*.h"),
    matchfiles ("../../ode/src/*.h", "../../ode/src/*.c", "../../ode/src/*.cpp")
  }

  excluded_files =
  {
    "../../ode/src/collision_std.cpp",
    "../../ode/src/scrapbook.cpp",
    "../../ode/src/stack.cpp"
  }

  trimesh_files =
  {
    "../../ode/src/collision_trimesh_internal.h",
    "../../ode/src/collision_trimesh_opcode.cpp",
    "../../ode/src/collision_trimesh_gimpact.cpp",
    "../../ode/src/collision_trimesh_box.cpp",
    "../../ode/src/collision_trimesh_ccylinder.cpp",
    "../../ode/src/collision_cylinder_trimesh.cpp",
    "../../ode/src/collision_trimesh_distance.cpp",
    "../../ode/src/collision_trimesh_ray.cpp",
    "../../ode/src/collision_trimesh_sphere.cpp",
    "../../ode/src/collision_trimesh_trimesh.cpp",
    "../../ode/src/collision_trimesh_plane.cpp"
  }

  opcode_files =
  {
    matchrecursive("../../OPCODE/*.h", "../../OPCODE/*.cpp")
  }
  
  gimpact_files =
  {
    matchrecursive("../../GIMPACT/*.h", "../../GIMPACT/*.cpp")
  }

  dif_files =
  {
    "../../ode/src/export-dif.cpp"
  }

  package.files = { core_files }
  package.excludes = { excluded_files }

  if (options["no-dif"]) then
    table.insert(package.excludes, dif_files)
  end

  if (options["no-trimesh"]) then
    table.insert(package.excludes, trimesh_files)
  else
    table.insert(package.files, gimpact_files)
    table.insert(package.files, opcode_files)
  end