Skip to content

Allow users to have 2 different build scripts for Windows depending if rust is the msvc or if it is the gnu build. #38285

Closed
@AraHaan

Description

@AraHaan

The issue is that build scripts cannot have the ability to get if the build of rust is msvc or the gnu build for windows so then it fails.

So, with that it would be nice to have build scripts to be able to do it or at least for windows a custom build script for only the msvc build and then a different one for the gnu windows build.

The reason for this is because if you want to import a lib file for a msvc build version because the gnu produces corrupt binaries they would have to have:
__declspec(dllimport)

That is if they are linking to a *lib file made in C or C++ (like the original cpython lib file shipped with the installable python)

The suggestion is to have support for something like this entirely in Cargo.toml:

[package]
name = "crate name here"
version = "version here"
description = "description here"
authors = ["creators here"]
readme = "readme file here"
keywords = [
    "keywords here",
]
homepage = "homepage here"
repository = "repo here"
documentation = "documentation here"
license = "MIT"
exclude = [
    "exclude files here.",
]

[package.x86_64-pc-windows-msvc]
build = "custombuildscripthere.rs"

[package.i686-pc-windows-msvc]
build = "custombuildscripthere.rs"

[package.x86_64-pc-windows-gnu]
build = "custombuildscripthere.rs"

[package.i686-pc-windows-gnu]
build = "custombuildscripthere.rs"

This is so that way Windows would have a better build system for multi platform crates that relies on C or C++ code that has multiple platform implementations like Python's C API for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions