Tweak install-related variables

* don't force Debian-style games prefix - distros that want it can add
  it with -DCMAKE_INSTALL_DATAROOTDIR=/share/games etc., but it should
  be easy for normal distros to not get the prefix and end up with a
  working build.
* only set GLOBAL_DATA_PATH/GLOBAL_CONFIG_PATH defines for the one file
  that uses them. This means changing them won't force a rebuild of
  every single file.
* improve how those defines are used to eliminate some fuckiness
This commit is contained in:
AnyOldName3
2026-09-30 02:03:25 +01:00
parent 46bd459920
commit 2465dcdcf1
3 changed files with 11 additions and 12 deletions
+5 -3
View File
@@ -228,7 +228,7 @@ endif()
include(GNUInstallDirs)
# todo: force this suffix to match sApplicationName in configurationmanager.cpp
set(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/openmw")
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/games/openmw")
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/openmw")
# Set up common paths
if (UNIX AND NOT APPLE)
@@ -249,11 +249,13 @@ if (APPLE)
elseif(UNIX)
# Paths
SET(DATAROOTDIR "${CMAKE_INSTALL_DATAROOTDIR}" CACHE PATH "Sets the root of data directories to a non-default location")
SET(GLOBAL_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/games/" CACHE PATH "Set data path prefix")
# we can't use CMAKE_INSTALL_FULL_DATADIR to get this with our suffix as we add it after including GNUInstallDirs
SET(GLOBAL_DATA_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/openmw" CACHE PATH "Set absolute data path prefix for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.")
SET(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE PATH "Set icon dir")
SET(LICDIR "${DATAROOTDIR}/licenses/openmw" CACHE PATH "Sets the openmw license directory to a non-default location.")
SET(GLOBAL_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/.." CACHE PATH "Set absolute config dir path for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.")
# we have to re-add our suffix here, too.
SET(GLOBAL_CONFIG_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/openmw" CACHE PATH "Set absolute config dir path for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.")
set(OPENMW_RESOURCE_FILES "${CMAKE_INSTALL_DATADIR}/resources")
endif(APPLE)
+4 -5
View File
@@ -312,11 +312,6 @@ add_component_dir (stereo
add_component_dir (debug
debugging debuglog gldebug debugdraw writeflags
)
IF(NOT WIN32 AND NOT APPLE)
add_compile_definitions(GLOBAL_DATA_PATH="${GLOBAL_DATA_PATH}")
add_compile_definitions(GLOBAL_CONFIG_PATH="${GLOBAL_CONFIG_PATH}")
ENDIF()
add_component_dir (files
linuxpath androidpath windowspath macospath fixedpath multidircollection collections configurationmanager
constrainedfilestream memorystream hash configfileparser openfile constrainedfilestreambuf conversion
@@ -327,6 +322,10 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_FRONTEND
set_source_files_properties(files/configfileparser.cpp PROPERTIES COMPILE_FLAGS -Wno-shadow)
endif()
if (NOT WIN32 AND NOT APPLE)
set_source_files_properties(files/linuxpath.cpp PROPERTIES COMPILE_DEFINITIONS "GLOBAL_DATA_PATH=\"${GLOBAL_DATA_PATH}\";GLOBAL_CONFIG_PATH=\"${GLOBAL_CONFIG_PATH}\"")
endif ()
add_component_dir (compiler
context controlparser errorhandler exception exprparser extensions fileparser generator
lineparser literals locals output parser scanner scriptparser skipparser streamerrorhandler
+2 -4
View File
@@ -71,8 +71,7 @@ namespace Files
std::filesystem::path LinuxPath::getGlobalConfigPath() const
{
std::filesystem::path globalPath(GLOBAL_CONFIG_PATH);
return globalPath / mName;
return GLOBAL_CONFIG_PATH;
}
std::filesystem::path LinuxPath::getLocalPath() const
@@ -98,8 +97,7 @@ namespace Files
std::filesystem::path LinuxPath::getGlobalDataPath() const
{
std::filesystem::path globalDataPath(GLOBAL_DATA_PATH);
return globalDataPath / mName;
return GLOBAL_DATA_PATH;
}
std::vector<std::filesystem::path> LinuxPath::getInstallPaths() const