File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ pub struct Config {
76
76
no_build_target : bool ,
77
77
verbose_cmake : bool ,
78
78
verbose_make : bool ,
79
+ pic : Option < bool > ,
79
80
}
80
81
81
82
/// Builds the native library rooted at `path` with the default cmake options.
@@ -123,9 +124,16 @@ impl Config {
123
124
no_build_target : false ,
124
125
verbose_cmake : false ,
125
126
verbose_make : false ,
127
+ pic : None ,
126
128
}
127
129
}
128
130
131
+ /// Sets flag for PIC. Otherwise use cc::Build platform default
132
+ pub fn pic ( & mut self , explicit_flag : bool ) -> & mut Config {
133
+ self . pic = Some ( explicit_flag) ;
134
+ self
135
+ }
136
+
129
137
/// Sets the build-tool generator (`-G`) for this compilation.
130
138
pub fn generator < T : AsRef < OsStr > > ( & mut self , generator : T ) -> & mut Config {
131
139
self . generator = Some ( generator. as_ref ( ) . to_owned ( ) ) ;
@@ -345,6 +353,10 @@ impl Config {
345
353
c_cfg. static_crt ( static_crt) ;
346
354
cxx_cfg. static_crt ( static_crt) ;
347
355
}
356
+ if let Some ( explicit_flag) = self . pic {
357
+ c_cfg. pic ( explicit_flag) ;
358
+ cxx_cfg. pic ( explicit_flag) ;
359
+ }
348
360
let c_compiler = c_cfg. get_compiler ( ) ;
349
361
let cxx_compiler = cxx_cfg. get_compiler ( ) ;
350
362
let asm_compiler = c_cfg. get_compiler ( ) ;
You can’t perform that action at this time.
0 commit comments