Commit f06bfe6d authored by Bernhard Stegmaier's avatar Bernhard Stegmaier Committed by Wayne Stambaugh

Commit the rest of the OSX build fixes missed in the previous commit.

parent 816974b8
...@@ -349,8 +349,9 @@ if( APPLE ) ...@@ -349,8 +349,9 @@ if( APPLE )
set( OSX_BUNDLE_MAIN "kicad.app" ) set( OSX_BUNDLE_MAIN "kicad.app" )
set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" )
set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" )
set( OSX_BUNDLE_KIFACE_DIR "Contents/Plugins" ) set( OSX_BUNDLE_KIFACE_DIR "Contents/PlugIns" )
set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" )
set( OSX_BUNDLE_APP_DIR "Contents/Applications" )
set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" )
set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" )
set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" )
...@@ -377,6 +378,24 @@ if( APPLE ) ...@@ -377,6 +378,24 @@ if( APPLE )
# used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used
# set it to correct value just in case (see common.cpp) # set it to correct value just in case (see common.cpp)
set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" )
# Override default paths for fixup_bundle
set( OSX_BUNDLE_OVERRIDE_PATHS "
function( gp_item_default_embedded_path_override item default_embedded_path_var )
# by default, embed things right next to the main bundle executable:
set( path \"@executable_path/../../Contents/MacOS\" )
set( overridden 0 )
# embed .dylibs right next to the main bundle executable:
if( item MATCHES \"\\\\.dylib$\" )
set( path \"@executable_path/../Frameworks\" )
set( overridden 1 )
endif()
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
endfunction(gp_item_default_embedded_path_override)
"
)
endif() endif()
mark_as_advanced( KICAD_BIN mark_as_advanced( KICAD_BIN
...@@ -614,7 +633,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) ...@@ -614,7 +633,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
) )
else() else()
# relative path for python in bundle # relative path for python in bundle
set( PYTHON_LIB_DIR "python" ) set( PYTHON_LIB_DIR "python/site-packages" )
# install into bundle Frameworks folder # install into bundle Frameworks folder
set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}"
CACHE PATH "Python module install path." CACHE PATH "Python module install path."
...@@ -655,6 +674,25 @@ endif() ...@@ -655,6 +674,25 @@ endif()
# 'CMakeLists.txt' files to process # 'CMakeLists.txt' files to process
#================================================ #================================================
if( APPLE )
# Remove app bundles in ${KICAD_BIN} before installing anything new.
# Must be defined before all includes so that it is executed first.
install( CODE "
message( STATUS \"Removing existing application bundles...\" )
# Remove links to standalone apps
file( REMOVE ${KICAD_BIN}/bitmap2component.app )
file( REMOVE ${KICAD_BIN}/eeschema.app )
file( REMOVE ${KICAD_BIN}/cvpcb.app )
file( REMOVE ${KICAD_BIN}/gerbview.app )
file( REMOVE ${KICAD_BIN}/pcb_calculator.app )
file( REMOVE ${KICAD_BIN}/pcbnew.app )
file( REMOVE ${KICAD_BIN}/pl_editor.app )
# Remove main bundle
file( REMOVE_RECURSE ${KICAD_BIN}/${OSX_BUNDLE_MAIN} )
" COMPONENT Runtime
)
endif()
############################ ############################
# Binaries ( CMake targets ) # # Binaries ( CMake targets ) #
############################ ############################
......
...@@ -100,6 +100,8 @@ target folder for compiled binaries, third parameter is the kicad folder, and ...@@ -100,6 +100,8 @@ target folder for compiled binaries, third parameter is the kicad folder, and
the last optional parameter are make options used during the build (in this the last optional parameter are make options used during the build (in this
case for building with 4 jobs in parallel). case for building with 4 jobs in parallel).
The script will automatically detect if you are compiling wxWidgets or wxPython. The script will automatically detect if you are compiling wxWidgets or wxPython.
NOTE: All paths are assumed to be relative to the current directory, i.e., the
working root you are in.
CAUTION: The script will erase existing wx-build and target folders (wx-bin) CAUTION: The script will erase existing wx-build and target folders (wx-bin)
without any confirmation! without any confirmation!
......
...@@ -142,8 +142,11 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -142,8 +142,11 @@ wxString FindKicadFile( const wxString& shortname )
{ {
// Test the presence of the file in the directory shortname of // Test the presence of the file in the directory shortname of
// the KiCad binary path. // the KiCad binary path.
#ifndef __WXMAC__
wxString fullFileName = Pgm().GetExecutablePath() + shortname; wxString fullFileName = Pgm().GetExecutablePath() + shortname;
#else
wxString fullFileName = Pgm().GetExecutablePath() + wxT( "Contents/MacOS/" ) + shortname;
#endif
if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) )
return fullFileName; return fullFileName;
...@@ -157,16 +160,22 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -157,16 +160,22 @@ wxString FindKicadFile( const wxString& shortname )
return fullFileName; return fullFileName;
} }
// find binary file from possibilities list:
// /usr/local/kicad/linux or c:/kicad/winexe
// Path list for KiCad binary files // Path list for KiCad binary files
const static wxChar* possibilities[] = { const static wxChar* possibilities[] = {
#ifdef __WINDOWS__ #if defined( __WINDOWS__ )
wxT( "c:/kicad/bin/" ), wxT( "c:/kicad/bin/" ),
wxT( "d:/kicad/bin/" ), wxT( "d:/kicad/bin/" ),
wxT( "c:/Program Files/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ),
wxT( "d:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ),
#elif defined( __WXMAC__ )
// all internal paths are relative to main bundle kicad.app
wxT( "Contents/Applications/cvpcb.app/Contents/MacOS/" ),
wxT( "Contents/Applications/pcbnew.app/Contents/MacOS/" ),
wxT( "Contents/Applications/eeschema.app/Contents/MacOS/" ),
wxT( "Contents/Applications/gerbview.app/Contents/MacOS/" ),
wxT( "Contents/Applications/bitmap2component.app/Contents/MacOS/" ),
wxT( "Contents/Applications/pcb_calculator.app/Contents/MacOS/" ),
wxT( "Contents/Applications/pl_editor.app/Contents/MacOS/" ),
#else #else
wxT( "/usr/bin/" ), wxT( "/usr/bin/" ),
wxT( "/usr/local/bin/" ), wxT( "/usr/local/bin/" ),
...@@ -174,9 +183,15 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -174,9 +183,15 @@ wxString FindKicadFile( const wxString& shortname )
#endif #endif
}; };
// find binary file from possibilities list:
for( unsigned i=0; i<DIM(possibilities); ++i ) for( unsigned i=0; i<DIM(possibilities); ++i )
{ {
#ifndef __WXMAC__
fullFileName = possibilities[i] + shortname; fullFileName = possibilities[i] + shortname;
#else
// make relative paths absolute
fullFileName = Pgm().GetExecutablePath() + possibilities[i] + shortname;
#endif
if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) )
return fullFileName; return fullFileName;
...@@ -189,31 +204,25 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -189,31 +204,25 @@ wxString FindKicadFile( const wxString& shortname )
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param,
wxProcess *callback ) wxProcess *callback )
{ {
wxString fullFileName; wxString fullFileName = FindKicadFile( ExecFile );
fullFileName = FindKicadFile( ExecFile );
#ifdef __WXMAC__ if( wxFileExists( fullFileName ) )
if( wxFileExists( fullFileName ) || wxDir::Exists( fullFileName ) )
{ {
return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" ) if( !param.IsEmpty() )
+ ExecFile + wxT( " " ) fullFileName += wxT( " " ) + param;
+ param, wxEXEC_ASYNC, callback );
return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback );
} }
#ifdef __WXMAC__
else else
{
return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback );
}
#else
if( wxFileExists( fullFileName ) )
{ {
if( !param.IsEmpty() ) if( !param.IsEmpty() )
fullFileName += wxT( " " ) + param; fullFileName += wxT( " " ) + param;
return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); return ProcessExecute( wxT( "/usr/bin/open -a " ) + fullFileName, wxEXEC_ASYNC, callback );
} }
#endif #endif
wxString msg; wxString msg;
msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) );
DisplayError( frame, msg, 20 ); DisplayError( frame, msg, 20 );
...@@ -233,6 +242,7 @@ wxString KicadDatasPath() ...@@ -233,6 +242,7 @@ wxString KicadDatasPath()
} }
else // Path of executables. else // Path of executables.
{ {
#ifndef __WXMAC__
wxString tmp = Pgm().GetExecutablePath(); wxString tmp = Pgm().GetExecutablePath();
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp.MakeLower(); tmp.MakeLower();
...@@ -303,6 +313,11 @@ wxString KicadDatasPath() ...@@ -303,6 +313,11 @@ wxString KicadDatasPath()
break; break;
} }
} }
#else
// On OSX point to Contents/SharedSupport folder of main bundle
data_path = GetOSXKicadDataDir();
found = true;
#endif
} }
if( found ) if( found )
......
...@@ -113,11 +113,13 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId ) ...@@ -113,11 +113,13 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId )
return wxEmptyString; return wxEmptyString;
} }
#ifndef __WXMAC__
wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); wxFileName fn = wxStandardPaths::Get().GetExecutablePath();
#ifdef __WXMAC__ #else
// we have the dso's in @executable_path/../Plugins in OSX bundle // we have the dso's in main OSX bundle kicad.app/Contents/PlugIns
fn.RemoveLastDir(); wxFileName fn = Pgm().GetExecutablePath();
fn.AppendDir( wxT( "Plugins" ) ); fn.AppendDir( wxT( "Contents" ) );
fn.AppendDir( wxT( "PlugIns" ) );
#endif #endif
fn.SetName( name ); fn.SetName( name );
......
...@@ -412,38 +412,30 @@ bool PGM_BASE::initPgm() ...@@ -412,38 +412,30 @@ bool PGM_BASE::initPgm()
bool PGM_BASE::setExecutablePath() bool PGM_BASE::setExecutablePath()
{ {
#ifdef __APPLE__ // Apple MacOSx
// Derive path from location of the app bundle
CFBundleRef mainBundle = CFBundleGetMainBundle();
if( mainBundle == NULL )
return false;
CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );
if( urlref == NULL )
return false;
CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );
if( str == NULL )
return false;
char* native_str = NULL;
int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),
kCFStringEncodingUTF8 ) + 1;
native_str = new char[len];
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
m_bin_dir = FROM_UTF8( native_str );
delete[] native_str;
#else
m_bin_dir = wxStandardPaths::Get().GetExecutablePath(); m_bin_dir = wxStandardPaths::Get().GetExecutablePath();
#endif #ifdef __WXMAC__
// On OSX Pgm().GetExecutablePath() will always point to main
// bundle directory, e.g., /Applications/kicad.app/
wxFileName fn( m_bin_dir );
if( fn.GetName() == wxT( "kicad" ) )
{
// kicad launcher, so just remove the Contents/MacOS part
fn.RemoveLastDir();
fn.RemoveLastDir();
}
else
{
// standalone binaries live in Contents/Applications/<standalone>.app/Contents/MacOS
fn.RemoveLastDir();
fn.RemoveLastDir();
fn.RemoveLastDir();
fn.RemoveLastDir();
fn.RemoveLastDir();
}
m_bin_dir = fn.GetPath() + wxT( "/" );
#else
// Use unix notation for paths. I am not sure this is a good idea, // Use unix notation for paths. I am not sure this is a good idea,
// but it simplifies compatibility between Windows and Unices. // but it simplifies compatibility between Windows and Unices.
// However it is a potential problem in path handling under Windows. // However it is a potential problem in path handling under Windows.
...@@ -452,6 +444,7 @@ bool PGM_BASE::setExecutablePath() ...@@ -452,6 +444,7 @@ bool PGM_BASE::setExecutablePath()
// Remove file name form command line: // Remove file name form command line:
while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() ) while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() )
m_bin_dir.RemoveLast(); m_bin_dir.RemoveLast();
#endif
return true; return true;
} }
......
...@@ -111,7 +111,12 @@ const wxString PROJECT::FootprintLibTblName() const ...@@ -111,7 +111,12 @@ const wxString PROJECT::FootprintLibTblName() const
// application title which is no longer constant or known. This next line needs // application title which is no longer constant or known. This next line needs
// to be re-thought out. // to be re-thought out.
#ifndef __WXMAC__
fn.AssignDir( wxStandardPaths::Get().GetUserConfigDir() ); fn.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );
#else
// don't pollute home folder, temp folder seems to be more appropriate
fn.AssignDir( wxStandardPaths::Get().GetTempDir() );
#endif
#if defined( __WINDOWS__ ) #if defined( __WINDOWS__ )
fn.AppendDir( wxT( "kicad" ) ); fn.AppendDir( wxT( "kicad" ) );
......
...@@ -53,8 +53,23 @@ if( MINGW ) ...@@ -53,8 +53,23 @@ if( MINGW )
endif() endif()
if( APPLE )
# setup bundle
set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
set( MACOSX_BUNDLE_NAME cvpcb )
endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
add_executable( cvpcb WIN32 add_executable( cvpcb WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp ../common/pgm_base.cpp
${CVPCB_RESOURCES} ${CVPCB_RESOURCES}
...@@ -141,13 +156,32 @@ if( USE_KIWAY_DLLS ) ...@@ -141,13 +156,32 @@ if( USE_KIWAY_DLLS )
# these 2 binaries are a matched set, keep them together: # these 2 binaries are a matched set, keep them together:
if( APPLE ) if( APPLE )
# puts binaries into the *.app bundle while linking
set_target_properties( cvpcb PROPERTIES set_target_properties( cvpcb PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
# puts binaries into the *.app bundle while linking
set_target_properties( cvpcb_kiface PROPERTIES set_target_properties( cvpcb_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
) )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS cvpcb
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/cvpcb.app/Contents/MacOS/cvpcb
\"\"
\"\"
)
" COMPONENT Runtime
)
else() else()
install( TARGETS cvpcb install( TARGETS cvpcb
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
...@@ -161,7 +195,7 @@ if( USE_KIWAY_DLLS ) ...@@ -161,7 +195,7 @@ if( USE_KIWAY_DLLS )
else() else()
add_executable( cvpcb WIN32 add_executable( cvpcb WIN32 MACOSX_BUNDLE
${CVPCB_SRCS} ${CVPCB_SRCS}
${CVPCB_DIALOGS} ${CVPCB_DIALOGS}
${CVPCB_RESOURCES} ${CVPCB_RESOURCES}
...@@ -201,15 +235,8 @@ else() ...@@ -201,15 +235,8 @@ else()
# Must follow github_plugin # Must follow github_plugin
target_link_libraries( cvpcb ${Boost_LIBRARIES} ) target_link_libraries( cvpcb ${Boost_LIBRARIES} )
if( APPLE ) install( TARGETS cvpcb
# puts binaries into the *.app bundle while linking DESTINATION ${KICAD_BIN}
set_target_properties( cvpcb PROPERTIES COMPONENT binary
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} )
)
else()
install( TARGETS cvpcb
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif()
endif() endif()
...@@ -233,9 +233,23 @@ set_source_files_properties( dialogs/dialog_bom.cpp ...@@ -233,9 +233,23 @@ set_source_files_properties( dialogs/dialog_bom.cpp
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
) )
if( APPLE )
# setup bundle
set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE eeschema.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
set( MACOSX_BUNDLE_NAME eeschema )
endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
add_executable( eeschema WIN32 add_executable( eeschema WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp ../common/pgm_base.cpp
${EESCHEMA_RESOURCES} ${EESCHEMA_RESOURCES}
...@@ -292,13 +306,32 @@ if( USE_KIWAY_DLLS ) ...@@ -292,13 +306,32 @@ if( USE_KIWAY_DLLS )
# these 2 binaries are a matched set, keep them together: # these 2 binaries are a matched set, keep them together:
if( APPLE ) if( APPLE )
# puts binaries into the *.app bundle while linking
set_target_properties( eeschema PROPERTIES set_target_properties( eeschema PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
# puts binaries into the *.app bundle while linking
set_target_properties( eeschema_kiface PROPERTIES set_target_properties( eeschema_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
) )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS eeschema
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/eeschema.app/Contents/MacOS/eeschema
\"\"
\"\"
)
" COMPONENT Runtime
)
else() else()
install( TARGETS eeschema install( TARGETS eeschema
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
...@@ -313,7 +346,7 @@ if( USE_KIWAY_DLLS ) ...@@ -313,7 +346,7 @@ if( USE_KIWAY_DLLS )
endif() endif()
else() else()
add_executable( eeschema WIN32 add_executable( eeschema WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
${EESCHEMA_SRCS} ${EESCHEMA_SRCS}
${EESCHEMA_COMMON_SRCS} ${EESCHEMA_COMMON_SRCS}
...@@ -333,17 +366,10 @@ else() ...@@ -333,17 +366,10 @@ else()
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL" COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
) )
if( APPLE ) install( TARGETS eeschema
# puts binaries into the *.app bundle while linking DESTINATION ${KICAD_BIN}
set_target_properties( eeschema PROPERTIES COMPONENT binary
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} )
)
else()
install( TARGETS eeschema
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif()
endif() endif()
......
...@@ -10,13 +10,11 @@ ...@@ -10,13 +10,11 @@
<array> <array>
<string>sch</string> <string>sch</string>
</array> </array>
<key>CFBundleTypeIconFile</key> <string>eeschema_doc.icns</string>
<key>CFBundleTypeIconFile</key> <string>eeschema.icns</string>
<key>CFBundleTypeName</key> <string>eeschema document</string> <key>CFBundleTypeName</key> <string>eeschema document</string>
<key>LSHandlerRank</key> <string>Owner</string> <key>LSHandlerRank</key> <string>Owner</string>
</dict> </dict>
</array> </array>
<key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>eeschema</string> <key>CFBundleExecutable</key> <string>eeschema</string>
<key>CFBundleGetInfoString</key> <string></string> <key>CFBundleGetInfoString</key> <string></string>
......
...@@ -379,7 +379,11 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) ...@@ -379,7 +379,11 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
void DIALOG_BOM::OnChoosePlugin( wxCommandEvent& event ) void DIALOG_BOM::OnChoosePlugin( wxCommandEvent& event )
{ {
wxString mask = wxT( "*" ); wxString mask = wxT( "*" );
#ifndef __WXMAC__
wxString path = Pgm().GetExecutablePath(); wxString path = Pgm().GetExecutablePath();
#else
wxString path = GetOSXKicadDataDir() + wxT( "/plugins" );
#endif
wxString fullFileName = EDA_FileSelector( _( "Plugin files:" ), wxString fullFileName = EDA_FileSelector( _( "Plugin files:" ),
path, path,
......
...@@ -871,7 +871,11 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event ) ...@@ -871,7 +871,11 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
wxString FullFileName, Mask, Path; wxString FullFileName, Mask, Path;
Mask = wxT( "*" ); Mask = wxT( "*" );
#ifndef __WXMAC__
Path = Pgm().GetExecutablePath(); Path = Pgm().GetExecutablePath();
#else
Path = GetOSXKicadDataDir() + wxT( "/plugins" );
#endif
FullFileName = EDA_FileSelector( _( "Plugin files:" ), FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, Path,
FullFileName, FullFileName,
......
...@@ -79,9 +79,23 @@ if( MINGW ) ...@@ -79,9 +79,23 @@ if( MINGW )
mingw_resource_compiler( gerbview ) mingw_resource_compiler( gerbview )
endif() endif()
if( APPLE )
# setup bundle
set( GERBVIEW_RESOURCES gerbview.icns gerbview_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE gerbview.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
set( MACOSX_BUNDLE_NAME gerbview )
endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
add_executable( gerbview WIN32 add_executable( gerbview WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp ../common/pgm_base.cpp
${GERBVIEW_RESOURCES} ${GERBVIEW_RESOURCES}
...@@ -135,13 +149,32 @@ if( USE_KIWAY_DLLS ) ...@@ -135,13 +149,32 @@ if( USE_KIWAY_DLLS )
# these 2 binaries are a matched set, keep them together # these 2 binaries are a matched set, keep them together
if( APPLE ) if( APPLE )
# puts binaries into the *.app bundle while linking
set_target_properties( gerbview PROPERTIES set_target_properties( gerbview PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
# puts binaries into the *.app bundle while linking
set_target_properties( gerbview_kiface PROPERTIES set_target_properties( gerbview_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
) )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS gerbview
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/gerbview.app/Contents/MacOS/gerbview
\"\"
\"\"
)
" COMPONENT Runtime
)
else() else()
install( TARGETS gerbview install( TARGETS gerbview
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
...@@ -155,7 +188,7 @@ if( USE_KIWAY_DLLS ) ...@@ -155,7 +188,7 @@ if( USE_KIWAY_DLLS )
else() else()
add_executable( gerbview WIN32 add_executable( gerbview WIN32 MACOSX_BUNDLE
gerbview.cpp gerbview.cpp
${GERBVIEW_SRCS} ${GERBVIEW_SRCS}
${DIALOGS_SRCS} ${DIALOGS_SRCS}
...@@ -170,16 +203,9 @@ else() ...@@ -170,16 +203,9 @@ else()
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
) )
if( APPLE ) install( TARGETS gerbview
# puts binaries into the *.app bundle while linking DESTINATION ${KICAD_BIN}
set_target_properties( gerbview PROPERTIES COMPONENT binary
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} )
)
else()
install( TARGETS gerbview
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif()
endif() endif()
...@@ -89,7 +89,7 @@ if( APPLE ) ...@@ -89,7 +89,7 @@ if( APPLE )
set( SCRIPTING_HELPER "0" ) set( SCRIPTING_HELPER "0" )
endif() endif()
# make bundle relocatable # make main bundle relocatable
install( CODE " install( CODE "
# find all libs and modules # find all libs and modules
file( GLOB BUNDLE_FIX_LIBS ${OSX_BUNDLE_INSTALL_KIFACE_DIR}/*.kiface ) file( GLOB BUNDLE_FIX_LIBS ${OSX_BUNDLE_INSTALL_KIFACE_DIR}/*.kiface )
...@@ -101,19 +101,7 @@ if( APPLE ) ...@@ -101,19 +101,7 @@ if( APPLE )
endif() endif()
# override default embedded path settings # override default embedded path settings
function( gp_item_default_embedded_path_override item default_embedded_path_var ) ${OSX_BUNDLE_OVERRIDE_PATHS}
# by default, embed things right next to the main bundle executable:
set( path \"@executable_path/../../Contents/MacOS\" )
set( overridden 0 )
# embed .dylibs right next to the main bundle executable:
if( item MATCHES \"\\\\.dylib$\" )
set( path \"@executable_path/../Frameworks\" )
set( overridden 1 )
endif()
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
endfunction(gp_item_default_embedded_path_override)
# do all the work # do all the work
include( BundleUtilities ) include( BundleUtilities )
...@@ -123,4 +111,32 @@ if( APPLE ) ...@@ -123,4 +111,32 @@ if( APPLE )
) )
" COMPONENT Runtime " COMPONENT Runtime
) )
# move all individual app bundles into main bundle
install( CODE "
# helper function to move a bundle into main bundle
function( move_to_main_bundle bundle_name )
message( STATUS \"Moving \${bundle_name} into main bundle...\" )
file( MAKE_DIRECTORY ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR} )
file( REMOVE_RECURSE ${KICAD_BIN}/\${bundle_name}/${OSX_BUNDLE_LIB_DIR} )
file( RENAME ${KICAD_BIN}/\${bundle_name} ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR}/\${bundle_name} )
execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink \"../../../Frameworks\" \"Frameworks\"
WORKING_DIRECTORY ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR}/\${bundle_name}/Contents
)
# create a top-level link pointing inside main bundle
execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink \"${OSX_BUNDLE_MAIN}/${OSX_BUNDLE_APP_DIR}/\${bundle_name}\" \"\${bundle_name}\"
WORKING_DIRECTORY ${KICAD_BIN}
)
endfunction( move_to_main_bundle )
# move all app bundles
move_to_main_bundle( bitmap2component.app )
move_to_main_bundle( eeschema.app )
move_to_main_bundle( cvpcb.app )
move_to_main_bundle( gerbview.app )
move_to_main_bundle( pcb_calculator.app )
move_to_main_bundle( pcbnew.app )
move_to_main_bundle( pl_editor.app )
" COMPONENT Runtime
)
endif() endif()
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <vector> #include <vector>
#include <build_version.h> #include <build_version.h>
#include <macros.h> #include <macros.h>
#include <common.h>
#include <wx/dir.h> #include <wx/dir.h>
#include <wx/filename.h> #include <wx/filename.h>
...@@ -74,6 +75,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName, ...@@ -74,6 +75,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName,
wxFileName templatePath; wxFileName templatePath;
wxString envStr; wxString envStr;
#ifndef __WXMAC__
wxGetEnv( wxT( "KICAD" ), &envStr ); wxGetEnv( wxT( "KICAD" ), &envStr );
// Add a new tab for system templates // Add a new tab for system templates
...@@ -101,6 +103,10 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName, ...@@ -101,6 +103,10 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName,
sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "template" ) + sep; sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "template" ) + sep;
} }
} }
#else
// Use what is provided in the bundle data dir
templatePath = GetOSXKicadDataDir() + sep + wxT( "template" );
#endif
ps->AddPage( _( "System Templates" ), templatePath ); ps->AddPage( _( "System Templates" ), templatePath );
......
...@@ -53,10 +53,25 @@ if( MINGW ) ...@@ -53,10 +53,25 @@ if( MINGW )
endif() endif()
if( APPLE )
# setup bundle
set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
set( MACOSX_BUNDLE_NAME pl_editor )
endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
# a very small program launcher for pl_editor_kiface # a very small program launcher for pl_editor_kiface
add_executable( pl_editor WIN32 add_executable( pl_editor WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp ../common/pgm_base.cpp
${PL_EDITOR_RESOURCES} ${PL_EDITOR_RESOURCES}
...@@ -110,13 +125,32 @@ if( USE_KIWAY_DLLS ) ...@@ -110,13 +125,32 @@ if( USE_KIWAY_DLLS )
# these 2 binaries are a matched set, keep them together: # these 2 binaries are a matched set, keep them together:
if( APPLE ) if( APPLE )
# puts binaries into the *.app bundle while linking
set_target_properties( pl_editor PROPERTIES set_target_properties( pl_editor PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
# puts binaries into the *.app bundle while linking
set_target_properties( pl_editor_kiface PROPERTIES set_target_properties( pl_editor_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
) )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS pl_editor
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/pl_editor.app/Contents/MacOS/pl_editor
\"\"
\"\"
)
" COMPONENT Runtime
)
else() else()
install( TARGETS pl_editor install( TARGETS pl_editor
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
...@@ -130,7 +164,7 @@ if( USE_KIWAY_DLLS ) ...@@ -130,7 +164,7 @@ if( USE_KIWAY_DLLS )
else() else()
add_executable( pl_editor WIN32 add_executable( pl_editor WIN32 MACOSX_BUNDLE
pl_editor.cpp pl_editor.cpp
${PL_EDITOR_SRCS} ${PL_EDITOR_SRCS}
${DIALOGS_SRCS} ${DIALOGS_SRCS}
...@@ -145,15 +179,9 @@ else() ...@@ -145,15 +179,9 @@ else()
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
) )
if( APPLE ) install( TARGETS pl_editor
# puts binaries into the *.app bundle while linking DESTINATION ${KICAD_BIN}
set_target_properties( pl_editor PROPERTIES COMPONENT binary
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} )
)
else()
install( TARGETS pl_editor
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif()
endif() endif()
...@@ -10,13 +10,11 @@ ...@@ -10,13 +10,11 @@
<array> <array>
<string>kicad_wks</string> <string>kicad_wks</string>
</array> </array>
<key>CFBundleTypeIconFile</key> <string>pl_editor_doc.icns</string>
<key>CFBundleTypeIconFile</key> <string>pl_editor.icns</string>
<key>CFBundleTypeName</key> <string>pl_editor document</string> <key>CFBundleTypeName</key> <string>pl_editor document</string>
<key>LSHandlerRank</key> <string>Owner</string> <key>LSHandlerRank</key> <string>Owner</string>
</dict> </dict>
</array> </array>
<key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>pl_editor</string> <key>CFBundleExecutable</key> <string>pl_editor</string>
<key>CFBundleGetInfoString</key> <string></string> <key>CFBundleGetInfoString</key> <string></string>
......
...@@ -54,11 +54,22 @@ make_lexer( ...@@ -54,11 +54,22 @@ make_lexer(
datafile_read_write.h datafile_read_write.h
) )
if( APPLE )
# setup bundle
set( PCB_CALCULATOR_RESOURCES pcb_calculator.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pcb_calculator.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.kicad )
set( MACOSX_BUNDLE_NAME pcb_calculator )
endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
#if( false ) #if( false )
add_executable( pcb_calculator WIN32 add_executable( pcb_calculator WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp ../common/pgm_base.cpp
${PCB_CALCULATOR_RESOURCES} ${PCB_CALCULATOR_RESOURCES}
...@@ -108,13 +119,32 @@ if( USE_KIWAY_DLLS ) ...@@ -108,13 +119,32 @@ if( USE_KIWAY_DLLS )
# these 2 binaries are a matched set, keep them together # these 2 binaries are a matched set, keep them together
if( APPLE ) if( APPLE )
# puts binaries into the *.app bundle while linking
set_target_properties( pcb_calculator PROPERTIES set_target_properties( pcb_calculator PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
# puts binaries into the *.app bundle while linking
set_target_properties( pcb_calculator_kiface PROPERTIES set_target_properties( pcb_calculator_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
) )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS pcb_calculator
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/pcb_calculator.app/Contents/MacOS/pcb_calculator
\"\"
\"\"
)
" COMPONENT Runtime
)
else() else()
install( TARGETS pcb_calculator install( TARGETS pcb_calculator
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
...@@ -128,7 +158,7 @@ if( USE_KIWAY_DLLS ) ...@@ -128,7 +158,7 @@ if( USE_KIWAY_DLLS )
else() else()
add_executable( pcb_calculator WIN32 add_executable( pcb_calculator WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
pcb_calculator.cpp pcb_calculator.cpp
${PCB_CALCULATOR_SRCS} ${PCB_CALCULATOR_SRCS}
...@@ -146,16 +176,9 @@ else() ...@@ -146,16 +176,9 @@ else()
polygon polygon
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )
if( APPLE ) install( TARGETS pcb_calculator
# puts binaries into the *.app bundle while linking DESTINATION ${KICAD_BIN}
set_target_properties( pcb_calculator PROPERTIES COMPONENT binary
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} )
)
else()
install( TARGETS pcb_calculator
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif()
endif() endif()
...@@ -217,7 +217,7 @@ static bool scriptingSetup() ...@@ -217,7 +217,7 @@ static bool scriptingSetup()
{ {
wxString path_frag; wxString path_frag;
#ifdef __MINGW32__ #if defined( __MINGW32__ )
// force python environment under Windows: // force python environment under Windows:
const wxString python_us( "python27_us" ); const wxString python_us( "python27_us" );
...@@ -261,28 +261,24 @@ static bool scriptingSetup() ...@@ -261,28 +261,24 @@ static bool scriptingSetup()
// [KICAD_PATH]/scripting/plugins // [KICAD_PATH]/scripting/plugins
// Add this default search path: // Add this default search path:
path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" ); path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" );
#elif defined __WXMAC__ #elif defined( __WXMAC__ )
// User plugin folder is ~/Library/Application Support/kicad/scripting/plugins // User plugin folder is ~/Library/Application Support/kicad/scripting/plugins
path_frag = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" ); path_frag = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" );
// Add default paths to PYTHONPATH // Add default paths to PYTHONPATH
wxString pypath; wxString pypath;
// User scripting folder (~/Library/Application Support/kicad/scripting/plugins) // User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
pypath = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" ); pypath = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" );
// Machine scripting folder (/Library/Application Support/kicad/scripting/plugins) // Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)
pypath += wxT( ":/Library/Application Support/kicad/scripting/plugins" ); pypath += wxT( ":" ) + GetOSXKicadMachineDataDir() + wxT( "/scripting/plugins" );
// Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins) // Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
pypath += wxT( ":" ) + wxStandardPaths::Get().GetDataDir() + wxT( "/scripting/plugins" ); pypath += wxT( ":" ) + GetOSXKicadDataDir() + wxT( "/scripting/plugins" );
// Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python) // Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python/site-packages)
wxFileName fn = wxFileName( wxStandardPaths::Get().GetExecutablePath() ); pypath += wxT( ":" ) + Pgm().GetExecutablePath() + wxT( "Contents/Frameworks/python/site-packages" );
fn.RemoveLastDir(); // Original content of $PYTHONPATH
fn.AppendDir( wxT( "Frameworks" ) );
fn.AppendDir( wxT( "python" ) );
pypath += wxT( ":" ) + fn.GetPath();
// Original content of PYTHONPATH
if( wxGetenv("PYTHONPATH") != NULL ) if( wxGetenv("PYTHONPATH") != NULL )
{ {
pypath += wxT( ":" ) + wxString( wxGetenv("PYTHONPATH") ); pypath = wxString( wxGetenv("PYTHONPATH") ) + wxT( ":" ) + pypath;
} }
// set $PYTHONPATH // set $PYTHONPATH
...@@ -292,9 +288,6 @@ static bool scriptingSetup() ...@@ -292,9 +288,6 @@ static bool scriptingSetup()
path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" ); path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" );
#endif #endif
// On linux and osx, 2 others paths are
// [HOME]/.kicad_plugins/
// [HOME]/.kicad/scripting/plugins/
if( !pcbnewInitPythonScripting( TO_UTF8( path_frag ) ) ) if( !pcbnewInitPythonScripting( TO_UTF8( path_frag ) ) )
{ {
wxLogSysError( wxT( "pcbnewInitPythonScripting() failed." ) ); wxLogSysError( wxT( "pcbnewInitPythonScripting() failed." ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment