Skip to content

Commit

Permalink
Initial commit: Professional C++ Calculator Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Anon23261 committed Dec 17, 2024
0 parents commit 3f5872d
Show file tree
Hide file tree
Showing 11 changed files with 1,323 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: C++ CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libgtest-dev doxygen graphviz
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp lib/*.a /usr/lib
- name: Configure CMake
run: cmake -B build -DBUILD_TESTING=ON

- name: Build
run: cmake --build build

- name: Run tests
run: |
cd build
ctest --output-on-failure
- name: Generate documentation
run: doxygen Doxyfile

- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/html
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Build directories
build/
out/
cmake-build-*/

# IDE specific files
.idea/
.vscode/
*.swp
*.swo
.vs/

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# CMake
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
install_manifest.txt

# Testing
Testing/
test/Testing/

# Code coverage
*.gcda
*.gcno
coverage/

# Documentation
docs/html/
docs/latex/

# OS specific
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
37 changes: 37 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.10)
project(Calculator VERSION 1.0.0 LANGUAGES CXX)

# Specify C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Add compiler warnings
if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# Create library target
add_library(calculator_lib
src/calculator.cpp
src/calculator.h
)

target_include_directories(calculator_lib PUBLIC src)

# Add executable
add_executable(calculator src/main.cpp)
target_link_libraries(calculator PRIVATE calculator_lib)

# Install rules
install(TARGETS calculator calculator_lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

install(FILES src/calculator.h
DESTINATION include
)
44 changes: 44 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
PROJECT_NAME = "Modern C++ Calculator"
PROJECT_NUMBER = 1.0.0
PROJECT_BRIEF = "A professional-grade calculator implementation in modern C++"
OUTPUT_DIRECTORY = docs
CREATE_SUBDIRS = YES
OPTIMIZE_OUTPUT_FOR_C = YES

EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES

GENERATE_HTML = YES
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
GENERATE_XML = NO

INPUT = src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.cpp *.h
RECURSIVE = YES

EXCLUDE_PATTERNS = */build/* */test/*

HAVE_DOT = YES
UML_LOOK = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES

HTML_DYNAMIC_SECTIONS = YES
INTERACTIVE_SVG = YES
DOT_IMAGE_FORMAT = svg
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80

GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250

FORMULA_FONTSIZE = 10

USE_MDFILE_AS_MAINPAGE = README.md
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 [Your Name]

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.
Loading

0 comments on commit 3f5872d

Please sign in to comment.