Skip to content
Snippets Groups Projects
Select Git revision
  • b1d0bd4944670d74a9b5f0c47c34b6f1cc56705a
  • main default protected
  • quickstart
3 results

set_env.sh

Blame
  • Forked from SoCLabs / Accelerator Project
    342 commits behind the upstream repository.
    user avatar
    dam1n19 authored
    b1d0bd49
    History
    set_env.sh 1.50 KiB
    #-----------------------------------------------------------------------------
    # SoC Labs Environment Setup Script
    # A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
    #
    # Contributors
    #
    # David Mapstone (d.a.mapstone@soton.ac.uk)
    #
    # Copyright  2023, SoC Labs (www.soclabs.org)
    #-----------------------------------------------------------------------------
    #!/bin/bash
    
    echo "set_env root"
    # Get Root Location of Design Structure
    if [ -z $DESIGN_ROOT ]; then
        # If $DESIGN_ROOT hasn't been set yet
        DESIGN_ROOT=`git rev-parse --show-superproject-working-tree`
    
        if [ -z $DESIGN_ROOT ]; then
            # If not in a submodule - at root
            DESIGN_ROOT=`git rev-parse --show-toplevel`
        fi
    
        # Source Top-Level Sourceme
        source $DESIGN_ROOT/set_env.sh
    else
        # Set Environment Variable for this Repository
        export SOC_TOP_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    
        # If this Repo is root of workspace
        if [ $SOC_TOP_DIR = $DESIGN_ROOT ]; then
            echo "Design Workspace: $DESIGN_ROOT" 
            export DESIGN_ROOT
            # Set Default Simulator
            export SIMULATOR="ivlog"
        fi
    
        # Source environment variables for all submodules
        for d in $SOC_TOP_DIR/* ; do
            if [ -e "$d/.git" ]; then
                echo $d
                if [ -f "$d/set_env.sh" ]; then
                # If .git file exists - submodule
                    source $d/set_env.sh
                fi
            fi
        done
    
        # Add Scripts to Path
        export PATH="$PATH:/$SOC_TOP_DIR/flow"
    fi