#!/bin/bash

CURRENT_PATH=$(pwd)
CMAKE_CACHE_FILE="./CMakeCache.txt"
PROJECT_NAME="laser_detection"

sed -i "s|$PROJEKT_NAME\_SOURCE_DIR:STATIC=.*|$PROJEKT_NAME\_SOURCE_DIR:STATIC=$CURRENT_PATH|g" "$CMAKE_CACHE_FILE"
sed -i "s|CMAKE_HOME_DIRECTORY:INTERNAL=.*|CMAKE_HOME_DIRECTORY:INTERNAL=$CURRENT_PATH|g" "$CMAKE_CACHE_FILE"
sed -i "s|CMAKE_CACHEFILE_DIR:INTERNAL=.*|CMAKE_CACHEFILE_DIR:INTERNAL=$CURRENT_PATH|g" "$CMAKE_CACHE_FILE"


# Aktualizujeme balíky v systéme
sudo apt-get update

# Inštalujeme nevyhnutné nástroje na zostavenie OpenCV a jeho prerekvizít
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

# Inštalujeme yasm pre lepšiu podporu hardwarového kódovania
sudo apt-get install -y yasm

# Inštalujeme OpenCV pre C++
sudo apt-get install -y libopencv-dev

# Vypíšeme verziu OpenCV
pkg-config --modversion opencv


cmake .
make

