-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split project by libs & refactoring cmake files
Dev/v1.1.1
- Loading branch information
Showing
31 changed files
with
722 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CompileFlags: | ||
CompilationDatabase: "build" | ||
|
||
Diagnostics: | ||
ClangTidy: | ||
Add: modernize* | ||
Remove: modernize-use-trailing-return-type | ||
UnusedIncludes: Strict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "cmake: configure", | ||
"type": "shell", | ||
"command": "cmake", | ||
"args": [ | ||
"-S", "${workspaceFolder}", | ||
"-B", "${workspaceFolder}/build", | ||
"-DCMAKE_BUILD_TYPE=${input:buildType}" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": ["$gcc"], | ||
"detail": "Generated task to configure CMake project" | ||
}, | ||
{ | ||
"label": "cmake: build", | ||
"type": "shell", | ||
"command": "cmake", | ||
"args": [ | ||
"--build", "${workspaceFolder}/build", | ||
"--config", "${input:buildType}", | ||
"--target", "all", | ||
"--", | ||
"-j8" | ||
], | ||
"dependsOn": "cmake: configure", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": ["$gcc"], | ||
"detail": "Generated task to build CMake project" | ||
}, | ||
{ | ||
"label": "cleanup", | ||
"type": "shell", | ||
"command": "rm", | ||
"args": [ | ||
"-rf", | ||
"${workspaceFolder}/build/*" | ||
], | ||
"group": "none" | ||
}, | ||
{ | ||
"label": "install libspreadsheet", | ||
"type": "shell", | ||
"command": "cmake", | ||
"args": [ | ||
"--build", "${workspaceFolder}/build", | ||
"--config", "${input:buildType}", | ||
"--target", "install" | ||
], | ||
"dependsOn": "cmake: build", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": ["$gcc"], | ||
"detail": "Install libspreadsheet" | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "buildType", | ||
"type": "pickString", | ||
"description": "Select the build type", | ||
"options": [ | ||
"Debug", | ||
"Release", | ||
"MinSizeRel", | ||
"RelWithDebInfo" | ||
], | ||
"default": "Debug" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.24) | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
project(spreadsheet | ||
VERSION 1.1.0 | ||
DESCRIPTION "spreadsheet" | ||
HOMEPAGE_URL "https://github.com/IgorKilipenko/cpp-spreadsheet" | ||
LANGUAGES CXX | ||
) | ||
|
||
project(cpp-spreadsheet-app VERSION 1.1.0 LANGUAGES CXX) | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# Set C++ standard | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough") | ||
|
||
# Add subdirectory with the library | ||
add_subdirectory(spreadsheet) | ||
# Source directiory | ||
set(PROJECT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") | ||
|
||
# Public include directiory | ||
set(PROJECT_PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
|
||
# Installation directiory | ||
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/bin") | ||
|
||
# Add threads library for all lib targets | ||
find_package(Threads REQUIRED) | ||
link_libraries(Threads::Threads) | ||
|
||
# Find Java | ||
find_package(Java REQUIRED) | ||
|
||
# Include the ANTLR setup | ||
include(cmake/install_antlr.cmake) | ||
|
||
# Include the source files and create targets | ||
include(cmake/install.cmake) | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL "spreadsheet") # if spreadsheet is top-level project | ||
# add include path | ||
include_directories(include) | ||
include_directories(src/include) | ||
include_directories(src) | ||
|
||
include(cmake/utils.cmake) | ||
include(cmake/develop.cmake) | ||
endif() | ||
|
||
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT spreadsheet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,80 @@ | ||
# Cpp-Spreadsheet | ||
|
||
## Дипломный проект: Электронная таблица | ||
# Cpp-Spreadsheet (Электронная таблица) | ||
|
||
## Содержание | ||
|
||
- [Описание проекта](#project-description) | ||
- [Функциональность](#main-features) | ||
- [Пример использования](#use-examples) | ||
- [Технологии](#project-technology) | ||
- [Установка](#project-installation) | ||
|
||
## Описание проекта {#project-description} | ||
|
||
Этот проект представляет собой упрощённый аналог электронных таблиц. В ячейках таблицы могут содержаться как текст, так и формулы, включающие индексы (ссылки) других ячеек. | ||
|
||
## Функциональность {#main-features} | ||
|
||
- Поддержка чисел и строк в ячейках | ||
- Возможность использования формул с числами, строками и ссылками на другие ячейки | ||
- Автоматическое обновление значений ячеек при изменении зависимых ячеек | ||
- Обработка циклических зависимостей и ошибок в формулах | ||
|
||
## Пример использования {#use-examples} | ||
|
||
```cpp | ||
#include "spreadsheet.h" | ||
#include <iostream> | ||
|
||
int main() { | ||
// Создаем новую таблицу | ||
auto sheet = CreateSheet(); | ||
|
||
// Задаем значения ячеек | ||
sheet->SetCell("A1"_pos, "Hello, world!"); | ||
sheet->SetCell("B1"_pos, "=2+2"); | ||
|
||
// Получаем значения ячеек и выводим на экран | ||
std::cout << "A1: " << sheet->GetCell("A1"_pos)->GetValue() << std::endl; | ||
std::cout << "B1: " << sheet->GetCell("B1"_pos)->GetValue() << std::endl; | ||
|
||
// Очищаем ячейку | ||
sheet->ClearCell("B1"_pos); | ||
|
||
// Получаем значение очищенной ячейки (должно быть пусто) | ||
std::cout << "B1 after clearing: " << sheet->GetCell("B1"_pos)->GetValue() << std::endl; | ||
|
||
return 0; | ||
} | ||
``` | ||
|
||
## Технологии {#project-technology} | ||
|
||
- Стандарт языка: C++17 | ||
- Парсинг формул: [ANTLR4](https://www.antlr.org/) | ||
- Основная логика приложения: библиотека `libspreadsheet` | ||
- Пример использования: консольное приложение `spreadsheet` | ||
|
||
## Установка {#project-installation} | ||
|
||
<details> | ||
|
||
<summary>Для установки проекта выполните следующие шаги:</summary> | ||
|
||
```bash | ||
# Клонировать репозиторий | ||
git clone https://github.com/IgorKilipenko/cpp-spreadsheet.git | ||
|
||
# Перейти в каталог проекта | ||
cd cpp-spreadsheet | ||
|
||
# Собрать проект с помощью CMake | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
|
||
# Установить | ||
make install | ||
``` | ||
|
||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
message(STATUS "-------------DEVELOP SETTING------------") | ||
|
||
# Enable address sanitizer | ||
option(ENABLE_SANITIZER "Enable sanitizer(Debug+Gcc/Clang/AppleClang)" ON) | ||
|
||
if(ENABLE_SANITIZER AND NOT MSVC) | ||
if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
check_asan(HAS_ASAN) | ||
if(HAS_ASAN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") | ||
else() | ||
message(WARNING "sanitizer is no supported with current tool-chains") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# warning | ||
option(ENABLE_WARNING "Enable warning for all project " OFF) | ||
if(ENABLE_WARNING) | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
list(APPEND MSVC_OPTIONS "/W3") | ||
if(MSVC_VERSION GREATER 1900) # Allow non fatal security warnings for msvc 2015 | ||
list(APPEND MSVC_OPTIONS "/WX") | ||
endif() | ||
add_compile_options(MSVC_OPTIONS) | ||
else() | ||
add_compile_options(-Wall | ||
-Wextra | ||
-Wconversion | ||
-pedantic | ||
-Werror | ||
-Wfatal-errors) | ||
endif() | ||
endif() | ||
|
||
message(STATUS "--------------------------------------------") |
Oops, something went wrong.