Skip to content

Commit

Permalink
Enable test only if VKU_ENABLE_TEST flag set to ON.
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe2933 committed Aug 19, 2024
1 parent 1a75039 commit d03771a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 35 deletions.
48 changes: 16 additions & 32 deletions .github/workflows/CMakeUserPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
"version": 6,
"configurePresets": [
{
"name": "clang-libstdcxx",
"displayName": "Clang + libstdc++",
"name": "ci-test",
"hidden": true,
"inherits": "vcpkg",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"VKU_ENABLE_TEST": "ON"
}
},
{
"name": "clang",
"hidden": true,
"inherits": "ci-test",
"cacheVariables": {
"CMAKE_C_COMPILER": "/usr/bin/clang-18",
"CMAKE_CXX_COMPILER": "/usr/bin/clang++-18"
},
Expand All @@ -19,24 +26,16 @@
{
"name": "clang-libcxx",
"displayName": "Clang + libc++",
"inherits": "vcpkg",
"inherits": "clang",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "/usr/bin/clang-18",
"CMAKE_CXX_COMPILER": "/usr/bin/clang++-18",
"CMAKE_CXX_FLAGS": "-stdlib=libc++",
"CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++ -lc++abi"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "msvc",
"displayName": "MSVC",
"inherits": "vcpkg",
"inherits": "ci-test",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -46,31 +45,16 @@
],
"buildPresets": [
{
"name": "clang-libstdcxx",
"configurePreset": "clang-libstdcxx",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
"name": "clang",
"configurePreset": "clang"
},
{
"name": "clang-libcxx",
"configurePreset": "clang-libcxx",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
"configurePreset": "clang-libcxx"
},
{
"name": "msvc",
"configurePreset": "msvc",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
"configurePreset": "msvc"
}
]
}
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:
- name: Configure
run: |
mv .github/workflows/CMakeUserPresets.json .
cmake --preset=${{ matrix.use_std_module == 'ON' && 'clang-libcxx' || 'clang-libstdcxx' }} \
cmake --preset=${{ matrix.use_std_module == 'ON' && 'clang-libcxx' || 'clang' }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
-DVKU_USE_STD_MODULE=${{ matrix.use_std_module }}
- name: Install
run: cmake --build --preset=${{ matrix.use_std_module == 'ON' && 'clang-libcxx' || 'clang-libstdcxx' }} --target install
run: cmake --build --preset=${{ matrix.use_std_module == 'ON' && 'clang-libcxx' || 'clang' }} --target install
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ endif()
option(VKU_USE_STD_MODULE "Use the standard library module for compilation.")
option(VKU_USE_SHADERC "Add runtime GLSL compilation feature by shaderc.")
option(VKU_DEFAULT_DYNAMIC_DISPATCHER "Use the vk::DispatchLoaderDynamic as the default dispatcher.")
option(VKU_ENABLE_TEST "Enable the test targets.")

# ----------------
# External dependencies.
Expand Down Expand Up @@ -103,7 +104,7 @@ add_library(${PROJECT_NAME}::vku ALIAS vku)
# Tests.
# --------------------

if (PROJECT_IS_TOP_LEVEL)
if (VKU_ENABLE_TEST)
enable_testing()
add_subdirectory(test)
endif()
Expand Down

0 comments on commit d03771a

Please sign in to comment.