-
Notifications
You must be signed in to change notification settings - Fork 38
/
CMakeLists.txt
42 lines (33 loc) · 1.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.20)
project(HelloWorld_HighLevelApp C)
include(CTest)
add_executable(${PROJECT_NAME} main.c led.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)
if(LEAK)
target_compile_definitions(${PROJECT_NAME} PUBLIC LEAK)
endif()
# TARGET_HARDWARE and TARGET_DEFINITION relate to the hardware definition targeted by this sample.
# When using this sample with other hardware, replace TARGET_HARDWARE with the name of that hardware.
# For example, to target the Avnet MT3620 Starter Kit, use the value "avnet_mt3620_sk".
# See https://aka.ms/azsphere-samples-hardwaredefinitions for further details on this feature.
set(TARGET_HARDWARE "mt3620_rdb")
set(TARGET_DEFINITION "sample_appliance.json")
# This finds the path to the target hardware definition, in one of two places.
# If the sample is cloned from the github repo, then the path to the target hardware is
# "../../../HardwareDefinitions/${TARGET_HARDWARE}". If the sample is downloaded from the Microsoft
# samples browser, then the path is "HardwareDefinitions/${TARGET_HARDWARE}"
find_path(
TARGET_DIRECTORY
NAMES ${TARGET_DEFINITION}
PATHS "HardwareDefinitions/${TARGET_HARDWARE}" "../../../HardwareDefinitions/${TARGET_HARDWARE}"
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "${TARGET_DIRECTORY}" TARGET_DEFINITION "${TARGET_DEFINITION}")
azsphere_target_add_image_package(${PROJECT_NAME})
if(BUILD_TESTING)
add_executable(LedTest tests/led_test.c led.c)
target_include_directories(LedTest PUBLIC ${AZURE_SPHERE_SDK_PATH}/HardwareDefinitions/inc)
target_link_libraries(LedTest applibs)
add_test(NAME LedTest COMMAND LedTest)
endif()