@@ -17,6 +17,7 @@ pub struct Build {
17
17
}
18
18
19
19
pub struct Artifacts {
20
+ include_dir : PathBuf ,
20
21
lib_dir : PathBuf ,
21
22
libs : Vec < String > ,
22
23
}
@@ -50,7 +51,11 @@ impl Build {
50
51
let out_dir = self . out_dir . as_ref ( ) . expect ( "OUT_DIR is not set" ) ;
51
52
let manifest_dir = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
52
53
let mut source_dir = manifest_dir. join ( version. source_dir ( ) ) ;
53
- let build_dir = out_dir. join ( "lua-build" ) ;
54
+ let include_dir = out_dir. join ( "include" ) ;
55
+
56
+ if !include_dir. exists ( ) {
57
+ fs:: create_dir_all ( & include_dir) . unwrap ( ) ;
58
+ }
54
59
55
60
let mut config = cc:: Build :: new ( ) ;
56
61
config. warnings ( false ) . cargo_metadata ( false ) ;
@@ -124,11 +129,16 @@ impl Build {
124
129
. flag ( "-w" ) // Suppress all warnings
125
130
. flag_if_supported ( "-fno-common" ) // Compile common globals like normal definitions
126
131
. add_files_by_ext ( & source_dir, "c" )
127
- . out_dir ( & build_dir )
132
+ . out_dir ( out_dir )
128
133
. compile ( version. lib_name ( ) ) ;
129
134
135
+ for f in & [ "lauxlib.h" , "lua.h" , "luaconf.h" , "lualib.h" ] {
136
+ fs:: copy ( source_dir. join ( f) , include_dir. join ( f) ) . unwrap ( ) ;
137
+ }
138
+
130
139
Artifacts {
131
- lib_dir : build_dir,
140
+ include_dir,
141
+ lib_dir : out_dir. clone ( ) ,
132
142
libs : vec ! [ version. lib_name( ) . to_string( ) ] ,
133
143
}
134
144
}
@@ -155,6 +165,10 @@ impl Version {
155
165
}
156
166
157
167
impl Artifacts {
168
+ pub fn include_dir ( & self ) -> & Path {
169
+ & self . include_dir
170
+ }
171
+
158
172
pub fn lib_dir ( & self ) -> & Path {
159
173
& self . lib_dir
160
174
}
0 commit comments