Skip to content

Commit

Permalink
Surrender and disable the option to build MEOS from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
Davichet-e committed Oct 17, 2024
1 parent eeaddea commit 99e82bb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 68 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ edition = "2021"

[dependencies]
paste = "1.0.15"
meos-sys = { path = "sys", version = "0.1.5", features=["bundled_proj"] }
meos-sys = { path = "sys", version = "0.1.5" }
chrono = "0.4.38"
libc = "0.2.155"
bitmask-enum = "2.2.4"
geos = { version = "9.0.0", optional = true }

[features]
default = ["geos"]
geos = ["dep:geos"]

[dev-dependencies]
csv = "1.3.0"
Expand Down
5 changes: 2 additions & 3 deletions sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ edition = "2021"
links = "meos"

[dependencies]
meos-src = { path = "./meos-src", version = "0.1.3", optional = true }

[build-dependencies]
pkg-config = "0.3.30"
cmake = "0.1"
bindgen = { version = "0.70.1", optional = true}
bindgen = { version = "0.70.1", optional = true }

[features]
default = ["v1_2"]
v1_1 = []
v1_2 = []

buildtime_bindgen = ["dep:bindgen", "meos-src"]
buildtime_bindgen = ["dep:bindgen"]
bundled_proj = ["buildtime_bindgen"]
4 changes: 0 additions & 4 deletions sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ DYLD_FALLBACK_LIBRARY_PATH=<path to MEOS>/lib MEOS_LIB_DIR=<path to MEOS>/lib ME

```

---

You can also enable the `bundled_proj` feature to build MEOS from scratch, (note that you will need to already have installed `json-c`, `proj`, and `geos` in your system, see [here](https://github.com/MobilityDB/MobilityDB/?tab=readme-ov-file#requirements)).

## Binding generation
By default, meos-sys will use the pregenerated bindings for the 1.2 version, the 1.1 ones is also available. Alternatively, you can generate your own bindings from your `libmeos` installation by specifying the `bindgen` feature.

Expand Down
45 changes: 16 additions & 29 deletions sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,26 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=MEOS_LIB_DIR");

// If `bundled_proj` is on, use the git submodule to build MEOS from scratch
let include_path = if cfg!(feature = "bundled_proj") {
let meos_path = std::env::var("DEP_MEOSSRC_SEARCH").unwrap();
let pk_include_path = detect_meos_via_pkg_config();

println!("cargo:rustc-link-search=dylib={}", meos_path);
// Try to find the library manually
let include_path = if !pk_include_path.is_some() {
let default_include_path = String::from("/usr/local/lib/");
let lib_dir_env = env::var_os("MEOS_LIB_DIR")
.map(OsString::into_string)
.transpose()
.ok()
.flatten()
.unwrap_or(default_include_path.clone());

// Tell cargo to tell rustc to link the system meos shared library.
println!("cargo:rustc-link-lib=meos");
// Tell cargo to look for shared libraries in the specified directory
println!("cargo:rustc-link-search={lib_dir_env}");

meos_path
// Else use pkg-config, using a default as a fallback
// Tell cargo to tell rustc to link the system meos shared library.
println!("cargo:rustc-link-lib=dylib=meos");
default_include_path
} else {
let pk_include_path = detect_meos_via_pkg_config();

// Try to find the library manually
if !pk_include_path.is_some() {
let default_include_path = String::from("/usr/local/lib/");
let lib_dir_env = env::var_os("MEOS_LIB_DIR")
.map(OsString::into_string)
.transpose()
.ok()
.flatten()
.unwrap_or(default_include_path.clone());

// Tell cargo to look for shared libraries in the specified directory
println!("cargo:rustc-link-search={lib_dir_env}");

// Tell cargo to tell rustc to link the system meos shared library.
println!("cargo:rustc-link-lib=dylib=meos");
default_include_path
} else {
pk_include_path.unwrap().display().to_string()
}
pk_include_path.unwrap().display().to_string()
};

#[cfg(feature = "buildtime_bindgen")]
Expand Down
14 changes: 0 additions & 14 deletions sys/meos-src/Cargo.toml

This file was deleted.

11 changes: 0 additions & 11 deletions sys/meos-src/build.rs

This file was deleted.

1 change: 0 additions & 1 deletion sys/meos-src/source
Submodule source deleted from 256556
1 change: 0 additions & 1 deletion sys/meos-src/src/lib.rs

This file was deleted.

0 comments on commit 99e82bb

Please sign in to comment.