Skip to content

Commit

Permalink
holy moly
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndskg committed Jan 7, 2024
1 parent 6779621 commit 10f4663
Show file tree
Hide file tree
Showing 32 changed files with 1,342 additions and 14,498 deletions.
150 changes: 105 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Set the minimum required version of CMake
cmake_minimum_required(VERSION 3.26)

# Enable verbose output during the build process
set(CMAKE_VERBOSE_MAKEFILE on)

# Project configuration
Expand All @@ -17,11 +18,11 @@ project(black-scholes-cpp VERSION 1.0 LANGUAGES CXX)
#cmake_policy(SET CMP0146 OLD)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
message(STATUS "C++ Compiler Flags: ${CMAKE_CXX_FLAGS}")

# Set the minimum macOS deployment target
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.5" CACHE STRING "Minimum macOS version")

message(STATUS "C++ Compiler Flags: ${CMAKE_CXX_FLAGS}")

# Set C++ standard to 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -43,41 +44,54 @@ include (project-defaults.cmake)
# message(FATAL_ERROR "Google Test not found. Please make sure it is installed.")
# endif()

# Optionally, enable CTest for running tests with 'make test'
enable_testing()


# Main program executable
##########################################################################################################

# Add subdirectories
add_subdirectory(gtest) # Assuming Google Test is in the 'gtest' directory
# Add subdirectories for project components
add_subdirectory(src)
add_subdirectory(test)

# Executable dependencies
# Collect source files
file(GLOB SOURCES "src/*.cpp" "include/black-scholes-cpp/*.h")

# Add the main executable
set(EXECUTABLE_NAME "black_scholes")
add_executable(black_scholes src/main.cpp)

# Executable dependencies
# Check if there are source files before creating the executable
if(SOURCES)
add_executable("${EXECUTABLE_NAME}" ${SOURCES})
endif(SOURCES)
# Create the main executable
add_executable(black_scholes ${SOURCES})

# Set include directories for the executable
target_include_directories(black_scholes PRIVATE include/black-scholes-cpp)
target_include_directories(black_scholes PRIVATE include/third_party)

# Add include directories
include_directories(${GTEST_INCLUDE_DIRS})
include_directories(black_scholes PRIVATE include/black-scholes-cpp)
include_directories(black_scholes PRIVATE include/third_party)
# Link the main executable against Google Test, the Black-Scholes library, and other necessary libraries
target_link_libraries(black_scholes
PRIVATE
GTest::gtest
GTest::gtest_main
blackScholesLibrary
curl
)
endif()


# Instantiate and define Black-Scholes library
# Instantiate and define the Black-Scholes library
##########################################################################################################

# Add the source files for the library
add_library(blackScholesLibrary
${SOURCES}
test/gtest_main.cpp
test/test_blackScholesModel.cpp
src/blackScholesModel.cpp
src/hestonModel.cpp
src/inputReader.cpp
src/optionGreeks.cpp
src/optionGreeksModel.cpp
src/outputWriter.cpp
src/Program.cpp
src/main.cpp
)

# Add include directories for the library
Expand All @@ -87,51 +101,97 @@ target_include_directories(blackScholesLibrary
# Add other include directories as needed
)

# Set compiler features
# Set compiler features for the library
target_compile_features(blackScholesLibrary PUBLIC cxx_std_20)

## Link against Threads library (if needed)
#target_link_libraries(blackScholesLibrary PRIVATE Threads::Threads)
# Link against Google Test and other necessary libraries
target_link_libraries(blackScholesLibrary PRIVATE GTest::gtest GTest::gtest_main curl)

# Include directories for the library
target_include_directories(blackScholesLibrary
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
# Add other include directories as needed
)

# Set compiler features
target_compile_features(blackScholesLibrary PUBLIC cxx_std_20)

# Link against Google Test, blackScholesLibrary, Threads, and other necessary libraries
target_link_libraries(black_scholes
PRIVATE
GTest::gtest_main
blackScholesLibrary
curl
)

# Testing configurations
##########################################################################################################


# Optionally, enable CTest for running tests with 'make test'
enable_testing()

include(GoogleTest)
include(CTest)

# Discover and run tests using Google Test
gtest_discover_tests(black_scholes)

# Add each test
# Add a test target
add_test(NAME black_scholes_test COMMAND black_scholes)


# Custom targets
##########################################################################################################

# Cleaning up the project and build directory
# Add a custom target for cleaning up the project and the build directory
add_custom_target(cleanup
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cleanup.cmake
COMMENT "Cleaning build artifacts"
)

# Create a custom target for each test file
# Testing blackScholesModel
add_custom_target(test_blackScholesModel
COMMAND test_blackScholesModel
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for blackScholesModel"
)

# Testing hestonModel
add_custom_target(test_hestonModel
COMMAND test_hestonModel
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for hestonModel"
)

# Testing inputReader
add_custom_target(test_inputReader
COMMAND test_inputReader
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for inputReader"
)

# Testing optionGreeks
add_custom_target(test_optionGreeks
COMMAND test_optionGreeks
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for optionGreeks"
)

# Testing optionGreeksModel
add_custom_target(test_optionGreeksModel
COMMAND test_optionGreeksModel
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for optionGreeksModel"
)

# Testing outputWriter
add_custom_target(test_outputWriter
COMMAND test_outputWriter
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for outputWriter"
)

# Testing Program
add_custom_target(test_Program
COMMAND test_Program
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests for Program"
)

# Add a custom target for running all tests
add_custom_target(run_tests
COMMAND ${CMAKE_CTEST_COMMAND} --verbose
DEPENDS
test_blackScholesModel
test_hestonModel
test_inputReader
test_optionGreeks
test_optionGreeksModel
test_outputWriter
test_Program
# Add other test targets if needed
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running all unit tests"
)
16 changes: 9 additions & 7 deletions docs/hierarchy.gql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ black-scholes-cpp/ # Project root directory
│ ├── usage.md # Library usage guide
│ ├── troubleshooting.md # Troubleshooting guide
│ ├── contribution.md # Contribution guidelines
│ ├── Doxyfile # Doxygen documentation
│ └── api_reference.md # API reference documentation
├── gtest/ # Google Test framework
├── include/ # Directory for header files
Expand All @@ -18,7 +19,8 @@ black-scholes-cpp/ # Project root directory
│ │ ├── optionGreeks.h # Header file for optionGreeks
│ │ ├── optionGreeksModel.h # Header file for optionGreeksModel
│ │ ├── outputWriter.h # Header file for outputWriter
│ │ └── Program.h # Header file for Program
│ │ ├── Program.h # Header file for Program
│ │ └── csv.h # Header file (possibly for CSV-related functionality)
│ └── third_party/ # Header files for third-party libraries
│ ├── libcurl/ # libcurl headers
│ ├── websocketpp/ # WebSocket++ headers
Expand All @@ -32,22 +34,22 @@ black-scholes-cpp/ # Project root directory
│ ├── optionGreeksModel.cpp # Source file for optionGreeksModel
│ ├── outputWriter.cpp # Source file for outputWriter
│ ├── Program.cpp # Source file for Program
│ ├── main.cpp # Source file for main driver file
│ └── CMakeLists.txt # CMake configuration for the entire src directory
├── tests/ # Test directory
├── test/ # Test directory
│ ├── test_blackScholesModel.cpp # Test file for blackScholesModel
│ ├── test_hestonModel.cpp # Test file for hestonModel
│ ├── test_Program.cpp # Test file for Program
│ ├── test_inputReader.cpp # Test file for inputReader
│ ├── test_outputWriter.cpp # Test file for outputWriter
│ ├── test_optionGreeks.cpp # Test file for optionGreeks
│ ├── test_optionGreeksModel.cpp # Test file for optionGreeksModel
│ ├── unit_test_framework.h # Header file for the unit test framework
│ └── CMakeLists.txt # CMake configuration for the tests directory
│ ├── gtest_main.cpp # Main test file for Google Test
│ └── CMakeLists.txt # CMake configuration for the test directory
├── .gitignore # Git ignore file to exclude certain files/directories from version control
├── Makefile # Makefile for building the project
├── csv.h # Header file (possibly for CSV-related functionality)
├── option_GS_df.csv # CSV file
├── main.cpp # Main driver file
├── CMakeLists.txt # Top-level CMake configuration
├── project-defaults.cmake # Top-level CMake default module configurations
├── cleanup.cmake # Custom CMake target for cleaning build direcotry
├── xcode_redirect.hpp # Header file (possibly related to Xcode)
└── README.md # Project README file
53 changes: 0 additions & 53 deletions gtest/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 10f4663

Please sign in to comment.