File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1
1
target
2
2
Cargo.lock
3
+ lumol.so
Original file line number Diff line number Diff line change 2
2
name = " lumol-py"
3
3
version = " 0.1.0"
4
4
authors = [" Guillaume Fraux <guillaume.fraux@ens.fr>" ]
5
+ build = " build.rs"
5
6
6
7
[dependencies ]
7
8
lumol = {git = " https://github.com/lumol-org/lumol" , rev = " 11503ea" }
Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+ use std:: path:: { Path , PathBuf } ;
3
+ use std:: io:: Result ;
4
+ use std:: fs;
5
+
6
+ #[ cfg( unix) ]
7
+ fn symlink < P : AsRef < Path > , Q : AsRef < Path > > ( src : P , dst : Q ) -> Result < ( ) > {
8
+ use std:: os:: unix:: fs;
9
+ return fs:: symlink ( src, dst) ;
10
+ }
11
+
12
+ #[ cfg( windows) ]
13
+ fn symlink < P : AsRef < Path > , Q : AsRef < Path > > ( src : P , dst : Q ) -> Result < ( ) > {
14
+ use std:: os:: windws:: fs;
15
+ return fs:: symlink_file ( src, dst) ;
16
+ }
17
+
18
+ fn dynlib_ext ( ) -> & ' static str {
19
+ if cfg ! ( target_os="macos" ) {
20
+ ".dylib"
21
+ } else if cfg ! ( target_os="linux" ) {
22
+ ".so"
23
+ } else if cfg ! ( windows) {
24
+ ".dll"
25
+ } else {
26
+ panic ! ( "Missing dynamic library extension for this platform. Please edit 'build.rs'" ) ;
27
+ }
28
+ }
29
+
30
+ fn main ( ) {
31
+ let profile = env:: var ( "PROFILE" ) . unwrap ( ) ;
32
+ let libname = String :: from ( "liblumol_py" ) + dynlib_ext ( ) ;
33
+ let library = PathBuf :: from ( "target" ) . join ( profile) . join ( libname) ;
34
+ let link = Path :: new ( "./lumol.so" ) ;
35
+
36
+ if link. symlink_metadata ( ) . is_ok ( ) {
37
+ fs:: remove_file ( link) . expect ( "Could not remove symbolic link" ) ;
38
+ }
39
+
40
+ symlink ( library, link) . expect ( "Could not create symbolic link" ) ;
41
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments