# Use vcpkg

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/)
- [Install vcpkg](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/installation/)
- [Initialize vcpkg](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/initialization/)
- [Create a vcpkg-configuration.json file](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/config_creation/)
- [Use vcpkg](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/usage/)
- [Activate a license](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/licenseactivation/)
- [Remove vcpkg](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/removal/)
- [Next Steps](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/vcpkg-tool-installation/_next-steps/)

The following commands help you to work with `vcpkg`. The most important one is `activate` as this activates all tools specified by the configuration file.

## Activate vcpkg

### Activate tools specified by vcpkg-configuration.json

```bash
vcpkg-shell activate
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
Artifact                                Version Status    Dependency Summary
arm:tools/open-cmsis-pack/cmsis-toolbox 2.0.0   installed            Arm distributed Open-CMSIS-Pack cli tools
arm:compilers/arm/armclang              6.20.0  installed            Arm Compiler for Embedded
microsoft:tools/kitware/cmake           3.25.2  installed            Kitware's cmake tool
microsoft:tools/ninja-build/ninja       1.10.2  installed            Ninja is a small build system with a focus on speed.
```

### Deactivate artifacts specified by vcpkg-configuration.json

```bash
vcpkg-shell deactivate
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
Deactivating: /Users/myuser/projects/myproject
```

### Activating tools without vcpkg-configuration.json

```bash
vcpkg-shell use cmsis-toolbox
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
Artifact                                Version Status    Dependency Summary
arm:tools/open-cmsis-pack/cmsis-toolbox 2.0.0   installed            Arm distributed Open-CMSIS-Pack cli tools
```

### Retrieve all available versions of a tool

```bash
vcpkg-shell use open-cmsis-pack
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
error: Unable to resolve artifact: open-cmsis-pack
Possible matches:
  arm:tools/open-cmsis-pack/cmsis-toolbox-2.0.0
  arm:tools/open-cmsis-pack/cmsis-toolbox-2.0.0-dev3
  arm:tools/open-cmsis-pack/cmsis-toolbox-2.0.0-dev2
  arm:tools/open-cmsis-pack/cmsis-toolbox-2.0.0-dev1
  arm:tools/open-cmsis-pack/cmsis-toolbox-2.0.0-dev0
  arm:tools/open-cmsis-pack/ctools-2.0.0-dev0
  arm:tools/open-cmsis-pack/ctools-1.7.0
  arm:tools/open-cmsis-pack/ctools-1.6.0
  arm:tools/open-cmsis-pack/ctools-1.5.0
```

## List available artifacts

### For example, tools

```bash
vcpkg-shell find artifact tools
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
Artifact                                    Version    Summary
microsoft:tools/kitware/cmake               3.25.2     Kitwares cmake tool
microsoft:tools/ninja-build/ninja           1.10.2     Ninja is a small build system with a focus on speed.
microsoft:tools/arduino/arduino-cli         0.18.3     Arduino IDE
microsoft:tools/microsoft/openocd           0.12.0     Free and open on-chip debugging
arm:tools/arm/cmsis-core-tools              5.2.0      Arm CMSIS Core Tools
arm:tools/open-cmsis-pack/cmsis-toolbox     2.0.0      Arm distributed Open-CMSIS-Pack cli tools
arm:tools/open-cmsis-pack/ctools            2.0.0-dev0 Arm distributed Open-CMSIS-Pack cli tools
arm:tools/arm/uv2csolution                  v1.0.0     *.uvprojx/*.uvmpw to csolution/cproject converter
```

### For example, compilers

```bash
vcpkg-shell find artifact compilers
__output__
warning: vcpkg-artifacts is experimental and may change at any time.
Artifact                                                         Version        Summary
microsoft:compilers/arm-none-eabi-gcc                            10.3.1-2021.10 GCC compiler for ARM CPUs.
arm:compilers/arm/llvm-embedded                                  16.0.0         LLVM Embedded Toolchain for Arm CPUs.
arm:compilers/arm/arm-none-eabi-gcc                              12.2.1-mpacbti GCC compiler for ARM CPUs.
arm:compilers/arm/armclang                                       6.20.0         Arm Compiler for Embedded
```

## Working with the vcpkg-configuration.json file

### Create a new vcpkg-configuration.json file

```bash
vcpkg-shell new --application
```

### Add artifact to vcpkg-configuration.json file

```bash
vcpkg-shell add artifact cmake
```

### Remove artifact to vcpkg-configuration.json file

```bash
vcpkg-shell remove microsoft:tools/kitware/cmake
```

### Update a registry

For example, the `arm` registry:

```bash
vcpkg-shell x-update-registry arm
```

Before using the Arm Compiler, you need to activate a license. The next step shows how to do that.
