From a9bf53d4ed986212d19ee38f5a0b9022f4b908af Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Tue, 7 Dec 2021 11:31:41 +0100 Subject: [PATCH 1/2] modified builtin_scripts to be macOS aware; simplified things as the SHADER and MYGUI dir were just pointing to the OpenMW_BINARY_DIR anyway, so removing the code duplication --- CMakeLists.txt | 5 ++--- apps/opencs/CMakeLists.txt | 3 +-- apps/openmw/CMakeLists.txt | 3 +-- files/builtin_scripts/CMakeLists.txt | 24 ++++++++++++++++++------ files/mygui/CMakeLists.txt | 4 ++-- files/shaders/CMakeLists.txt | 4 ++-- files/vfs/CMakeLists.txt | 4 ++-- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f19b2a54f..d1da593883 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,9 +445,8 @@ if (APPLE) "${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY) endif (APPLE) -if (NOT APPLE) - set(OPENMW_MYGUI_FILES_ROOT ${OpenMW_BINARY_DIR}) - set(OPENMW_SHADERS_ROOT ${OpenMW_BINARY_DIR}) +if (NOT APPLE) # this is modified for macOS use later in "apps/open[mw|cs]/CMakeLists.txt" + set(OPENMW_BINARY_ROOT ${OpenMW_BINARY_DIR}) endif () add_subdirectory(files/) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 952bbbdbda..521cf495f7 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -183,8 +183,7 @@ if(APPLE) set(OPENCS_BUNDLE_NAME "OpenMW-CS") set(OPENCS_BUNDLE_RESOURCES_DIR "${OpenMW_BINARY_DIR}/${OPENCS_BUNDLE_NAME}.app/Contents/Resources") - set(OPENMW_MYGUI_FILES_ROOT ${OPENCS_BUNDLE_RESOURCES_DIR}) - set(OPENMW_SHADERS_ROOT ${OPENCS_BUNDLE_RESOURCES_DIR}) + set(OPENMW_BINARY_ROOT ${OPENCS_BUNDLE_RESOURCES_DIR}) add_subdirectory(../../files/ ${CMAKE_CURRENT_BINARY_DIR}/files) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index c8ce797587..fc5e6af325 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -179,8 +179,7 @@ endif() if(APPLE) set(BUNDLE_RESOURCES_DIR "${APP_BUNDLE_DIR}/Contents/Resources") - set(OPENMW_MYGUI_FILES_ROOT ${BUNDLE_RESOURCES_DIR}) - set(OPENMW_SHADERS_ROOT ${BUNDLE_RESOURCES_DIR}) + set(OPENMW_BINARY_ROOT ${BUNDLE_RESOURCES_DIR}) add_subdirectory(../../files/ ${CMAKE_CURRENT_BINARY_DIR}/files) diff --git a/files/builtin_scripts/CMakeLists.txt b/files/builtin_scripts/CMakeLists.txt index 5906680e1b..3e531c680e 100644 --- a/files/builtin_scripts/CMakeLists.txt +++ b/files/builtin_scripts/CMakeLists.txt @@ -1,8 +1,20 @@ -file(GLOB_RECURSE BUILTIN_SCRIPTS LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS "*") +if (NOT DEFINED OPENMW_BINARY_ROOT) + return() +endif() -foreach (f ${BUILTIN_SCRIPTS}) - if (NOT ("CMakeLists.txt" STREQUAL "${f}")) - copy_resource_file("${CMAKE_CURRENT_SOURCE_DIR}/${f}" "${OpenMW_BINARY_DIR}" "resources/vfs/${f}") - endif() -endforeach (f) +# Copy resource files into the build directory +set(SDIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(DDIRRELATIVE resources/vfs) +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "builtin.omwscripts") +set(DDIRRELATIVE resources/vfs/openmw_aux) +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "openmw_aux/util.lua") + +set(LUA_SCRIPTS_FILES + scripts/omw/camera.lua + scripts/omw/head_bobbing.lua + scripts/omw/third_person.lua +) + +set(DDIRRELATIVE resources/vfs/scripts/omw) +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${LUA_SCRIPTS_FILES}") diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index 49b833e382..cac1691aa3 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_MYGUI_FILES_ROOT) +if (NOT DEFINED OPENMW_BINARY_ROOT) return() endif() @@ -97,4 +97,4 @@ set(MYGUI_FILES ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_MYGUI_FILES_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}") diff --git a/files/shaders/CMakeLists.txt b/files/shaders/CMakeLists.txt index 6e19263a38..f00b52d024 100644 --- a/files/shaders/CMakeLists.txt +++ b/files/shaders/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_SHADERS_ROOT) +if (NOT DEFINED OPENMW_BINARY_ROOT) return() endif() @@ -42,4 +42,4 @@ set(SHADER_FILES softparticles.glsl ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_SHADERS_ROOT} ${DDIRRELATIVE} "${SHADER_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${SHADER_FILES}") diff --git a/files/vfs/CMakeLists.txt b/files/vfs/CMakeLists.txt index a97210d1df..0139138c04 100644 --- a/files/vfs/CMakeLists.txt +++ b/files/vfs/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_MYGUI_FILES_ROOT) +if (NOT DEFINED OPENMW_BINARY_ROOT) return() endif() @@ -15,4 +15,4 @@ set(TEXTURE_FILES textures/omw_menu_scroll_center_v.dds ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_MYGUI_FILES_ROOT} ${DDIRRELATIVE} "${TEXTURE_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${TEXTURE_FILES}") From 93366269271f13f658a05e7175979387f71683f9 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Wed, 8 Dec 2021 14:33:49 +0100 Subject: [PATCH 2/2] use OPENMW_RESOURCES_ROOT instead --- CMakeLists.txt | 2 +- apps/opencs/CMakeLists.txt | 2 +- apps/openmw/CMakeLists.txt | 2 +- files/builtin_scripts/CMakeLists.txt | 8 ++++---- files/mygui/CMakeLists.txt | 4 ++-- files/shaders/CMakeLists.txt | 4 ++-- files/vfs/CMakeLists.txt | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1da593883..644a7419a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,7 +446,7 @@ if (APPLE) endif (APPLE) if (NOT APPLE) # this is modified for macOS use later in "apps/open[mw|cs]/CMakeLists.txt" - set(OPENMW_BINARY_ROOT ${OpenMW_BINARY_DIR}) + set(OPENMW_RESOURCES_ROOT ${OpenMW_BINARY_DIR}) endif () add_subdirectory(files/) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 521cf495f7..b3d405d1a3 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -183,7 +183,7 @@ if(APPLE) set(OPENCS_BUNDLE_NAME "OpenMW-CS") set(OPENCS_BUNDLE_RESOURCES_DIR "${OpenMW_BINARY_DIR}/${OPENCS_BUNDLE_NAME}.app/Contents/Resources") - set(OPENMW_BINARY_ROOT ${OPENCS_BUNDLE_RESOURCES_DIR}) + set(OPENMW_RESOURCES_ROOT ${OPENCS_BUNDLE_RESOURCES_DIR}) add_subdirectory(../../files/ ${CMAKE_CURRENT_BINARY_DIR}/files) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index fc5e6af325..94babb6ab1 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -179,7 +179,7 @@ endif() if(APPLE) set(BUNDLE_RESOURCES_DIR "${APP_BUNDLE_DIR}/Contents/Resources") - set(OPENMW_BINARY_ROOT ${BUNDLE_RESOURCES_DIR}) + set(OPENMW_RESOURCES_ROOT ${BUNDLE_RESOURCES_DIR}) add_subdirectory(../../files/ ${CMAKE_CURRENT_BINARY_DIR}/files) diff --git a/files/builtin_scripts/CMakeLists.txt b/files/builtin_scripts/CMakeLists.txt index 3e531c680e..6f290cc1f7 100644 --- a/files/builtin_scripts/CMakeLists.txt +++ b/files/builtin_scripts/CMakeLists.txt @@ -1,14 +1,14 @@ -if (NOT DEFINED OPENMW_BINARY_ROOT) +if (NOT DEFINED OPENMW_RESOURCES_ROOT) return() endif() # Copy resource files into the build directory set(SDIR ${CMAKE_CURRENT_SOURCE_DIR}) set(DDIRRELATIVE resources/vfs) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "builtin.omwscripts") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "builtin.omwscripts") set(DDIRRELATIVE resources/vfs/openmw_aux) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "openmw_aux/util.lua") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "openmw_aux/util.lua") set(LUA_SCRIPTS_FILES scripts/omw/camera.lua @@ -17,4 +17,4 @@ set(LUA_SCRIPTS_FILES ) set(DDIRRELATIVE resources/vfs/scripts/omw) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${LUA_SCRIPTS_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "${LUA_SCRIPTS_FILES}") diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index cac1691aa3..bdf7558cf7 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_BINARY_ROOT) +if (NOT DEFINED OPENMW_RESOURCES_ROOT) return() endif() @@ -97,4 +97,4 @@ set(MYGUI_FILES ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}") diff --git a/files/shaders/CMakeLists.txt b/files/shaders/CMakeLists.txt index f00b52d024..73929486cd 100644 --- a/files/shaders/CMakeLists.txt +++ b/files/shaders/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_BINARY_ROOT) +if (NOT DEFINED OPENMW_RESOURCES_ROOT) return() endif() @@ -42,4 +42,4 @@ set(SHADER_FILES softparticles.glsl ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${SHADER_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "${SHADER_FILES}") diff --git a/files/vfs/CMakeLists.txt b/files/vfs/CMakeLists.txt index 0139138c04..15dcb80ec1 100644 --- a/files/vfs/CMakeLists.txt +++ b/files/vfs/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT DEFINED OPENMW_BINARY_ROOT) +if (NOT DEFINED OPENMW_RESOURCES_ROOT) return() endif() @@ -15,4 +15,4 @@ set(TEXTURE_FILES textures/omw_menu_scroll_center_v.dds ) -copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_BINARY_ROOT} ${DDIRRELATIVE} "${TEXTURE_FILES}") +copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "${TEXTURE_FILES}")