More migration towards single process, extend PROJECT::Config*() in proper direction, cleanups.

This commit is contained in:
Dick Hollenbeck 2014-04-07 23:55:53 -05:00
parent 94bc435599
commit d053e5615b
18 changed files with 114 additions and 128 deletions

View File

@ -364,13 +364,13 @@ check_find_package_result( OPENGL_FOUND "OpenGL" )
# https://www.mail-archive.com/cmake@cmake.org/msg47501.html # https://www.mail-archive.com/cmake@cmake.org/msg47501.html
# Handle target used to specify if a target needs wx-widgets or other libraries # Handle target used to specify if a target needs wx-widgets or other libraries
# Always defined, empty if no libraries are to be build # Always defined, empty if no libraries are to be built
add_custom_target( lib-dependencies ) add_custom_target( lib-dependencies )
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
# This should be build in all cases, if swig exec is not avaiable # This should be built in all cases, if swig exec is not avaiable
# will be impossible also enable SCRIPTING being for PCBNEW required immediatly # will be impossible also enable SCRIPTING being for PCBNEW required immediately
include( download_pcre ) include( download_pcre )
include( download_swig ) include( download_swig )

View File

@ -622,8 +622,6 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
// wxGetenv( wchar_t* ) is not re-entrant on linux. // wxGetenv( wchar_t* ) is not re-entrant on linux.
// Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(), // Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(),
// needed by bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL ); // needed by bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL );
#if 1
#include <ki_mutex.h> #include <ki_mutex.h>
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString ) const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
@ -637,16 +635,6 @@ const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
return wxExpandEnvVars( aString ); return wxExpandEnvVars( aString );
} }
#else
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
{
// We reserve the right to do this another way, by providing our own member
// function.
return wxExpandEnvVars( aString );
}
#endif
bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback ) bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback )
{ {
@ -691,7 +679,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( SEARCH_STACK& aSStack, NETLIST& aNetList,
{ {
wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension ); wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
libPath = aSStack.FindValidPath( fn ); libPath = aSStack.FindValidPath( fn.GetFullPath() );
if( !libPath ) if( !libPath )
{ {

View File

@ -205,14 +205,17 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
// is there an edge transition, a change in m_project_filename? // is there an edge transition, a change in m_project_filename?
if( m_project_name != fn ) if( m_project_name != fn )
{ {
m_pcb_search.Clear();
m_sch_search.Clear(); m_sch_search.Clear();
SetProjectFullName( fn.GetFullPath() ); SetProjectFullName( fn.GetFullPath() );
// to the empty list, add project dir as first // to the empty lists, add project dir as first
m_pcb_search.AddPaths( fn.GetPath() );
m_sch_search.AddPaths( fn.GetPath() ); m_sch_search.AddPaths( fn.GetPath() );
// append all paths from aSList // append all paths from aSList
add_search_paths( &m_pcb_search, aSList, -1 );
add_search_paths( &m_sch_search, aSList, -1 ); add_search_paths( &m_sch_search, aSList, -1 );
// addLibrarySearchPaths( SEARCH_STACK* aSP, wxConfigBase* aCfg ) // addLibrarySearchPaths( SEARCH_STACK* aSP, wxConfigBase* aCfg )

View File

@ -182,10 +182,6 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
return fn.GetFullPath(); return fn.GetFullPath();
} }
// Use of this is arbitrary, remember single_top only knows about a single DSO.
// Could have used one from the KIWAY also.
static wxDynamicLibrary dso;
// Only a single KIWAY is supported in this single_top top level component, // Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO. // which is dedicated to loading only a single DSO.
@ -261,6 +257,15 @@ IMPLEMENT_APP( APP_SINGLE_TOP );
static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName ) static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
{ {
#if defined(BUILD_KIWAY_DLL) #if defined(BUILD_KIWAY_DLL)
// Remember single_top only knows about a single DSO. Using an automatic
// with a defeated destructor, see Detach() below, so that the DSO program
// image stays in RAM until process termination, and specifically
// beyond the point in time at which static destructors are run. Otherwise
// a static wxDynamicLibrary's destructor might create an out of sequence
// problem. This was never detected, so it's only a preventative strategy.
wxDynamicLibrary dso;
void* addr = NULL; void* addr = NULL;
if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) ) if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) )
@ -275,6 +280,9 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
// No further reporting required here. // No further reporting required here.
} }
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
(void) dso.Detach();
return (KIFACE_GETTER_FUNC*) addr; return (KIFACE_GETTER_FUNC*) addr;
#else #else

View File

@ -107,7 +107,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
{ {
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension ); fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
} }
tmp = search.FindValidPath( fn ); tmp = search.FindValidPath( fn.GetFullPath() );
if( !tmp ) if( !tmp )
{ {

View File

@ -27,7 +27,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <kiface_i.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <id.h> #include <id.h>
#include <common.h> #include <common.h>
@ -42,29 +42,24 @@
#include <class_DisplayFootprintsFrame.h> #include <class_DisplayFootprintsFrame.h>
#define GROUP wxT("/cvpcb")
#define GROUPLIB wxT("/pcbnew/libraries")
#define GROUPEQU wxT("/cvpcb/libraries")
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters() PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
{ {
if( !m_projectFileParams.empty() ) if( !m_projectFileParams.empty() )
return m_projectFileParams; return m_projectFileParams;
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB, PARAM_COMMAND_ERASE ) ); m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
wxT( "LibName" ), &m_ModuleLibNames, GROUPLIB ) ); wxT( "LibName" ), &m_ModuleLibNames, GROUP_PCB_LIBS ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
wxT( "EquName" ), &m_AliasLibNames, GROUPEQU ) ); wxT( "EquName" ), &m_AliasLibNames, GROUP_CVP_EQU ) );
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
wxT( "NetIExt" ), &m_NetlistFileExtension ) ); wxT( "NetIExt" ), &m_NetlistFileExtension ) );
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( m_projectFileParams.push_back( new PARAM_CFG_FILENAME(
wxT( "LibDir" ), &m_UserLibraryPath, GROUPLIB ) ); wxT( "LibDir" ), &m_UserLibraryPath, GROUP_PCB_LIBS ) );
return m_projectFileParams; return m_projectFileParams;
} }
@ -81,7 +76,7 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
// was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
prj.ConfigLoad( prj.PcbSearchS(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_CVP, GetProjectFileParameters(), false );
if( m_NetlistFileExtension.IsEmpty() ) if( m_NetlistFileExtension.IsEmpty() )
m_NetlistFileExtension = wxT( "net" ); m_NetlistFileExtension = wxT( "net" );
@ -133,7 +128,7 @@ void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
// Pgm().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); // Pgm().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
PROJECT& prj = Prj(); PROJECT& prj = Prj();
SEARCH_STACK& search = prj.SchSearchS();
prj.ConfigSave( search, fn.GetFullPath(), GROUP, GetProjectFileParameters() ); prj.ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_CVP, GetProjectFileParameters() );
} }

View File

@ -138,27 +138,36 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack, static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack,
const wxArrayString& aLibNames, wxString* aErrorMsg ) const wxArrayString& aLibNames, wxString* aErrorMsg )
{ {
bool retv = false; bool missing = false;
for( unsigned i = 0; i < aLibNames.GetCount(); i++ ) for( unsigned i = 0; i < aLibNames.GetCount(); i++ )
{ {
wxFileName fn( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension ); wxFileName fn( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension );
wxString legacyLibPath = aSStack.FindValidPath( fn ); wxString legacyLibPath = aSStack.FindValidPath( fn.GetFullPath() );
/*
if( legacyLibPath.IsEmpty() ) if( legacyLibPath.IsEmpty() )
continue; continue;
*/
if( aTbl->FindRowByURI( legacyLibPath ) == 0 ) if( !aTbl->FindRowByURI( legacyLibPath ) )
{ {
retv = true; missing = true;
if( aErrorMsg ) if( aErrorMsg )
*aErrorMsg += wxT( "\"" ) + legacyLibPath + wxT( "\"\n" ); {
*aErrorMsg += wxChar( '"' );
if( !legacyLibPath )
*aErrorMsg += !legacyLibPath ? aLibNames[i] : legacyLibPath;
*aErrorMsg += wxT( "\"\n" );
}
} }
} }
return retv; return missing;
} }
@ -210,7 +219,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
if( missingLegacyLibs( FootprintLibs(), Prj().PcbSearchS(), m_ModuleLibNames, &missingLibs ) ) if( missingLegacyLibs( FootprintLibs(), Prj().PcbSearchS(), m_ModuleLibNames, &missingLibs ) )
{ {
msg = wxT( "The following legacy libraries are defined in the project file " msg = wxT( "The following legacy libraries are defined in the project file "
"were not found in the footprint library table:\n\n" ) + missingLibs; "but were not found in the footprint library table:\n\n" ) + missingLibs;
msg += wxT( "\nDo you want to update the footprint library table before " msg += wxT( "\nDo you want to update the footprint library table before "
"attempting to update the assigned footprints?" ); "attempting to update the assigned footprints?" );
@ -237,7 +246,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{ {
HTML_MESSAGE_BOX dlg( this, wxEmptyString ); HTML_MESSAGE_BOX dlg( this, wxEmptyString );
dlg.MessageSet( wxT( "The following errors occurred attempt to convert the " dlg.MessageSet( wxT( "The following errors occurred attempting to convert the "
"footprint assignments:\n\n" ) ); "footprint assignments:\n\n" ) );
dlg.ListSet( msg ); dlg.ListSet( msg );
dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them " dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them "

View File

@ -62,7 +62,7 @@ void SCH_EDIT_FRAME::LoadLibraries()
if( !fn.FileExists() ) if( !fn.FileExists() )
{ {
tmp = lib_search.FindValidPath( fn ); tmp = lib_search.FindValidPath( fn.GetFullPath() );
if( !tmp ) if( !tmp )
{ {

View File

@ -370,7 +370,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList()
&m_userLibraryPath ) ); &m_userLibraryPath ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&m_componentLibFiles, &m_componentLibFiles,
GROUPLIB ) ); GROUP_SCH_LIBS ) );
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
&m_netListFormat) ); &m_netListFormat) );
@ -410,7 +410,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
// extension (.pro). // extension (.pro).
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
if( !prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, if( !prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_SCH,
GetProjectFileParametersList(), !aForceReread ) ) GetProjectFileParametersList(), !aForceReread ) )
{ {
m_componentLibFiles = liblist_tmp; m_componentLibFiles = liblist_tmp;
@ -429,7 +429,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName); pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName);
// libraries in the *.pro file take precedence over standard library search paths, // libraries in the *.pro file take precedence over standard library search paths,
// but not over the director of the project, which is at index 0. // but not over the directory of the project, which is at index 0.
prj.SchSearchS().AddPaths( m_userLibraryPath, 1 ); prj.SchSearchS().AddPaths( m_userLibraryPath, 1 );
// If the list is empty, force loading the standard power symbol library. // If the list is empty, force loading the standard power symbol library.
@ -466,7 +466,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
} }
prj.ConfigSave( Kiface().KifaceSearch(), prj.ConfigSave( Kiface().KifaceSearch(),
fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); fn.GetFullPath(), GROUP_SCH, GetProjectFileParametersList() );
} }

View File

@ -4,9 +4,6 @@
#include <config_params.h> #include <config_params.h>
#define GROUP wxT( "/eeschema" )
#define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" )
/* saving parameters option : */ /* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config #define INSETUP true /* used when the parameter is saved in general config

View File

@ -868,7 +868,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
// was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
Prj().ConfigSave( Kiface().KifaceSearch(), Prj().ConfigSave( Kiface().KifaceSearch(),
fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); fn.GetFullPath(), GROUP_SCH, GetProjectFileParametersList() );
} }
} }

View File

@ -37,6 +37,17 @@
#include <limits> #include <limits>
#define GROUP_PCB wxT( "/pcbnew" )
#define GROUP_SCH wxT( "/eeschema" )
#define GROUP_PCB_LIBS wxT( "/pcbnew/libraries" )
#define GROUP_SCH_LIBS wxT( "/eeschema/libraries" )
#define GROUP_COMMON wxT( "/common" )
#define GROUP_CVP wxT("/cvpcb")
//#define GROUP_CVP_LIBS wxT("/pcbnew/libraries")
#define GROUP_CVP_EQU wxT("/cvpcb/libraries")
#define CONFIG_VERSION 1 #define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true #define FORCE_LOCAL_CONFIG true

View File

@ -39,21 +39,6 @@ public:
return wxPathList::FindValidPath( aFileName ); return wxPathList::FindValidPath( aFileName );
} }
/**
* Function FindValidPath
* KiCad saves user defined library files that are not in the standard
* library search path list with the full file path. Calling the library
* search path list with a user library file will fail. This helper method
* solves that problem.
* @param fileName
* @return a wxEmptyString if library file is not found.
*/
wxString FindValidPath( const wxFileName& aFileName ) const
{
// call wxPathList::FindValidPath( const wxString& );
return wxPathList::FindValidPath( aFileName.GetFullPath() );
}
/** /**
* Function AddPaths * Function AddPaths
* insert or append path(s) * insert or append path(s)

View File

@ -341,13 +341,10 @@ if( KICAD_SCRIPTING )
COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
endif() endif()
###
# _pcbnew DLL/DSO file creation
###
if( BUILD_GITHUB_PLUGIN ) if( BUILD_GITHUB_PLUGIN )
set( GITHUB_PLUGIN_LIBRARIES github_plugin ) set( GITHUB_PLUGIN_LIBRARIES github_plugin )
@ -396,7 +393,8 @@ if( KICAD_SCRIPTING_MODULES )
if( MAKE_LINK_MAPS ) if( MAKE_LINK_MAPS )
set_target_properties( _pcbnew PROPERTIES set_target_properties( _pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.so.map" ) LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.so.map"
)
endif() endif()
endif() endif()
@ -417,14 +415,13 @@ if( DOXYGEN_FOUND )
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS Doxyfile_xml DEPENDS Doxyfile_xml
COMMENT "building doxygen docs into directory doxygen-python/html" COMMENT "building doxygen docs into directory doxygen-python/html"
) )
# create .i files from XML doxygen parsing, docstrings.i will include all of them # create .i files from XML doxygen parsing, docstrings.i will include all of them
add_custom_target( xml-to-docstrings add_custom_target( xml-to-docstrings
COMMAND ${CMAKE_COMMAND} -E remove_directory docstrings COMMAND ${CMAKE_COMMAND} -E remove_directory docstrings
COMMAND ${CMAKE_COMMAND} -E make_directory docstrings COMMAND ${CMAKE_COMMAND} -E make_directory docstrings
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/extract_docstrings.py pcbnew.py doxygen-xml/xml docstrings COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/extract_docstrings.py pcbnew.py doxygen-xml/xml docstrings
COMMAND ${CMAKE_COMMAND} -E remove pcbnew.py # force removal so it will be recreated later with the new docstrings COMMAND ${CMAKE_COMMAND} -E remove pcbnew.py # force removal so it will be recreated later with the new docstrings
COMMENT "building docstring files" COMMENT "building docstring files"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@ -440,16 +437,14 @@ if( DOXYGEN_FOUND )
DEPENDS Doxyfile_python DEPENDS Doxyfile_python
DEPENDS xml-to-docstrings DEPENDS xml-to-docstrings
DEPENDS pcbnew.py DEPENDS pcbnew.py
COMMENT "building doxygen docs into directory doxygen-python/html" COMMENT "building doxygen docs into directory doxygen-python/html"
) )
endif() endif()
else() else()
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" ) message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
endif() endif()
if( MINGW ) if( MINGW )
# PCBNEW_RESOURCES variable is set by the macro. # PCBNEW_RESOURCES variable is set by the macro.
mingw_resource_compiler( pcbnew ) mingw_resource_compiler( pcbnew )
@ -480,9 +475,8 @@ add_custom_command(
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html" from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html"
) )
set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp PROPERTIES
PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
) )
@ -506,14 +500,14 @@ endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
#if( false )
# a very small program launcher for pcbnew_kiface # a very small program launcher for pcbnew_kiface
add_executable( pcbnew WIN32 MACOSX_BUNDLE add_executable( pcbnew WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp
${PCBNEW_RESOURCES} ${PCBNEW_RESOURCES}
) )
set_source_files_properties( ../common/single_top.cpp PROPERTIES set_source_files_properties( ../common/single_top.cpp pcbnew.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL" COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL"
) )
target_link_libraries( pcbnew target_link_libraries( pcbnew
@ -534,9 +528,7 @@ if( USE_KIWAY_DLLS )
${PCBNEW_SRCS} ${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS} ${PCBNEW_COMMON_SRCS}
${PCBNEW_SCRIPTING_SRCS} ${PCBNEW_SCRIPTING_SRCS}
# ${PCBNEW_RESOURCES}
) )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
# _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface
@ -547,7 +539,7 @@ if( USE_KIWAY_DLLS )
if( ${OPENMP_FOUND} ) if( ${OPENMP_FOUND} )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
COMPILE_FLAGS ${OpenMP_CXX_FLAGS} COMPILE_FLAGS ${OpenMP_CXX_FLAGS}
) )
endif() endif()
target_link_libraries( pcbnew_kiface target_link_libraries( pcbnew_kiface
@ -578,7 +570,11 @@ if( USE_KIWAY_DLLS )
) )
if( MAKE_LINK_MAPS ) if( MAKE_LINK_MAPS )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_pcbnew.kiface.map" ) LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_pcbnew.kiface.map"
)
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map"
)
endif() endif()
# if building pcbnew, then also build pcbnew_kiface if out of date. # if building pcbnew, then also build pcbnew_kiface if out of date.
@ -600,18 +596,22 @@ if( USE_KIWAY_DLLS )
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.kiface "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.app/Contents/MacOS/" COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.kiface "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.app/Contents/MacOS/"
DEPENDS pcbnew_kiface DEPENDS pcbnew_kiface
COMMENT "Copying kiface into pcbnew" COMMENT "Copying kiface into pcbnew"
) )
endif() endif()
else() # milestone A) kills this off: else() # milestone A) kills this off:
add_executable( pcbnew WIN32 MACOSX_BUNDLE add_executable( pcbnew WIN32 MACOSX_BUNDLE
../common/single_top.cpp
pcbnew.cpp pcbnew.cpp
${PCBNEW_SRCS} ${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS} ${PCBNEW_COMMON_SRCS}
${PCBNEW_SCRIPTING_SRCS} ${PCBNEW_SCRIPTING_SRCS}
${PCBNEW_RESOURCES} ${PCBNEW_RESOURCES}
) )
set_source_files_properties( ../common/single_top.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\""
)
target_link_libraries( pcbnew target_link_libraries( pcbnew
3d-viewer 3d-viewer
pcbcommon pcbcommon
@ -646,28 +646,25 @@ else() # milestone A) kills this off:
) )
endif() endif()
if( MAKE_LINK_MAPS )
# generate a link map with cross reference
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map"
)
endif()
install( TARGETS pcbnew install( TARGETS pcbnew
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
endif() endif()
add_dependencies( pcbnew lib-dependencies ) add_dependencies( pcbnew lib-dependencies )
###
# Set properties for APPLE on pcbnew target
###
if( APPLE ) if( APPLE )
set_target_properties( pcbnew PROPERTIES set_target_properties( pcbnew PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
endif() )
if( MAKE_LINK_MAPS )
# generate a link map with cross reference
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map" )
endif() endif()
@ -686,19 +683,19 @@ if( KICAD_SCRIPTING )
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py "${PYTHON_DEST}/wx-3.0-osx_cocoa/" COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py "${PYTHON_DEST}/wx-3.0-osx_cocoa/"
DEPENDS FixSwigImportsScripting DEPENDS FixSwigImportsScripting
COMMENT "Copying pcbnew.py into PYTHON_DEST/wx-3.0-osx_cocoa/" COMMENT "Copying pcbnew.py into PYTHON_DEST/wx-3.0-osx_cocoa/"
) )
add_custom_target( pcbnew_copy_wxpython_scripting ALL add_custom_target( pcbnew_copy_wxpython_scripting ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/
DEPENDS FixSwigImportsScripting _pcbnew_py_copy DEPENDS FixSwigImportsScripting _pcbnew_py_copy
COMMENT "Copying wxPython into pcbnew.app Framework" COMMENT "Copying wxPython into pcbnew.app Framework"
) )
add_custom_target( pcbnew_copy_plugins ALL add_custom_target( pcbnew_copy_plugins ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/PlugIns/scripting/plugins COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/PlugIns/scripting/plugins
DEPENDS pcbnew_copy_wxpython_scripting DEPENDS pcbnew_copy_wxpython_scripting
COMMENT "Copying plugins into bundle" COMMENT "Copying plugins into bundle"
) )
# fix bundle after copying wxpython, fixing and copying # fix bundle after copying wxpython, fixing and copying
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting ) add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting )
@ -733,13 +730,13 @@ if( KICAD_SCRIPTING_MODULES )
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so "${PYTHON_DEST}" COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so "${PYTHON_DEST}"
DEPENDS _pcbnew FixSwigImportsModuleScripting DEPENDS _pcbnew FixSwigImportsModuleScripting
COMMENT "Copying _pcbnew.so into PYTHON_DEST" COMMENT "Copying _pcbnew.so into PYTHON_DEST"
) )
add_custom_target( pcbnew_copy_wxpython_module ALL add_custom_target( pcbnew_copy_wxpython_module ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/
DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy
COMMENT "Copying wxPython into pcbnew.app Frameworks" COMMENT "Copying wxPython into pcbnew.app Frameworks"
) )
if( KICAD_BUILD_DYNAMIC ) if( KICAD_BUILD_DYNAMIC )
# Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython # Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython
@ -750,14 +747,15 @@ if( KICAD_SCRIPTING_MODULES )
endif() endif()
# This one gets made only when testing. if( false ) # haven't been used in years.
add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp ) # This one gets made only when testing.
target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} ) add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp )
target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} )
# This one gets made only when testing. # This one gets made only when testing.
add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp layer_widget.cpp
) )
target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )
endif()

View File

@ -91,7 +91,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
// was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(),
GROUP, GetProjectFileParameters() ); GROUP_PCB, GetProjectFileParameters() );
} }
} }

View File

@ -208,13 +208,13 @@ MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BA
return &kiface; return &kiface;
} }
#if defined(BUILD_KIWAY_DLL)
PGM_BASE& Pgm() PGM_BASE& Pgm()
{ {
wxASSERT( process ); // KIFACE_GETTER has already been called. wxASSERT( process ); // KIFACE_GETTER has already been called.
return *process; return *process;
} }
#endif
/** /**
* Function set3DShapesPath * Function set3DShapesPath
@ -484,6 +484,5 @@ void IFACE::OnKifaceEnd()
// This should only be called if python was setup correctly. // This should only be called if python was setup correctly.
pcbnewFinishPythonScripting(); pcbnewFinishPythonScripting();
#endif #endif
} }

View File

@ -29,7 +29,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <project.h> #include <project.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
@ -239,7 +238,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
// was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters(), false );
// Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
// what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings // what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings
@ -302,9 +301,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
fn = dlg.GetPath(); fn = dlg.GetPath();
} }
SEARCH_STACK& search = Kiface().KifaceSearch(); Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters() );
Prj().ConfigSave( search, fn.GetFullPath(), GROUP, GetProjectFileParameters() );
} }
@ -315,7 +312,7 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
&BASE_SCREEN::m_PageLayoutDescrFileName ) ); &BASE_SCREEN::m_PageLayoutDescrFileName ) );
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), &g_UserLibDirBuffer, GROUPLIB ) ); pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), &g_UserLibDirBuffer, GROUP_PCB_LIBS ) );
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) );

View File

@ -1,6 +1,6 @@
/** /**
* @file pcbnew_config.h * @file pcbnew_config.h
* @brief Cconfiguration parameters for Pcbnew. * @brief Configuration parameters for Pcbnew.
*/ */
#ifndef _PCBNEW_CONFIG_H_ #ifndef _PCBNEW_CONFIG_H_
@ -9,10 +9,6 @@
#include <config_params.h> #include <config_params.h>
#include <colors_selection.h> #include <colors_selection.h>
#define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" )
#define GROUPCOMMON wxT( "/common" )
/* Useful macro : */ /* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer] #define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible] #define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]