@@ -183,62 +183,37 @@ function setup_ethos_u_tools() {
183183 CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install --no-dependencies -r $et_dir /backends/arm/requirements-arm-ethos-u.txt
184184}
185185
186- function prepend_env_in_setup_path() {
187- echo " export $1 =$2 :\$ {$1 -}" >> ${setup_path_script} .sh
188- echo " set --path -pgx $1 $2 " >> ${setup_path_script} .fish
189- }
190-
191- function append_env_in_setup_path() {
192- echo " export $1 =\$ {$1 -}:$2 " >> ${setup_path_script} .sh
193- echo " set --path -agx $1 $2 " >> ${setup_path_script} .fish
194- }
195-
196186function create_setup_path(){
197187 cd " ${root_dir} "
198188
199- # Clear setup_path_script
200- echo " " > " ${setup_path_script} .sh"
201- echo " " > " ${setup_path_script} .fish"
189+ clear_setup_path
202190
203191 if [[ " ${enable_fvps} " -eq 1 ]]; then
204192 setup_path_fvp
205193 fi
206194
207195 if [[ " ${enable_baremetal_toolchain} " -eq 1 ]]; then
208- toolchain_bin_path=" $( cd ${toolchain_dir} /bin && pwd) "
209- append_env_in_setup_path PATH ${toolchain_bin_path}
196+ setup_path_toolchain
210197 fi
211198
212199 if [[ " ${enable_vulkan_sdk} " -eq 1 ]]; then
213- cd " ${root_dir} "
214- vulkan_sdk_bin_path=" $( cd ${vulkan_sdk_bin_dir} && pwd) "
215- append_env_in_setup_path PATH ${vulkan_sdk_bin_path}
200+ setup_path_vulkan
216201 fi
217202
218203 if [[ " ${enable_model_converter} " -eq 1 ]]; then
219- cd " ${root_dir} "
220- model_converter_bin_path=" $( cd ${mlsdk_manifest_dir} /sw/model-converter/build && pwd) "
221- append_env_in_setup_path PATH ${model_converter_bin_path}
204+ setup_path_model_converter
222205 fi
223206
224- # Add Path for vgf-lib and emulation-layer
225207 if [[ " ${enable_vgf_lib} " -eq 1 ]]; then
226- cd " ${root_dir} "
227- model_vgf_path=" $( cd ${mlsdk_manifest_dir} /sw/vgf-lib/deploy && pwd) "
228- append_env_in_setup_path PATH ${model_vgf_path} /bin
229- append_env_in_setup_path LD_LIBRARY_PATH " ${model_vgf_path} /lib"
230- append_env_in_setup_path DYLD_LIBRARY_PATH " ${model_vgf_path} /lib"
208+ setup_path_vgf_lib
231209 fi
232210
233211 if [[ " ${enable_emulation_layer} " -eq 1 ]]; then
234- cd " ${root_dir} "
235- model_emulation_layer_path=" $( cd ${mlsdk_manifest_dir} /sw/emulation-layer/ && pwd) "
236- prepend_env_in_setup_path LD_LIBRARY_PATH " ${model_emulation_layer_path} /deploy/lib"
237- prepend_env_in_setup_path DYLD_LIBRARY_PATH " ${model_emulation_layer_path} /deploy/lib"
238- prepend_env_in_setup_path VK_INSTANCE_LAYERS VK_LAYER_ML_Tensor_Emulation
239- prepend_env_in_setup_path VK_INSTANCE_LAYERS VK_LAYER_ML_Graph_Emulation
240- prepend_env_in_setup_path VK_ADD_LAYER_PATH " ${model_emulation_layer_path} /deploy/share/vulkan/explicit_layer.d"
212+ setup_path_emulation_layer
241213 fi
214+
215+ echo " [main] Update path by running 'source ${setup_path_script} .sh'"
216+ echo " [main] Or for fish shell use 'source ${setup_path_script} .fish'"
242217}
243218
244219
@@ -305,13 +280,8 @@ if [[ $is_script_sourced -eq 0 ]]; then
305280 setup_model_converter ${root_dir} ${mlsdk_manifest_dir} ${enable_model_converter} ${enable_vgf_lib} ${enable_emulation_layer}
306281 fi
307282
308- # Create new setup_path script
309- if [[ " ${enable_baremetal_toolchain} " -eq 1 || \
310- " ${enable_fvps} " -eq 1 || \
311- " ${enable_vulkan_sdk} " -eq 1 || \
312- " ${enable_model_converter} " -eq 1 ]]; then
313- create_setup_path
314- fi
283+ # Create the setup_path.sh used to create the PATH variable for shell
284+ create_setup_path
315285
316286 # Setup the tosa_reference_model and dependencies
317287 CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install --no-dependencies -r $et_dir /backends/arm/requirements-arm-tosa.txt
@@ -320,8 +290,6 @@ if [[ $is_script_sourced -eq 0 ]]; then
320290 setup_ethos_u_tools
321291 fi
322292
323- echo " [main] Update path by running 'source ${setup_path_script} .sh'"
324- hash fish 2> /dev/null && echo >&2 " [main] Or for fish shell use 'source ${setup_path_script} .fish'"
325293 echo " [main] success!"
326294 exit 0
327295fi
0 commit comments