From ca90702af671dd29357460f85856390704fd43ce Mon Sep 17 00:00:00 2001 From: Hendrik Sauer Date: Tue, 22 Jun 2021 16:14:13 +0200 Subject: [PATCH] Fix CMakeLists so Platformio works properly again --- zephyr/CMakeLists.txt | 29 +++++++++++++++++------------ zephyr/build_native.sh | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 6575a90..638e388 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -2,17 +2,22 @@ cmake_minimum_required(VERSION 3.13.1) include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(test) -include(FetchContent) -FetchContent_Declare( - exposure-notification - GIT_REPOSITORY https://github.com/prathje/exposure-notification - GIT_TAG origin/main -) -FetchContent_GetProperties(exposure-notification) -if (NOT exposure-notification_POPULATED) - FetchContent_Populate(exposure-notification) -endif () -target_include_directories(app PUBLIC ${exposure-notification_SOURCE_DIR}/include) +if(DEFINED NATIVE_POSIX) + include(FetchContent) + FetchContent_Declare( + exposure-notification + GIT_REPOSITORY https://github.com/prathje/exposure-notification + GIT_TAG origin/main + ) + FetchContent_GetProperties(exposure-notification) + if (NOT exposure-notification_POPULATED) + FetchContent_Populate(exposure-notification) + endif () + target_include_directories(app PUBLIC ${exposure-notification_SOURCE_DIR}/include) + + FILE(GLOB app_sources ../src/*.c* ${exposure-notification_SOURCE_DIR}/src/*.c*) +else() + FILE(GLOB app_sources ../src/*.c*) +endif() -FILE(GLOB app_sources ../src/*.c* ${exposure-notification_SOURCE_DIR}/src/*.c*) target_sources(app PRIVATE ${app_sources}) diff --git a/zephyr/build_native.sh b/zephyr/build_native.sh index 5b3fd9c..e440f29 100755 --- a/zephyr/build_native.sh +++ b/zephyr/build_native.sh @@ -1,5 +1,5 @@ #!/bin/bash rm -rf build -west build -b native_posix_64 . -- -DCMAKE_C_FLAGS="-DNATIVE_POSIX -I../../include/tls_config -DDISPLAY" +west build -b native_posix_64 . -- -DCMAKE_C_FLAGS="-DNATIVE_POSIX -I../../include/tls_config -DDISPLAY" -DNATIVE_POSIX=1 echo "Run ./build/zephyr/zephyr.elf" \ No newline at end of file