Browse Source

Use KICAD_DATA for data path lookup in scripting

Fixes https://gitlab.com/kicad/code/kicad/issues/7036
6.0.7
Seth Hillbrand 5 years ago
parent
commit
2cb8dff650
  1. 10
      CMakeLists.txt
  2. 3
      CMakeModules/config.h.cmake
  3. 4
      pcbnew/swig/python_scripting.cpp

10
CMakeLists.txt

@ -490,8 +490,14 @@ if( NOT APPLE )
set( KICAD_BIN bin
CACHE PATH "Location of KiCad binaries." )
set( KICAD_DATA ${CMAKE_INSTALL_DATADIR}/kicad
CACHE PATH "Location of KiCad data files." )
# Do not make these variables "PATH" b/c cmake will truncate them and we need the full path
if( NOT IS_ABSOLUTE ${CMAKE_INSTALL_DATADIR} )
set( KICAD_DATA ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/kicad
CACHE STRING "Location of KiCad data files." )
else()
set( KICAD_DATA ${CMAKE_INSTALL_DATADIR}/kicad
CACHE STRING "Location of KiCad data files." )
endif()
if( WIN32 )
set( KICAD_PLUGINS ${KICAD_BIN}/scripting/plugins

3
CMakeModules/config.h.cmake

@ -77,6 +77,9 @@
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
/// Allows scripts install directory to be referenced by the program code.
#define KICAD_DATA "@KICAD_DATA@"
/// ngspice version string detected by pkg-config when available.
#cmakedefine NGSPICE_BUILD_VERSION "@NGSPICE_BUILD_VERSION@"

4
pcbnew/swig/python_scripting.cpp

@ -41,6 +41,8 @@
#include <wx/app.h>
#include <config.h>
/* init functions defined by swig */
#if PY_MAJOR_VERSION >= 3
@ -658,7 +660,7 @@ wxString PyScriptingPath( bool aUserPath )
#if defined( __WXMAC__ )
path = GetOSXKicadDataDir() + wxT( "/scripting" );
#else
path = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting" );
path = Pgm().GetExecutablePath() + KICAD_DATA + wxS( "/scripting" );
#endif
}
}

Loading…
Cancel
Save