1# SPDX-License-Identifier: Apache-2.0 2 3cmake_minimum_required(VERSION 3.20.0) 4 5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 6project(fs_shell) 7 8if(CONFIG_HELLO_WORLD_MODE STREQUAL "m") 9 10 # Build the llext ... 11 12 set(ext_name hello_world) 13 set(ext_src src/${ext_name}_ext.c) 14 set(ext_bin ${ZEPHYR_BINARY_DIR}/${ext_name}.llext) 15 set(ext_inc ${ZEPHYR_BINARY_DIR}/include/generated/${ext_name}_ext.inc) 16 add_llext_target(${ext_name}_ext 17 OUTPUT ${ext_bin} 18 SOURCES ${ext_src} 19 ) 20 generate_inc_file_for_target(app ${ext_bin} ${ext_inc}) 21 22 # ...and the code for loading and running it 23 24 target_sources(app PRIVATE 25 src/main_module.c 26 ) 27 28elseif(CONFIG_HELLO_WORLD_MODE STREQUAL "y") 29 30 # Just build the two files together 31 32 target_sources(app PRIVATE 33 src/main_builtin.c 34 src/hello_world_ext.c 35 ) 36 37else() 38 message(FATAL_ERROR "Please choose 'y' or 'm' for CONFIG_HELLO_WORLD_MODE") 39endif() 40