Fix 3D plugins mutiarch support.

Use CMAKE_INSTALL_LIBDIR instead of wxStandardPaths::GetPluginsDir() to
determine plugin directory.

Fixes lp:1682812

https://bugs.launchpad.net/kicad/+bug/1682812
This commit is contained in:
Cirilo Bernardo 2017-04-17 01:41:21 +00:00 committed by Wayne Stambaugh
parent 1a75d9979f
commit 68a7a5235e
3 changed files with 20 additions and 8 deletions

View File

@ -36,6 +36,7 @@
#include "common.h"
#include "pgm_base.h"
#include "3d_plugin_dir.h"
#include "3d_plugin_manager.h"
#include "plugins/3d/3d_plugin.h"
#include "3d_cache/sg/scenegraph.h"
@ -132,22 +133,29 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
checkPluginPath( testpath, searchpaths );
#endif
#ifndef _WIN32 // suppress 'kicad' subdir since it is redundant on MSWin
fn.Assign( wxStandardPaths::Get().GetPluginsDir(), "" );
#ifndef _WIN32
// multiarch friendly determination of the plugin directory: the executable dir
// is first determined via wxStandardPaths::Get().GetExecutablePath() and then
// the CMAKE_INSTALL_LIBDIR path is appended relative to the executable dir.
fn.Assign( wxStandardPaths::Get().GetExecutablePath() );
fn.RemoveLastDir();
fn.AppendDir( wxT( "kicad" ) );
wxString tfname = fn.GetPathWithSep();
tfname.Append( wxString::FromUTF8Unchecked( PLUGINDIR ) );
fn.Assign( tfname, "");
fn.AppendDir( "kicad" );
#else
// on windows the plugins directory is within the executable's directory
fn.Assign( wxStandardPaths::Get().GetExecutablePath() );
#endif
fn.AppendDir( wxT( "plugins" ) );
fn.AppendDir( wxT( "3d" ) );
// checks plugin directory relative to executable path
checkPluginPath( std::string( fn.GetPathWithSep().ToUTF8() ), searchpaths );
checkPluginPath( wxT( "/usr/lib/kicad/plugins/3d" ), searchpaths );
checkPluginPath( wxT( "/usr/local/lib/kicad/plugins/3d" ), searchpaths );
checkPluginPath( wxT( "/opt/kicad/lib/kicad/plugins/3d" ), searchpaths );
// check for per-user third party plugins
// note: GetUserDataDir() gives '.pcbnew' rather than '.kicad' since it uses the exe name;
fn.Assign( wxStandardPaths::Get().GetUserDataDir(), "" );
fn.RemoveLastDir();

View File

@ -0,0 +1 @@
#define PLUGINDIR "@CMAKE_INSTALL_LIBDIR@"

View File

@ -1,8 +1,11 @@
#add_definitions(-DPRINT_STATISTICS_3D_VIEWER)
add_definitions(-DPCBNEW)
configure_file( 3d_plugin_dir.h.in 3d_plugin_dir.h @ONLY )
include_directories(BEFORE ${INC_BEFORE})
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
../pcbnew
../polygon
3d_canvas