Skip to content
Snippets Groups Projects
Commit d6139d72 authored by Jens Nolte's avatar Jens Nolte
Browse files

Adapt build scripts for new project structure

parent 4c782c4e
No related branches found
No related tags found
1 merge request!16Merge dev branch into master
#!/usr/bin/env bash
#!/usr/bin/env zsh
set -e
set -u
function print_usage {
print_usage() {
echo "Usage: set-device [ DEVICE_NAME | DEVICE_DIR ]"
}
function list_known_devices {
list_known_devices() {
echo "Known devices:"
ls -1 devices | while read f; do
if [[ -d "devices/$f" && -f "devices/$f/device_config.h" && -f "devices/$f/device_main.cpp" ]]; then
if [[ -d "devices/$f" ]]; then
echo "$f"
fi
done
}
function link_device_directory {
if [[ "$1" == /* ]]; then
DIR="$1"
else
DIR="../$1"
fi
echo "Linking main/device to $DIR"
rm "main/device" || true
ln -s "$DIR" "main/device"
touch --no-create "main/device/device_config.h"
touch --no-create "main/device/device_main.cpp"
link_device_directory() {
echo "Linking main to $1"
ln -snf "$1" "main"
touch --no-create main/**/*
}
if [[ -z "$1" ]]; then
if [[ $# < 1 ]]; then
print_usage
list_known_devices
elif [[ -f "$1/device_config.h" && -f "$1/device_main.cpp" ]]; then
elif [[ -d "$1" ]]; then
echo "Found device in directory $1"
link_device_directory "$1"
elif [[ -f "devices/$1/device_config.h" && -f "devices/$1/device_main.cpp" ]]; then
elif [[ -d "devices/$1" ]]; then
echo "Found device $1 in devices directory"
link_device_directory "devices/$1"
else
echo "Cannot find device_config.h and device_main.cpp in one of the following directories:"
echo "Cannot find device in one of the following directories:"
echo "$1"
echo "devices/$1"
fi
......@@ -17,10 +17,9 @@ function link_environment {
else
TARGET="../$1"
fi
echo "Linking main/environment.h to $TARGET"
rm "main/environment.h" || true
ln -s "$TARGET" "main/environment.h"
touch --no-create "main/environment.h"
echo "Linking qthing/environment.h to $TARGET"
ln -snf "$TARGET" "qthing/environment.h"
touch --no-create "qthing/environment.h"
}
if [[ -z "$1" ]]; then
......
......@@ -52,7 +52,7 @@ in rec {
shell = pkgs.stdenv.mkDerivation {
name = "esp-idf-env";
buildInputs = qthingDependencies;
buildInputs = qthingDependencies ++ [pkgs.zsh];
shellHook = shellSetup;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment