Fix c_impl not installing to lib/ for Debug

This commit is contained in:
Stephen Seo 2019-04-22 18:27:34 +09:00
parent 5dd42a6e23
commit dc5ba1bf14
2 changed files with 3 additions and 6 deletions

View file

@ -40,7 +40,7 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_include_directories(NetworkTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) target_include_directories(NetworkTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif() endif()
install(TARGETS UDPConnection CONFIGURATIONS Release DESTINATION lib) install(TARGETS UDPConnection DESTINATION lib)
install(FILES install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/UDPConnection.h ${CMAKE_CURRENT_SOURCE_DIR}/src/UDPConnection.h
${CMAKE_CURRENT_SOURCE_DIR}/src/UDPC_Defines.h ${CMAKE_CURRENT_SOURCE_DIR}/src/UDPC_Defines.h

View file

@ -6,16 +6,13 @@ use std::path::PathBuf;
fn main() { fn main() {
let mut config = Config::new("../c_impl"); let mut config = Config::new("../c_impl");
let mut dst: PathBuf;
if env::var("PROFILE").unwrap().eq("release") { if env::var("PROFILE").unwrap().eq("release") {
config.define("CMAKE_BUILD_TYPE", "Release"); config.define("CMAKE_BUILD_TYPE", "Release");
dst = config.build();
dst.push("lib");
} else { } else {
config.define("CMAKE_BUILD_TYPE", "Debug"); config.define("CMAKE_BUILD_TYPE", "Debug");
dst = config.build();
dst.push("build");
} }
let mut dst = config.build();
dst.push("lib");
println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=UDPConnection"); println!("cargo:rustc-link-lib=static=UDPConnection");