@@ -72,6 +72,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
72
72
// returns the path of "include" for the built proj
73
73
fn build_from_source ( ) -> Result < std:: path:: PathBuf , Box < dyn std:: error:: Error > > {
74
74
eprintln ! ( "building libproj from source" ) ;
75
+ println ! ( "cargo:rustc-cfg=bundled_build" ) ;
75
76
if let Ok ( val) = & env:: var ( "_PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC" ) {
76
77
if val == "0" {
77
78
panic ! (
@@ -80,7 +81,6 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
80
81
}
81
82
}
82
83
83
- // NOTE: The PROJ build expects Sqlite3 to be present on the system.
84
84
let path = "PROJSRC/proj-9.3.1.tar.gz" ;
85
85
let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
86
86
let tar_gz = File :: open ( path) ?;
@@ -98,6 +98,14 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
98
98
config. define ( "BUILD_PROJINFO" , "OFF" ) ;
99
99
config. define ( "BUILD_PROJSYNC" , "OFF" ) ;
100
100
config. define ( "ENABLE_CURL" , "OFF" ) ;
101
+ config. define (
102
+ "SQLITE3_INCLUDE_DIR" ,
103
+ std:: env:: var ( "DEP_SQLITE3_INCLUDE" ) . expect ( "This is set by libsqlite3-sys" ) ,
104
+ ) ;
105
+ config. define (
106
+ "SQLITE3_LIBRARY" ,
107
+ format ! ( "{}/libsqlite3.a" , std:: env:: var( "DEP_SQLITE3_LIB_DIR" ) . unwrap( ) ) ,
108
+ ) ;
101
109
102
110
if cfg ! ( feature = "tiff" ) {
103
111
eprintln ! ( "enabling tiff support" ) ;
@@ -132,9 +140,6 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
132
140
& out_path. join( "build/lib" ) . display( )
133
141
) ;
134
142
135
- // The PROJ library needs SQLite and the C++ standard library.
136
- println ! ( "cargo:rustc-link-lib=dylib=sqlite3" ) ;
137
-
138
143
if cfg ! ( feature = "tiff" ) {
139
144
// On platforms like apples aarch64, users are likely to have installed libtiff with homebrew,
140
145
// which isn't in the default search path, so try to determine path from pkg-config
@@ -159,13 +164,5 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
159
164
println ! ( "cargo:rustc-link-lib=dylib=tiff" ) ;
160
165
}
161
166
162
- if cfg ! ( target_os = "linux" ) {
163
- println ! ( "cargo:rustc-link-lib=dylib=stdc++" ) ;
164
- } else if cfg ! ( target_os = "macos" ) {
165
- println ! ( "cargo:rustc-link-lib=dylib=c++" ) ;
166
- } else {
167
- println ! ( "cargo:warning=proj-sys: Not configuring an explicit C++ standard library on this target." ) ;
168
- }
169
-
170
167
Ok ( proj. join ( "include" ) )
171
168
}
0 commit comments