@@ -17,7 +17,6 @@ pub struct Build {
1717}
1818
1919pub struct Artifacts {
20- include_dir : PathBuf ,
2120 lib_dir : PathBuf ,
2221 libs : Vec < String > ,
2322 cpp_stdlib : Option < String > ,
@@ -77,8 +76,6 @@ impl Build {
7776 let target = & self . target . as_ref ( ) . expect ( "TARGET not set" ) [ ..] ;
7877 let host = & self . host . as_ref ( ) . expect ( "HOST not set" ) [ ..] ;
7978 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" ) ;
8279
8380 let source_dir_base = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
8481 let common_include_dir = source_dir_base. join ( "luau" ) . join ( "Common" ) . join ( "include" ) ;
@@ -96,15 +93,9 @@ impl Build {
9693 let vm_include_dir = source_dir_base. join ( "luau" ) . join ( "VM" ) . join ( "include" ) ;
9794
9895 // 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 ( ) ;
10198 }
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 ( ) ;
10899
109100 // Configure C++
110101 let mut config = cc:: Build :: new ( ) ;
@@ -144,7 +135,7 @@ impl Build {
144135 . include ( & ast_include_dir)
145136 . include ( & common_include_dir)
146137 . add_files_by_ext ( & ast_source_dir, "cpp" )
147- . out_dir ( & lib_dir )
138+ . out_dir ( & out_dir )
148139 . compile ( ast_lib_name) ;
149140
150141 // Build CogeGen
@@ -164,7 +155,7 @@ impl Build {
164155 // Code generator uses lua VM internals, so we need to provide the same defines used to build VM
165156 . define ( "LUA_API" , "extern \" C\" " )
166157 . add_files_by_ext ( & codegen_source_dir, "cpp" )
167- . out_dir ( & lib_dir )
158+ . out_dir ( & out_dir )
168159 . compile ( codegen_lib_name) ;
169160 }
170161
@@ -177,7 +168,7 @@ impl Build {
177168 . include ( & common_include_dir)
178169 . define ( "LUACODE_API" , "extern \" C\" " )
179170 . add_files_by_ext ( & compiler_source_dir, "cpp" )
180- . out_dir ( & lib_dir )
171+ . out_dir ( & out_dir )
181172 . compile ( compiler_lib_name) ;
182173
183174 // Build customization lib
@@ -188,7 +179,7 @@ impl Build {
188179 . include ( & vm_source_dir)
189180 . include ( & common_include_dir)
190181 . add_files_by_ext ( & custom_source_dir, "cpp" )
191- . out_dir ( & lib_dir )
182+ . out_dir ( & out_dir )
192183 . compile ( custom_lib_name) ;
193184
194185 // Build VM
@@ -199,20 +190,11 @@ impl Build {
199190 . include ( & common_include_dir)
200191 . define ( "LUA_API" , "extern \" C\" " )
201192 . add_files_by_ext ( & vm_source_dir, "cpp" )
202- . out_dir ( & lib_dir )
193+ . out_dir ( & out_dir )
203194 . compile ( vm_lib_name) ;
204195
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-
213196 let mut artifacts = Artifacts {
214- lib_dir,
215- include_dir,
197+ lib_dir : out_dir. to_path_buf ( ) ,
216198 libs : vec ! [
217199 vm_lib_name. to_string( ) ,
218200 compiler_lib_name. to_string( ) ,
@@ -263,10 +245,6 @@ impl Build {
263245}
264246
265247impl Artifacts {
266- pub fn include_dir ( & self ) -> & Path {
267- & self . include_dir
268- }
269-
270248 pub fn lib_dir ( & self ) -> & Path {
271249 & self . lib_dir
272250 }
0 commit comments