From 54f1cabed9bd84271c8cffc1040aeb9838a0c746 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Nov 2022 07:44:36 +0100 Subject: [PATCH] - backend update from Raze. Progdir stuff for POSIX. --- src/CMakeLists.txt | 6 ++++++ src/common/platform/posix/sdl/i_main.cpp | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f1bced051..4bd5e14d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -468,9 +468,15 @@ elseif( APPLE ) set_source_files_properties( posix/osx/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) set_source_files_properties( common/platform/posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions ) else() + option (SYSTEMINSTALL "Set global progdir based on CMake Install Dir" OFF) + set( SYSTEM_SOURCES_DIR common/platform/posix common/platform/posix/sdl ) set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} ) set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ) + + if ( SYSTEMINSTALL ) + add_definitions( -DPROGDIR="${CMAKE_INSTALL_PREFIX}/${INSTALL_PK3_PATH}" ) + endif() endif() if( HAVE_MMX ) diff --git a/src/common/platform/posix/sdl/i_main.cpp b/src/common/platform/posix/sdl/i_main.cpp index a28b90f01..196504b54 100644 --- a/src/common/platform/posix/sdl/i_main.cpp +++ b/src/common/platform/posix/sdl/i_main.cpp @@ -174,7 +174,9 @@ int main (int argc, char **argv) Args = new FArgs(argc, argv); - // Should we even be doing anything with progdir on Unix systems? +#ifdef PROGDIR + progdir = PROGDIR; +#else char program[PATH_MAX]; if (realpath (argv[0], program) == NULL) strcpy (program, argv[0]); @@ -188,6 +190,7 @@ int main (int argc, char **argv) { progdir = "./"; } +#endif I_StartupJoysticks();