Skip to content

Commit

Permalink
samples: use ZEPHYR_EXTRA_MODULES instead of ZEPHYR_MODULES
Browse files Browse the repository at this point in the history
ZEPHYR_EXTRA_MODULES should be used when the intention is to add an
extra module to those already found by west. The QEMU targets didn't
require additional modules, so this was not apparent.

Fixes #17
  • Loading branch information
tylerwhall committed Mar 27, 2020
1 parent aefaae8 commit 78b433a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Rust on Zephyr RTOS
Overview
********
Zephyr_ module for building a Cargo project and linking it into a Zephyr image.
Add this directory to ZEPHYR_MODULES to build a Cargo library project (located
in the Zephyr app's source directory by default) and link it into the Zephyr
app.
Add this directory to ZEPHYR_EXTRA_MODULES to build a Cargo library project
(located in the Zephyr app's source directory by default) and link it into the
Zephyr app.

Features
========
Expand Down
6 changes: 5 additions & 1 deletion samples/futures/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# For this example, add ZEPHYR_RUST as a zephyr module. Not needed if added in
# your environment or managed by west.
get_filename_component(ZEPHYR_RUST ${CMAKE_CURRENT_SOURCE_DIR}/../.. ABSOLUTE)
list(APPEND ZEPHYR_MODULES ${ZEPHYR_RUST})
list(APPEND ZEPHYR_EXTRA_MODULES ${ZEPHYR_RUST})

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(rust)
target_sources(app PRIVATE ./src/main.c)
6 changes: 5 additions & 1 deletion samples/rust-app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# For this example, add ZEPHYR_RUST as a zephyr module. Not needed if added in
# your environment or managed by west.
get_filename_component(ZEPHYR_RUST ${CMAKE_CURRENT_SOURCE_DIR}/../.. ABSOLUTE)
list(APPEND ZEPHYR_MODULES ${ZEPHYR_RUST})
list(APPEND ZEPHYR_EXTRA_MODULES ${ZEPHYR_RUST})

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(hello_world)
target_sources(app PRIVATE ./src/main.c)
6 changes: 5 additions & 1 deletion samples/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# For this example, add ZEPHYR_RUST as a zephyr module. Not needed if added in
# your environment or managed by west.
get_filename_component(ZEPHYR_RUST ${CMAKE_CURRENT_SOURCE_DIR}/../.. ABSOLUTE)
list(APPEND ZEPHYR_MODULES ${ZEPHYR_RUST})
list(APPEND ZEPHYR_EXTRA_MODULES ${ZEPHYR_RUST})

list(APPEND QEMU_EXTRA_FLAGS -serial tcp:localhost:4444,server,nowait)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(hello_world)
Expand Down
6 changes: 5 additions & 1 deletion tests/rust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# For this example, add ZEPHYR_RUST as a zephyr module. Not needed if added in
# your environment or managed by west.
get_filename_component(ZEPHYR_RUST ${CMAKE_CURRENT_SOURCE_DIR}/../.. ABSOLUTE)
list(APPEND ZEPHYR_MODULES ${ZEPHYR_RUST})
list(APPEND ZEPHYR_EXTRA_MODULES ${ZEPHYR_RUST})

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(rust)
target_sources(app PRIVATE ./src/main.c)
6 changes: 5 additions & 1 deletion tests/semaphore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# For this example, add ZEPHYR_RUST as a zephyr module. Not needed if added in
# your environment or managed by west.
get_filename_component(ZEPHYR_RUST ${CMAKE_CURRENT_SOURCE_DIR}/../.. ABSOLUTE)
list(APPEND ZEPHYR_MODULES ${ZEPHYR_RUST})
list(APPEND ZEPHYR_EXTRA_MODULES ${ZEPHYR_RUST})

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(rust)
target_sources(app PRIVATE ./src/main.c)

0 comments on commit 78b433a

Please sign in to comment.