Allow to relocate EDA libraries out of KICAD_DATA
Introduce a new advanced config variable `KICAD_LIBRARY_DATA` which can be used to move templates, symbols, footprints, and 3dmodels out of `KICAD_DATA`. If not defined, everything is kept as before. To facilitate this, PATHS::GetStockEDALibraryPath() is added. This allows to differentiate code paths looking for EDA library data vs. code paths looking for plugins, demos, and the like. Thanks to Aimylios for the hints and suggestions with regards to the stock EDA library data path handling on Windows and MacOS.
This commit is contained in:
parent
f7cc6d1e1e
commit
39c1387b5b
|
@ -542,6 +542,9 @@ if( NOT APPLE )
|
|||
CACHE STRING "Location of KiCad data files." )
|
||||
endif()
|
||||
|
||||
set( KICAD_LIBRARY_DATA ${KICAD_DATA}
|
||||
CACHE STRING "Location of KiCad stock EDA library data" )
|
||||
|
||||
if( WIN32 )
|
||||
set( KICAD_PLUGINS ${KICAD_BIN}/scripting/plugins
|
||||
CACHE PATH "Location of KiCad plugins." )
|
||||
|
@ -566,7 +569,7 @@ if( NOT APPLE )
|
|||
CACHE PATH "Location of KiCad documentation files." )
|
||||
set( KICAD_DEMOS ${KICAD_DATA}/demos
|
||||
CACHE PATH "Location of KiCad demo files." )
|
||||
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||
set( KICAD_TEMPLATE ${KICAD_LIBRARY_DATA}/template
|
||||
CACHE PATH "Location of KiCad template files." )
|
||||
else()
|
||||
# everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
||||
|
@ -642,6 +645,7 @@ mark_as_advanced( KICAD_BIN
|
|||
KICAD_USER_PLUGIN
|
||||
KICAD_LIB
|
||||
KICAD_DATA
|
||||
KICAD_LIBRARY_DATA
|
||||
KICAD_DOCS
|
||||
KICAD_DEMOS
|
||||
KICAD_TEMPLATE )
|
||||
|
|
|
@ -85,6 +85,10 @@
|
|||
/// Allows scripts install directory to be referenced by the program code.
|
||||
#define KICAD_DATA "@KICAD_DATA@"
|
||||
|
||||
/// Allows KiCad stock EDA library data (templates, symbols, footprints, 3dmodels)
|
||||
/// directory to be referenced by the program code.
|
||||
#define KICAD_LIBRARY_DATA "@KICAD_LIBRARY_DATA@"
|
||||
|
||||
// Plugins directory
|
||||
#define KICAD_PLUGINDIR "@CMAKE_INSTALL_FULL_LIBDIR@"
|
||||
|
||||
|
|
|
@ -162,6 +162,22 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir )
|
|||
}
|
||||
|
||||
|
||||
wxString PATHS::GetStockEDALibraryPath()
|
||||
{
|
||||
wxString path;
|
||||
|
||||
#if defined( __WXMAC__ )
|
||||
path = GetOSXKicadMachineDataDir();
|
||||
#elif defined( __WXMSW__ )
|
||||
path = GetStockDataPath( false );
|
||||
#else
|
||||
path = wxString::FromUTF8Unchecked( KICAD_LIBRARY_DATA );
|
||||
#endif
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
wxString PATHS::GetStockScriptingPath()
|
||||
{
|
||||
wxString path;
|
||||
|
|
|
@ -279,11 +279,7 @@ bool PGM_BASE::InitPgm()
|
|||
return false;
|
||||
|
||||
wxFileName baseSharePath;
|
||||
#ifdef __WXMAC__
|
||||
baseSharePath.AssignDir( PATHS::GetOSXKicadMachineDataDir() );
|
||||
#else
|
||||
baseSharePath.AssignDir( PATHS::GetStockDataPath( false ) );
|
||||
#endif
|
||||
baseSharePath.AssignDir( PATHS::GetStockEDALibraryPath() );
|
||||
|
||||
// KICAD6_FOOTPRINT_DIR
|
||||
wxString envVarName = wxT( "KICAD6_FOOTPRINT_DIR" );
|
||||
|
|
|
@ -68,9 +68,10 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack )
|
|||
maybe.AddPaths( wxT( DEFAULT_INSTALL_PATH ) );
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// On Linux, the stock data install path is defined by KICAD_DATA.
|
||||
// On Linux, the stock EDA library data install path can be redefined via
|
||||
// KICAD_LIBRARY_DATA, otherwise KICAD_DATA will be used.
|
||||
// Useful when multiple versions of KiCad are installed in parallel.
|
||||
maybe.AddPaths( PATHS::GetStockDataPath( false ) );
|
||||
maybe.AddPaths( PATHS::GetStockEDALibraryPath() );
|
||||
#endif
|
||||
|
||||
// Add the directory for the user-dependent, program specific data files.
|
||||
|
|
|
@ -72,6 +72,12 @@ public:
|
|||
*/
|
||||
static wxString GetStockDataPath( bool aRespectRunFromBuildDir = true );
|
||||
|
||||
/**
|
||||
* Gets the stock (install) EDA library data path, which is the base path for
|
||||
* templates, schematic symbols, footprints, and 3D models.
|
||||
*/
|
||||
static wxString GetStockEDALibraryPath();
|
||||
|
||||
/**
|
||||
* Gets the stock (install) scripting path
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue