diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acc32fb..d91317a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,18 +66,9 @@ jobs: - name: cache uses: actions/cache@v3 with: - path: "**/cpm_modules" + path: "**/CPM_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - - name: setup dependencies - uses: aminya/setup-cpp@v1 - with: - compiler: ${{ matrix.compiler }} - vcvarsall: ${{ contains(matrix.os, 'windows')}} - cmake: true - ccache: true - clangtidy: ${{ env.CLANG_TIDY_VERSION }} - - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_configuration}} diff --git a/CMakeLists.txt b/CMakeLists.txt index e8d0920..5a5247e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED true) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) set_property(GLOBAL PROPERTY USE_FOLDERS ON) -OPTION(ENABLE_TESTS "Enable Unit Tests" OFF) +OPTION(ENABLE_TESTS "Enable Unit Tests" ON) OPTION(ENABLE_ALL_REASONABLE_WARNINGS "Enable all possible reasonable warnings" ON ) OPTION(ENABLE_WARNINGS_AS_ERRORS "Warnings are treated as Errors" ON) OPTION(ENABLE_STATIC_ANALYSIS "Enable Static Analysis Tools" OFF) @@ -20,4 +20,10 @@ include(${CMAKE_SCRIPTS_DIR}/sanitizers.cmake) include(${CMAKE_SCRIPTS_DIR}/staticanalysis.cmake) include(${CMAKE_SCRIPTS_DIR}/cpm.cmake) +if (ENABLE_TESTS) + message("-- Unit Testing Enabled") + enable_testing() + add_subdirectory(test) +endif() + add_subdirectory(src) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..861e575 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,15 @@ +include(${CMAKE_SCRIPTS_DIR}/googletest.cmake) +set(current_target opengl-starter-test) + +add_executable( + ${current_target} + test_main.cpp +) + +target_link_libraries( + ${current_target} + gtest_main +) + +include(GoogleTest) +gtest_discover_tests(${current_target}) diff --git a/test/test_main.cpp b/test/test_main.cpp new file mode 100644 index 0000000..d46382c --- /dev/null +++ b/test/test_main.cpp @@ -0,0 +1,6 @@ +#include + +TEST(testmain, example) +{ + EXPECT_EQ(42, 7*6); +} \ No newline at end of file