Add is_msvc function · rust-lang/rust@b3c9ffd (original) (raw)

`@@ -98,7 +98,7 @@ pub fn prebuilt_llvm_config(

`

98

98

`let out_dir = builder.llvm_out(target);

`

99

99

``

100

100

`let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);

`

101

``

`-

if !builder.config.build.contains("msvc") || builder.ninja() {

`

``

101

`+

if !builder.config.build.is_msvc() || builder.ninja() {

`

102

102

` llvm_config_ret_dir.push("build");

`

103

103

`}

`

104

104

` llvm_config_ret_dir.push("bin");

`

`@@ -411,7 +411,7 @@ impl Step for Llvm {

`

411

411

` ldflags.shared.push(" -latomic");

`

412

412

`}

`

413

413

``

414

``

`-

if target.contains("msvc") {

`

``

414

`+

if target.is_msvc() {

`

415

415

` cfg.define("LLVM_USE_CRT_DEBUG", "MT");

`

416

416

` cfg.define("LLVM_USE_CRT_RELEASE", "MT");

`

417

417

` cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT");

`

`@@ -644,7 +644,7 @@ fn configure_cmake(

`

644

644

`}

`

645

645

``

646

646

`let sanitize_cc = |cc: &Path| {

`

647

``

`-

if target.contains("msvc") {

`

``

647

`+

if target.is_msvc() {

`

648

648

`OsString::from(cc.to_str().unwrap().replace("\", "/"))

`

649

649

`} else {

`

650

650

` cc.as_os_str().to_owned()

`

`@@ -654,7 +654,7 @@ fn configure_cmake(

`

654

654

`// MSVC with CMake uses msbuild by default which doesn't respect these

`

655

655

`// vars that we'd otherwise configure. In that case we just skip this

`

656

656

`// entirely.

`

657

``

`-

if target.contains("msvc") && !builder.ninja() {

`

``

657

`+

if target.is_msvc() && !builder.ninja() {

`

658

658

`return;

`

659

659

`}

`

660

660

``

`@@ -664,7 +664,7 @@ fn configure_cmake(

`

664

664

`};

`

665

665

``

666

666

`// Handle msvc + ninja + ccache specially (this is what the bots use)

`

667

``

`-

if target.contains("msvc") && builder.ninja() && builder.config.ccache.is_some() {

`

``

667

`+

if target.is_msvc() && builder.ninja() && builder.config.ccache.is_some() {

`

668

668

`let mut wrap_cc = env::current_exe().expect("failed to get cwd");

`

669

669

` wrap_cc.set_file_name("sccache-plus-cl.exe");

`

670

670

``

`@@ -768,7 +768,7 @@ fn configure_cmake(

`

768

768

`// For distribution we want the LLVM tools to be statically linked to libstdc++.

`

769

769

`// We also do this if the user explicitly requested static libstdc++.

`

770

770

`if builder.config.llvm_static_stdcpp

`

771

``

`-

&& !target.contains("msvc")

`

``

771

`+

&& !target.is_msvc()

`

772

772

` && !target.contains("netbsd")

`

773

773

` && !target.contains("solaris")

`

774

774

`{

`

`@@ -874,7 +874,7 @@ impl Step for Lld {

`

874

874

`// when doing PGO on CI, cmake or clang-cl don't automatically link clang's

`

875

875

`// profiler runtime in. In that case, we need to manually ask cmake to do it, to avoid

`

876

876

`// linking errors, much like LLVM's cmake setup does in that situation.

`

877

``

`-

if builder.config.llvm_profile_generate && target.contains("msvc") {

`

``

877

`+

if builder.config.llvm_profile_generate && target.is_msvc() {

`

878

878

`if let Some(clang_cl_path) = builder.config.llvm_clang_cl.as_ref() {

`

879

879

`// Find clang's runtime library directory and push that as a search path to the

`

880

880

`// cmake linker flags.

`