From 85e2925f2d5d0a2b83a08bca9376772de99d9847 Mon Sep 17 00:00:00 2001 From: Jisse Meruma Date: Fri, 19 Sep 2025 16:32:24 +0200 Subject: [PATCH] more infra structure --- .gitignore | 1 + README.md | 20 ++++++++++++++++++++ taskmasterd/CMakeLists.txt | 18 +++++++++++++++++- taskmasterd/include/example.hpp | 0 taskmasterd/include/job.hpp | 17 +++++++++++++++++ taskmasterd/src/job.cpp | 8 ++++++++ taskmasterd/src/main.cpp | 16 +++++++++++++--- 7 files changed, 76 insertions(+), 4 deletions(-) delete mode 100644 taskmasterd/include/example.hpp create mode 100644 taskmasterd/include/job.hpp create mode 100644 taskmasterd/src/job.cpp diff --git a/.gitignore b/.gitignore index e69de29..07ed706 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +build/* \ No newline at end of file diff --git a/README.md b/README.md index 78f1dc9..64c9db2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ # TaskMaster The goal of this project is to make a job control daemon, with features similar to supervisor. + +# Build steps +first go to the build directory +``` +cd build +``` + +then you can build the project by running the following: +``` +cmake .. +make +``` + +Executables will be located in the direcotries +``` +./build/taskmasterd/taskmasterd +--------------------------------- +./build/taskmasterctl/taskmaserctl +``` + diff --git a/taskmasterd/CMakeLists.txt b/taskmasterd/CMakeLists.txt index 7aafde1..4e2afd0 100644 --- a/taskmasterd/CMakeLists.txt +++ b/taskmasterd/CMakeLists.txt @@ -14,8 +14,24 @@ target_sources(taskmasterd PRIVATE ${SOURCES}) # include header directory target_include_directories(taskmasterd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +#include FetchContent module +include(FetchContent) + +# Fetch yaml-cpp library +FetchContent_Declare( + yaml-cpp + GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git + GIT_TAG 0.8.0 +) +FetchContent_MakeAvailable(yaml-cpp) + +# link yaml-cpp library +target_link_libraries(taskmasterd PUBLIC yaml-cpp) + # Set C++ standard to C++20 -set_target_properties(taskmasterd PRIVATE cxx_std_20) +set_target_properties(taskmasterd PROPERTIES CXX_STANDARD 20) + + # the PRIVATE keyword means that the target source and include directories will # only be used for this target and not for any targets that link to it. \ No newline at end of file diff --git a/taskmasterd/include/example.hpp b/taskmasterd/include/example.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/taskmasterd/include/job.hpp b/taskmasterd/include/job.hpp new file mode 100644 index 0000000..a9689ea --- /dev/null +++ b/taskmasterd/include/job.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +class Job { +public: + Job(const std::string& name); + void execute(); + +private: + // The name of the job + std::string _name; + + // Process ID of the job + std::vector _pid; +}; diff --git a/taskmasterd/src/job.cpp b/taskmasterd/src/job.cpp new file mode 100644 index 0000000..10da237 --- /dev/null +++ b/taskmasterd/src/job.cpp @@ -0,0 +1,8 @@ +#include "job.hpp" +#include + +Job::Job(const std::string& name) : _name(name) {} + +void Job::execute() { + std::cout << "Executing job: " << _name << std::endl; +} diff --git a/taskmasterd/src/main.cpp b/taskmasterd/src/main.cpp index cf8f5b2..04f645b 100644 --- a/taskmasterd/src/main.cpp +++ b/taskmasterd/src/main.cpp @@ -1,5 +1,15 @@ +#include +#include +#include "job.hpp" + int main() { - int i = 0 ; - return 0; + Job job("Example Job"); + std::cout << "Hello, Taskmaster!" << std::endl; + + // Load configuration from YAML file + YAML::Node config = YAML::LoadFile("../config.yaml"); + + job.execute(); + return 0; - i++; \ No newline at end of file +} \ No newline at end of file