Skip to content

Commit f9a8a93

Browse files
keith-packardstephanosio
authored andcommitted
gnu: Add legacy Zephyr bisectability
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, but it needs to be synchronous with with changes in Zephyr which enable this support, and I couldn't find anything in that series which looked workable. Signed-off-by: Keith Packard <[email protected]>
1 parent ac42d50 commit f9a8a93

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-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: 15 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 Create symbolic links matching the old SDK layout for old Zephyr (< 4.3) bisectability"
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 "Create symbolic links for old Zephyr bisectability" && 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,15 @@ if [ "${do_cmake_pkg}" = "y" ]; then
301307
echo
302308
fi
303309

310+
# Create links for old Zephyr versions
311+
if [ "${do_old_zephyr}" = "y" ]; then
312+
echo "Creating links for old Zephyr bisectability ..."
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+
ln -sr hosttools/* . || assert_rc "ERROR: Creating hosttools links" 50
316+
echo
317+
fi
318+
304319
echo "All done."
305320
if [ "${interactive}" = "y" ]; then
306321
read -n 1 -s -r -p "Press any key to exit ..."

0 commit comments

Comments
 (0)