aboutsummaryrefslogtreecommitdiff
path: root/CMakeModules/WindowsCopyFiles.cmake
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2025-09-09 20:47:49 +0200
committercrueter <crueter@eden-emu.dev>2025-09-09 20:47:49 +0200
commit9d2681ecc9565681db623fb71799e76381998512 (patch)
tree3133129860a1569a8be8e7e0c9c5985adbd992ca /CMakeModules/WindowsCopyFiles.cmake
parent428f136a754096e34c7bfec902684e2546a43ca4 (diff)
[cmake] enable clang-cl and WoA builds (#348)
Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'CMakeModules/WindowsCopyFiles.cmake')
-rw-r--r--CMakeModules/WindowsCopyFiles.cmake33
1 files changed, 21 insertions, 12 deletions
diff --git a/CMakeModules/WindowsCopyFiles.cmake b/CMakeModules/WindowsCopyFiles.cmake
index 08b598365d..8d37bd5c2c 100644
--- a/CMakeModules/WindowsCopyFiles.cmake
+++ b/CMakeModules/WindowsCopyFiles.cmake
@@ -12,16 +12,25 @@ set(__windows_copy_files YES)
# Any number of files to copy from SOURCE_DIR to DEST_DIR can be specified after DEST_DIR.
# This copying happens post-build.
-function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
- # windows commandline expects the / to be \ so switch them
- string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR})
- string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR})
+if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
+ # windows commandline expects the / to be \ so switch them
+ string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR})
+ string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR})
- # /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
- # cmake adds an extra check for command success which doesn't work too well with robocopy
- # so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
- add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
- COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
- )
-endfunction()
+ # /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
+ # cmake adds an extra check for command success which doesn't work too well with robocopy
+ # so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
+ add_custom_command(TARGET ${TARGET} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
+ COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
+ )
+ endfunction()
+else()
+ function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
+ add_custom_command(TARGET ${TARGET} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
+ COMMAND cp -ra ${SOURCE_DIR}/. ${DEST_DIR}
+ )
+ endfunction()
+endif()