Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
name: Configure and build
shell: pwsh
run: |
cmake -B"build/${{ matrix.platform }}" -G"Ninja" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -DCMAKE_C_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache -DCMAKE_CXX_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache
cmake -B"build/${{ matrix.platform }}" -G"Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -DCMAKE_C_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache -DCMAKE_CXX_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache
cmake --build "build/${{ matrix.platform }}" --target vulkan_samples --config ${{ matrix.build_type }} -j 1
- if: ${{ matrix.platform != 'windows' }}
name: Configure and build
run: |
cmake -B"build/${{ matrix.platform }}" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -DGLFW_BUILD_WAYLAND=OFF
cmake -B"build/${{ matrix.platform }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -DGLFW_BUILD_WAYLAND=OFF
cmake --build "build/${{ matrix.platform }}" --target vulkan_samples --config ${{ matrix.build_type }} ${{ env.PARALLEL }}

build_v2:
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ if(MSVC AND (DEFINED CMAKE_C_COMPILER_LAUNCHER))
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
message(DEBUG "New flags: ${CMAKE_CXX_FLAGS_DEBUG}")
add_link_options(
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:/DEBUG:FASTLINK>
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:/INCREMENTAL:NO>)
endif()

# create output folder
Expand Down
1 change: 1 addition & 0 deletions bldsys/cmake/sample_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ if(${TARGET_TYPE} STREQUAL "Sample")
elseif(${TARGET_TYPE} STREQUAL "Test")
add_library(${PROJECT_NAME} STATIC ${TARGET_FILES} ${SHADERS_GLSL} ${SHADERS_HLSL} ${SHADERS_SLANG} ${SHADERS_SPVASM})
endif()
vkb__trim_static_lib_objects(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)

# # inherit include directories from framework target
Expand Down
11 changes: 10 additions & 1 deletion bldsys/cmake/utils.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[[
Copyright (c) 2019-2021, Arm Limited and Contributors
Copyright (c) 2019-2026, Arm Limited and Contributors

SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -39,4 +39,13 @@ function(scan_dirs)
endforeach()

set(${TARGET_LIST} ${DIR_LIST} PARENT_SCOPE)
endfunction()

function(vkb__trim_static_lib_objects TARGET_NAME)
if(MSVC AND (DEFINED CMAKE_C_COMPILER_LAUNCHER) AND (CMAKE_GENERATOR MATCHES "Ninja|Makefiles"))
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will "rm -rf" work on windows?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, but cmake -E rm rf tells cmake to use it's portable remove function. Thus it should work. The problem for why it didn't work was the if check above it.

COMMENT "Trimming intermediate objects for ${TARGET_NAME} (already embedded in its .lib)"
VERBATIM)
endif()
endfunction()
3 changes: 2 additions & 1 deletion framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ if(WIN32)
endif()

#NB: switch this to shared library and things stop working. (there is likely two copies of volk somewhere.
add_library(${PROJECT_NAME} OBJECT ${PROJECT_FILES})
add_library(${PROJECT_NAME} STATIC ${PROJECT_FILES})
vkb__trim_static_lib_objects(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)

# compiler flags based on compiler type
Expand Down
Loading