Skip to content

Pre-main#5

Open
Meytardzhevtd wants to merge 9 commits intomainfrom
pre-main
Open

Pre-main#5
Meytardzhevtd wants to merge 9 commits intomainfrom
pre-main

Conversation

@Meytardzhevtd
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@Vdaleke Vdaleke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавить github-actions с проверками clang-format и clang-tidy. Сделать нормальное название PR и наполнить description.

Copy link
Collaborator

@Vdaleke Vdaleke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В общем и целом нормально, просто надо убрать лишнее и переделать cmake

runs-on: ubuntu-latest

steps:
# Шаг 1: Checkout репозитория
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Убрать комментарии на русском языке

steps:
# Шаг 1: Checkout репозитория
- name: Checkout repository
uses: actions/checkout@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть версия actions/checkout@v4, проапгрейдить

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy libboost-all-dev \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

оставить только нужные зависимости, e.g. clang-format

nlohmann-json3-dev libpqxx-dev

# Шаг 3: Установка TgBot
- name: Install TgBot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот шаг уже не нужен

sudo make install

# Шаг 4: Кэширование директории сборки
- name: Cache Build Directory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай пока без кеширования, если понадобится, добавим по гайду от cpm-cmake

CMakeLists.txt Outdated

include_directories(include)

file(GLOB SOURCES source/*.cpp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file(GLOB SOURCES source/*.cpp)
# ---- 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")

CMakeLists.txt Outdated

file(GLOB SOURCES source/*.cpp)

add_executable(main ${SOURCES})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай executable, который будет запускать бота на сервере будет лежать в отдельной папке apps, как это описано здесь и сделано здесь

при этом у вас в проекте будет два проекта: библиотека и приложение запускающее эту библиотеку на сервере.

В это CMakeLists.txt будет конфигурация основного проекта - библиотеки.
Сделаем вот так:

# ---- Create library ----

add_library(${PROJECT_NAME} ${headers} ${sources})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)

CMakeLists.txt с executable можешь создать уже в своем PR

```sh
git clone git@github.com:EntryPoint-C-project/EntryPoint.git
cd EntryPoint
# You need to make a telegram-bot token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше одной командой. и клонировать репозиторий и перейти в него это spoon-feeding, лучше не надо. Давай так:

Clone repository, go to the directory and run:
...sh
cmake  -S . -B build && cmake --build build
...

${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
)

include(${CPM_DOWNLOAD_LOCATION}) No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай здесь тоже последнюю строчку добавим чтоб гитхаб не ругался

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потом не забыть удалить, так как по факту файлики эти не нужны

@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(MyProject LANGUAGES CXX)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
project(MyProject LANGUAGES CXX)
project(EntryPoint LANGUAGES CXX)


project(MyProject LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не нужно, ты уже устанвливаешь настройку в 19 строчке для target-а.


set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "MyApp")

target_include_directories(${PROJECT_NAME} PUBLIC include)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_include_directories(
  ${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
                         $<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)


add_library(${PROJECT_NAME} ${headers} ${sources})

set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "MyApp")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTPUT_NAME зачем?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants