Skip to content

Commit

Permalink
feat(cmake): use symlink/junction for shaders in build dir (#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
ns6089 authored Aug 22, 2024
1 parent 0a6abb7 commit 0164be6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/"
DESTINATION "${SUNSHINE_ASSETS_DIR}")
# copy assets to build directory, for running without install

# copy assets (excluding shaders) to build directory, for running without install
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/"
DESTINATION "${CMAKE_BINARY_DIR}/assets")
DESTINATION "${CMAKE_BINARY_DIR}/assets"
PATTERN "shaders" EXCLUDE)
# use symbolic link for shaders directory
file(CREATE_LINK "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/shaders"
"${CMAKE_BINARY_DIR}/assets/shaders" COPY_ON_ERROR SYMBOLIC)

if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
DESTINATION "${SUNSHINE_ASSETS_DIR}/udev/rules.d")
Expand Down
10 changes: 8 additions & 2 deletions cmake/packaging/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/gamepad/"
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/"
DESTINATION "${SUNSHINE_ASSETS_DIR}"
COMPONENT assets)
# copy assets to build directory, for running without install

# copy assets (excluding shaders) to build directory, for running without install
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/"
DESTINATION "${CMAKE_BINARY_DIR}/assets")
DESTINATION "${CMAKE_BINARY_DIR}/assets"
PATTERN "shaders" EXCLUDE)
# use junction for shaders directory
file(TO_NATIVE_PATH "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/shaders" shaders_in_build_src_native)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/assets/shaders" shaders_in_build_dest_native)
execute_process(COMMAND cmd.exe /c mklink /J "${shaders_in_build_dest_native}" "${shaders_in_build_src_native}")

# set(CPACK_NSIS_MUI_HEADERIMAGE "") # TODO: image should be 150x57 bmp
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\sunshine.ico")
Expand Down

0 comments on commit 0164be6

Please sign in to comment.