Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setting-up-vcpkg documentation #2246

Merged
merged 5 commits into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions doc/setting_up_vcpkg.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
# Building applications using vcpkg for C SDK
# Using vcpkg for the Azure IoT C SDK to build device applications

This document describes how to setup vcpkg to build applications using Microsoft Azure IoT device C SDK. It demonstrates building and running a C language SDK sample for Windows, Linux, and Mac.
This document describes how to setup vcpkg to build device applications using Microsoft Azure IoT C SDK. It demonstrates building and running a C language device SDK sample for Windows, Linux, and Mac.

## Setup C SDK vcpkg for Windows development environment
## Azure IoT C SDK vcpkg support

The Azure IoT C SDK uses [vcpkg](https://github.com/microsoft/vcpkg) primarily for LTS releases. The most recent LTS release can be installed using the syntax: `vcpkg install azure-iot-sdk-c` and builds using the following CMake flags:

```
-Dskip_samples=ON
-Duse_installed_dependencies=ON
-Duse_default_uuid=ON
-Dbuild_as_dynamic=OFF
-Duse_edge_modules=ON
-Dwarnings_as_errors=OFF
```

The `use-prov-client` feature uses the syntax: `vcpkg install azure-iot-sdk-c[use-prov-client]` and builds using additional CMake flags:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for tag if you spoke offline, but @CIPop could you please double check that these flags still make sense in light of #2229? If not very well need a vcpkg PR, but since it's on mind wanted to ask. Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We def need to review this entire vcpkg portfile.cmake. There is a card to do that if it is not updated beforehand.

```
-Dhsm_type_symm_key=ON
-Duse_prov_client=ON
```

The `public-preview` feature allows you to build and install the azure-iot-sdk-c from a provided public-preview hash. The `REF` hash used can be found in the [portfile.cmake](https://github.com/microsoft/vcpkg/blob/master/ports/azure-iot-sdk-c/portfile.cmake) file. To access this feature, use the syntax: `vcpkg install azure-iot-sdk-c[public-preview]`. The following CMake flags will be set:

```
-Dskip_samples=ON
-Duse_installed_dependencies=ON
-Duse_default_uuid=ON
-Dbuild_as_dynamic=OFF
-Duse_edge_modules=ON
-Dwarnings_as_errors=OFF
```

There are no other configuration options via vcpkg available.

> NOTE: If your application requires specific CMake flags not shown above, please build and install directly from the source code. See [devbox_setup.md](https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/devbox_setup.md) for further information.

The most recent [portfile.cmake](https://github.com/microsoft/vcpkg/blob/master/ports/azure-iot-sdk-c/portfile.cmake) and [vcpkg.json](https://github.com/microsoft/vcpkg/blob/master/ports/azure-iot-sdk-c/vcpkg.json) files for the Azure IoT C SDK can be found under [vcpkg/ports/azure-iot-sdk-c](https://github.com/microsoft/vcpkg/tree/master/ports/azure-iot-sdk-c).


## Setup Azure IoT C SDK vcpkg for Windows development environment

- Open PowerShell and run the following commands:

Expand All @@ -20,7 +57,7 @@ This document describes how to setup vcpkg to build applications using Microsoft
.\vcpkg.exe install azure-iot-sdk-c
popd

# Open the C SDK telemetry sample solution for Visual Studio.
# Open the Azure IoT C SDK telemetry sample solution for Visual Studio.
git clone https://github.com/Azure/azure-iot-sdk-c.git # Skip if already have a cloned repo
pushd .\azure-iot-sdk-c\iothub_client\samples\iothub_ll_telemetry_sample\windows\
start .\iothub_ll_telemetry_sample.sln
Expand All @@ -36,7 +73,7 @@ This document describes how to setup vcpkg to build applications using Microsoft
.\vcpkg.exe export azure-iot-sdk-c --nuget
popd

# Open the C SDK telemetry sample solution for Visual Studio.
# Open the Azure IoT C SDK telemetry sample solution for Visual Studio.
git clone https://github.com/Azure/azure-iot-sdk-c.git # Skip if already have a cloned repo
pushd .\azure-iot-sdk-c\iothub_client\samples\iothub_ll_telemetry_sample\windows\
start .\iothub_ll_telemetry_sample.sln
Expand All @@ -50,9 +87,9 @@ This document describes how to setup vcpkg to build applications using Microsoft

- Hit F5 to build and run.

- More information on building the C SDK and samples can be found [here](https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/devbox_setup.md).
- More information on building the Azure IoT C SDK and samples can be found [here](https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/devbox_setup.md).

## Setup C SDK vcpkg for Linux or Mac development environment
## Setup Azure IoT C SDK vcpkg for Linux or Mac development environment

- Open a command prompt and run the following commands:

Expand All @@ -63,7 +100,7 @@ This document describes how to setup vcpkg to build applications using Microsoft
./vcpkg install azure-iot-sdk-c
cd ..
```
- Enter the C SDK telemetry sample directory.
- Enter the Azure IoT C SDK telemetry sample directory.

```bash
git clone https://github.com/Azure/azure-iot-sdk-c.git # Skip if already have a cloned repo
Expand All @@ -75,4 +112,4 @@ This document describes how to setup vcpkg to build applications using Microsoft
./iothub_ll_telemetry_sample
```

- More information on building the C SDK and samples can be found [here](https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/devbox_setup.md).
- More information on building the Azure IoT C SDK and samples can be found [here](https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/devbox_setup.md).