Skip to content

Commit 9e950dc

Browse files
committed
gnu: Add legacy Zephyr compatibility
In setup.sh, add option to create symlinks from gnu/ so that paths match previous SDK versions. In Zephyr-sdkConfig.cmake, set ZEPHYR_TOOLCHAIN_VARIANT to zephyr/gnu only when Zephyr sets ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT before finding the SDK module. This will require a change to Zephyr, which is unfortunate. Ideally, we'd use some existing mechanism to detect when to make this switch. Signed-off-by: Keith Packard <[email protected]>
1 parent a827661 commit 9e950dc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

cmake/Zephyr-sdkConfig.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ get_filename_component(ZEPHYR_SDK_INSTALL_DIR ${CMAKE_CURRENT_LIST_DIR}/.. ABSOL
1313
set(ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR})
1414

1515
if(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT)
16-
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr/gnu")
16+
if(DEFINED ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT)
17+
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr/gnu")
18+
else()
19+
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr")
20+
endif()
1721
endif()
1822

1923
# Those are CMake package parameters.

scripts/template_setup_posix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ usage()
6969
echo " all Install all GNU toolchains"
7070
echo " -l Install LLVM toolchain"
7171
echo " -h Install host tools"
72+
echo " -o Old zephyr version compatibility"
7273
echo " -c Register Zephyr SDK CMake package"
7374
echo
7475
echo "Supported GNU Toolchains:"
@@ -117,6 +118,8 @@ user_prompt()
117118
# Environment Configurations
118119
ask_yn "Register Zephyr SDK CMake package" && do_cmake_pkg="y"
119120

121+
ask_yn "Old zephyr version compatibility" && do_old_zephyr="y"
122+
120123
echo
121124
}
122125

@@ -159,6 +162,9 @@ else
159162
-c)
160163
do_cmake_pkg="y"
161164
;;
165+
-o)
166+
do_old_zephyr="y"
167+
;;
162168
'-?')
163169
usage
164170
exit 0
@@ -301,6 +307,14 @@ if [ "${do_cmake_pkg}" = "y" ]; then
301307
echo
302308
fi
303309

310+
# Create compatibility links for old Zephyr versions
311+
if [ "${do_old_zephyr}" = "y" ]; then
312+
echo "Creating links for old Zephyr compatibility ..."
313+
ln -sr gnu/* . || assert_rc "ERROR: Creating toolchain links" 50
314+
ln -sr cmake/zephyr/gnu/* cmake/zephyr || assert_rc "ERROR: Creating cmake links" 50
315+
echo
316+
fi
317+
304318
echo "All done."
305319
if [ "${interactive}" = "y" ]; then
306320
read -n 1 -s -r -p "Press any key to exit ..."

0 commit comments

Comments
 (0)