From 1853318016594335664f6b58c1260afc118a3e2f Mon Sep 17 00:00:00 2001 From: marcelb Date: Mon, 20 Jan 2025 22:37:58 +0100 Subject: [PATCH] Switch to CMake --- .gitignore | 4 +- .vscode/c_cpp_properties.json | 16 -------- .vscode/settings.json | 76 ----------------------------------- .vscode/tasks.json | 28 ------------- CMakeLists.txt | 31 ++++++++++++++ test/CMakeLists.txt | 4 ++ test/compile.sh | 1 - test/{test.cpp => main.cpp} | 12 +++--- 8 files changed, 43 insertions(+), 129 deletions(-) delete mode 100644 .vscode/c_cpp_properties.json delete mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json create mode 100644 CMakeLists.txt create mode 100644 test/CMakeLists.txt delete mode 100644 test/compile.sh rename test/{test.cpp => main.cpp} (98%) diff --git a/.gitignore b/.gitignore index 621da26..eecb734 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -test/test -test/*.txt +build +.vscode example \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 4039bef..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c17", - "cppStandard": "gnu++17", - "intelliSenseMode": "linux-gcc-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 8372c4a..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "files.associations": { - "iostream": "cpp", - "functional": "cpp", - "thread": "cpp", - "chrono": "cpp", - "ostream": "cpp", - "condition_variable": "cpp", - "array": "cpp", - "atomic": "cpp", - "cwchar": "cpp", - "deque": "cpp", - "unordered_map": "cpp", - "vector": "cpp", - "exception": "cpp", - "initializer_list": "cpp", - "iosfwd": "cpp", - "mutex": "cpp", - "new": "cpp", - "ratio": "cpp", - "stdexcept": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "future": "cpp", - "*.ipp": "cpp", - "bitset": "cpp", - "algorithm": "cpp", - "string": "cpp", - "string_view": "cpp", - "fstream": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "csignal": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwctype": "cpp", - "any": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "codecvt": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "cstdint": "cpp", - "list": "cpp", - "map": "cpp", - "set": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "system_error": "cpp", - "iomanip": "cpp", - "istream": "cpp", - "limits": "cpp", - "numbers": "cpp", - "semaphore": "cpp", - "sstream": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "cinttypes": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "variant": "cpp", - "coroutine": "cpp", - "source_location": "cpp" - } -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 2193d8d..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "tasks": [ - { - "type": "cppbuild", - "label": "C/C++: gcc build active file", - "command": "/usr/bin/g++", - "args": [ - "-fdiagnostics-color=always", - "-g", - "${file}", - "-o", - "${fileDirname}/${fileBasenameNoExtension}" - ], - "options": { - "cwd": "${fileDirname}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Task generated by Debugger." - } - ], - "version": "2.0.0" -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..681174e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) + +project(Asynco) + +# Postavi verziju projekta +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Pronađi Boost biblioteku (ako nije uobičajeni direktorijum, postavi put) +find_package(Boost REQUIRED COMPONENTS system) + +# Dodaj direktorijume sa zaglavljima +include_directories(lib) + +# Dodaj biblioteku +add_library(asynco STATIC + src/engine.cpp + src/timers.cpp +) + +# Linkaj Asynco biblioteku sa Boost-om +target_link_libraries(asynco Boost::system) + +# Dodaj testove +add_subdirectory(test) + + +# Instaliraj biblioteku +# install(TARGETS asynco DESTINATION lib) +# install(FILES lib/asynco.hpp lib/define.hpp lib/engine.hpp lib/filesystem.hpp lib/timers.hpp lib/trigger.hpp DESTINATION include/asynco) +# \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..27c726e --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(asynco_test main.cpp) + +# Linkaj test sa Asynco bibliotekom +target_link_libraries(asynco_test asynco Boost::system) diff --git a/test/compile.sh b/test/compile.sh deleted file mode 100644 index 9cda8c6..0000000 --- a/test/compile.sh +++ /dev/null @@ -1 +0,0 @@ -g++ test.cpp ../src/* -o test \ No newline at end of file diff --git a/test/test.cpp b/test/main.cpp similarity index 98% rename from test/test.cpp rename to test/main.cpp index 43e284f..98defce 100644 --- a/test/test.cpp +++ b/test/main.cpp @@ -1,10 +1,10 @@ -// // #define NUM_OF_RUNNERS 2 +#define NUM_OF_RUNNERS 4 -#include "../lib/asynco.hpp" -#include "../lib/trigger.hpp" -#include "../lib/filesystem.hpp" -#include "../lib/timers.hpp" -#include "../lib/define.hpp" +#include "asynco.hpp" +#include "trigger.hpp" +#include "filesystem.hpp" +#include "timers.hpp" +#include "define.hpp" using namespace marcelb::asynco; using namespace triggers;