Reorder includes is some simulator files to fix issues on msys2 (no code change)

Due to pegtl.hpp included in some files, reordering include fix some conflicts:
wxWidgets files must be included before pegtl.hpp, to compile with wxWidgets 3.0
I sometimes use wxWidgets 3.0 for debugging purposes.
This commit is contained in:
jean-pierre charras 2022-11-12 18:41:29 +01:00
parent 0d42003247
commit 78e45fa1b9
11 changed files with 56 additions and 31 deletions

View File

@ -27,12 +27,14 @@
#ifndef NGSPICE_H #ifndef NGSPICE_H
#define NGSPICE_H #define NGSPICE_H
#include <sim/spice_simulator.h> #include <wx/dynlib.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include "sim/spice_simulator.h"
#include <sim/sim_model.h> #include <sim/sim_model.h>
#include <sim/sim_value.h> #include <sim/sim_value.h>
#include <wx/dynlib.h>
#include <ngspice/sharedspice.h> #include <ngspice/sharedspice.h>
#include <enum_vector.h> #include <enum_vector.h>

View File

@ -22,13 +22,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <sim/sim_lib_mgr.h>
#include <sch_symbol.h> #include <sch_symbol.h>
#include <sim/sim_library.h>
#include <sim/sim_model.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <string> #include <string>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include <sim/sim_library.h>
#include <sim/sim_model.h>
#include <sim/sim_lib_mgr.h>
SIM_LIB_MGR::SIM_LIB_MGR( const PROJECT& aPrj ) : m_project( aPrj ) SIM_LIB_MGR::SIM_LIB_MGR( const PROJECT& aPrj ) : m_project( aPrj )
{ {

View File

@ -22,6 +22,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <lib_symbol.h>
#include <confirm.h>
#include <sim/sim_model.h> #include <sim/sim_model.h>
#include <sim/sim_model_behavioral.h> #include <sim/sim_model_behavioral.h>
#include <sim/sim_model_ideal.h> #include <sim/sim_model_ideal.h>
@ -38,9 +41,6 @@
#include <sim/sim_library_kibis.h> #include <sim/sim_library_kibis.h>
#include <lib_symbol.h>
#include <confirm.h>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>

View File

@ -21,14 +21,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <sim/kibis/kibis.h>
#include <sim/sim_model_kibis.h>
#include <sim/sim_library_kibis.h>
#include <paths.h> #include <paths.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <kiway.h> #include <kiway.h>
#include <sim/kibis/kibis.h>
#include <sim/sim_model_kibis.h>
#include <sim/sim_library_kibis.h>
std::string SPICE_GENERATOR_KIBIS::ModelName( const SPICE_ITEM& aItem ) const std::string SPICE_GENERATOR_KIBIS::ModelName( const SPICE_ITEM& aItem ) const
{ {
return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName ); return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName );

View File

@ -21,12 +21,14 @@
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <confirm.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include <sim/sim_model_spice.h> #include <sim/sim_model_spice.h>
#include <sim/sim_model_raw_spice.h> #include <sim/sim_model_raw_spice.h>
#include <sim/spice_model_parser.h> #include <sim/spice_model_parser.h>
#include <sim/sim_library_spice.h> #include <sim/sim_library_spice.h>
#include <confirm.h>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>

View File

@ -26,6 +26,9 @@
#include <wx/debug.h> #include <wx/debug.h>
#include <wx/stc/stc.h> #include <wx/stc/stc.h>
// For some obscure reason, needed on msys2 with some wxWidgets versions (3.0) to avoid
// undefined symbol at link stage (due to use of #include <pegtl.hpp>)
#include <wx/menu.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
@ -40,12 +43,6 @@
#include "string_utils.h" #include "string_utils.h"
#include "ngspice_helpers.h" #include "ngspice_helpers.h"
#include <pgm_base.h> #include <pgm_base.h>
#include "ngspice.h"
#include "sim_plot_colors.h"
#include "sim_plot_frame.h"
#include "sim_plot_panel.h"
#include "spice_simulator.h"
#include "spice_reporter.h"
#include <menus_helpers.h> #include <menus_helpers.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
@ -55,6 +52,14 @@
#include <dialog_shim.h> #include <dialog_shim.h>
#include <wx_filename.h> #include <wx_filename.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include "ngspice.h"
#include "sim_plot_colors.h"
#include "sim_plot_frame.h"
#include "sim_plot_panel.h"
#include "spice_simulator.h"
#include "spice_reporter.h"
SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond ) SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond )
{ {

View File

@ -21,15 +21,17 @@
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <sim/sim_property.h>
#include <sim/sim_value.h>
#include <ki_exception.h> #include <ki_exception.h>
#include <confirm.h> #include <confirm.h>
#include <wx/combo.h> #include <wx/combo.h>
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/notebook.h> #include <wx/notebook.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include <sim/sim_property.h>
#include <sim/sim_value.h>
wxBEGIN_EVENT_TABLE( SIM_VALIDATOR, wxValidator ) wxBEGIN_EVENT_TABLE( SIM_VALIDATOR, wxValidator )
EVT_KEY_DOWN( SIM_VALIDATOR::onKeyDown ) EVT_KEY_DOWN( SIM_VALIDATOR::onKeyDown )

View File

@ -25,13 +25,15 @@
#ifndef SIM_PROPERTY_H #ifndef SIM_PROPERTY_H
#define SIM_PROPERTY_H #define SIM_PROPERTY_H
#include <sim/sim_model.h>
#include <wx/window.h> #include <wx/window.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/propgrid/propgrid.h> #include <wx/propgrid/propgrid.h>
#include <wx/propgrid/manager.h> #include <wx/propgrid/manager.h>
#include <wx/propgrid/props.h> #include <wx/propgrid/props.h>
// Include this header after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include <sim/sim_model.h>
class SIM_VALIDATOR : public wxValidator class SIM_VALIDATOR : public wxValidator
{ {

View File

@ -29,8 +29,10 @@
#include <optional> #include <optional>
#include <complex> #include <complex>
#include <memory> #include <memory>
#include <pegtl.hpp>
// Include this header after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include <pegtl.hpp>
namespace SIM_VALUE_GRAMMAR namespace SIM_VALUE_GRAMMAR
{ {

View File

@ -23,10 +23,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "ngspice.h"
#include <confirm.h> #include <confirm.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include "ngspice.h"
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR::CreateInstance( const std::string& ) std::shared_ptr<SPICE_SIMULATOR> SIMULATOR::CreateInstance( const std::string& )
{ {
try try

View File

@ -22,11 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "spice_value.h"
#include <stdexcept> #include <stdexcept>
#include <cmath> #include <cmath>
#include <wx/event.h>
#include <wx/textentry.h> #include <wx/textentry.h>
#include <wx/numformatter.h> #include <wx/numformatter.h>
#include <confirm.h> #include <confirm.h>
@ -34,6 +33,11 @@
#include <ki_exception.h> #include <ki_exception.h>
#include <locale_io.h> #include <locale_io.h>
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
// (especially on msys2)
#include "spice_value.h"
SPICE_VALUE::SPICE_VALUE( const wxString& aString ) SPICE_VALUE::SPICE_VALUE( const wxString& aString )
{ {
char buf[8] = { 0, }; char buf[8] = { 0, };