summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Bird <Archez@users.noreply.github.com>2023-04-14 09:56:38 -0400
committerGitHub <noreply@github.com>2023-04-14 09:56:38 -0400
commite72eeb95aa293df241ef741e0c34a06d8fe41b44 (patch)
treea87ff9941f5ceba46ff03f2a07a2eff496b89390
parentead17892fe8c1b3a19e09d40ad4a9de4f9299f2c (diff)
chore: copy otrs in windows into target dir (#2704)
* copy otrs in windows into target dir * improve status messaging for otr copy script
-rw-r--r--CMakeLists.txt2
-rw-r--r--copy-existing-otrs.cmake25
2 files changed, 23 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c96c4be03..26f9a64f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,7 +111,7 @@ add_custom_target(
# CMake versions prior to 3.17 do not have the rm command, use remove instead for older versions
COMMAND ${CMAKE_COMMAND} -E $<IF:$<VERSION_LESS:${CMAKE_VERSION},3.17>,remove,rm> -f oot.otr oot-mq.otr soh.otr
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --non-interactive
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/copy-existing-otrs.cmake
+ COMMAND ${CMAKE_COMMAND} -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DTARGET_DIR="$<TARGET_FILE_DIR:soh>" -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/copy-existing-otrs.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter
COMMENT "Running asset extraction..."
DEPENDS ZAPD
diff --git a/copy-existing-otrs.cmake b/copy-existing-otrs.cmake
index b700e9de5..aa4b739cc 100644
--- a/copy-existing-otrs.cmake
+++ b/copy-existing-otrs.cmake
@@ -1,18 +1,37 @@
+message(STATUS "Copying otr files...")
+
if(EXISTS ${SOURCE_DIR}/OTRExporter/oot.otr)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${SOURCE_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${BINARY_DIR}/soh/)
+ message(STATUS "Copied oot.otr")
endif()
if(EXISTS ${SOURCE_DIR}/OTRExporter/oot-mq.otr)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot-mq.otr ${SOURCE_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot-mq.otr ${BINARY_DIR}/soh/)
+ message(STATUS "Copied oot-mq.otr")
endif()
if(EXISTS ${SOURCE_DIR}/OTRExporter/soh.otr)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy soh.otr ${SOURCE_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy soh.otr ${BINARY_DIR}/soh/)
+ message(STATUS "Copied soh.otr")
endif()
+
+# Additionally for Windows, copy the otrs to the target dir, side by side with soh.exe
+if(SYSTEM_NAME MATCHES "Windows")
+ if(EXISTS ${SOURCE_DIR}/OTRExporter/oot.otr)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${TARGET_DIR})
+ endif()
+ if(EXISTS ${SOURCE_DIR}/OTRExporter/oot-mq.otr)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy oot-mq.otr ${TARGET_DIR})
+ endif()
+ if(EXISTS ${SOURCE_DIR}/OTRExporter/soh.otr)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy soh.otr ${TARGET_DIR})
+ endif()
+endif()
+
if(NOT EXISTS ${SOURCE_DIR}/oot.otr AND NOT EXISTS ${SOURCE_DIR}/oot-mq.otr)
- message(FATAL_ERROR, "No OTR files found.")
+ message(FATAL_ERROR "Failed to copy. No OTR files found.")
endif()
if(NOT EXISTS ${SOURCE_DIR}/soh.otr)
- message(FATAL_ERROR, "No soh OTR found.")
-endif() \ No newline at end of file
+ message(FATAL_ERROR "Failed to copy. No soh OTR found.")
+endif()