diff --git a/CMakeLists.txt b/CMakeLists.txt index f7acc44faf16d..11202cbd79b9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,8 @@ option(CURSES "Build curses version." "ON") option(SOUND "Support for in-game sounds & music." "OFF") option(BACKTRACE "Support for printing stack backtraces on crash" "ON") option(LIBBACKTRACE "Print backtrace with libbacktrace." "OFF") -option(USE_HOME_DIR "Use user's home directory for save files." "ON") +option(USE_XDG_DIR "Use XDG directories for save and config files." "OFF") +option(USE_HOME_DIR "Use user's home directory for save and config files." "ON") option(USE_PREFIX_DATA_DIR "Use UNIX system directories for game data in release build." "ON") option(LOCALIZE "Support for language localizations. Also enable UTF support." "ON") option(LANGUAGES "Compile localization files for specified languages." "") @@ -186,6 +187,11 @@ if (TILES) set(CURSES OFF) endif () +# Can't use both home and xdg directories +if (USE_XDG_DIR) + set(USE_HOME_DIR OFF) +endif () + # Set build types and display info if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(RELEASE 0) @@ -229,6 +235,7 @@ message(STATUS "CURSES : ${CURSES}") message(STATUS "SOUND : ${SOUND}") message(STATUS "BACKTRACE : ${BACKTRACE}") message(STATUS "LOCALIZE : ${LOCALIZE}") +message(STATUS "USE_XDG_DIR : ${USE_XDG_DIR}") message(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}") message(STATUS "LANGUAGES : ${LANGUAGES}") message(STATUS "See doc/COMPILING/COMPILING-CMAKE.md for details and more info --") @@ -412,6 +419,10 @@ if (USE_HOME_DIR) add_definitions(-DUSE_HOME_DIR) endif () +if (USE_XDG_DIR) + add_definitions(-DUSE_XDG_DIR) +endif () + find_program(CCACHE_FOUND ccache) if (CCACHE_FOUND AND CATA_CCACHE) set(CMAKE_C_COMPILER_LAUNCHER ccache) diff --git a/doc/COMPILING/COMPILING-CMAKE.md b/doc/COMPILING/COMPILING-CMAKE.md index 92c27ceca2568..18b34d20c7f2b 100644 --- a/doc/COMPILING/COMPILING-CMAKE.md +++ b/doc/COMPILING/COMPILING-CMAKE.md @@ -281,7 +281,8 @@ $ cmake -DOPTION_NAME1=option_value1 [-DOPTION_NAME2=option_value2 [...]] * `CURSES=`: Build curses version. * `TILES=`: Build graphical tileset version. * `SOUND=`: Support for in-game sounds & music. - * `USE_HOME_DIR=`: Use user's home directory for save files. + * `USE_XDG_DIR=`: Use user's XDG directories for save and config files. + * `USE_HOME_DIR=`: Use user's home directory for save and config files. * `USE_PREFIX_DATA_DIR=`: Use UNIX system directories for game data in release build. * `LOCALIZE=`: Support for language localizations. Also enable UTF support. * `LANGUAGES=`: Compile localization files for specified languages. Example: diff --git a/doc/COMPILING/COMPILING.md b/doc/COMPILING/COMPILING.md index 8989697d0b40e..bbcccb2d41352 100644 --- a/doc/COMPILING/COMPILING.md +++ b/doc/COMPILING/COMPILING.md @@ -539,7 +539,7 @@ The Cataclysm source is compiled using `make`. * `RELEASE=1` build an optimized release version; omit for debug build. * `CLANG=1` build with [Clang](http://clang.llvm.org/), the compiler that's included with the latest Command Line Tools for Xcode; omit to build using gcc/g++. This is enabled by default. * `MACPORTS=1` build against dependencies installed via Macports, currently only `gettext` and `ncurses`. -* `USE_HOME_DIR=1` places user files (config, saves, graveyard, etc) in the user's home directory. For curses builds, this is `/Users//.cataclysm-dda`, for SDL builds it is `/Users//Library/Application Support/Cataclysm`. +* `USE_HOME_DIR=1` places user files (config, saves, graveyard, etc) in the user's home directory. For curses builds, this is `/Users//.cataclysm-dda`, for OSX builds it is `/Users//Library/Application Support/Cataclysm`. * `DEBUG_SYMBOLS=1` retains debug symbols when building an optimized release binary, making it easy for developers to spot the crash site. In addition to the options above, there is an `app` make target which will package the tiles build into `Cataclysm.app`, a complete tiles build in a Mac application that can run without Terminal.