@@ -72,6 +72,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
7272// returns the path of "include" for the built proj
7373fn build_from_source ( ) -> Result < std:: path:: PathBuf , Box < dyn std:: error:: Error > > {
7474 eprintln ! ( "building libproj from source" ) ;
75+ println ! ( "cargo:rustc-cfg=bundled_build" ) ;
7576 if let Ok ( val) = & env:: var ( "_PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC" ) {
7677 if val == "0" {
7778 panic ! (
@@ -80,7 +81,6 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
8081 }
8182 }
8283
83- // NOTE: The PROJ build expects Sqlite3 to be present on the system.
8484 let path = "PROJSRC/proj-9.3.1.tar.gz" ;
8585 let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
8686 let tar_gz = File :: open ( path) ?;
@@ -98,6 +98,14 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
9898 config. define ( "BUILD_PROJINFO" , "OFF" ) ;
9999 config. define ( "BUILD_PROJSYNC" , "OFF" ) ;
100100 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+ ) ;
101109
102110 if cfg ! ( feature = "tiff" ) {
103111 eprintln ! ( "enabling tiff support" ) ;
@@ -132,9 +140,6 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
132140 & out_path. join( "build/lib" ) . display( )
133141 ) ;
134142
135- // The PROJ library needs SQLite and the C++ standard library.
136- println ! ( "cargo:rustc-link-lib=dylib=sqlite3" ) ;
137-
138143 if cfg ! ( feature = "tiff" ) {
139144 // On platforms like apples aarch64, users are likely to have installed libtiff with homebrew,
140145 // 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>>
159164 println ! ( "cargo:rustc-link-lib=dylib=tiff" ) ;
160165 }
161166
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-
170167 Ok ( proj. join ( "include" ) )
171168}
0 commit comments