Lines Matching +full:cross +full:- +full:ios +full:- +full:build
1 // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
16 fn probe_library(library: &str, cargo_metadata: bool) -> Library { in probe_library()
23 Err(e) => panic!("can't find library {} via pkg-config: {:?}", library, e), in probe_library()
32 "grpc/third_party/abseil-cpp", in prepare_grpc()
40 update --init --recursive` first to build the project.", in prepare_grpc()
47 fn is_directory_empty<P: AsRef<Path>>(p: P) -> Result<bool, io::Error> { in is_directory_empty()
52 fn trim_start<'a>(s: &'a str, prefix: &str) -> Option<&'a str> { in trim_start()
63 let build_dir = format!("{}/build", env::var("OUT_DIR").unwrap()); in clean_up_stale_cache()
80 // See https://gitlab.kitware.com/cmake/cmake/-/issues/18959. in clean_up_stale_cache()
86 fn build_grpc(cc: &mut cc::Build, library: &str) { in build_grpc() argument
94 config.cxxflag("-stdlib=libc++"); in build_grpc()
97 // Ensure CoreFoundation be found in macos or ios in build_grpc()
99 || get_env("CARGO_CFG_TARGET_OS").map_or(false, |s| s == "ios") in build_grpc()
101 println!("cargo:rustc-link-lib=framework=CoreFoundation"); in build_grpc()
115 // Cross-compile support for iOS in build_grpc()
117 "aarch64-apple-ios" => { in build_grpc()
122 "armv7-apple-ios" => { in build_grpc()
127 "armv7s-apple-ios" => { in build_grpc()
132 "i386-apple-ios" => { in build_grpc()
137 "x86_64-apple-ios" => { in build_grpc()
153 // We don't need to build csharp target. in build_grpc()
155 // We don't need to build codegen target. in build_grpc()
157 // We don't need to build benchmarks. in build_grpc()
161 if cfg!(feature = "openssl-vendored") { in build_grpc()
167 if cfg!(feature = "no-omit-frame-pointer") { in build_grpc()
169 .cflag("-fno-omit-frame-pointer") in build_grpc()
170 .cxxflag("-fno-omit-frame-pointer"); in build_grpc()
172 // Uses zlib from libz-sys. in build_grpc()
174 config.build_target(library).uses_cxx11().build() in build_grpc()
182 let build_dir = format!("{}/build", dst.display()); in build_grpc()
187 "cargo:rustc-link-search=native={}", in build_grpc()
199 if let Some(s) = lib.strip_prefix("-l") { in build_grpc()
210 println!("cargo:rustc-link-lib=static={}", l); in build_grpc()
214 if cfg!(feature = "openssl") && !cfg!(feature = "openssl-vendored") { in build_grpc()
217 println!("cargo:rustc-link-lib=static=ssl"); in build_grpc()
218 println!("cargo:rustc-link-lib=static=crypto"); in build_grpc()
222 println!("cargo:rustc-link-lib=static=upb"); in build_grpc()
223 println!("cargo:rustc-link-lib=static=cares"); in build_grpc()
224 println!("cargo:rustc-link-lib=static=z"); in build_grpc()
225 println!("cargo:rustc-link-lib=static=address_sorting"); in build_grpc()
242 "cargo:rustc-link-search=native={}", in figure_ssl_path()
254 println!("cargo:rustc-link-lib=ssl"); in figure_ssl_path()
255 println!("cargo:rustc-link-lib=crypto"); in figure_ssl_path()
259 let boringssl_artifact = boringssl_src::Build::new().build(); in build_boringssl()
266 "cargo:rustc-link-search=native={}", in build_boringssl()
274 // cmake script expect libz.a being under ${DEP_Z_ROOT}/lib, but libz-sys crate put it in setup_libz()
275 // under ${DEP_Z_ROOT}/build. Append the path to CMAKE_PREFIX_PATH to get around it. in setup_libz()
278 format!("{};{}/build", prefix_path, zlib_root) in setup_libz()
280 format!("{}/build", zlib_root) in setup_libz()
283 println!("cargo:rustc-link-search=native={}/build", zlib_root); in setup_libz()
284 println!("cargo:rustc-link-search=native={}/lib", zlib_root); in setup_libz()
288 fn get_env(name: &str) -> Option<String> { in get_env()
289 println!("cargo:rerun-if-env-changed={}", name); in get_env()
299 // Generate the bindings to grpc C-core.
300 // Try to disable the generation of platform-related bindings.
301 #[cfg(feature = "use-bindgen")]
306 config = config.clang_arg("-DGRPC_SYS_SECURE"); in bindgen_grpc()
310 config = config.clang_arg("-D _WIN32_WINNT=0x600"); in bindgen_grpc()
335 println!("cargo:rerun-if-env-changed=TEST_BIND"); in bindgen_grpc()
340 .clang_arg("-xc++") in bindgen_grpc()
341 .clang_arg("-I./grpc/include") in bindgen_grpc()
342 .clang_arg("-std=c++11") in bindgen_grpc()
381 "x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu" => { in config_binding_path()
382 // Cargo treats nonexistent files changed, so we only emit the rerun-if-changed in config_binding_path()
383 // directive when we expect the target-specific pre-generated binding file to be in config_binding_path()
385 println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target); in config_binding_path()
389 .join(format!("{}-bindings.rs", &target)); in config_binding_path()
391 #[cfg(feature = "use-bindgen")] in config_binding_path()
399 let file_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("grpc-bindings.rs"); in config_binding_path()
401 #[cfg(feature = "use-bindgen")] in config_binding_path()
409 "cargo:rustc-env=BINDING_PATH={}", in config_binding_path()
415 println!("cargo:rerun-if-changed=grpc_wrap.cc"); in main()
416 println!("cargo:rerun-if-changed=grpc"); in main()
417 println!("cargo:rerun-if-env-changed=UPDATE_BIND"); in main()
420 let mut cc = cc::Build::new(); in main()
446 cc.flag("-std=c++11"); in main()