Update to match window-starter template
This commit is contained in:
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
@@ -18,46 +18,38 @@ jobs:
|
|||||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||||
build_configuration: [Debug, Release]
|
build_configuration: [Debug, Release]
|
||||||
compiler: [llvm, gcc]
|
compiler: [llvm, gcc]
|
||||||
vcpkg_bootstrap: [bootstrap-vcpkg.sh]
|
|
||||||
|
|
||||||
exclude:
|
exclude:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.sh
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: llvm
|
compiler: llvm
|
||||||
build_configuration: Debug
|
build_configuration: Debug
|
||||||
|
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: llvm
|
compiler: llvm
|
||||||
build_configuration: Release
|
build_configuration: Release
|
||||||
|
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
build_configuration: Debug
|
build_configuration: Debug
|
||||||
|
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
build_configuration: Release
|
build_configuration: Release
|
||||||
|
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: msvc
|
compiler: msvc
|
||||||
build_configuration: Debug
|
build_configuration: Debug
|
||||||
|
|
||||||
- os: 'windows-latest'
|
- os: 'windows-latest'
|
||||||
triplet: x64-windows
|
triplet: x64-windows
|
||||||
vcpkg_bootstrap: bootstrap-vcpkg.bat
|
|
||||||
compiler: msvc
|
compiler: msvc
|
||||||
build_configuration: Release
|
build_configuration: Release
|
||||||
|
|
||||||
@@ -70,22 +62,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: cache
|
- name: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: "**/cpm_modules"
|
||||||
~/vcpkg
|
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
|
||||||
./build/vcpkg_installed
|
|
||||||
${{ env.HOME }}/.cache/vcpkg/archives
|
|
||||||
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
|
|
||||||
${{ env.LOCALAPPDATA }}\vcpkg\archives
|
|
||||||
${{ env.APPDATA }}\vcpkg\archives
|
|
||||||
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build_configuration }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-${{ matrix.build_configuration }}-
|
|
||||||
|
|
||||||
- name: setup dependencies
|
- name: setup dependencies
|
||||||
uses: aminya/setup-cpp@v1
|
uses: aminya/setup-cpp@v1
|
||||||
@@ -93,20 +75,11 @@ jobs:
|
|||||||
compiler: ${{ matrix.compiler }}
|
compiler: ${{ matrix.compiler }}
|
||||||
vcvarsall: ${{ contains(matrix.os, 'windows')}}
|
vcvarsall: ${{ contains(matrix.os, 'windows')}}
|
||||||
cmake: true
|
cmake: true
|
||||||
vcpkg: true
|
|
||||||
ccache: true
|
ccache: true
|
||||||
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
|
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
|
||||||
cppcheck: true
|
|
||||||
|
|
||||||
- name: Boostrap Vcpkg
|
|
||||||
run: ${{github.workspace}}/external/vcpkg/${{matrix.vcpkg_bootstrap}} -disableMetrics
|
|
||||||
|
|
||||||
- name: Install packaged dependencies
|
|
||||||
run: ${{github.workspace}}/external/vcpkg/vcpkg install spdlog --triplet ${{matrix.triplet}}
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_configuration}}
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_configuration}}
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/external/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_configuration}}
|
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_configuration}}
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "external/vcpkg"]
|
|
||||||
path = external/vcpkg
|
|
||||||
url = https://github.com/Microsoft/vcpkg.git
|
|
||||||
@@ -18,11 +18,6 @@ set(CMAKE_SCRIPTS_DIR ${CMAKE_CURRENT_LIST_DIR}/scripts/cmake)
|
|||||||
include(${CMAKE_SCRIPTS_DIR}/compilerwarnings.cmake)
|
include(${CMAKE_SCRIPTS_DIR}/compilerwarnings.cmake)
|
||||||
include(${CMAKE_SCRIPTS_DIR}/sanitizers.cmake)
|
include(${CMAKE_SCRIPTS_DIR}/sanitizers.cmake)
|
||||||
include(${CMAKE_SCRIPTS_DIR}/staticanalysis.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)
|
add_subdirectory(src)
|
||||||
|
|||||||
33
cmake/cpm.cmake
Normal file
33
cmake/cpm.cmake
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
set(CPM_DOWNLOAD_VERSION 0.38.1)
|
||||||
|
|
||||||
|
if(CPM_SOURCE_CACHE)
|
||||||
|
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||||
|
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||||
|
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||||
|
else()
|
||||||
|
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||||
|
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||||
|
|
||||||
|
function(download_cpm)
|
||||||
|
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
||||||
|
file(DOWNLOAD
|
||||||
|
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||||
|
${CPM_DOWNLOAD_LOCATION}
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
|
||||||
|
download_cpm()
|
||||||
|
else()
|
||||||
|
# resume download if it previously failed
|
||||||
|
file(READ ${CPM_DOWNLOAD_LOCATION} check)
|
||||||
|
if("${check}" STREQUAL "")
|
||||||
|
download_cpm()
|
||||||
|
endif()
|
||||||
|
unset(check)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(${CPM_DOWNLOAD_LOCATION})
|
||||||
18
cmake/googletest.cmake
Normal file
18
cmake/googletest.cmake
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
include_guard()
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME googletest
|
||||||
|
GITHUB_REPOSITORY google/googletest
|
||||||
|
GIT_TAG v1.13.0
|
||||||
|
VERSION 1.13.0
|
||||||
|
OPTIONS
|
||||||
|
"INSTALL_GTEST OFF"
|
||||||
|
"gtest_force_shared_crt ON"
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET
|
||||||
|
gtest
|
||||||
|
gtest_main
|
||||||
|
gmock
|
||||||
|
gmock_main
|
||||||
|
PROPERTY FOLDER third_party/GoogleTest)
|
||||||
1
external/vcpkg
vendored
1
external/vcpkg
vendored
Submodule external/vcpkg deleted from af031ae388
@@ -1,18 +0,0 @@
|
|||||||
include_guard()
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(
|
|
||||||
googletest
|
|
||||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
||||||
GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # release-1.12.1
|
|
||||||
)
|
|
||||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
||||||
FetchContent_MakeAvailable(googletest)
|
|
||||||
|
|
||||||
set_property(TARGET
|
|
||||||
gtest
|
|
||||||
gtest_main
|
|
||||||
gmock
|
|
||||||
gmock_main
|
|
||||||
PROPERTY FOLDER GoogleTest)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
include(${CMAKE_SCRIPTS_DIR}/googletest.cmake)
|
|
||||||
|
|
||||||
add_executable(
|
|
||||||
opengl-starter-test
|
|
||||||
test_main.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
opengl-starter-test
|
|
||||||
gtest_main
|
|
||||||
)
|
|
||||||
|
|
||||||
include(GoogleTest)
|
|
||||||
gtest_discover_tests(opengl-starter-test)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
TEST(testmain, example)
|
|
||||||
{
|
|
||||||
EXPECT_EQ(42, 7*6);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user