From 9f2e20aefe3f4b40211f522268b8b052280d5b28 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 13:56:48 +0300 Subject: [PATCH 1/9] create pre-main --- .clang-format | 6 +- .github/workflows/clang-format-check.yml | 53 +++++++++++++++ .github/workflows/clang-tidy.yml | 64 ++++++++++++++++++ .github/workflows/cppcheck.yml | 27 ++++++++ .vscode/settings.json | 82 ++++++++++++++++++++++++ LICENSE | 21 ++++++ README.md | 8 +-- cmake/CPM.cmake | 24 +++++++ 8 files changed, 277 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/clang-format-check.yml create mode 100644 .github/workflows/clang-tidy.yml create mode 100644 .github/workflows/cppcheck.yml create mode 100644 .vscode/settings.json create mode 100644 LICENSE create mode 100644 cmake/CPM.cmake diff --git a/.clang-format b/.clang-format index 457581e..cf318c0 100644 --- a/.clang-format +++ b/.clang-format @@ -1,8 +1,8 @@ --- BasedOnStyle: Google +AccessModifierOffset: -4 -AccessModifierOffset: -2 AlignTrailingComments: true IndentPPDirectives: AfterHash IndentWidth: 4 @@ -15,11 +15,13 @@ BreakBeforeTernaryOperators: true ColumnLimit: 100 ConstructorInitializerAllOnOneLineOrOnePerLine: true -IncludeBlocks: Regroup +IncludeBlocks: Regroup + SortIncludes: true SpaceBeforeParens: ControlStatements AllowShortFunctionsOnASingleLine: InlineOnly AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false + ... \ No newline at end of file diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml new file mode 100644 index 0000000..b723966 --- /dev/null +++ b/.github/workflows/clang-format-check.yml @@ -0,0 +1,53 @@ +name: Clang Format Check + +on: + push: + branches: + - '**' + +jobs: + clang-format: + runs-on: ubuntu-latest + + steps: + # Шаг 1: Checkout репозитория + - name: Checkout repository + uses: actions/checkout@v3 + + # Шаг 2: Установка зависимостей + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang-format clang-tidy libboost-all-dev \ + libcurl4-openssl-dev libpq-dev \ + nlohmann-json3-dev libpqxx-dev + + # Шаг 3: Установка TgBot + - name: Install TgBot + run: | + git clone https://github.com/reo7sp/tgbot-cpp.git + cd tgbot-cpp + mkdir build + cd build + cmake .. + make -j$(nproc) + sudo make install + + # Шаг 4: Кэширование директории сборки + - name: Cache Build Directory + uses: actions/cache@v3 + with: + path: build + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build- + + # Шаг 5: Конфигурация CMake + - name: Configure CMake + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTgBot_DIR=/usr/local/lib/cmake/TgBot + + # Шаг 6: Запуск Clang Format + - name: Run Clang Format + run: | + find include source -name '*.cpp' -o -name '*.h' | xargs clang-format -i + git diff --exit-code || (echo "Clang format check failed! Run clang-format and commit changes."; exit 1) \ No newline at end of file diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 0000000..e6e58af --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,64 @@ +name: Static Analysis Checks + +on: + push: + branches: + - '**' + +defaults: + run: + working-directory: . + +jobs: + install-deps: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang-format clang-tidy libboost-all-dev \ + libcurl4-openssl-dev libpq-dev \ + nlohmann-json3-dev libpqxx-dev + + - name: Install TgBot + run: | + git clone https://github.com/reo7sp/tgbot-cpp.git + cd tgbot-cpp + mkdir build + cd build + cmake .. + make -j$(nproc) + sudo make install + + - name: Cache Build Directory + uses: actions/cache@v3 + with: + path: build + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build- + + - name: Configure CMake + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTgBot_DIR=/usr/local/lib/cmake/TgBot + + + clang-tidy: + needs: install-deps + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Restore Cached Build + uses: actions/cache@v3 + with: + path: build + key: ${{ runner.os }}-build-${{ github.sha }} + + - name: Run Clang Tidy + run: | + # Найдем все исходные файлы (.cpp и .h) в нужных папках (source, include), исключая build + clang-tidy source/*.cpp include/*.hpp \ No newline at end of file diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000..e4666b6 --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,27 @@ +name: CppCheck Analysis + +on: + push: + branches: + - '**' + +jobs: + cppcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cppcheck + + - name: Configure CMake + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Run CppCheck + run: | + # Указываем CppCheck проверять только исходные файлы в папке source или include + cppcheck --enable=all --inconclusive --quiet --error-exitcode=1 source/ include/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5d785b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,82 @@ +{ + "files.associations": { + "tuple": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "any": "cpp", + "array": "cpp", + "atomic": "cpp", + "strstream": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "coroutine": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "source_location": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "shared_mutex": "cpp", + "span": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "variant": "cpp", + "format": "cpp", + "cfenv": "cpp", + "valarray": "cpp", + "stdfloat": "cpp" + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..34a1f1b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Melnikov Kirill + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 25c0187..db2f725 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,6 @@ git clone git@github.com:EntryPoint-C-project/EntryPoint.git cd EntryPoint # You need to make a telegram-bot token mkdir build && cd build -cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # Enable clang-tidy support +cmake -G Ninja .. ninja -``` -### 🔹 2. Running clang-tidy -```sh -run-clang-tidy -p build/ -``` \ No newline at end of file +``` \ No newline at end of file diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake new file mode 100644 index 0000000..4c61aea --- /dev/null +++ b/cmake/CPM.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors + +set(CPM_DOWNLOAD_VERSION 0.40.7) +set(CPM_HASH_SUM "c0fc82149e00c43a21febe7b2ca57b2ffea2b8e88ab867022c21d6b81937eb50") + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) + +file(DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} +) + +include(${CPM_DOWNLOAD_LOCATION}) \ No newline at end of file From a35963f2d79018ba0f3bd8edd10f23132342edeb Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 13:58:42 +0300 Subject: [PATCH 2/9] modified .gitignore --- .gitignore | 1 + .vscode/settings.json | 82 ------------------------------------------- 2 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 0c18535..fcbadf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ build/ +.vscode/ # Prerequisites *.d diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c5d785b..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "files.associations": { - "tuple": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "csignal": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "any": "cpp", - "array": "cpp", - "atomic": "cpp", - "strstream": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "charconv": "cpp", - "chrono": "cpp", - "codecvt": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "coroutine": "cpp", - "cstdint": "cpp", - "deque": "cpp", - "list": "cpp", - "map": "cpp", - "set": "cpp", - "string": "cpp", - "unordered_map": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "ratio": "cpp", - "source_location": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "fstream": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "numbers": "cpp", - "ostream": "cpp", - "semaphore": "cpp", - "shared_mutex": "cpp", - "span": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "thread": "cpp", - "cinttypes": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "variant": "cpp", - "format": "cpp", - "cfenv": "cpp", - "valarray": "cpp", - "stdfloat": "cpp" - } -} \ No newline at end of file From c04bfb64969933d19808e0175d4291dd3b8604ab Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 14:01:45 +0300 Subject: [PATCH 3/9] Update CMakeLists.txt --- CMakeLists.txt | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81f6226..b17810c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,31 @@ -cmake_minimum_required(VERSION 3.10) -project(TelegramBot) +cmake_minimum_required(VERSION 3.14 FATAL_ERROR) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +project(MyProject) -find_package(Boost REQUIRED COMPONENTS system) -find_package(TgBot REQUIRED) +include_directories(include) -target_include_directories(include) +file(GLOB SOURCES source/*.cpp) -file(GLOB SOURCES source/*.cpp) +add_executable(main ${SOURCES}) -add_executable(my_bot ${SOURCES}) +include(cmake/CPM.cmake) -target_link_libraries(my_bot Boost::system TgBot::TgBot) +CPMAddPackage( + NAME Boost + VERSION 1.86.0 + URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz + URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 + OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_SKIP_INSTALL_RULES ON" + "BUILD_SHARED_LIBS OFF" "BOOST_INCLUDE_LIBRARIES system" +) +CPMAddPackage( + NAME TgBot + GIT_REPOSITORY https://github.com/reo7sp/tgbot-cpp.git + GIT_TAG master +) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - target_compile_options(my_bot PRIVATE - -g - -fsanitize=address,undefined - -fno-omit-frame-pointer - ) - target_link_options(my_bot PRIVATE - -fsanitize=address,undefined - -fno-omit-frame-pointer - ) -endif() \ No newline at end of file +target_link_libraries(main + Boost::system + TgBot +) From 4897b1a47453203bdb5c708024d9f9fc13e97156 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 18:12:01 +0300 Subject: [PATCH 4/9] Update cppcheck.yml --- .github/workflows/cppcheck.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index e4666b6..72ad9b6 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -3,7 +3,10 @@ name: CppCheck Analysis on: push: branches: - - '**' + - main + pull_request: + branches: + - main jobs: cppcheck: @@ -11,7 +14,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies run: | @@ -23,5 +26,5 @@ jobs: - name: Run CppCheck run: | - # Указываем CppCheck проверять только исходные файлы в папке source или include - cppcheck --enable=all --inconclusive --quiet --error-exitcode=1 source/ include/ \ No newline at end of file + cppcheck --enable=all --inconclusive --quiet --error-exitcode=1 source/ include/ + From f8d3a1ccdd7a6755eee7dde6780d85ec126e1b02 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 18:12:11 +0300 Subject: [PATCH 5/9] Update clang-tidy.yml --- .github/workflows/clang-tidy.yml | 37 ++++++++++---------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index e6e58af..c37a50a 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -3,7 +3,10 @@ name: Static Analysis Checks on: push: branches: - - '**' + - main + pull_request: + branches: + - main defaults: run: @@ -14,35 +17,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y clang-format clang-tidy libboost-all-dev \ - libcurl4-openssl-dev libpq-dev \ - nlohmann-json3-dev libpqxx-dev - - - name: Install TgBot - run: | - git clone https://github.com/reo7sp/tgbot-cpp.git - cd tgbot-cpp - mkdir build - cd build - cmake .. - make -j$(nproc) - sudo make install - - - name: Cache Build Directory - uses: actions/cache@v3 - with: - path: build - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- + sudo apt-get install -y clang-tidy - name: Configure CMake - run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTgBot_DIR=/usr/local/lib/cmake/TgBot + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON clang-tidy: @@ -60,5 +43,7 @@ jobs: - name: Run Clang Tidy run: | - # Найдем все исходные файлы (.cpp и .h) в нужных папках (source, include), исключая build - clang-tidy source/*.cpp include/*.hpp \ No newline at end of file + clang-tidy source/*.cpp include/*.hpp + + + From 3b358faf011f425badd133dd2244ac6c46810530 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 18:12:22 +0300 Subject: [PATCH 6/9] Update clang-format-check.yml --- .github/workflows/clang-format-check.yml | 42 ++++++------------------ 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index b723966..3ecb350 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -3,51 +3,29 @@ name: Clang Format Check on: push: branches: - - '**' + - main + pull_request: + branches: + - main jobs: clang-format: runs-on: ubuntu-latest steps: - # Шаг 1: Checkout репозитория - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - # Шаг 2: Установка зависимостей - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y clang-format clang-tidy libboost-all-dev \ - libcurl4-openssl-dev libpq-dev \ - nlohmann-json3-dev libpqxx-dev - - # Шаг 3: Установка TgBot - - name: Install TgBot - run: | - git clone https://github.com/reo7sp/tgbot-cpp.git - cd tgbot-cpp - mkdir build - cd build - cmake .. - make -j$(nproc) - sudo make install + sudo apt-get install -y clang-format - # Шаг 4: Кэширование директории сборки - - name: Cache Build Directory - uses: actions/cache@v3 - with: - path: build - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - # Шаг 5: Конфигурация CMake - name: Configure CMake - run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTgBot_DIR=/usr/local/lib/cmake/TgBot + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - # Шаг 6: Запуск Clang Format - name: Run Clang Format run: | - find include source -name '*.cpp' -o -name '*.h' | xargs clang-format -i - git diff --exit-code || (echo "Clang format check failed! Run clang-format and commit changes."; exit 1) \ No newline at end of file + find include source -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i + git diff --exit-code || (echo "Clang format check failed! Run clang-format and commit changes."; exit 1) + From dd5b1b114ce3ca01644e4885302136a8e647f3d0 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Sun, 9 Mar 2025 18:12:44 +0300 Subject: [PATCH 7/9] Update .gitignore --- .gitignore | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index fcbadf5..4cca412 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,18 @@ +# IDEs and editors .idea/ -build/ .vscode/ + +# Build directories +build/ + # Prerequisites *.d # Compiled Object files -*.slo -*.lo *.o *.obj +*.slo +*.lo # Precompiled Headers *.gch @@ -24,10 +28,10 @@ build/ *.smod # Compiled Static libraries -*.lai -*.la *.a *.lib +*.lai +*.la # Executables *.exe From e0324cba0a08d3b202bd17b013a82d67038ed3cc Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Mon, 10 Mar 2025 23:38:43 +0300 Subject: [PATCH 8/9] Update CMakeLists.txt --- CMakeLists.txt | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b17810c..05fba6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,22 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR) -project(MyProject) +project(MyProject LANGUAGES CXX) -include_directories(include) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -file(GLOB SOURCES source/*.cpp) +include(cmake/CPM.cmake) -add_executable(main ${SOURCES}) -include(cmake/CPM.cmake) +# ---- Add source files ---- +# Note: globbing sources is considered bad practice as CMake's generators may not detect new files +# automatically. Keep that in mind when changing files, or explicitly mention them here. +file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp") + +add_library(${PROJECT_NAME} ${headers} ${sources}) + +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "MyApp") + +target_include_directories(${PROJECT_NAME} PUBLIC include) -CPMAddPackage( - NAME Boost - VERSION 1.86.0 - URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz - URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 - OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_SKIP_INSTALL_RULES ON" - "BUILD_SHARED_LIBS OFF" "BOOST_INCLUDE_LIBRARIES system" -) - -CPMAddPackage( - NAME TgBot - GIT_REPOSITORY https://github.com/reo7sp/tgbot-cpp.git - GIT_TAG master -) - -target_link_libraries(main - Boost::system - TgBot -) From 412699a128a571b9e7ba2e3c87bdbd322e41eb46 Mon Sep 17 00:00:00 2001 From: Meytardzhevtd Date: Tue, 11 Mar 2025 00:07:03 +0300 Subject: [PATCH 9/9] modified workflows --- .github/workflows/clang-format-check.yml | 2 +- .github/workflows/clang-tidy.yml | 2 +- .github/workflows/cppcheck.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 3ecb350..10d10d1 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -6,7 +6,7 @@ on: - main pull_request: branches: - - main + - '**' jobs: clang-format: diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index c37a50a..1d398c1 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -6,7 +6,7 @@ on: - main pull_request: branches: - - main + - '**' defaults: run: diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 72ad9b6..0705669 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -6,7 +6,7 @@ on: - main pull_request: branches: - - main + - '**' jobs: cppcheck: