diff --git a/org.lflang/src/lib/c/reactor-c b/org.lflang/src/lib/c/reactor-c index d97620bb54..6dcdf0c657 160000 --- a/org.lflang/src/lib/c/reactor-c +++ b/org.lflang/src/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit d97620bb54734a25521271169dadae68b6b3ad9b +Subproject commit 6dcdf0c657614a78bf0dd61451287c3846d0cd7f diff --git a/org.lflang/src/org/lflang/generator/c/CCmakeGenerator.java b/org.lflang/src/org/lflang/generator/c/CCmakeGenerator.java index 0cbb44f14b..7de898f1cf 100644 --- a/org.lflang/src/org/lflang/generator/c/CCmakeGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CCmakeGenerator.java @@ -118,13 +118,15 @@ CodeBuilder generateCMakeCode( cMakeCode.newLine(); cMakeCode.pr("cmake_minimum_required(VERSION " + MIN_CMAKE_VERSION + ")"); - cMakeCode.pr("project("+executableName+" LANGUAGES C)"); - cMakeCode.newLine(); + if (targetConfig.platformOptions.platform == Platform.ZEPHYR) { cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})"); cMakeCode.newLine(); } + cMakeCode.pr("project("+executableName+" LANGUAGES C)"); + cMakeCode.newLine(); + // The Test build type is the Debug type plus coverage generation cMakeCode.pr("if(CMAKE_BUILD_TYPE STREQUAL \"Test\")"); cMakeCode.pr(" set(CMAKE_BUILD_TYPE \"Debug\")"); diff --git a/test/C/src/zephyr/HelloZephyr.lf b/test/C/src/zephyr/HelloZephyr.lf index f4d5b898da..6274c4c174 100644 --- a/test/C/src/zephyr/HelloZephyr.lf +++ b/test/C/src/zephyr/HelloZephyr.lf @@ -2,7 +2,6 @@ target C { platform: "Zephyr", build: "bash scripts/zephyr_build.sh qemu_cortex_m3 flash", threading: false, - cmake-include: "scripts/zephyr.cmake" } main reactor { diff --git a/test/C/src/zephyr/scripts/zephyr.cmake b/test/C/src/zephyr/scripts/zephyr.cmake deleted file mode 100644 index dbc9f701f9..0000000000 --- a/test/C/src/zephyr/scripts/zephyr.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Disable the old target defined in the generated cmake file -set_target_properties(${LF_MAIN_TARGET} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) -# Get the source files assoicated with the generated cmake build -get_target_property(LF_SOURCES ${LF_MAIN_TARGET} SOURCES) -get_target_property(LF_COMPILE_DEFS ${LF_MAIN_TARGET} COMPILE_DEFINITIONS) -get_target_property(LF_LINKS ${LF_MAIN_TARGET} LINK_LIBRARIES) -get_target_property(LF_INCLUDES ${LF_MAIN_TARGET} INCLUDE_DIRECTORIES) -# Use these sources with Zephyr build. -target_compile_definitions(app PUBLIC ${LF_COMPILE_DEFS}) -target_sources(app PRIVATE ${LF_SOURCES}) -target_link_libraries(app PUBLIC ${LF_LINKS}) -target_include_directories(app PUBLIC ${LF_INCLUDES}) - -# Link corelib with zephyr -target_link_libraries(core PUBLIC zephyr_interface) -zephyr_library_compile_options(-Wl,--print-memory-usage) diff --git a/test/C/src/zephyr/scripts/zephyr_build.sh b/test/C/src/zephyr/scripts/zephyr_build.sh index d0b6e205d1..8212e36dac 100644 --- a/test/C/src/zephyr/scripts/zephyr_build.sh +++ b/test/C/src/zephyr/scripts/zephyr_build.sh @@ -50,3 +50,5 @@ else echo "Unrecognized board $BOARD" exit 1 fi + +fi \ No newline at end of file