Skip to content

Commit

Permalink
Merge pull request #176 from timberio/cmake-msvc
Browse files Browse the repository at this point in the history
Support CMake build on MSVC
  • Loading branch information
benesch authored Nov 30, 2019
2 parents 6e1ddb0 + 8973c58 commit d3a5e8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ jobs:
rust: stable
- os: osx
rust: stable
- os: windows
arch: amd64
rust: stable
env: FEATURES=cmake_build

script:
- if [[ "$RDKAFKA_RUN_TESTS" ]]; then ./test_suite.sh; else cargo build --verbose; fi
- if [[ "$RDKAFKA_RUN_TESTS" ]]; then ./test_suite.sh; else cargo build --verbose --features "$FEATURES"; fi

cache: cargo

Expand Down
9 changes: 9 additions & 0 deletions rdkafka-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ fn build_librdkafka() {
config.define("CMAKE_SYSTEM_NAME", system_name);
}
let dst = config.build();
#[cfg(target_env = "msvc")]
{
let profile = match &env::var("PROFILE").expect("Cannot determine build profile")[..] {
"release" | "bench" => "Release",
_ => "Debug"
};
println!("cargo:rustc-link-search=native={}/build/src/{}", dst.display(), profile);
}
#[cfg(not(target_env = "msvc"))]
println!("cargo:rustc-link-search=native={}/build/src", dst.display());
println!("cargo:rustc-link-lib=static=rdkafka");
}

0 comments on commit d3a5e8a

Please sign in to comment.