From 64eadad8c192de17deeddd8f505bddc3ddacd6a5 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Wed, 18 Dec 2024 00:10:20 -0700 Subject: [PATCH] Copy Assets with "If Different" Variants, CMake bump (#4714) * Change copy assets procedure to use "if different" variants of the copy commands. Bump minimum cmake to 3.26 to accommodate those variants. * Change MSVC_CMD asset copy command to VS_COPY_ASSETS_CMD, change setting it to only be on Visual Studio build chain. --- soh/CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 935f32ea1..8218588e4 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.26.0 FATAL_ERROR) set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) @@ -607,22 +607,22 @@ endif() ################################################################################ # Pre build events ################################################################################ -if (MSVC) - set(MSVC_CMD ${CMAKE_COMMAND} -E copy_directory $/assets ${CMAKE_BINARY_DIR}/soh/assets) +if (CMAKE_GENERATOR MATCHES "Visual Studio") + set(VS_COPY_ASSETS_CMD ${CMAKE_COMMAND} -E copy_directory_if_different $/assets ${CMAKE_BINARY_DIR}/soh/assets) endif() if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD COMMENT "Copying asset xmls..." - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/soh/assets/extractor $/assets/extractor - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/soh/assets/xml $/assets/extractor/xmls - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/filelists $/assets/extractor/filelists + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_SOURCE_DIR}/soh/assets/extractor $/assets/extractor + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_SOURCE_DIR}/soh/assets/xml $/assets/extractor/xmls + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/filelists $/assets/extractor/filelists COMMAND ${CMAKE_COMMAND} -E make_directory $/assets/extractor/symbols - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/ActorList_OoTMqDbg.txt $/assets/extractor/symbols - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/ObjectList_OoTMqDbg.txt $/assets/extractor/symbols - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/SymbolMap_OoTMqDbg.txt $/assets/extractor/symbols - COMMAND ${MSVC_CMD} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/ActorList_OoTMqDbg.txt $/assets/extractor/symbols + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/ObjectList_OoTMqDbg.txt $/assets/extractor/symbols + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/OTRExporter/CFG/SymbolMap_OoTMqDbg.txt $/assets/extractor/symbols + COMMAND ${VS_COPY_ASSETS_CMD} ) endif() ################################################################################