Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions cmake/vcpkg-triplets/x64-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)

# Static libavcodec has x86 asm that can't be linked into libtoast_engine.so (R_X86_64_PC32 against ff_h264_cabac_tables)
if (PORT STREQUAL "tracy" OR PORT STREQUAL "ffmpeg")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif ()
19 changes: 19 additions & 0 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ if (TOAST_DLSS)
# The runtime's license has to ship with it, the port installs it as share/nvidia-dlss/copyright
get_filename_component(_nvidia_dlss_license "${NVIDIA_DLSS_RUNTIME_DLL}/../../share/nvidia-dlss/copyright" ABSOLUTE)
add_custom_command(TARGET toast_engine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${TOAST_ENGINE_BIN_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NVIDIA_DLSS_RUNTIME_DLL}" "${TOAST_ENGINE_BIN_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_nvidia_dlss_license}" "${TOAST_ENGINE_BIN_DIR}/NVIDIA_DLSS_LICENSE.txt"
COMMENT "Copying the DLSS runtime"
Expand Down Expand Up @@ -312,6 +313,24 @@ add_custom_command(TARGET toast_engine POST_BUILD
VERBATIM
)

if (NOT WIN32)
# ffmpeg is shared on Linux (see cmake/vcpkg-triplets/x64-linux.cmake), ship each lib under its soname
set(_ffmpeg_prefix "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")
file(GLOB _ffmpeg_sos_debug CONFIGURE_DEPENDS "${_ffmpeg_prefix}/debug/lib/libav*.so.*" "${_ffmpeg_prefix}/debug/lib/libsw*.so.*")
file(GLOB _ffmpeg_sos_release CONFIGURE_DEPENDS "${_ffmpeg_prefix}/lib/libav*.so.*" "${_ffmpeg_prefix}/lib/libsw*.so.*")
list(FILTER _ffmpeg_sos_debug INCLUDE REGEX "\\.so\\.[0-9]+$")
list(FILTER _ffmpeg_sos_release INCLUDE REGEX "\\.so\\.[0-9]+$")
add_custom_command(TARGET toast_engine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_SONAME_FILE:Tracy::TracyClient>" "${TOAST_ENGINE_OUTPUT_ROOT}/lib"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<$<CONFIG:Debug>:${_ffmpeg_sos_debug}>"
"$<$<NOT:$<CONFIG:Debug>>:${_ffmpeg_sos_release}>"
"${TOAST_ENGINE_OUTPUT_ROOT}/lib"
COMMAND_EXPAND_LISTS
VERBATIM
)
endif ()

if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/assets")
add_custom_command(TARGET toast_engine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${CMAKE_CURRENT_SOURCE_DIR}/assets" "${TOAST_ENGINE_BIN_DIR}/assets"
Expand Down
1 change: 1 addition & 0 deletions tools/asset_packer/pack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(toast_pack CXX)
find_package(lz4 CONFIG REQUIRED)

add_library(toast_pack STATIC src/pack.cpp)
set_target_properties(toast_pack PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_features(toast_pack PUBLIC cxx_std_23)
target_include_directories(toast_pack PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(toast_pack PUBLIC LZ4::lz4)
Expand Down
3 changes: 3 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"vcpkg-configuration": {
"overlay-ports": [
"./cmake/vcpkg-ports"
],
"overlay-triplets": [
"./cmake/vcpkg-triplets"
]
},
"dependencies": [
Expand Down
Loading