dub 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/.gitignore +8 -0
  2. data/History.txt +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +53 -0
  5. data/Rakefile +58 -0
  6. data/dub.gemspec +194 -0
  7. data/lib/dub/argument.rb +261 -0
  8. data/lib/dub/entities_unescape.rb +16 -0
  9. data/lib/dub/function.rb +111 -0
  10. data/lib/dub/function_group.rb +74 -0
  11. data/lib/dub/generator.rb +15 -0
  12. data/lib/dub/group.rb +10 -0
  13. data/lib/dub/klass.rb +231 -0
  14. data/lib/dub/lua/class.cpp.erb +75 -0
  15. data/lib/dub/lua/class_gen.rb +78 -0
  16. data/lib/dub/lua/function.cpp.erb +4 -0
  17. data/lib/dub/lua/function_gen.rb +223 -0
  18. data/lib/dub/lua/group.cpp.erb +10 -0
  19. data/lib/dub/lua/lua_cpp_helper.h +141 -0
  20. data/lib/dub/lua/namespace.cpp.erb +35 -0
  21. data/lib/dub/lua/namespace_gen.rb +86 -0
  22. data/lib/dub/lua.rb +24 -0
  23. data/lib/dub/member_extraction.rb +88 -0
  24. data/lib/dub/namespace.rb +276 -0
  25. data/lib/dub/parser.rb +46 -0
  26. data/lib/dub/templates/lua_template.erb +21 -0
  27. data/lib/dub/version.rb +3 -0
  28. data/lib/dub.rb +26 -0
  29. data/test/argument_test.rb +423 -0
  30. data/test/fixtures/app/CMakeLists.txt +54 -0
  31. data/test/fixtures/app/Doxyfile +1600 -0
  32. data/test/fixtures/app/bindings/all_lua.cpp +299 -0
  33. data/test/fixtures/app/include/matrix.h +123 -0
  34. data/test/fixtures/app/make_lua_bindings.rb +13 -0
  35. data/test/fixtures/app/vendor/lua/CMakeLists.txt +25 -0
  36. data/test/fixtures/app/vendor/lua/COPYRIGHT +34 -0
  37. data/test/fixtures/app/vendor/lua/HISTORY +183 -0
  38. data/test/fixtures/app/vendor/lua/INSTALL +99 -0
  39. data/test/fixtures/app/vendor/lua/Makefile +183 -0
  40. data/test/fixtures/app/vendor/lua/README +37 -0
  41. data/test/fixtures/app/vendor/lua/lapi.c +1080 -0
  42. data/test/fixtures/app/vendor/lua/lapi.h +16 -0
  43. data/test/fixtures/app/vendor/lua/lauxlib.c +653 -0
  44. data/test/fixtures/app/vendor/lua/lauxlib.h +174 -0
  45. data/test/fixtures/app/vendor/lua/lbaselib.c +643 -0
  46. data/test/fixtures/app/vendor/lua/lcode.c +839 -0
  47. data/test/fixtures/app/vendor/lua/lcode.h +76 -0
  48. data/test/fixtures/app/vendor/lua/ldblib.c +397 -0
  49. data/test/fixtures/app/vendor/lua/ldebug.c +622 -0
  50. data/test/fixtures/app/vendor/lua/ldebug.h +33 -0
  51. data/test/fixtures/app/vendor/lua/ldo.c +516 -0
  52. data/test/fixtures/app/vendor/lua/ldo.h +57 -0
  53. data/test/fixtures/app/vendor/lua/ldump.c +164 -0
  54. data/test/fixtures/app/vendor/lua/lfunc.c +174 -0
  55. data/test/fixtures/app/vendor/lua/lfunc.h +34 -0
  56. data/test/fixtures/app/vendor/lua/lgc.c +711 -0
  57. data/test/fixtures/app/vendor/lua/lgc.h +110 -0
  58. data/test/fixtures/app/vendor/lua/liblua.a +0 -0
  59. data/test/fixtures/app/vendor/lua/linit.c +38 -0
  60. data/test/fixtures/app/vendor/lua/liolib.c +532 -0
  61. data/test/fixtures/app/vendor/lua/llex.c +461 -0
  62. data/test/fixtures/app/vendor/lua/llex.h +81 -0
  63. data/test/fixtures/app/vendor/lua/llimits.h +128 -0
  64. data/test/fixtures/app/vendor/lua/lmathlib.c +263 -0
  65. data/test/fixtures/app/vendor/lua/lmem.c +86 -0
  66. data/test/fixtures/app/vendor/lua/lmem.h +49 -0
  67. data/test/fixtures/app/vendor/lua/loadlib.c +664 -0
  68. data/test/fixtures/app/vendor/lua/lobject.c +214 -0
  69. data/test/fixtures/app/vendor/lua/lobject.h +381 -0
  70. data/test/fixtures/app/vendor/lua/lopcodes.c +102 -0
  71. data/test/fixtures/app/vendor/lua/lopcodes.h +268 -0
  72. data/test/fixtures/app/vendor/lua/loslib.c +244 -0
  73. data/test/fixtures/app/vendor/lua/lparser.c +1337 -0
  74. data/test/fixtures/app/vendor/lua/lparser.h +82 -0
  75. data/test/fixtures/app/vendor/lua/lstate.c +214 -0
  76. data/test/fixtures/app/vendor/lua/lstate.h +168 -0
  77. data/test/fixtures/app/vendor/lua/lstring.c +111 -0
  78. data/test/fixtures/app/vendor/lua/lstring.h +31 -0
  79. data/test/fixtures/app/vendor/lua/lstrlib.c +868 -0
  80. data/test/fixtures/app/vendor/lua/ltable.c +588 -0
  81. data/test/fixtures/app/vendor/lua/ltable.h +40 -0
  82. data/test/fixtures/app/vendor/lua/ltablib.c +278 -0
  83. data/test/fixtures/app/vendor/lua/ltm.c +75 -0
  84. data/test/fixtures/app/vendor/lua/ltm.h +54 -0
  85. data/test/fixtures/app/vendor/lua/lua.c +695 -0
  86. data/test/fixtures/app/vendor/lua/lua.h +385 -0
  87. data/test/fixtures/app/vendor/lua/lua_dub_helper.h +77 -0
  88. data/test/fixtures/app/vendor/lua/luac +0 -0
  89. data/test/fixtures/app/vendor/lua/luac.c +200 -0
  90. data/test/fixtures/app/vendor/lua/luaconf.h +762 -0
  91. data/test/fixtures/app/vendor/lua/lualib.h +53 -0
  92. data/test/fixtures/app/vendor/lua/lundump.c +223 -0
  93. data/test/fixtures/app/vendor/lua/lundump.h +36 -0
  94. data/test/fixtures/app/vendor/lua/lvm.c +765 -0
  95. data/test/fixtures/app/vendor/lua/lvm.h +36 -0
  96. data/test/fixtures/app/vendor/lua/lzio.c +82 -0
  97. data/test/fixtures/app/vendor/lua/lzio.h +67 -0
  98. data/test/fixtures/app/vendor/lua/matrix.h +102 -0
  99. data/test/fixtures/app/vendor/lua/print.c +227 -0
  100. data/test/fixtures/app/vendor/lua/test/README +26 -0
  101. data/test/fixtures/app/vendor/lua/test/bisect.lua +27 -0
  102. data/test/fixtures/app/vendor/lua/test/cf.lua +16 -0
  103. data/test/fixtures/app/vendor/lua/test/echo.lua +5 -0
  104. data/test/fixtures/app/vendor/lua/test/env.lua +7 -0
  105. data/test/fixtures/app/vendor/lua/test/factorial.lua +32 -0
  106. data/test/fixtures/app/vendor/lua/test/fib.lua +40 -0
  107. data/test/fixtures/app/vendor/lua/test/fibfor.lua +13 -0
  108. data/test/fixtures/app/vendor/lua/test/globals.lua +13 -0
  109. data/test/fixtures/app/vendor/lua/test/hello.lua +3 -0
  110. data/test/fixtures/app/vendor/lua/test/life.lua +111 -0
  111. data/test/fixtures/app/vendor/lua/test/luac.lua +7 -0
  112. data/test/fixtures/app/vendor/lua/test/printf.lua +7 -0
  113. data/test/fixtures/app/vendor/lua/test/readonly.lua +12 -0
  114. data/test/fixtures/app/vendor/lua/test/sieve.lua +29 -0
  115. data/test/fixtures/app/vendor/lua/test/sort.lua +66 -0
  116. data/test/fixtures/app/vendor/lua/test/table.lua +12 -0
  117. data/test/fixtures/app/vendor/lua/test/trace-calls.lua +32 -0
  118. data/test/fixtures/app/vendor/lua/test/trace-globals.lua +38 -0
  119. data/test/fixtures/app/vendor/lua/test/xd.lua +14 -0
  120. data/test/fixtures/app/xml/classdub_1_1_matrix.xml +239 -0
  121. data/test/fixtures/app/xml/classdub_1_1_t_mat.xml +233 -0
  122. data/test/fixtures/app/xml/combine.xslt +15 -0
  123. data/test/fixtures/app/xml/compound.xsd +814 -0
  124. data/test/fixtures/app/xml/dir_53661a2bdeb1d55e60581a7e15deb763.xml +12 -0
  125. data/test/fixtures/app/xml/index.xml +42 -0
  126. data/test/fixtures/app/xml/index.xsd +66 -0
  127. data/test/fixtures/app/xml/matrix_8h.xml +149 -0
  128. data/test/fixtures/app/xml/namespacedub.xml +41 -0
  129. data/test/fixtures/classcv_1_1_mat.xml +1996 -0
  130. data/test/fixtures/classcv_1_1_point__.xml +341 -0
  131. data/test/fixtures/classcv_1_1_size__.xml +270 -0
  132. data/test/fixtures/group___magic_type.xml +406 -0
  133. data/test/fixtures/namespacecv.xml +12659 -0
  134. data/test/function_group_test.rb +15 -0
  135. data/test/function_test.rb +252 -0
  136. data/test/group_test.rb +155 -0
  137. data/test/helper.rb +34 -0
  138. data/test/klass_test.rb +297 -0
  139. data/test/lua_function_gen_test.rb +179 -0
  140. data/test/namespace_test.rb +220 -0
  141. data/test/parser_test.rb +36 -0
  142. metadata +216 -0
@@ -0,0 +1,423 @@
1
+ require 'helper'
2
+ require 'dub/lua'
3
+
4
+ class ArgumentTest < Test::Unit::TestCase
5
+ context 'An const ref argument' do
6
+ setup do
7
+ # namespacecv_xml = Dub.parse(fixture('namespacecv.xml'))
8
+ @argument = namespacecv_xml[:cv][:resize].arguments.first
9
+ end
10
+
11
+ should 'return type with type' do
12
+ assert_equal 'Mat', @argument.type
13
+ end
14
+
15
+ should 'return name with name' do
16
+ assert_equal 'src', @argument.name
17
+ end
18
+
19
+ should 'know if argument is const' do
20
+ assert @argument.is_const?
21
+ end
22
+
23
+ should 'know if argument is passed by ref' do
24
+ assert @argument.is_ref?
25
+ end
26
+
27
+ should 'know that it is a pointer' do
28
+ assert !@argument.is_pointer?
29
+ end
30
+
31
+ should 'know if argument type is a native type' do
32
+ assert !@argument.is_native?
33
+ end
34
+
35
+ should 'create a pointer' do
36
+ assert_equal 'const Mat *', @argument.create_type
37
+ end
38
+
39
+ should 'keep a link to the function' do
40
+ assert_kind_of Dub::Function, @argument.function
41
+ end
42
+
43
+ should 'not return true on has_default if it does not have a default value' do
44
+ assert !@argument.has_default?
45
+ end
46
+
47
+ should 'return signature' do
48
+ assert_equal 'const Mat&', @argument.signature
49
+ end
50
+
51
+ should 'return signature on inspect' do
52
+ assert_equal 'const Mat&', @argument.inspect
53
+ end
54
+ end
55
+
56
+ context 'A double argument' do
57
+ setup do
58
+ # namespacecv_xml = Dub.parse(fixture('namespacecv.xml'))
59
+ @argument = namespacecv_xml[:cv][:resize].arguments[3]
60
+ end
61
+
62
+ should 'return type with type' do
63
+ assert_equal 'double', @argument.type
64
+ end
65
+
66
+ should 'return name with name' do
67
+ assert_equal 'fx', @argument.name
68
+ end
69
+
70
+ should 'know if argument is const' do
71
+ assert !@argument.is_const?
72
+ end
73
+
74
+ should 'know if argument is passed by ref' do
75
+ assert !@argument.is_ref?
76
+ end
77
+
78
+ should 'know that it is a pointer' do
79
+ assert !@argument.is_pointer?
80
+ end
81
+
82
+ should 'know if argument type is a native type' do
83
+ assert @argument.is_native?
84
+ end
85
+
86
+ should 'return double on create_type' do
87
+ assert_equal 'double ', @argument.create_type
88
+ end
89
+
90
+ should 'return signature' do
91
+ assert_equal 'double', @argument.signature
92
+ end
93
+ end
94
+
95
+ context 'An argument without name' do
96
+ setup do
97
+ @argument = namespacecv_xml[:cv][:fastMalloc].arguments.first
98
+ end
99
+
100
+ should 'choose a name from its position' do
101
+ assert_equal 'arg1', @argument.name
102
+ end
103
+ end
104
+
105
+ context 'A vararg argument' do
106
+ setup do
107
+ @argument = namespacecv_xml[:cv][:format].arguments[1]
108
+ end
109
+
110
+ should 'know it is a vararg' do
111
+ assert @argument.vararg?
112
+ end
113
+ end
114
+
115
+ context 'A bool argument' do
116
+ setup do
117
+ # namespacecv_xml = Dub.parse(fixture('namespacecv.xml'))
118
+ @argument = namespacedub_xml[:dub][:Matrix][:do_something].arguments[1]
119
+ end
120
+
121
+ should 'return type with type' do
122
+ assert_equal 'bool', @argument.type
123
+ end
124
+
125
+ should 'return name with name' do
126
+ assert_equal 'fast', @argument.name
127
+ end
128
+
129
+ should 'know if argument is const' do
130
+ assert !@argument.is_const?
131
+ end
132
+
133
+ should 'know if argument is passed by ref' do
134
+ assert !@argument.is_ref?
135
+ end
136
+
137
+ should 'know that it is a pointer' do
138
+ assert !@argument.is_pointer?
139
+ end
140
+
141
+ should 'know if argument type is a native type' do
142
+ assert @argument.is_native?
143
+ end
144
+
145
+ should 'return bool on create_type' do
146
+ assert_equal 'bool ', @argument.create_type
147
+ end
148
+
149
+ should 'return signature' do
150
+ assert_equal 'bool', @argument.signature
151
+ end
152
+
153
+ should 'return default value if it has one' do
154
+ assert_equal 'false', @argument.default
155
+ end
156
+ end
157
+
158
+ context 'An argument with the same name as the function' do
159
+ setup do
160
+ @function = namespacecv_xml[:cv][:magnitude]
161
+ @argument = @function.arguments[2]
162
+ end
163
+
164
+ should 'be prefixed with arg_' do
165
+ assert_equal 'arg_magnitude', @argument.name
166
+ end
167
+ end
168
+
169
+ context 'An argument with a default value' do
170
+ setup do
171
+ # namespacecv_xml = Dub.parse(fixture('namespacecv.xml'))
172
+ @argument = namespacecv_xml[:cv][:resize].arguments[5]
173
+ end
174
+
175
+ should 'return type with type' do
176
+ assert_equal 'int', @argument.type
177
+ end
178
+
179
+ should 'return name with name' do
180
+ assert_equal 'interpolation', @argument.name
181
+ end
182
+
183
+ should 'return default value' do
184
+ assert_equal 'cv::INTER_LINEAR', @argument.default
185
+ end
186
+
187
+ should 'know if it has a default value' do
188
+ assert @argument.has_default?
189
+ end
190
+
191
+ context 'that is an enum' do
192
+ setup do
193
+ @argument = namespacecv_xml[:cv][:Mat].constructor[6].arguments[4]
194
+ end
195
+
196
+ should 'use full namespace signature if default is an enum' do
197
+ assert_equal 'cv::Mat::AUTO_STEP', @argument.default
198
+ end
199
+ end
200
+
201
+ context 'that is a class' do
202
+ setup do
203
+ @method = namespacecv_xml[:cv][:accumulate]
204
+ @argument = @method.arguments[2]
205
+ end
206
+
207
+ should 'know that it has a default value' do
208
+ assert @argument.has_default?
209
+ end
210
+
211
+ should 'return default value' do
212
+ assert_equal 'Mat()', @argument.default
213
+ end
214
+
215
+ context 'bound to a generator' do
216
+ setup do
217
+ Dub::Lua.bind(@method)
218
+ end
219
+
220
+ should 'use if then else for default' do
221
+ assert_match %r{if\s*\(top__ < 3\) \{\s*accumulate\(\*src, \*dst\);}m,
222
+ @method.to_s
223
+ end
224
+ end
225
+ end
226
+ end
227
+
228
+ context 'A group of overloaded functions' do
229
+ setup do
230
+ @group = namespacecv_xml[:cv][:divide]
231
+ end
232
+
233
+ should 'be ordered into a decision tree' do
234
+ f1 = @group.detect {|f| f.arguments[0].type == 'Mat'}
235
+ f2 = @group.detect {|f| f.arguments[0].type == 'MatND'}
236
+ f3 = @group.detect {|f| f.arguments[0].type == 'double' && f.arguments[1].type == 'Mat'}
237
+ f4 = @group.detect {|f| f.arguments[0].type == 'double' && f.arguments[1].type == 'MatND'}
238
+ hash = {'cv.Mat'=>f1, 'cv.MatND'=>f2, :number=> {'cv.Mat' => f3, 'cv.MatND' => f4}}
239
+ assert_equal hash, Dub::Argument.decision_tree(@group)
240
+ end
241
+ end
242
+
243
+ context 'A group of overloaded member methods' do
244
+ setup do
245
+ @group = namespacecv_xml[:cv][:Mat][:zeros]
246
+ end
247
+
248
+ should 'be ordered into a decision tree' do
249
+ f1 = @group.detect {|f| f.arguments[0].type == 'Size'}
250
+ f2 = @group.detect {|f| f.arguments[0].type == 'int'}
251
+ hash = {'cv.Size'=>f1, :number=> f2}
252
+ assert_equal hash, Dub::Argument.decision_tree(@group)
253
+ end
254
+ end
255
+
256
+ class MockArgument
257
+ attr_reader :type, :full_type
258
+ def initialize(type, full_type=nil, is_pointer=false)
259
+ @type = type
260
+ @full_type = full_type || type
261
+ @is_pointer = is_pointer
262
+ end
263
+ def is_pointer?
264
+ @is_pointer
265
+ end
266
+ end
267
+ context 'An int argument' do
268
+ should 'belong to the :number group' do
269
+ assert_equal :number, Dub::Argument.type_group(MockArgument.new('int'))
270
+ end
271
+ end
272
+
273
+ context 'A float argument' do
274
+ should 'belong to the :number group' do
275
+ assert_equal :number, Dub::Argument.type_group(MockArgument.new('float'))
276
+ end
277
+ end
278
+
279
+ context 'A double argument' do
280
+ setup do
281
+ @argument = namespacecv_xml[:cv][:resize].arguments[3]
282
+ end
283
+
284
+ should 'belong to the :number group' do
285
+ assert_equal :number, Dub::Argument.type_group(MockArgument.new('double'))
286
+ end
287
+
288
+ should 'create double type' do
289
+ assert_equal 'double ', @argument.create_type
290
+ end
291
+
292
+ should 'pass by value in call' do
293
+ assert_equal 'fx', @argument.in_call_type
294
+ end
295
+ end
296
+
297
+ context 'An array of C types' do
298
+ setup do
299
+ @argument = namespacedub_xml[:dub][:FMatrix][:FunkyThing].arguments.first
300
+ end
301
+
302
+ should 'return array count on array_count' do
303
+ assert_equal '[7]', @argument.array_suffix
304
+ end
305
+
306
+ should 'be passed as is' do
307
+ assert_equal 'v', @argument.name
308
+ end
309
+
310
+ should 'respond true to has_array_argumetns in method' do
311
+ assert namespacedub_xml[:dub][:FMatrix][:FunkyThing].has_array_arguments?
312
+ end
313
+
314
+ context 'bound to a generator' do
315
+ setup do
316
+ @method = namespacedub_xml[:dub][:FMatrix][:FunkyThing]
317
+ Dub::Lua.bind(@method)
318
+ end
319
+
320
+ should 'append array when creating receiver' do
321
+ assert_match %r{double\s+v\[7\]}, @method.to_s
322
+ end
323
+ end
324
+ end
325
+
326
+ context 'A custom class by ref' do
327
+ setup do
328
+ @argument = namespacecv_xml[:cv][:resize].arguments[0]
329
+ end
330
+
331
+ should 'belong to its own group' do
332
+ assert_equal 'cv.Mat', Dub::Argument.type_group(@argument)
333
+ end
334
+
335
+ should 'create a const pointer' do
336
+ assert_equal 'const Mat *', @argument.create_type
337
+ end
338
+
339
+ should 'pass by ref in call' do
340
+ assert_equal '*src', @argument.in_call_type
341
+ end
342
+
343
+ should 'know if argument is const' do
344
+ assert @argument.is_const?
345
+ end
346
+
347
+ should 'know if argument is passed by ref' do
348
+ assert @argument.is_ref?
349
+ end
350
+
351
+ should 'know that it is a pointer' do
352
+ assert !@argument.is_pointer?
353
+ end
354
+ end
355
+
356
+ context 'A pointer to a class' do
357
+ setup do
358
+ @argument = namespacecv_xml[:cv][:calcHist][0].arguments[0]
359
+ end
360
+
361
+ should 'belong to its own group' do
362
+ assert_equal 'cv.Mat', Dub::Argument.type_group(@argument)
363
+ end
364
+
365
+ should 'return type with namespace on id_name' do
366
+ assert_equal 'cv.Mat', @argument.id_name
367
+ end
368
+
369
+ should 'pass by value in call' do
370
+ assert_equal 'images', @argument.in_call_type
371
+ end
372
+
373
+ should 'know if argument is const' do
374
+ assert @argument.is_const?
375
+ end
376
+
377
+ should 'know if argument is passed by ref' do
378
+ assert !@argument.is_ref?
379
+ end
380
+
381
+ should 'know that it is a pointer' do
382
+ assert @argument.is_pointer?
383
+ end
384
+
385
+ should 'create a pointer' do
386
+ assert_equal 'const Mat *', @argument.create_type
387
+ end
388
+ end
389
+
390
+ context 'A pointer to a native type' do
391
+ setup do
392
+ @argument = namespacecv_xml[:cv][:calcHist][0].arguments[2]
393
+ end
394
+
395
+ should 'belong to the number_pointer group' do
396
+ assert_equal :number_ptr, Dub::Argument.type_group(MockArgument.new('int', 'int', true))
397
+ end
398
+
399
+ should 'pass by value in call' do
400
+ assert_equal 'channels', @argument.in_call_type
401
+ end
402
+
403
+ should 'know if argument is const' do
404
+ assert @argument.is_const?
405
+ end
406
+
407
+ should 'know if argument is passed by ref' do
408
+ assert !@argument.is_ref?
409
+ end
410
+
411
+ should 'know that it is a pointer' do
412
+ assert @argument.is_pointer?
413
+ end
414
+
415
+ should 'return the type without star' do
416
+ assert_equal 'int', @argument.type
417
+ end
418
+
419
+ should 'create a native type' do
420
+ assert_equal 'const int *', @argument.create_type
421
+ end
422
+ end
423
+ end
@@ -0,0 +1,54 @@
1
+ cmake_minimum_required(VERSION 2.6)
2
+ # ----------------------------------------------------------------------------
3
+ # CMake file for Lua. See root CMakeLists.txt
4
+ #
5
+ # ----------------------------------------------------------------------------
6
+ project(Matrix)
7
+
8
+ include_directories(
9
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
10
+ ${CMAKE_CURRENT_SOURCE_DIR}/vendor/lua
11
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/dub/lua
12
+ )
13
+
14
+ # ==============================================================================
15
+ #
16
+ # Platform guessing
17
+ #
18
+ # ==============================================================================
19
+ if(UNIX)
20
+ if(APPLE)
21
+ # macosx
22
+ set(PLAT_LINK "-bundle -undefined dynamic_lookup -all_load")
23
+ else(APPLE)
24
+ # linux
25
+ set(PLAT_LINK "-shared")
26
+ endif(APPLE)
27
+ else(UNIX)
28
+ if(WIN32)
29
+ # ?
30
+ else(WIN32)
31
+ # ?
32
+ endif(WIN32)
33
+ endif(UNIX)
34
+
35
+ # ----------------------------------------------------------------------------------
36
+ # Define the library target:
37
+ # ----------------------------------------------------------------------------------
38
+
39
+ set(the_target "Matrix")
40
+
41
+ file(GLOB lib_srcs bindings/*.cpp)
42
+ file(GLOB lib_hdrs bindings/*.h)
43
+ set(lib_ext_hdrs)
44
+
45
+ set(CMAKE_CXX_FLAGS "-DLUA_USE_DLOPEN -DLUA_USE_POSIX")
46
+ add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
47
+
48
+ set_target_properties(${the_target}
49
+ PROPERTIES OUTPUT_NAME "${the_target}"
50
+ #LINK_FLAGS ${PLAT_LINK}
51
+ PREFIX ""
52
+ SUFFIX ".a" #".so"
53
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vendor/lua
54
+ )