Skip to content

Commit

Permalink
feat!: use build from pkg as the default feature
Browse files Browse the repository at this point in the history
  • Loading branch information
chiichen committed May 23, 2024
1 parent ed95679 commit 90bcf30
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:
- name: Install Rust nightly
run : rustup update nightly
- name: Build
run: cargo build -p libvnc-sys --features "source" --verbose
run: cargo build -p libvnc --no-default-features --verbose
- name: Test
run: cargo test -p libvnc-sys --features "source" --verbose
run: cargo test -p libvnc --no-default-features --verbose
2 changes: 1 addition & 1 deletion libvnc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ cmake = "0.1.50"

[features]
default = []
source = []
pkg = [] #Build from libvncserver package
5 changes: 3 additions & 2 deletions libvnc-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::path::PathBuf;

#[cfg(not(feature = "source"))]
#[cfg(feature = "pkg")]
fn bindgen_vncserver() {
let libvncserver =
pkg_config::probe_library("libvncserver").expect("libvncserver package not found. Please install libvncserver/libvncserver-dev/libvncserver-devel with your package manager ");
Expand Down Expand Up @@ -40,7 +40,7 @@ fn bindgen_vncserver() {
.write_to_file(out_path.join("rfb.rs"))
.expect("couldn't write bindings!");
}
#[cfg(feature = "source")]
#[cfg(not(feature = "pkg"))]
fn bindgen_vncserver() {
#[cfg(target_os = "android")]
compile_error!("Unsupported Target Android");
Expand All @@ -51,6 +51,7 @@ fn bindgen_vncserver() {
"CMAKE_TOOLCHAIN_FILE",
"../cmake/Toolchain-cross-mingw32-linux.cmake",
);
//TODO In WSL, if QT is installed in Windows system, then the build process might fail on Qt example.
let dst = config.build();
println!("cargo:rustc-link-lib=dylib=vncserver");
println!("cargo:rustc-link-lib=dylib=vncclient"); //There's no libvncclient , so we need to specify the vncclient manually
Expand Down
4 changes: 4 additions & 0 deletions libvnc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ log = "0.4.21"

[dev-dependencies]
libc = "0.2.154"

[features]
default = ["pkg"]
pkg = ["libvnc-sys/pkg"]

0 comments on commit 90bcf30

Please sign in to comment.