# msvc
A tool to automate setup for MSVC projects with `vc-ltl` and optionally `thunk-rs`.
## Features
- Automatically adds or removes `vc-ltl` as a dependency.
- Optionally adds or removes `thunk-rs` as a build dependency and modifies `build.rs` to call `thunk::thunk()` only on MSVC.
- Optionally configures or removes the default target to `x86_64-pc-windows-msvc`.
- Optionally adds or removes all configurations at once.
## Installation
```bash
cargo install msvc
```
## Usage
Navigate to your Cargo project directory and run:
```bash
# Add or remove vc-ltl dependency
msvc
# Add vc-ltl and thunk-rs, and modify build.rs
msvc -t
# or
msvc --thunk
# Remove thunk-rs dependency and build.rs file (if managed by cargo-msvc)
msvc -t
# or
msvc --thunk
# Configure default target to x86_64-pc-windows-msvc
msvc -x
# or
msvc --x86-64
# Remove default target configuration
msvc -x
# or
msvc --x86-64
# Add all configurations (vc-ltl, thunk-rs, and target configuration)
msvc -a
# or
msvc --add-all
# Remove all configurations (vc-ltl, thunk-rs, and target configuration)
msvc -r
# or
msvc --remove-all
```
This will:
1. If no flags are specified:
- If `vc-ltl` is not in your project's dependencies, add it.
- If `vc-ltl` is already in your project's dependencies, remove it.
2. If `-t` or `--thunk` is specified:
- If `thunk-rs` is not in your project's build dependencies, add it and create or update `build.rs`.
- If `thunk-rs` is already in your project's build dependencies, remove it and the `build.rs` file (if managed by cargo-msvc).
3. If `-x` or `--x86-64` is specified:
- If the default target is not configured to `x86_64-pc-windows-msvc`, configure it by creating or updating `.cargo/config.toml`.
- If the default target is already configured to `x86_64-pc-windows-msvc`, remove the configuration from `.cargo/config.toml`.
4. If `-a` or `--add-all` is specified:
- Add `vc-ltl` dependency.
- Add `thunk-rs` build dependency.
- Create or update `build.rs`.
- Configure default target to `x86_64-pc-windows-msvc`.
5. If `-r` or `--remove-all` is specified:
- Remove `vc-ltl` dependency.
- Remove `thunk-rs` build dependency (if present).
- Remove `build.rs` file (if managed by cargo-msvc).
- Remove target configuration from `.cargo/config.toml` (if present).
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.