cannam@89
|
1 ----------------------------------------------------------------------
|
cannam@89
|
2 -- Premake4 configuration script for LibLo
|
cannam@89
|
3 -- Adapted from ODE's build script by Jason Perkins.
|
cannam@89
|
4 -- For more information on Premake: http://industriousone.com/premake
|
cannam@89
|
5 ----------------------------------------------------------------------
|
cannam@89
|
6
|
cannam@89
|
7 ----------------------------------------------------------------------
|
cannam@89
|
8 -- Configuration options
|
cannam@89
|
9 ----------------------------------------------------------------------
|
cannam@89
|
10
|
cannam@89
|
11 -- always clean all of the optional components and toolsets
|
cannam@89
|
12 if _ACTION == "clean" then
|
cannam@89
|
13 for action in pairs(premake.actions) do
|
cannam@89
|
14 os.rmdir(action)
|
cannam@89
|
15 end
|
cannam@89
|
16 end
|
cannam@89
|
17
|
cannam@89
|
18
|
cannam@89
|
19
|
cannam@89
|
20 ----------------------------------------------------------------------
|
cannam@89
|
21 -- The solution, and solution-wide settings
|
cannam@89
|
22 ----------------------------------------------------------------------
|
cannam@89
|
23
|
cannam@89
|
24 solution "liblo"
|
cannam@89
|
25
|
cannam@89
|
26 language "C"
|
cannam@89
|
27 location ( _OPTIONS["to"] or _ACTION )
|
cannam@89
|
28
|
cannam@89
|
29 includedirs {
|
cannam@89
|
30 "../lo",
|
cannam@89
|
31 "../src"
|
cannam@89
|
32 }
|
cannam@89
|
33
|
cannam@89
|
34 -- define all the possible build configurations
|
cannam@89
|
35 configurations {
|
cannam@89
|
36 "DebugDLL", "ReleaseDLL",
|
cannam@89
|
37 "DebugLib", "ReleaseLib",
|
cannam@89
|
38 }
|
cannam@89
|
39
|
cannam@89
|
40 configuration { "Debug*" }
|
cannam@89
|
41 defines { "_DEBUG" }
|
cannam@89
|
42 flags { "Symbols" }
|
cannam@89
|
43
|
cannam@89
|
44 configuration { "Release*" }
|
cannam@89
|
45 flags { "OptimizeSpeed", "NoFramePointer" }
|
cannam@89
|
46
|
cannam@89
|
47 configuration { "Windows" }
|
cannam@89
|
48 defines { "WIN32" }
|
cannam@89
|
49
|
cannam@89
|
50 -- give each configuration a unique output directory
|
cannam@89
|
51 for _, name in ipairs(configurations()) do
|
cannam@89
|
52 configuration { name }
|
cannam@89
|
53 targetdir ( "../lib/" .. name )
|
cannam@89
|
54 end
|
cannam@89
|
55
|
cannam@89
|
56 -- disable Visual Studio security warnings
|
cannam@89
|
57 configuration { "vs*" }
|
cannam@89
|
58 defines { "_CRT_SECURE_NO_DEPRECATE" }
|
cannam@89
|
59
|
cannam@89
|
60 -- tell source to use config.h
|
cannam@89
|
61 configuration { "vs*" }
|
cannam@89
|
62 defines { "HAVE_CONFIG_H" }
|
cannam@89
|
63
|
cannam@89
|
64 -- don't remember why we had to do this (from ODE)
|
cannam@89
|
65 configuration { "vs2002 or vs2003", "*Lib" }
|
cannam@89
|
66 flags { "StaticRuntime" }
|
cannam@89
|
67
|
cannam@89
|
68 ----------------------------------------------------------------------
|
cannam@89
|
69 -- Write a custom <config.h> to .., based on the supplied flags
|
cannam@89
|
70 ----------------------------------------------------------------------
|
cannam@89
|
71
|
cannam@89
|
72 -- First get the version number from "configure.ac" --
|
cannam@89
|
73
|
cannam@89
|
74 io.input("../configure.ac")
|
cannam@89
|
75 text = io.read("*all")
|
cannam@89
|
76 io.close()
|
cannam@89
|
77 text = string.sub(text,string.find(text, "AC_INIT.+"))
|
cannam@89
|
78 version = string.sub(text,string.find(text, "%d+%.%d+"))
|
cannam@89
|
79
|
cannam@89
|
80 -- Replace it in "config.h" --
|
cannam@89
|
81
|
cannam@89
|
82 io.input("config-msvc.h")
|
cannam@89
|
83 local text = io.read("*all")
|
cannam@89
|
84
|
cannam@89
|
85 text = string.gsub(text, '/%*VERSION%*/', '"'..version..'"')
|
cannam@89
|
86
|
cannam@89
|
87 io.output("../config.h")
|
cannam@89
|
88 io.write(text)
|
cannam@89
|
89 io.close()
|
cannam@89
|
90
|
cannam@89
|
91 ----------------------------------------------------------------------
|
cannam@89
|
92 -- Copy <lo_endian.h> to ../lo
|
cannam@89
|
93 ----------------------------------------------------------------------
|
cannam@89
|
94
|
cannam@89
|
95 io.input("lo_endian-msvc.h")
|
cannam@89
|
96 io.output("../lo/lo_endian.h")
|
cannam@89
|
97 local text = io.read("*all")
|
cannam@89
|
98 io.write(text)
|
cannam@89
|
99 io.close()
|
cannam@89
|
100
|
cannam@89
|
101 ----------------------------------------------------------------------
|
cannam@89
|
102 -- The LibLo library project
|
cannam@89
|
103 ----------------------------------------------------------------------
|
cannam@89
|
104
|
cannam@89
|
105 project "liblo"
|
cannam@89
|
106
|
cannam@89
|
107 kind "StaticLib"
|
cannam@89
|
108 location ( _OPTIONS["to"] or _ACTION )
|
cannam@89
|
109
|
cannam@89
|
110 includedirs {
|
cannam@89
|
111 "..",
|
cannam@89
|
112 }
|
cannam@89
|
113
|
cannam@89
|
114 files {
|
cannam@89
|
115 "../src/*.c",
|
cannam@89
|
116 "../src/*.h",
|
cannam@89
|
117 "../lo/*.h",
|
cannam@89
|
118 "../src/liblo.def",
|
cannam@89
|
119 }
|
cannam@89
|
120
|
cannam@89
|
121 excludes {
|
cannam@89
|
122 "../src/testlo.c",
|
cannam@89
|
123 "../src/subtest.c",
|
cannam@89
|
124 "../src/tools",
|
cannam@89
|
125 }
|
cannam@89
|
126
|
cannam@89
|
127 configuration { "windows" }
|
cannam@89
|
128 links { "user32",
|
cannam@89
|
129 "wsock32",
|
cannam@89
|
130 "ws2_32",
|
cannam@89
|
131 "pthreadVC2",
|
cannam@89
|
132 }
|
cannam@89
|
133
|
cannam@89
|
134 configuration { "*Lib" }
|
cannam@89
|
135 kind "StaticLib"
|
cannam@89
|
136 defines "LIBLO_LIB"
|
cannam@89
|
137
|
cannam@89
|
138 configuration { "*DLL" }
|
cannam@89
|
139 kind "SharedLib"
|
cannam@89
|
140 defines "LIBLO_DLL"
|
cannam@89
|
141
|
cannam@89
|
142 configuration { "Debug*" }
|
cannam@89
|
143 targetname "liblo_d"
|
cannam@89
|
144
|
cannam@89
|
145 configuration { "Release*" }
|
cannam@89
|
146 targetname "liblo"
|
cannam@89
|
147
|
cannam@89
|
148
|
cannam@89
|
149 ----------------------------------------------------------------------
|
cannam@89
|
150 -- The automated test application
|
cannam@89
|
151 ----------------------------------------------------------------------
|
cannam@89
|
152
|
cannam@89
|
153
|
cannam@89
|
154 project "testlo"
|
cannam@89
|
155
|
cannam@89
|
156 kind "ConsoleApp"
|
cannam@89
|
157 location ( _OPTIONS["to"] or _ACTION )
|
cannam@89
|
158 links { "user32",
|
cannam@89
|
159 "wsock32",
|
cannam@89
|
160 "ws2_32",
|
cannam@89
|
161 "pthreadVC2",
|
cannam@89
|
162 }
|
cannam@89
|
163
|
cannam@89
|
164 includedirs {
|
cannam@89
|
165 "..",
|
cannam@89
|
166 }
|
cannam@89
|
167
|
cannam@89
|
168 files {
|
cannam@89
|
169 "../src/testlo.c",
|
cannam@89
|
170 }
|
cannam@89
|
171
|
cannam@89
|
172 configuration { "DebugDLL" }
|
cannam@89
|
173 links { "liblo_d" }
|
cannam@89
|
174 libdirs { "../lib/debugdll" }
|
cannam@89
|
175
|
cannam@89
|
176 configuration { "DebugLib" }
|
cannam@89
|
177 links { "liblo_d" }
|
cannam@89
|
178 libdirs { "../lib/debuglib" }
|
cannam@89
|
179
|
cannam@89
|
180 configuration { "Release*" }
|
cannam@89
|
181 links { "liblo" }
|
cannam@89
|
182
|
cannam@89
|
183 project "subtest"
|
cannam@89
|
184
|
cannam@89
|
185 kind "ConsoleApp"
|
cannam@89
|
186 location ( _OPTIONS["to"] or _ACTION )
|
cannam@89
|
187 links { "user32",
|
cannam@89
|
188 "wsock32",
|
cannam@89
|
189 "ws2_32",
|
cannam@89
|
190 "pthreadVC2",
|
cannam@89
|
191 }
|
cannam@89
|
192
|
cannam@89
|
193 includedirs {
|
cannam@89
|
194 "..",
|
cannam@89
|
195 }
|
cannam@89
|
196
|
cannam@89
|
197 files {
|
cannam@89
|
198 "../src/subtest.c",
|
cannam@89
|
199 }
|
cannam@89
|
200
|
cannam@89
|
201 configuration { "DebugDLL" }
|
cannam@89
|
202 links { "liblo_d" }
|
cannam@89
|
203 libdirs { "../lib/debugdll" }
|
cannam@89
|
204
|
cannam@89
|
205 configuration { "DebugLib" }
|
cannam@89
|
206 links { "liblo_d" }
|
cannam@89
|
207 libdirs { "../lib/debuglib" }
|
cannam@89
|
208
|
cannam@89
|
209 configuration { "Release*" }
|
cannam@89
|
210 links { "liblo" }
|