| 1 |
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. |
| 2 |
|
| 3 |
# Azure C Shared Utility |
| 4 |
|
| 5 |
azure-c-shared-utility is a C library providing common functionality for basic tasks (like string, list manipulation, IO, etc.). |
| 6 |
|
| 7 |
## Dependencies |
| 8 |
|
| 9 |
azure-c-shared-utility provides 3 tlsio implementations: |
| 10 |
- tlsio_schannel - runs only on Windows |
| 11 |
- tlsio_openssl - depends on OpenSSL being installed |
| 12 |
- tlsio_wolfssl - depends on WolfSSL being installed |
| 13 |
|
| 14 |
azure-c-shared-utility depends on curl for HTTPAPI for Linux. |
| 15 |
|
| 16 |
azure-c-shared-utility uses cmake for configuring build files. |
| 17 |
|
| 18 |
## Setup |
| 19 |
|
| 20 |
1. Clone **azure-c-shared-utility** using the recursive option: |
| 21 |
|
| 22 |
``` |
| 23 |
git clone --recursive https://github.com/Azure/azure-c-shared-utility.git |
| 24 |
``` |
| 25 |
|
| 26 |
2. Create a folder called *cmake* under *azure-c-shared-utility* |
| 27 |
|
| 28 |
3. Switch to the *cmake* folder and run |
| 29 |
``` |
| 30 |
cmake .. |
| 31 |
``` |
| 32 |
|
| 33 |
4. Build |
| 34 |
|
| 35 |
``` |
| 36 |
cmake --build . |
| 37 |
``` |
| 38 |
|
| 39 |
### Installation and Use |
| 40 |
Optionally, you may choose to install azure-c-shared-utility on your machine: |
| 41 |
|
| 42 |
1. Switch to the *cmake* folder and run |
| 43 |
``` |
| 44 |
cmake -Duse_installed_dependencies=ON ../ |
| 45 |
``` |
| 46 |
``` |
| 47 |
cmake --build . --target install |
| 48 |
``` |
| 49 |
|
| 50 |
or install using the follow commands for each platform: |
| 51 |
|
| 52 |
On Linux: |
| 53 |
``` |
| 54 |
sudo make install |
| 55 |
``` |
| 56 |
|
| 57 |
On Windows: |
| 58 |
``` |
| 59 |
msbuild /m INSTALL.vcxproj |
| 60 |
``` |
| 61 |
|
| 62 |
2. Use it in your project (if installed) |
| 63 |
``` |
| 64 |
find_package(azure_c_shared_utility REQUIRED CONFIG) |
| 65 |
target_link_library(yourlib aziotsharedutil) |
| 66 |
``` |
| 67 |
|
| 68 |
_If running tests, this requires that umock-c, azure-ctest, and azure-c-testrunnerswitcher are installed (through CMake) on your machine._ |
| 69 |
|
| 70 |
### Building the tests |
| 71 |
|
| 72 |
In order to build the tests use: |
| 73 |
|
| 74 |
``` |
| 75 |
cmake .. -Drun_unittests:bool=ON |
| 76 |
``` |
| 77 |
|
| 78 |
## Configuration options |
| 79 |
|
| 80 |
In order to turn on/off the tlsio implementations use the following CMAKE options: |
| 81 |
|
| 82 |
* `-Duse_schannel:bool={ON/OFF}` - turns on/off the SChannel support |
| 83 |
* `-Duse_openssl:bool={ON/OFF}` - turns on/off the OpenSSL support. If this option is used, an environment variable named OpenSSLDir should be set to point to the OpenSSL folder. |
| 84 |
* `-Duse_wolfssl:bool={ON/OFF}` - turns on/off the WolfSSL support. If this option is used, an environment variable named WolfSSLDir should be set to point to the WolfSSL folder. |
| 85 |
* `-Duse_http:bool={ON/OFF}` - turns on/off the HTTP API support. |
| 86 |
* `-Duse_installed_dependencies:bool={ON/OFF}` - turns on/off building azure-c-shared-utility using installed dependencies. This package may only be installed if this flag is ON. |
| 87 |
* `-Drun_unittests:bool={ON/OFF}` - enables building of unit tests. Default is OFF. |
| 88 |
* `-Duse_default_uuid:bool={ON/OFF}` - use the out-of-the-box UUID implementation that comes with the SDK rather than platform specific implementations. Default is OFF. |
| 89 |
* `-Dno_openssl_engine:bool={ON/OFF}` - disables the use of ENGINEs in OpenSSL. Default is OFF. |
| 90 |
|
| 91 |
## Porting to new devices |
| 92 |
|
| 93 |
Instructions for porting the Azure IoT C SDK to new devices are located |
| 94 |
[here](https://github.com/Azure/azure-c-shared-utility/blob/master/devdoc/porting_guide.md). |