GithubHelp home page GithubHelp logo

cargo-vs's Introduction

cargo-vs • autogenerate visual studio solutions / projects

GitHub crates.io %23![forbid(unsafe_code)] rust: stable License Build Status

Quickstart

cd my-rust-project
cargo install cargo-vs
cargo vs2017
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" vs\vs2017.sln

What's generated?

vs/.gitignore since many/most projects don't want .vsode boilerplate checked in IME (although I always provide mine)
vs/vs2017.sln
vs/vs2017/*.vcsproj - Makefile style projects which will invoke cargo +stable-%ARCH%-pc-windows-msvc build --target %ARCH%-pc-windows-msvc --package [package] [--bin|--example] [target] [--release]

Caveat: 32-bit (x86/Win32) builds require an i686 toolchain

When MSVC configures a build environment, rustc will pick up the %PATH% provided link.exe.
On the plus side, this means it should work for new VS versions rustc doesn't recognize.
On the minus side, this means that build.rs and your target use the same linker, and must match architectures.
This could be "fixed" by clearing a bunch of environment variables, but...

Why makefile projects instead of .vs/*.vs.json?

  • Easier to retrofit support for legacy Visual Studio versions
  • Presumably easier to integrate into your existing C++/C# msbuild mess
  • I can't figure out how to launch the graphics debugger with .vs/*
  • Proper build matricies

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

cargo-vs's People

Contributors

maulingmonkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cargo-vs's Issues

Metadata parsing error

When trying to invoke cargo vs2022 on my project, I get

error parsing `cargo metadata`: unable to parse .cargo\git\checkouts\wow_messages-a636457bd164f1ad\98a7745\wow_login_messages\Cargo.toml: invalid type: map, expected a string for key `package.repository` at line 
11 column 24

Here's why: https://github.com/gtker/wow_messages/blob/main/wow_login_messages/Cargo.toml#L11
I had included the crate as such: wow_login_messages = { git = "https://github.com/gtker/wow_messages", features = ["sync"] }

Support VS != 2017

For other VS versions I'll need:

sln headers

cargo-vs/src/run.rs

Lines 97 to 100 in a1983ae

write!(o, "Microsoft Visual Studio Solution File, Format Version 12.00\r\n")?;
write!(o, "# Visual Studio 15\r\n")?;
write!(o, "VisualStudioVersion = 15.0.28307.645\r\n")?;
write!(o, "MinimumVisualStudioVersion = 10.0.40219.1\r\n")?;

vcxproj versions?

cargo-vs/src/run.rs

Lines 164 to 165 in a1983ae

write!(o, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n")?;
write!(o, "<Project DefaultTargets=\"Build\" ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n")?;

write!(o, " <VCProjectVersion>15.0</VCProjectVersion>\r\n")?;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.