Adjust CMake's run-time resource handling such that the Windows CI script does not have to copy these files

new-script-api
AnyOldName3 7 years ago
parent 479f9535b4
commit f8fe992dc0

@ -750,19 +750,4 @@ if [ -z $VERBOSE ]; then
fi
fi
if [ -z $CI ]; then
echo "- Copying Runtime Resources/Config Files"
echo " gamecontrollerdb.txt"
cp gamecontrollerdb.txt $BUILD_CONFIG/gamecontrollerdb.txt
echo " openmw.cfg"
cp openmw.cfg.install $BUILD_CONFIG/openmw.cfg
echo " openmw-cs.cfg"
cp openmw-cs.cfg $BUILD_CONFIG/openmw-cs.cfg
echo " settings-default.cfg"
cp settings-default.cfg $BUILD_CONFIG/settings-default.cfg
echo " resources/"
cp -r resources $BUILD_CONFIG/resources
echo
fi
exit $RET

@ -313,27 +313,27 @@ endif (APPLE)
# Other files
configure_file(${OpenMW_SOURCE_DIR}/files/settings-default.cfg
"${OpenMW_BINARY_DIR}/settings-default.cfg")
configure_resource_file(${OpenMW_SOURCE_DIR}/files/settings-default.cfg
"${OpenMW_BINARY_DIR}" "settings-default.cfg")
if (NOT APPLE)
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local
"${OpenMW_BINARY_DIR}/openmw.cfg")
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
"${OpenMW_BINARY_DIR}/openmw.cfg.install")
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local
"${OpenMW_BINARY_DIR}" "openmw.cfg")
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
"${OpenMW_BINARY_DIR}" "openmw.cfg.install")
else ()
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
"${OpenMW_BINARY_DIR}/openmw.cfg")
endif ()
configure_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.cfg
"${OpenMW_BINARY_DIR}/openmw-cs.cfg")
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.cfg
"${OpenMW_BINARY_DIR}" "openmw-cs.cfg")
configure_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters
"${OpenMW_BINARY_DIR}/resources/defaultfilters" COPYONLY)
configure_resource_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters
"${OpenMW_BINARY_DIR}" "resources/defaultfilters" COPYONLY)
configure_file(${OpenMW_SOURCE_DIR}/files/gamecontrollerdb.txt
"${OpenMW_BINARY_DIR}/gamecontrollerdb.txt")
configure_resource_file(${OpenMW_SOURCE_DIR}/files/gamecontrollerdb.txt
"${OpenMW_BINARY_DIR}" "gamecontrollerdb.txt")
if (NOT WIN32 AND NOT APPLE)
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop

@ -26,4 +26,20 @@ else ()
message(WARNING "Failed to get valid version information from Git")
endif ()
configure_file(${VERSION_IN_FILE} ${VERSION_FILE})
# duplicated from OpenMWMacros.cmake
macro (configure_resource_file source_path destination_dir_base dest_path_relative)
if (MSVC)
configure_file(${source_path} "${destination_dir_base}/Debug/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/Release/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/RelWithDebInfo/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/MinSizeRel/${dest_path_relative}")
else (MSVC)
configure_file(${source_path} "${destination_dir_base}/${dest_path_relative}")
endif (MSVC)
endmacro (configure_resource_file)
message(STATUS ${VERSION_IN_FILE})
message(STATUS ${VERSION_FILE_PATH_BASE})
message(STATUS ${VERSION_FILE_PATH_RELATIVE})
configure_resource_file(${VERSION_IN_FILE} ${VERSION_FILE_PATH_BASE} ${VERSION_FILE_PATH_RELATIVE})

@ -171,3 +171,32 @@ macro (openmw_add_executable target)
endif (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
endif (MSVC)
endmacro (openmw_add_executable)
macro (copy_resource_file source_path destination_dir_base dest_path_relative)
if (MSVC)
configure_file(${source_path} "${destination_dir_base}/Debug/${dest_path_relative}" COPYONLY)
configure_file(${source_path} "${destination_dir_base}/Release/${dest_path_relative}" COPYONLY)
configure_file(${source_path} "${destination_dir_base}/RelWithDebInfo/${dest_path_relative}" COPYONLY)
configure_file(${source_path} "${destination_dir_base}/MinSizeRel/${dest_path_relative}" COPYONLY)
else (MSVC)
configure_file(${source_path} "${destination_dir_base}/${dest_path_relative}" COPYONLY)
endif (MSVC)
endmacro (copy_resource_file)
macro (configure_resource_file source_path destination_dir_base dest_path_relative)
if (MSVC)
configure_file(${source_path} "${destination_dir_base}/Debug/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/Release/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/RelWithDebInfo/${dest_path_relative}")
configure_file(${source_path} "${destination_dir_base}/MinSizeRel/${dest_path_relative}")
else (MSVC)
configure_file(${source_path} "${destination_dir_base}/${dest_path_relative}")
endif (MSVC)
endmacro (configure_resource_file)
macro (copy_all_resource_files source_dir destination_dir_base destination_dir_relative files)
foreach (f ${files})
get_filename_component(filename ${f} NAME)
copy_resource_file("${source_dir}/${f}" "${destination_dir_base}" "${destination_dir_relative}/${filename}")
endforeach (f)
endmacro (copy_all_files)

@ -2,22 +2,25 @@ project (Components)
# Version file
set (VERSION_IN_FILE "${OpenMW_SOURCE_DIR}/files/version.in")
set (VERSION_FILE "${OpenMW_BINARY_DIR}/resources/version")
set (VERSION_FILE_PATH_BASE "${OpenMW_BINARY_DIR}")
set (VERSION_FILE_PATH_RELATIVE resources/version)
if (GIT_CHECKOUT)
add_custom_target (git-version
COMMAND ${CMAKE_COMMAND}
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DVERSION_IN_FILE=${VERSION_IN_FILE}
-DVERSION_FILE=${VERSION_FILE}
-DVERSION_FILE_PATH_BASE=${VERSION_FILE_PATH_BASE}
-DVERSION_FILE_PATH_RELATIVE=${VERSION_FILE_PATH_RELATIVE}
-DOPENMW_VERSION_MAJOR=${OPENMW_VERSION_MAJOR}
-DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR}
-DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE}
-DOPENMW_VERSION=${OPENMW_VERSION}
-DMSVC=${MSVC}
-P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/GitVersion.cmake
VERBATIM)
else (GIT_CHECKOUT)
configure_file(${VERSION_IN_FILE} ${VERSION_FILE})
configure_resource_file(${VERSION_IN_FILE} ${VERSION_FILE_PATH_BASE} ${VERSION_FILE_PATH_RELATIVE})
endif (GIT_CHECKOUT)
if (OPENGL_ES)

@ -4,7 +4,7 @@ endif()
# Copy resource files into the build directory
set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DDIR ${OPENMW_MYGUI_FILES_ROOT}/resources/mygui)
set(DDIRRELATIVE resources/mygui)
set(MYGUI_FILES
core.skin
@ -97,4 +97,4 @@ set(MYGUI_FILES
)
copy_all_files(${CMAKE_CURRENT_SOURCE_DIR} ${DDIR} "${MYGUI_FILES}")
copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_MYGUI_FILES_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}")

@ -4,7 +4,7 @@ endif()
# Copy resource files into the build directory
set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DDIR ${OPENMW_SHADERS_ROOT}/resources/shaders)
set(DDIRRELATIVE resources/shaders)
set(SHADER_FILES
water_vertex.glsl
@ -18,4 +18,4 @@ set(SHADER_FILES
parallax.glsl
)
copy_all_files(${CMAKE_CURRENT_SOURCE_DIR} ${DDIR} "${SHADER_FILES}")
copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_SHADERS_ROOT} ${DDIRRELATIVE} "${SHADER_FILES}")

Loading…
Cancel
Save