File: premake4.lua

package info (click to toggle)
liblo 0.26~repack-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,012 kB
  • sloc: sh: 9,816; ansic: 5,120; makefile: 83
file content (210 lines) | stat: -rw-r--r-- 5,326 bytes parent folder | download | duplicates (4)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
----------------------------------------------------------------------
-- Premake4 configuration script for LibLo
-- Adapted from ODE's build script by Jason Perkins.
-- For more information on Premake: http://industriousone.com/premake
----------------------------------------------------------------------

----------------------------------------------------------------------
-- Configuration options
----------------------------------------------------------------------

  -- always clean all of the optional components and toolsets
  if _ACTION == "clean" then
    for action in pairs(premake.actions) do
      os.rmdir(action)
    end
  end
  
  

----------------------------------------------------------------------
-- The solution, and solution-wide settings
----------------------------------------------------------------------

  solution "liblo"

    language "C"
    location ( _OPTIONS["to"] or _ACTION )

    includedirs {
      "../lo",
      "../src"
    }
      
    -- define all the possible build configurations
    configurations {
      "DebugDLL", "ReleaseDLL", 
      "DebugLib", "ReleaseLib", 
    }
    
    configuration { "Debug*" }
      defines { "_DEBUG" }
      flags   { "Symbols" }
      
    configuration { "Release*" }
      flags   { "OptimizeSpeed", "NoFramePointer" }

    configuration { "Windows" }
      defines { "WIN32" }

    -- give each configuration a unique output directory
    for _, name in ipairs(configurations()) do
      configuration { name }
        targetdir ( "../lib/" .. name )
    end
      
    -- disable Visual Studio security warnings
    configuration { "vs*" }
      defines { "_CRT_SECURE_NO_DEPRECATE" }

    -- tell source to use config.h
    configuration { "vs*" }
      defines { "HAVE_CONFIG_H" }

    -- don't remember why we had to do this	(from ODE)
    configuration { "vs2002 or vs2003", "*Lib" }
      flags  { "StaticRuntime" }

----------------------------------------------------------------------
-- Write a custom <config.h> to .., based on the supplied flags
----------------------------------------------------------------------

-- First get the version number from "configure.ac" --

  io.input("../configure.ac")
  text = io.read("*all")
  io.close()
  text = string.sub(text,string.find(text, "AC_INIT.+"))
  version = string.sub(text,string.find(text, "%d+%.%d+"))

-- Replace it in "config.h" --

  io.input("config-msvc.h")
  local text = io.read("*all")

  text = string.gsub(text, '/%*VERSION%*/', '"'..version..'"')

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

----------------------------------------------------------------------
-- Copy <lo_endian.h> to ../lo
----------------------------------------------------------------------

  io.input("lo_endian-msvc.h")
  io.output("../lo/lo_endian.h")
  local text = io.read("*all")
  io.write(text)
  io.close()

----------------------------------------------------------------------
-- The LibLo library project
----------------------------------------------------------------------

  project "liblo"

    kind     "StaticLib"
    location ( _OPTIONS["to"] or _ACTION )

    includedirs {
      "..",
    }

    files {
      "../src/*.c",
      "../src/*.h",
      "../lo/*.h",
      "../src/liblo.def",
    }

    excludes {
      "../src/testlo.c",
      "../src/subtest.c",
      "../src/tools",
    }

    configuration { "windows" }
      links   { "user32",
                "wsock32",
                "ws2_32",
                "pthreadVC2",
              }
            
    configuration { "*Lib" }
      kind    "StaticLib"
      defines "LIBLO_LIB"
      
    configuration { "*DLL" }
      kind    "SharedLib"
      defines "LIBLO_DLL"

    configuration { "Debug*" }
      targetname "liblo_d"
      
    configuration { "Release*" }
      targetname "liblo"


----------------------------------------------------------------------
-- The automated test application
----------------------------------------------------------------------


  project "testlo"
  
    kind     "ConsoleApp"
    location ( _OPTIONS["to"] or _ACTION )
    links   { "user32",
              "wsock32",
              "ws2_32",
              "pthreadVC2",
            }

    includedirs { 
      "..",
    }
    
    files { 
      "../src/testlo.c",
    }

    configuration { "DebugDLL" }
      links { "liblo_d" }
      libdirs { "../lib/debugdll" }

    configuration { "DebugLib" }
      links { "liblo_d" }
      libdirs { "../lib/debuglib" }
      
    configuration { "Release*" }
      links { "liblo" }

  project "subtest"
  
    kind     "ConsoleApp"
    location ( _OPTIONS["to"] or _ACTION )
    links   { "user32",
              "wsock32",
              "ws2_32",
              "pthreadVC2",
            }

    includedirs { 
      "..",
    }

    files { 
      "../src/subtest.c",
    }

    configuration { "DebugDLL" }
      links { "liblo_d" }
      libdirs { "../lib/debugdll" }

    configuration { "DebugLib" }
      links { "liblo_d" }
      libdirs { "../lib/debuglib" }
      
    configuration { "Release*" }
      links { "liblo" }