Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Romanchuk.Evgenii/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.5.0)

# Установка стандарта C++
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Werror")

# Определение проекта
project(daemon VERSION 0.1.0 LANGUAGES C CXX)

# Добавление исполняемого файла
add_executable(daemon config.cpp daemon.cpp main.cpp)
1 change: 1 addition & 0 deletions Romanchuk.Evgenii/Folder_1/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-test
1 change: 1 addition & 0 deletions Romanchuk.Evgenii/Folder_2/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-test
41 changes: 41 additions & 0 deletions Romanchuk.Evgenii/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

# Получение пути до текущего каталога
initial_dir=$(dirname "$(readlink -f "$0")")

# Проверка наличия cmake
CMAKE_PATH=$(which cmake)

if [ -z "$CMAKE_PATH" ]; then
echo "cmake is not installed. Please install cmake and try again."
exit 1
else
echo "Using cmake at $CMAKE_PATH"
fi

# Создание папки build
mkdir -p "$initial_dir/build"

# Переход в папку build
cd "$initial_dir/build" || { echo "Failed to change to the build directory."; exit 1; }

# Запуск cmake и make
cmake ..
if [ $? -ne 0 ]; then
echo "Error while running cmake."
exit 1
fi

make
if [ $? -ne 0 ]; then
echo "Error while running make."
exit 1
fi

# Возвращение в начальную директорию и запуск демона
cd "$initial_dir" || { echo "Failed to exit build directory."; exit 1; }

sudo "$initial_dir/build/daemon" "$initial_dir/config.txt"

# Очистка после выполнения
sudo rm -rf "$initial_dir/build/daemon"
Loading