feat: add challenge code

This commit is contained in:
2024-03-13 01:55:14 +00:00
commit 5634d1bb39
22 changed files with 925 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.27)
project(CalculatorChallenge CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
INCLUDE(FetchContent)
FetchContent_Declare(
fmtformat
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 10.2.1
)
FetchContent_MakeAvailable(fmtformat)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.5.3
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(CTest)
include(Catch)
set(CMAKE_C_COMPILER /opt/homebrew/Cellar/llvm@16/16.0.6/bin/clang)
set(CMAKE_CXX_COMPILER /opt/homebrew/Cellar/llvm@16/16.0.6/bin/clang++)
SET(CALCULATOR_CHALLENGE_SOURCES
Calculator.cpp
CalculatorCli.cpp
utils.cpp
)
add_executable(calculator-challege
main.cpp
${CALCULATOR_CHALLENGE_SOURCES}
)
target_link_libraries(calculator-challege PRIVATE fmt::fmt)
add_executable(calculator-challege-tests
CalculatorTests.cpp
BinaryOperatorFactoryTests.cpp
CalculatorCliTests.cpp
${CALCULATOR_CHALLENGE_SOURCES}
)
target_link_libraries(calculator-challege-tests PRIVATE Catch2::Catch2WithMain fmt::fmt)
catch_discover_tests(calculator-challege-tests)