]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs
Rollup merge of #99736 - lopopolo:lopopolo/gh-80996-partial-stabilization-bounds...
[rust.git] / src / test / run-make / x86_64-fortanix-unknown-sgx-lvi / enclave / build.rs
1 fn main() {
2     cc::Build::new()
3         .file("foo.c")
4         .compile("foo_c");
5
6     cc::Build::new()
7         .file("foo_asm.s")
8         .compile("foo_asm");
9
10     cc::Build::new()
11         .cpp(true)
12         .cpp_set_stdlib(None)
13         .file("foo_cxx.cpp")
14         .compile("foo_cxx");
15
16     // When the cmake crate detects the clang compiler, it passes the
17     //  "--target" argument to the linker which subsequently fails. The
18     //  `CMAKE_C_COMPILER_FORCED` option makes sure that `cmake` does not
19     //  tries to test the compiler. From version 3.6 the option
20     //  `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` can be used
21     //  https://cmake.org/cmake/help/v3.5/module/CMakeForceCompiler.html
22     let dst = cmake::Config::new("libcmake_foo")
23                 .build_target("cmake_foo")
24                 .define("CMAKE_C_COMPILER_FORCED", "1")
25                 .define("CMAKE_CXX_COMPILER_FORCED", "1")
26                 .define("CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY", "1")
27                 .build();
28     println!("cargo:rustc-link-search=native={}/build/", dst.display());
29     println!("cargo:rustc-link-lib=static=cmake_foo");
30 }