Skip to content

Commit 8ec24f1

Browse files
authored
Added documentation on device application CMAKE (#2224)
* Added documentation on device application CMAKE * pr feedback * rename cmake doc
1 parent e45c605 commit 8ec24f1

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SDK CMake integration with your application
2+
3+
This document describes how to use your application CMake configuration to include and build the device C SDK.
4+
5+
## C Device SDK Git submodule
6+
Inclusion of the device C SDK usually uses git submodules to include the SDK into your application source code. For the example project CMake file below, the device C SDK is installed at your root project in a directory called `azure-iot-sdk-c`.
7+
8+
## Application CMake project example
9+
The device C SDK CMake files are configured to be directly referenced from your application CMake. The first step of your application CMake file is to set the SDK configuration options, and then include the SDK in your CMake by adding the `add_subdirectory()` to the SDK location within your project.
10+
11+
Below is an example of an application project CMake.txt file which referances the Azure IoT device C SDK source code.
12+
```Shell
13+
cmake_minimum_required (VERSION 3.7)
14+
PROJECT(iothub_device_sample_project C)
15+
16+
# Set Azure IoT SDK C settings
17+
set(use_mqtt ON CACHE BOOL "Set mqtt on" FORCE )
18+
set(skip_samples ON CACHE BOOL "Set slip_samples on" FORCE )
19+
set(BUILD_TESTING OFF CACHE BOOL "Set BUILD_TESTING off" FORCE )
20+
21+
# Add Azure IoT SDK C
22+
add_subdirectory(azure-iot-sdk-c out)
23+
24+
compileAsC99()
25+
26+
set(iothub_project_files
27+
your_application_file.c
28+
)
29+
30+
#Conditionally use the SDK trusted certs in the samples
31+
if(${use_sample_trusted_cert})
32+
add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES)
33+
include_directories(${PROJECT_SOURCE_DIR}/certs)
34+
set(iothub_c_files ${iothub_c_files} ${PROJECT_SOURCE_DIR}/certs/certs.c)
35+
endif()
36+
37+
include_directories(.)
38+
39+
add_executable(iothub_device_sample ${iothub_project_files})
40+
41+
target_link_libraries(iothub_device_sample iothub_client)
42+
```

iothub_client/readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Detailed instructions can be found below for each platforms:
8282

8383
<a name="samples"></a>
8484

85+
## CMake
86+
87+
The C device SDK uses [CMake](https://cmake.org/) for compiler independent configuration and generates native build files and workspaces that can be used in the compiler environment of your choice.
88+
89+
* [SDK CMake integration with your application](../doc/how_to_use_azure_iot_sdk_c_with_cmake.md)
90+
8591
## Samples
8692

8793
The repository contains a set of simple samples that will help you get started.

readme.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ that will impact the SDK's ability to connect to these services. In October 2022
4545
transition period beforehand where your IoT devices must have both the Baltimore and Digicert public certificates
4646
which may be hardcoded in their application or flashed onto your WiFi module in order to prevent connectivity issues.
4747

48-
**Devices with only the Baltimore public certificate will lose the ability to connect to Azure IoT Hub and Device Provisioning Service in October 2022.**
48+
> **Devices with only the Baltimore public certificate will lose the ability to connect to Azure IoT Hub and Device Provisioning Service in October 2022.**
4949
5050
To prepare for this change, make sure your device's TLS stack has both of these public root of trust certificates configured.
5151

@@ -54,7 +54,9 @@ For a more in depth explanation as to why the IoT services are doing this, pleas
5454

5555
## Getting the SDK
5656

57-
Please note, for constrained device scenarios like the below mbed and Arduino, there are better, lighter weight SDK options available. See [Other Azure IoT SDKs](#other-azure-iot-sdks) for more.
57+
> Please note, for constrained device scenarios like mbed and Arduino, there are better, lighter weight SDK options available. See [Other Azure IoT SDKs](#other-azure-iot-sdks) for more.
58+
59+
### Packages
5860

5961
The simplest way to get started with the Azure IoT SDKs on supported platforms is to use the following packages and libraries:
6062

@@ -63,12 +65,15 @@ The simplest way to get started with the Azure IoT SDKs on supported platforms i
6365
- Windows: [Device SDK on Vcpkg](./doc/setting_up_vcpkg.md#setup-c-sdk-vcpkg-for-windows-development-environment)
6466
- iOS: [Device SDK on CocoaPod](https://cocoapods.org/pods/AzureIoTHubClient)
6567

66-
### iOS Limitations
68+
*iOS Limitations*
69+
70+
- Authentication is limited to SAS keys on iOS. No certificate-based authentication is officially supported.
71+
- The Device Provisioning Client is not supported on iOS. Only the Azure IoT Hub device client is supported.
6772

68-
- Authentication is limited to SAS keys on iOS. No certificate-based authentication is officially supported.
69-
- The Device Provisioning Client is not supported on iOS. Only the Azure IoT Hub device client is supported.
73+
### Linux
7074

71-
For other platforms - including Linux - you need to clone and build the SDK directly. You may also build it directly for the platforms above. Instructions can be found [here](./iothub_client/readme.md#compile).
75+
For other platforms - including Linux - you need to clone and build the SDK directly. You may also build it directly for the platforms above.
76+
- Linux: [Device SDK library on Linux](./iothub_client/readme.md#compile)
7277

7378
## Samples
7479

0 commit comments

Comments
 (0)