diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e09e18902..3c00baaf4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,11 +128,9 @@ option( KICAD_SPICE "Build KiCad with internal Spice simulator." ON ) set( CMAKE_CXX_VISIBILITY_PRESET "hidden" ) set( CMAKE_VISIBILITY_INLINES_HIDDEN ON ) - # Global setting: build everything position independent set( CMAKE_POSITION_INDEPENDENT_CODE ON ) - # Global setting: Use C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -160,12 +158,9 @@ endif() # Add option to add user directories for linker, if any LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} ) -if( UNIX ) - set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specific KiCad config files" ) -elseif( MINGW ) - set( KICAD_USER_CONFIG_DIR $ENV{APPDATA} CACHE PATH "Location of user specific KiCad config files" ) -endif() -mark_as_advanced( KICAD_USER_CONFIG_DIR ) +set( KICAD_CONFIG_DIR "kicad" CACHE STRING "Location of user specific KiCad config files" ) +mark_as_advanced( KICAD_CONFIG_DIR ) +add_definitions( -DKICAD_CONFIG_DIR=${KICAD_CONFIG_DIR} ) # Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the # CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and diff --git a/Documentation/development/compiling.md b/Documentation/development/compiling.md index b9873a5a09..d106a970ed 100644 --- a/Documentation/development/compiling.md +++ b/Documentation/development/compiling.md @@ -144,7 +144,7 @@ so use at your own risk. ## Graphics Context Overlay ## {#overlay_opt} The USE_WX_OVERLAY option is used to enable the optional wxOverlay class for graphics rendering -on macOS. This is enabled on macOS by default and disabled on all other platforms. +on macOS. This is enabled on macOS and GTK3 by default and disabled on all other platforms. ## Scripting Support ## {#scripting_opt} @@ -222,6 +222,18 @@ information as follows: | output of `git describe --dirty` if git is available. + +## KiCad Config Directory ## {#config_dir_opt} + +The default KiCad configuration directory is `kicad`. On Linux this is located at +`~/.config/kicad`, on MSW, this is `C:\Documents and Settings\username\Application Data\kicad` and +on MacOS, this is `~/Library/Preferences/kicad`. If the installation package would like to, it may +specify an alternate configuration name instead of `kicad`. This may be useful for versioning +the configuration parameters and allowing the use of, e.g. `kicad5` and `kicad6` concurrently without +losing configuration data. + +This is set by specifying the KICAD_CONFIG_DIR string at compile time. + # Getting the KiCad Source Code ## {#getting_src} There are several ways to get the KiCad source. If you want to build the stable version you diff --git a/common/common.cpp b/common/common.cpp index 26a333a7f8..d2dec02727 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -288,7 +288,7 @@ wxString GetKicadConfigPath() cfgpath.AssignDir( envstr ); } - cfgpath.AppendDir( wxT( "kicad" ) ); + cfgpath.AppendDir( TO_STR( KICAD_CONFIG_DIR ) ); // Use KICAD_CONFIG_HOME to allow the user to force a specific configuration path. if( wxGetEnv( wxT( "KICAD_CONFIG_HOME" ), &envstr ) && !envstr.IsEmpty() ) diff --git a/include/macros.h b/include/macros.h index d5a5cf7706..7f75281f1f 100644 --- a/include/macros.h +++ b/include/macros.h @@ -46,6 +46,14 @@ */ #define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() ) +/** + * Stringifies the given parameter by placing in quotes + * @param cstring STRING (no spaces) + * @return "STRING" + */ +#define TO_STR2(x) #x +#define TO_STR(x) TO_STR2(x) + /** * function FROM_UTF8 * converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.