diff --git a/.gitea/workflows/build_and_test.yaml b/.gitea/workflows/build_and_test.yaml new file mode 100644 index 0000000..919dc44 --- /dev/null +++ b/.gitea/workflows/build_and_test.yaml @@ -0,0 +1,59 @@ + +name: Build and Test verification +run-name: ${{ gitea.actor }}: Build & Test on ${{ gitea.ref_name }} +on: [push] + +jobs: + build: + runs-on: debian12 + container: + image: git.vxbard.net/homeburger/bard-cpp-builder:1.0 + steps: + - name: clone + uses: actions/checkout@v3 + + - name: container-setup + run: container-setup.sh + + - name: configure + run: cmake -S . -B build + + - name: build + run: cmake --build build -j + + - name: upload + uses: actions/upload-artifact@v3 + with: + name: build-artifact + path: build + + test: + runs-on: debian12 + container: + image: git.vxbard.net/homeburger/bard-cpp-builder:1.0 + needs: build + steps: + - name: clone + uses: actions/checkout@v3 + + - name: container-setup + run: container-setup.sh + + - name: download + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: build + + - name: make_executable + run: chmod -R +x ./build + + - name: run_unit_tests + run: | + cd build + ctest -T Test + + - name: code_coverage + run: | + cd build + gcovr -r .. --filter "../src" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3394524 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +build/* +Testing/* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e177d05 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,55 @@ + +cmake_minimum_required(VERSION 3.23) + +project(maiden) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}) + +# gtest +include(FetchContent) +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.17.x +) +FetchContent_MakeAvailable(googletest) + +# add_subdirectory() to nest CMakeLists + +add_executable(maiden + src/App.cpp + src/main.cpp + # include extra source files here +) + +add_executable(maiden_test + src/App.cpp + test/TestApp.cpp +) + +target_include_directories(maiden PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/src" + # add additional include directories here +) + +target_include_directories(maiden_test PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/src" +) + +target_compile_options(maiden_test PRIVATE --coverage) +target_link_options(maiden_test PRIVATE --coverage) + +# TODO: add option for disabling tests (like if target == DEBUG then tests on, otherwise tests off) +target_link_libraries(maiden_test PRIVATE + GTest::gmock + GTest::gmock_main +) + +include(CTest) +enable_testing() # ctest is whatever + +include(GoogleTest) +gtest_discover_tests(maiden_test) diff --git a/README.md b/README.md index e6fa26c..27d798c 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,46 @@ The maiden project is a GPU accelerated 3D rendering engine built with C++ based ## Getting Started -### git instructions here -### build instructions here +### Clone Repository +```bash +$ git clone https://git.vxbard.net/homeburger/maiden.git + +# If there's any necessary submodules then: +$ git clone --recurse-submodules https://git.vxbard.net/homeburger/maiden.git + +# If you have already cloned the repository and you need its submodules: +$ git submodule update --init --recursive +``` +### Build +This app uses CMake and C++20, so a compatible compiler (gcc8, clang9, msvc16) are necessary. + +Most library prerequisites are handled within CMake. Any others that need to be manually installed will be described below as the project grows. + +To build the project (using default build directory "build"): +```bash +# configure +$ cmake -S . -B build # + any extra options + +# build +$ cmake --build build -j + +# execute +$ cd build +$ ./maiden +``` + +### Testing +This app uses GoogleTest for building unit tests. The below instructions use ctest and gcovr for test execution and code coverage: +```bash +# execute unit tests +$ ctest -T Test # + filter options + +# analyze code coverage +$ cd build +$ gcovr -r .. --filter "../src" +``` + ### app troubleshooting here -### testing instructions here ## Development Roadmap ### lots of todo here - - diff --git a/assets/.gitkeep b/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/.gitkeep b/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/.gitkeep b/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..e69de29 diff --git a/src/App.cpp b/src/App.cpp new file mode 100644 index 0000000..0026493 --- /dev/null +++ b/src/App.cpp @@ -0,0 +1,18 @@ + +#include "App.hpp" + +void App::run() { + + std::cout << "im an app and im running !!" << std::endl; + + (void)foo(); + + return; + +} + +int32_t App::foo() { + + return 12; + +} diff --git a/src/App.hpp b/src/App.hpp new file mode 100644 index 0000000..500db8c --- /dev/null +++ b/src/App.hpp @@ -0,0 +1,19 @@ + +#pragma once + +#include +#include + +class App { + + public: + App() = default; + ~App() = default; + + void run(); + + private: + + int32_t foo(); + +}; diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..80dab38 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,14 @@ + +#include + +#include "App.hpp" + +int main(int argc, char** argv) { + + std::cout << "hi mom !" << std::endl; + + App app; + app.run(); + + return 0; +} diff --git a/test/TestApp.cpp b/test/TestApp.cpp new file mode 100644 index 0000000..65159fa --- /dev/null +++ b/test/TestApp.cpp @@ -0,0 +1,36 @@ + +#include +#include + +#define private public +#include +#undef private + +class TestApp : public testing::Test { + + protected: + + void createUut() { + uut_ = std::make_unique(); + } + + std::unique_ptr uut_; + +}; + +TEST_F(TestApp, TestApp_run_nominal) { + + createUut(); + uut_->run(); + + // no expect here + +} + +TEST_F(TestApp, TestApp_foo_nominal) { + + createUut(); + + EXPECT_EQ(uut_->foo(), 12); + +}