@@ -17,7 +17,6 @@ pub struct Build {
17
17
}
18
18
19
19
pub struct Artifacts {
20
- include_dir : PathBuf ,
21
20
lib_dir : PathBuf ,
22
21
libs : Vec < String > ,
23
22
cpp_stdlib : Option < String > ,
@@ -77,8 +76,6 @@ impl Build {
77
76
let target = & self . target . as_ref ( ) . expect ( "TARGET not set" ) [ ..] ;
78
77
let host = & self . host . as_ref ( ) . expect ( "HOST not set" ) [ ..] ;
79
78
let out_dir = self . out_dir . as_ref ( ) . expect ( "OUT_DIR not set" ) ;
80
- let lib_dir = out_dir. join ( "lib" ) ;
81
- let include_dir = out_dir. join ( "include" ) ;
82
79
83
80
let source_dir_base = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
84
81
let common_include_dir = source_dir_base. join ( "luau" ) . join ( "Common" ) . join ( "include" ) ;
@@ -96,15 +93,9 @@ impl Build {
96
93
let vm_include_dir = source_dir_base. join ( "luau" ) . join ( "VM" ) . join ( "include" ) ;
97
94
98
95
// Cleanup
99
- if lib_dir . exists ( ) {
100
- fs:: remove_dir_all ( & lib_dir ) . unwrap ( ) ;
96
+ if out_dir . exists ( ) {
97
+ fs:: remove_dir_all ( & out_dir ) . unwrap ( ) ;
101
98
}
102
- fs:: create_dir_all ( & lib_dir) . unwrap ( ) ;
103
-
104
- if include_dir. exists ( ) {
105
- fs:: remove_dir_all ( & include_dir) . unwrap ( ) ;
106
- }
107
- fs:: create_dir_all ( & include_dir) . unwrap ( ) ;
108
99
109
100
// Configure C++
110
101
let mut config = cc:: Build :: new ( ) ;
@@ -144,7 +135,7 @@ impl Build {
144
135
. include ( & ast_include_dir)
145
136
. include ( & common_include_dir)
146
137
. add_files_by_ext ( & ast_source_dir, "cpp" )
147
- . out_dir ( & lib_dir )
138
+ . out_dir ( & out_dir )
148
139
. compile ( ast_lib_name) ;
149
140
150
141
// Build CogeGen
@@ -164,7 +155,7 @@ impl Build {
164
155
// Code generator uses lua VM internals, so we need to provide the same defines used to build VM
165
156
. define ( "LUA_API" , "extern \" C\" " )
166
157
. add_files_by_ext ( & codegen_source_dir, "cpp" )
167
- . out_dir ( & lib_dir )
158
+ . out_dir ( & out_dir )
168
159
. compile ( codegen_lib_name) ;
169
160
}
170
161
@@ -177,7 +168,7 @@ impl Build {
177
168
. include ( & common_include_dir)
178
169
. define ( "LUACODE_API" , "extern \" C\" " )
179
170
. add_files_by_ext ( & compiler_source_dir, "cpp" )
180
- . out_dir ( & lib_dir )
171
+ . out_dir ( & out_dir )
181
172
. compile ( compiler_lib_name) ;
182
173
183
174
// Build customization lib
@@ -188,7 +179,7 @@ impl Build {
188
179
. include ( & vm_source_dir)
189
180
. include ( & common_include_dir)
190
181
. add_files_by_ext ( & custom_source_dir, "cpp" )
191
- . out_dir ( & lib_dir )
182
+ . out_dir ( & out_dir )
192
183
. compile ( custom_lib_name) ;
193
184
194
185
// Build VM
@@ -199,20 +190,11 @@ impl Build {
199
190
. include ( & common_include_dir)
200
191
. define ( "LUA_API" , "extern \" C\" " )
201
192
. add_files_by_ext ( & vm_source_dir, "cpp" )
202
- . out_dir ( & lib_dir )
193
+ . out_dir ( & out_dir )
203
194
. compile ( vm_lib_name) ;
204
195
205
- for f in & [ "lua.h" , "luaconf.h" , "lualib.h" ] {
206
- fs:: copy ( vm_include_dir. join ( f) , include_dir. join ( f) ) . unwrap ( ) ;
207
- }
208
- #[ allow( clippy:: single_element_loop) ]
209
- for f in & [ "luacode.h" ] {
210
- fs:: copy ( compiler_include_dir. join ( f) , include_dir. join ( f) ) . unwrap ( ) ;
211
- }
212
-
213
196
let mut artifacts = Artifacts {
214
- lib_dir,
215
- include_dir,
197
+ lib_dir : out_dir. to_path_buf ( ) ,
216
198
libs : vec ! [
217
199
vm_lib_name. to_string( ) ,
218
200
compiler_lib_name. to_string( ) ,
@@ -263,10 +245,6 @@ impl Build {
263
245
}
264
246
265
247
impl Artifacts {
266
- pub fn include_dir ( & self ) -> & Path {
267
- & self . include_dir
268
- }
269
-
270
248
pub fn lib_dir ( & self ) -> & Path {
271
249
& self . lib_dir
272
250
}
0 commit comments