forked from georust/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces a new `gdal-src` crate which bundles gdal and builds a minimal version from source via `build.rs` Fixes georust#465
- Loading branch information
Showing
9 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "gdal-src/source"] | ||
path = gdal-src/source | ||
url = https://github.com/OSGeo/gdal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "gdal-src" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
proj-sys = { version = "0.23.2", features = ["bundled_proj"] } | ||
libsqlite3-sys = { version = "0.27.0", features = ["bundled"] } | ||
|
||
[build-dependencies] | ||
cmake = "0.1.50" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
fn main() { | ||
let sqlite3_include_dir = | ||
std::env::var("DEP_SQLITE3_INCLUDE").expect("This is set by libsqlite3-sys"); | ||
let sqlite3_lib_dir = std::env::var("DEP_SQLITE3_LIB_DIR").expect("set by libsqlite3-sys"); | ||
let proj_root = std::env::var("DEP_PROJ_ROOT").expect("set by proj-sys"); | ||
|
||
let res = cmake::Config::new("source") | ||
.define("GDAL_BUILD_OPTIONAL_DRIVERS", "OFF") | ||
.define("OGR_BUILD_OPTIONAL_DRIVERS", "OFF") | ||
.define("GDAL_USE_INTERNAL_LIBS", "ON") | ||
.define("GDAL_USE_EXTERNAL_LIBS", "OFF") | ||
.define("BUILD_SHARED_LIBS", "OFF") | ||
.define("BUILD_STATIC_LIBS", "ON") | ||
.define("BUILD_APPS", "OFF") | ||
.define("BUILD_DOCS", "OFF") | ||
.define("BUILD_TESTING", "OFF") | ||
.define("BUILD_GMOCK", "OFF") | ||
.define("PROJ_INCLUDE_DIRS", format!("{proj_root}/include")) | ||
.define("PROJ_LIBRARY_DIRS", format!("{proj_root}/lib64/")) | ||
// enable the gpkg driver | ||
.define("GDAL_USE_SQLITE3", "ON") | ||
.define("SQLite3_INCLUDE_DIR", sqlite3_include_dir) | ||
.define("SQLite3_LIBRARY", format!("{sqlite3_lib_dir}/libsqlite3.a")) | ||
.define("OGR_ENABLE_DRIVER_GPKG", "ON") | ||
.pic(true) | ||
.build(); | ||
let lib_dir = res.join("lib64"); | ||
|
||
println!("cargo:rustc-link-lib=static={}", "gdal"); | ||
println!( | ||
"cargo:rustc-link-search=native={}", | ||
lib_dir.to_str().unwrap() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
extern crate libsqlite3_sys; | ||
extern crate proj_sys; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters