Browse Source

Allow finding kicad_3dsg when running from build dir

This might also come in handy later when we use more dynamic libs
6.0.7
Jon Evans 5 years ago
parent
commit
cdb352bb24
  1. 14
      common/kiway.cpp
  2. 5
      libs/kiplatform/gtk/app.cpp
  3. 9
      libs/kiplatform/include/kiplatform/app.h
  4. 6
      libs/kiplatform/msw/app.cpp
  5. 5
      libs/kiplatform/osx/app.mm

14
common/kiway.cpp

@ -32,6 +32,7 @@
#include <config.h>
#include <core/arraydim.h>
#include <id.h>
#include <kiplatform/app.h>
#include <settings/settings_manager.h>
#include <logging.h>
@ -199,6 +200,19 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
{
wxString dname = dso_search_path( aFaceId );
// Insert DLL search path for kicad_3dsg from build dir
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
{
wxFileName myPath = wxStandardPaths::Get().GetExecutablePath();
if( !myPath.GetPath().EndsWith( wxT( "pcbnew" ) ) )
{
myPath.RemoveLastDir();
myPath.AppendDir( wxT( "pcbnew" ) );
KIPLATFORM::APP::AddDynamicLibrarySearchPath( myPath.GetPath() );
}
}
wxDynamicLibrary dso;
void* addr = NULL;

5
libs/kiplatform/gtk/app.cpp

@ -102,3 +102,8 @@ void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString&
void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
{
}
void KIPLATFORM::APP::AddDynamicLibrarySearchPath( const wxString& aPath )
{
}

9
libs/kiplatform/include/kiplatform/app.h

@ -82,6 +82,15 @@ namespace KIPLATFORM
* Call as needed in an application to ensure timers are dispatched
*/
void ForceTimerMessagesToBeCreatedIfNecessary();
/**
* Inserts a search path for loading dynamic libraries. The exact place this new path ends
* up in the dynamic library search order is platform-dependent, but generally this can be
* used to make sure dynamic libraries are found in non-standard runtime situations.
*
* @param aPath is the full path to insert
*/
void AddDynamicLibrarySearchPath( const wxString& aPath );
}
}

6
libs/kiplatform/msw/app.cpp

@ -111,3 +111,9 @@ void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
MSG msg;
PeekMessage( &msg, nullptr, WM_TIMER, WM_TIMER, PM_NOREMOVE );
}
void KIPLATFORM::APP::AddDynamicLibrarySearchPath( const wxString& aPath )
{
SetDllDirectoryA( aPath.c_str() );
}

5
libs/kiplatform/osx/app.mm

@ -63,3 +63,8 @@ void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString&
void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
{
}
void KIPLATFORM::APP::AddDynamicLibrarySearchPath( const wxString& aPath )
{
}
Loading…
Cancel
Save