summaryrefslogtreecommitdiff
path: root/cmake/GenerateO2R.cmake
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2026-07-23 02:02:58 +0200
committerGitHub <noreply@github.com>2026-07-22 18:02:58 -0600
commit4c24ae2bc2294c96a81d296a68b6d404f34358e7 (patch)
tree0a4d1fb0e353e1b14755d1a2c8d2fcc4d4c29b70 /cmake/GenerateO2R.cmake
parent022e0737d598e93429355db66c07be39e974926f (diff)
Refactor cmake (#721)
* some start of refactor * Update SetFlags.cmake * Update SetCmakeVar.cmake * Update SetFlags.cmake * Fix error int-convertion * more refactor * clean up include and source file * fix link of lib * fix a warning * fix include in src/actors * fix include in src/debug * fix include in src/ending * fix include in src/engine/actors * fix include in src/engine/cameras * fix include in src/engine/editor * fix include in src/engine/objects * fix include in src/engine/tracks * fix include in src/port/ui * fix include in src/racing * fix include in src/engine/vehicles * fix include in subfolder of src/engine * fix include in src/engine * fix include in src/enhancements * fix include in src * fix switch * invert common and findlib * Update SetFlags.cmake * clean up some workflow * some splification * Update build.sh * Update Game.h * add header back * Delete test_check.cmake * continue * Update common.cmake
Diffstat (limited to 'cmake/GenerateO2R.cmake')
-rw-r--r--cmake/GenerateO2R.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/GenerateO2R.cmake b/cmake/GenerateO2R.cmake
new file mode 100644
index 000000000..32e1e053d
--- /dev/null
+++ b/cmake/GenerateO2R.cmake
@@ -0,0 +1,22 @@
+foreach(REQUIRED_VARIABLE TORCH_EXECUTABLE SOURCE_DIR BINARY_DIR)
+ if(NOT DEFINED ${REQUIRED_VARIABLE})
+ message(FATAL_ERROR "${REQUIRED_VARIABLE} is required")
+ endif()
+endforeach()
+
+file(LOCK "${BINARY_DIR}/spaghetti-o2r.lock" GUARD PROCESS TIMEOUT 300)
+execute_process(
+ COMMAND "${TORCH_EXECUTABLE}" pack assets spaghetti.o2r o2r
+ WORKING_DIRECTORY "${SOURCE_DIR}"
+ RESULT_VARIABLE GENERATE_RESULT)
+if(NOT GENERATE_RESULT EQUAL 0)
+ message(FATAL_ERROR "Torch failed to generate spaghetti.o2r")
+endif()
+
+execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+ "${SOURCE_DIR}/spaghetti.o2r" "${BINARY_DIR}/spaghetti.o2r"
+ RESULT_VARIABLE COPY_RESULT)
+if(NOT COPY_RESULT EQUAL 0)
+ message(FATAL_ERROR "Failed to stage spaghetti.o2r")
+endif()