Skip to content
Open
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
8 changes: 4 additions & 4 deletions cmake/CopyFileScript.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ if(CMAKE_HOST_WIN32)

elseif(CMAKE_HOST_UNIX)
execute_process(
COMMAND rsync -av ${COPY_SOURCE} "${COPY_DEST}/"
RESULT_VARIABLE rs
COMMAND cp -av "${COPY_SOURCE}/" "${COPY_DEST}/"
RESULT_VARIABLE cp
)

if(rs GREATER 0) # Any non-zero exit code indicates an error
message(FATAL_ERROR "rsync failed (exit code ${rs})")
if(cp GREATER 0) # Any non-zero exit code indicates an error
message(FATAL_ERROR "cp failed (exit code ${cp})")
endif()
else()
message(FATAL_ERROR "Unsupported host platform for asset copying.")
Expand Down
17 changes: 9 additions & 8 deletions cmake/CopyFolderScript.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,25 @@ if(CMAKE_HOST_WIN32)
message(FATAL_ERROR "robocopy failed (exit code ${rc})")
endif()
elseif(CMAKE_HOST_UNIX)
set(rsync_args -av)
set(tar_args)

foreach(pattern IN LISTS EXCLUDE_FILES)
list(APPEND rsync_args "--exclude=${pattern}")
list(APPEND tar_args "--exclude=${pattern}")
endforeach()

foreach(pattern IN LISTS EXCLUDE_FOLDERS)
list(APPEND rsync_args "--exclude=${pattern}")
list(APPEND tar_args "--exclude=${pattern}")
endforeach()

# Trailing slashes ensure rsync copies contents, not the directory itself
# Trailing slashes ensure tar copies contents, not the directory itself
execute_process(
COMMAND rsync ${rsync_args} "${COPY_SOURCE}/" "${COPY_DEST}/"
RESULT_VARIABLE rs
COMMAND tar ${tar_args} -cf - -C "${COPY_SOURCE}/" .
COMMAND tar -xvf - -C "${COPY_DEST}/"
RESULT_VARIABLE tr
)

if(rs GREATER 0) # Any non-zero exit code indicates an error
message(FATAL_ERROR "rsync failed (exit code ${rs})")
if(tr GREATER 0) # Any non-zero exit code indicates an error
message(FATAL_ERROR "tar failed (exit code ${tr})")
endif()
else()
message(FATAL_ERROR "Unsupported host platform for asset copying.")
Expand Down
Loading