-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpremake5.lua
More file actions
150 lines (127 loc) · 3.37 KB
/
Copy pathpremake5.lua
File metadata and controls
150 lines (127 loc) · 3.37 KB
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
-- premake.lua
-- @Author : Dencer (tdaddon@163.com)
-- @Link : https://dengsir.github.io
-- @Date : 7/13/2019, 3:01:34 AM
workspace 'ObjEditing'
configurations { 'Debug', 'Release' }
location '.build'
symbols 'Full'
startproject 'ObjEditing'
flags {
'MultiProcessorCompile',
}
filter 'system:Windows'
architecture 'x86'
systemversion 'latest'
characterset 'MBCS'
staticruntime 'On'
defines { 'WIN32', '_WINDOWS' }
flags { 'Maps' }
filter 'configurations:Debug'
defines { '_DEBUG' }
filter 'configurations:Release'
defines { 'NDEBUG' }
optimize 'On'
project 'ObjEditing'
kind 'ConsoleApp'
language 'C++'
dependson { 'Lua' }
links { 'LibLua' }
files {
'src/*.c',
'src/*.cpp',
'src/*.h',
'src/*.hpp',
'src/**.lua',
'src/*.natvis',
}
removefiles {
'src/lua/**/main.lua',
'src/lua/**/init.lua',
}
vpaths {
['Source Files/*'] = {
'src/*.cpp',
'src/*.c',
},
['Header Files/*'] = {
'src/*.h',
},
['Lua Files/*'] = {
'src/lua/**.lua',
},
[''] = {
'**.natvis'
},
}
includedirs {
'3rd/lua',
'3rd/cmdline',
'.build',
'src'
}
filter 'system:Windows'
defines { 'PLATFORM_WINDOWS' }
filter 'system:macosx'
defines { 'PLATFORM_MACOS' }
filter 'system:linux'
defines { 'PLATFORM_LINUX' }
filter 'files:**.lua'
buildmessage 'Compiling %{file.name}'
buildinputs { 'bin/build.lua' }
buildcommands { [[%{ generateBuildLuaCommand(_ENV) }]] }
buildoutputs {
[[%{ getGeneratedSource(_ENV) }]],
[[%{ getGeneratedHeader(_ENV) }]],
}
compilebuildoutputs 'On'
group '3rd'
project 'LibLua'
kind 'StaticLib'
language 'C'
files {
'3rd/lua/*.h',
'3rd/lua/*.c',
}
removefiles {
'3rd/lua/lua.c',
'3rd/lua/luac.c',
}
vpaths {
['Header Files/*'] = {
'3rd/lua/*.h'
},
['Source Files/*'] = {
'3rd/lua/*.c',
}
}
project 'Lua'
kind 'ConsoleApp'
language 'C'
links { 'LibLua' }
files {
'3rd/lua/lua.c',
}
vpaths {
['Source Files/*'] = {
'3rd/lua/lua.c',
}
}
do -- for lua
function getGeneratedDir(_ENV)
return path.join(prj.location, path.getrelative(path.join(_MAIN_SCRIPT_DIR, 'src'), file.directory))
end
function getGeneratedSource(_ENV)
return path.join(getGeneratedDir(_ENV), file.basename .. '.lua.cpp')
end
function getGeneratedHeader(_ENV)
return path.join(getGeneratedDir(_ENV), file.basename .. '.lua.h')
end
function generateBuildLuaCommand(_ENV)
local luaExe = os.target() == 'windows' and 'Lua.exe' or 'Lua'
local lua = path.join(cfg.buildtarget.directory, luaExe)
local script = path.join(_MAIN_SCRIPT_DIR, 'bin/build.lua')
local out = getGeneratedDir(_ENV)
return string.format([["%s" "%s" "%s" "%s"]], lua, script, file.abspath, out)
end
end