-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake4.lua
72 lines (61 loc) · 2.13 KB
/
premake4.lua
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
for _,arg in ipairs(_ARGS) do
if arg == 'debug' then debug_compiler = true
elseif arg == 'html' then html = true
elseif arg == 'm' then m = true
elseif arg == 'dl' then dl = true
elseif arg == 'no-pattern' then no_pattern = true
elseif arg == 'no-dynlib' then no_dynlib = true
elseif arg == 'no-io' then no_io = true
elseif arg == 'generate' then generate = true
elseif arg == 'no-socket' then no_socket = true
elseif arg == 'winsock' then winsock = true
elseif arg == 'pthread' then pthread = true
else error('Unknown argument: ' .. arg) end
end
function create_project(k)
kind(k)
language 'C'
targetdir ''
platforms { 'native', 'x32', 'x64' }
includedirs { 'lua', 'src/vm' }
defines { '_CRT_SECURE_NO_WARNINGS' }
if k == 'ConsoleApp' then
files {
'src/repl/saurus.c'
}
links { 'libsaurus' }
if html then targetextension '.html' end
else
files {
'src/vm/*.h', 'src/vm/*.c',
'src/compiler/*.c',
'lua/**.h', 'lua/**.c'
}
targetname 'saurus'
end
if m then links { 'm' } end
if dl then links { 'dl' } end
if winsock then links { 'WS2_32' } end
if pthread then links { 'pthread' } end
if no_pattern then defines { 'SU_OPT_NO_PATTERN' } end
if no_socket then defines { 'SU_OPT_NO_SOCKET' } end
if os.getenv('SU_OPT_NO_FILE_IO') or no_io then defines { 'SU_OPT_NO_FILE_IO' } end
if os.getenv('SU_OPT_NO_DYNLIB') or no_dynlib then defines { 'SU_OPT_NO_DYNLIB' } end
end
if generate then
require 'pack'
assert(os.execute('saurus -c src/repl/saurus.su src/repl/saurus.c') == 0)
assert(os.execute('saurus -c src/compiler/compiler.su src/compiler/compiler.c') == 0)
end
solution 'saurus'
configurations { 'Debug', 'Release' }
configuration 'Debug'
defines { 'DEBUG' }
flags { 'Symbols' }
configuration 'Release'
defines { 'RELEASE' }
flags { 'Optimize' }
project 'saurus'
create_project 'ConsoleApp'
project 'libsaurus'
create_project 'StaticLib'