Skip to content

Adding the DevX Library

Dave Glover edited this page Sep 4, 2021 · 1 revision

Adding the Azure Sphere DevX Library

How to add the DevX library to your project

This example assumes you are using git, otherwise download the Azure Sphere DevX library and add to the directory to your project.

git submodule add https://github.com/gloveboxes/AzureSphereDevX.git

Update your CMakeLists.txt to include the DevX library

Add the library sub directory

add_subdirectory("AzureSphereDevX" out)

Add azure_sphere_devx to the link libraries

target_link_libraries (${PROJECT_NAME} applibs pthread gcc_s c azure_sphere_devx)

Add to include directories

target_include_directories(${PROJECT_NAME} PUBLIC Azure-Sphere-DevX/include )

Example CMakeLists.txt file

The following is an example of what the completed CMakeLists.txt file could look like.

cmake_minimum_required (VERSION 3.10)
project (AzureSphereAzureIoT C)

azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")

add_subdirectory("Azure-Sphere-DevX" out)

set(Source
    "main.c"
)
source_group("Source" FILES ${Source})

set(ALL_FILES
    ${Source}
)

# Create executable
add_executable(${PROJECT_NAME} ${ALL_FILES})

target_compile_definitions(${PROJECT_NAME} PUBLIC AZURE_IOT_HUB_CONFIGURED)
target_link_libraries(${PROJECT_NAME} applibs pthread gcc_s c azure_sphere_devx )

target_include_directories(${PROJECT_NAME} PUBLIC Azure-Sphere-DevX/include . )

target_compile_options(${PROJECT_NAME} PRIVATE -Wno-unknown-pragmas)

azsphere_target_add_image_package(${PROJECT_NAME})
Clone this wiki locally