diff --git a/src/buddies/unit_tests/bdBasicTests.cc b/src/buddies/unit_tests/bdBasicTests.cc index 8c1b64cdc..d48438f30 100644 --- a/src/buddies/unit_tests/bdBasicTests.cc +++ b/src/buddies/unit_tests/bdBasicTests.cc @@ -35,7 +35,8 @@ TEST(1) opt.add_options (cmd); - char *argv[] = { "x", + const char *argv[] = { + "x", "-os=1.25", "-od=0.125", "--drop-empty-cells", @@ -64,7 +65,7 @@ TEST(1) "--write-std-properties=2" }; - cmd.parse (sizeof (argv) / sizeof (argv[0]), argv); + cmd.parse (sizeof (argv) / sizeof (argv[0]), const_cast (argv)); db::Layout layout; diff --git a/src/db/db/dbConverters.h b/src/db/db/dbConverters.h index 63e374759..e8b846095 100644 --- a/src/db/db/dbConverters.h +++ b/src/db/db/dbConverters.h @@ -38,7 +38,7 @@ namespace db * T is supposed a transformation type such as "db::DCplxTrans". */ template -struct DB_PUBLIC TransformationConverter +struct DB_PUBLIC_TEMPLATE TransformationConverter { std::string to_string (const T &t) const { @@ -77,7 +77,7 @@ struct DB_PUBLIC LayoutLayerConverter * P is supposed to be a point type (i.e. db::DPoint). */ template -struct DB_PUBLIC PointConverter +struct DB_PUBLIC_TEMPLATE PointConverter { std::string to_string (const P &p) const { diff --git a/src/db/db/dbHash.h b/src/db/db/dbHash.h index fb900ca78..c7ffff096 100644 --- a/src/db/db/dbHash.h +++ b/src/db/db/dbHash.h @@ -20,22 +20,11 @@ */ - #ifndef HDR_dbHash #define HDR_dbHash -#if defined(__GNUC__) -# include -# include -namespace std_ext = __gnu_cxx; -# define DB_HASH_NAMESPACE __gnu_cxx -#else -# define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -# include -# include -namespace std_ext = std; -# define DB_HASH_NAMESPACE std -#endif +#include +#include #include "dbPoint.h" #include "dbVector.h" @@ -59,9 +48,9 @@ namespace std_ext = std; * It also provides namespace abstraction for the std_ext namespace */ -namespace DB_HASH_NAMESPACE +namespace std { -#if defined(_WIN64) +#if defined(_WIN64) && !defined(_MSC_VER) /** * @brief Specialization missing for size_t on WIN64 */ @@ -75,7 +64,7 @@ namespace DB_HASH_NAMESPACE }; #endif -#if defined(_WIN64) || defined(__APPLE__) +#if (defined(_WIN64) && !defined(_MSC_VER)) || defined(__APPLE__) /** * @brief Specialization missing for long long on WIN64 */ @@ -381,4 +370,3 @@ namespace DB_HASH_NAMESPACE } #endif - diff --git a/src/db/db/dbHershey.h b/src/db/db/dbHershey.h index 34ce67c6f..88e8e1bfd 100644 --- a/src/db/db/dbHershey.h +++ b/src/db/db/dbHershey.h @@ -63,7 +63,7 @@ private: }; template -class DB_PUBLIC hershey_edge_iterator +class DB_PUBLIC_TEMPLATE hershey_edge_iterator : private basic_hershey_edge_iterator { public: @@ -124,7 +124,7 @@ private: */ template -struct DB_PUBLIC hershey +struct DB_PUBLIC_TEMPLATE hershey { typedef C coord_type; typedef db::coord_traits coord_traits; diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index c9797f858..b41c243ac 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -267,6 +267,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const init_region (box_type::world ()); } +RecursiveShapeIterator::~RecursiveShapeIterator () +{ + // .. nothing yet .. +} + + void RecursiveShapeIterator::init () { diff --git a/src/db/db/dbRecursiveShapeIterator.h b/src/db/db/dbRecursiveShapeIterator.h index 22b1c625f..970085b63 100644 --- a/src/db/db/dbRecursiveShapeIterator.h +++ b/src/db/db/dbRecursiveShapeIterator.h @@ -238,6 +238,11 @@ public: */ RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers); + /** + * @brief Destructor + */ + ~RecursiveShapeIterator (); + /** * @brief Specify the maximum hierarchy depth to look into * diff --git a/src/db/db/gsiDeclDbBox.cc b/src/db/db/gsiDeclDbBox.cc index fd074a21e..0ee29b258 100644 --- a/src/db/db/gsiDeclDbBox.cc +++ b/src/db/db/gsiDeclDbBox.cc @@ -98,7 +98,7 @@ struct box_defs static size_t hash_value (const C *box) { - return std_ext::hfunc (*box); + return std::hfunc (*box); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbCell.cc b/src/db/db/gsiDeclDbCell.cc index b1d8ffe1c..9784a56af 100644 --- a/src/db/db/gsiDeclDbCell.cc +++ b/src/db/db/gsiDeclDbCell.cc @@ -345,7 +345,7 @@ struct cell_inst_array_defs static size_t hash_value (const C *i) { - return std_ext::hfunc (*i); + return std::hfunc (*i); } static bool less (const C *i, const C &other) diff --git a/src/db/db/gsiDeclDbEdge.cc b/src/db/db/gsiDeclDbEdge.cc index 99e2c8ad5..f60e70dca 100644 --- a/src/db/db/gsiDeclDbEdge.cc +++ b/src/db/db/gsiDeclDbEdge.cc @@ -134,7 +134,7 @@ struct edge_defs static size_t hash_value (const C *e) { - return std_ext::hfunc (*e); + return std::hfunc (*e); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbEdgePair.cc b/src/db/db/gsiDeclDbEdgePair.cc index 3ecd0f37e..a7b35c4fa 100644 --- a/src/db/db/gsiDeclDbEdgePair.cc +++ b/src/db/db/gsiDeclDbEdgePair.cc @@ -61,7 +61,7 @@ struct edge_pair_defs static size_t hash_value (const C *ep) { - return std_ext::hfunc (*ep); + return std::hfunc (*ep); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbLayout.cc b/src/db/db/gsiDeclDbLayout.cc index 2941af667..298655b8f 100644 --- a/src/db/db/gsiDeclDbLayout.cc +++ b/src/db/db/gsiDeclDbLayout.cc @@ -115,7 +115,7 @@ db::LayerProperties li_from_string (const char *s) static size_t hash_value (const db::LayerProperties *l) { - return std_ext::hfunc (*l); + return std::hfunc (*l); } // since there already exists a "LayerProperties" object, we call this one "LayerInfo" diff --git a/src/db/db/gsiDeclDbPath.cc b/src/db/db/gsiDeclDbPath.cc index d8f88129d..1d8ebd0ba 100644 --- a/src/db/db/gsiDeclDbPath.cc +++ b/src/db/db/gsiDeclDbPath.cc @@ -110,7 +110,7 @@ struct path_defs static size_t hash_value (const C *e) { - return std_ext::hfunc (*e); + return std::hfunc (*e); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbPoint.cc b/src/db/db/gsiDeclDbPoint.cc index d80b36959..7cf55744b 100644 --- a/src/db/db/gsiDeclDbPoint.cc +++ b/src/db/db/gsiDeclDbPoint.cc @@ -77,7 +77,7 @@ struct point_defs static size_t hash_value (const C *pt) { - return std_ext::hfunc (*pt); + return std::hfunc (*pt); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbPolygon.cc b/src/db/db/gsiDeclDbPolygon.cc index 9365e903f..bb4d68a31 100644 --- a/src/db/db/gsiDeclDbPolygon.cc +++ b/src/db/db/gsiDeclDbPolygon.cc @@ -207,7 +207,7 @@ struct simple_polygon_defs static size_t hash_value (const C *p) { - return std_ext::hfunc (*p); + return std::hfunc (*p); } static bool touches_box (const C *p, const db::box &box) @@ -1055,7 +1055,7 @@ struct polygon_defs static size_t hash_value (const C *p) { - return std_ext::hfunc (*p); + return std::hfunc (*p); } static bool touches_box (const C *p, const db::box &box) diff --git a/src/db/db/gsiDeclDbText.cc b/src/db/db/gsiDeclDbText.cc index 2918e1104..ce384492d 100644 --- a/src/db/db/gsiDeclDbText.cc +++ b/src/db/db/gsiDeclDbText.cc @@ -145,7 +145,7 @@ struct text_defs static size_t hash_value (const C *box) { - return std_ext::hfunc (*box); + return std::hfunc (*box); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbTrans.cc b/src/db/db/gsiDeclDbTrans.cc index 89d533ec9..43a981241 100644 --- a/src/db/db/gsiDeclDbTrans.cc +++ b/src/db/db/gsiDeclDbTrans.cc @@ -138,7 +138,7 @@ struct trans_defs static size_t hash_value (const C *t) { - return std_ext::hfunc (*t); + return std::hfunc (*t); } static gsi::Methods methods () @@ -636,7 +636,7 @@ struct cplx_trans_defs static size_t hash_value (const C *t) { - return std_ext::hfunc (*t); + return std::hfunc (*t); } static gsi::Methods methods () diff --git a/src/db/db/gsiDeclDbVector.cc b/src/db/db/gsiDeclDbVector.cc index 49cf76bb0..29b0b7981 100644 --- a/src/db/db/gsiDeclDbVector.cc +++ b/src/db/db/gsiDeclDbVector.cc @@ -97,7 +97,7 @@ struct vector_defs static size_t hash_value (const C *v) { - return std_ext::hfunc (*v); + return std::hfunc (*v); } static db::point add_with_point (const C *v, const db::point &p) diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index 9fb258493..2c5a6bc02 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -297,7 +297,9 @@ ApplicationBase::parse_cmd (int &argc, char **argv) int v = 0; tl::from_string (args [++i], v); - v = std::max (0, v); + if (v < 0) { + v = 0; + } tl::verbosity (v); } else if (a == "-l" && (i + 1) < argc) { @@ -374,13 +376,13 @@ ApplicationBase::parse_cmd (int &argc, char **argv) int r = 0; tl::from_string (args [++i], r); - m_gtf_replay_rate = std::max (0, r); + m_gtf_replay_rate = r > 0 ? r : 0; } else if (a == "-gb" && (i + 1) < argc) { int s = 0; tl::from_string (args [++i], s); - m_gtf_replay_stop = std::max (0, s); + m_gtf_replay_stop = s > 0 ? s : 0; } else if (a == "-c" && (i + 1) < argc) { diff --git a/src/lay/lay/layHelpProvider.cc b/src/lay/lay/layHelpProvider.cc index 592729282..462dcb61c 100644 --- a/src/lay/lay/layHelpProvider.cc +++ b/src/lay/lay/layHelpProvider.cc @@ -36,10 +36,3 @@ HelpProvider::HelpProvider () } } - -namespace tl -{ - // registration point for help providers - template<> - tl::Registrar *Registrar::instance = 0; -} diff --git a/src/lay/lay/laySalt.cc b/src/lay/lay/laySalt.cc index c2cd977a6..51bfa0b0d 100644 --- a/src/lay/lay/laySalt.cc +++ b/src/lay/lay/laySalt.cc @@ -216,7 +216,7 @@ Salt::validate () for (std::map::const_iterator g = m_grains_by_name.begin (); g != m_grains_by_name.end (); ++g) { int index = topological_index [g->first]; - for (std::vector::const_iterator d = g->second->dependencies ().begin (); d != g->second->dependencies ().end (); ++d) { + for (std::vector::const_iterator d = g->second->dependencies ().begin (); d != g->second->dependencies ().end (); ++d) { std::map::iterator ti = topological_index.find (d->name); if (ti != topological_index.end () && ti->second < index + 1) { ti->second = index + 1; diff --git a/src/lay/lay/laySaltDownloadManager.cc b/src/lay/lay/laySaltDownloadManager.cc index 529880cf2..e8c0024fe 100644 --- a/src/lay/lay/laySaltDownloadManager.cc +++ b/src/lay/lay/laySaltDownloadManager.cc @@ -206,7 +206,7 @@ SaltDownloadManager::compute_list (const lay::Salt &salt, const lay::Salt &salt_ Descriptor p = m_registry [i]; - for (std::vector::const_iterator d = p.grain.dependencies ().begin (); d != p.grain.dependencies ().end (); ++d) { + for (std::vector::const_iterator d = p.grain.dependencies ().begin (); d != p.grain.dependencies ().end (); ++d) { std::map::iterator r = reg_by_name.find (d->name); if (r != reg_by_name.end ()) { diff --git a/src/lay/lay/laySaltGrain.cc b/src/lay/lay/laySaltGrain.cc index 9ca74b57c..eb5ccb565 100644 --- a/src/lay/lay/laySaltGrain.cc +++ b/src/lay/lay/laySaltGrain.cc @@ -397,9 +397,9 @@ SaltGrain::xml_elements () tl::make_member (&SaltGrain::icon, &SaltGrain::set_icon, "icon", ImageConverter ()) + tl::make_member (&SaltGrain::screenshot, &SaltGrain::set_screenshot, "screenshot", ImageConverter ()) + tl::make_element (&SaltGrain::begin_dependencies, &SaltGrain::end_dependencies, &SaltGrain::add_dependency, "depends", - tl::make_member (&SaltGrain::Dependency::name, "name") + - tl::make_member (&SaltGrain::Dependency::url, "url") + - tl::make_member (&SaltGrain::Dependency::version, "version") + tl::make_member (&SaltGrainDependency::name, "name") + + tl::make_member (&SaltGrainDependency::url, "url") + + tl::make_member (&SaltGrainDependency::version, "version") ) ); } diff --git a/src/lay/lay/laySaltGrain.h b/src/lay/lay/laySaltGrain.h index 060ae48be..81e052293 100644 --- a/src/lay/lay/laySaltGrain.h +++ b/src/lay/lay/laySaltGrain.h @@ -34,6 +34,26 @@ namespace lay { +/** + * @brief A descriptor for one dependency + * A dependency can be specified either through a name (see name property) + * or a download URL. If download URL are specified, they have precedence + * over names. + * The version is the minimum required version. If empty, any version is + * allowed to resolve this dependency. + */ +struct SaltGrainDependency +{ + std::string name; + std::string url; + std::string version; + + bool operator== (const SaltGrainDependency &other) const + { + return name == other.name && url == other.url && version == other.version; + } +}; + /** * @brief This class represents on grain of salt * "One grain of salt" is one package. @@ -42,31 +62,16 @@ class LAY_PUBLIC SaltGrain : public tl::Object { public: - /** - * @brief A descriptor for one dependency - * A dependency can be specified either through a name (see name property) - * or a download URL. If download URL are specified, they have precedence - * over names. - * The version is the minimum required version. If empty, any version is - * allowed to resolve this dependency. - */ - struct Dependency - { - std::string name; - std::string url; - std::string version; - - bool operator== (const Dependency &other) const - { - return name == other.name && url == other.url && version == other.version; - } - }; - /** * @brief Constructor */ SaltGrain (); + /** + * @brief Destructor + */ + virtual ~SaltGrain () { } + /** * @brief Equality */ @@ -347,7 +352,7 @@ public: * Grains this grain depends on are installed automatically when the grain * is installed. */ - const std::vector &dependencies () const + const std::vector &dependencies () const { return m_dependencies; } @@ -355,7 +360,7 @@ public: /** * @brief Gets the dependencies of the grain (non-const) */ - std::vector &dependencies () + std::vector &dependencies () { return m_dependencies; } @@ -363,7 +368,7 @@ public: /** * @brief Dependency iterator (begin) */ - std::vector::const_iterator begin_dependencies () const + std::vector::const_iterator begin_dependencies () const { return m_dependencies.begin (); } @@ -371,7 +376,7 @@ public: /** * @brief Dependency iterator (end) */ - std::vector::const_iterator end_dependencies () const + std::vector::const_iterator end_dependencies () const { return m_dependencies.end (); } @@ -379,7 +384,7 @@ public: /** * @brief Adds a dependency */ - void add_dependency (const Dependency &dep) + void add_dependency (const SaltGrainDependency &dep) { m_dependencies.push_back (dep); } @@ -482,7 +487,7 @@ private: bool m_hidden; QDateTime m_authored_time, m_installed_time; QImage m_icon, m_screenshot; - std::vector m_dependencies; + std::vector m_dependencies; }; } diff --git a/src/lay/lay/laySaltGrainDetailsTextWidget.cc b/src/lay/lay/laySaltGrainDetailsTextWidget.cc index 2a0eeccae..3988b2e43 100644 --- a/src/lay/lay/laySaltGrainDetailsTextWidget.cc +++ b/src/lay/lay/laySaltGrainDetailsTextWidget.cc @@ -283,7 +283,7 @@ SaltGrainDetailsTextWidget::details_text () } if (! g->dependencies ().empty ()) { stream << "

" << QObject::tr ("Depends on: ") << "
"; - for (std::vector::const_iterator d = g->dependencies ().begin (); d != g->dependencies ().end (); ++d) { + for (std::vector::const_iterator d = g->dependencies ().begin (); d != g->dependencies ().end (); ++d) { stream << "    " << tl::to_qstring (tl::escaped_to_html (d->name)) << " "; stream << tl::to_qstring (tl::escaped_to_html (d->version)); if (! d->url.empty ()) { diff --git a/src/lay/lay/laySaltGrainPropertiesDialog.cc b/src/lay/lay/laySaltGrainPropertiesDialog.cc index 336f041c4..619a8ee81 100644 --- a/src/lay/lay/laySaltGrainPropertiesDialog.cc +++ b/src/lay/lay/laySaltGrainPropertiesDialog.cc @@ -169,7 +169,7 @@ SaltGrainPropertiesDialog::update_controls () license->setText (tl::to_qstring (m_grain.license ())); dependencies->clear (); - for (std::vector::const_iterator d = m_grain.dependencies ().begin (); d != m_grain.dependencies ().end (); ++d) { + for (std::vector::const_iterator d = m_grain.dependencies ().begin (); d != m_grain.dependencies ().end (); ++d) { QTreeWidgetItem *item = new QTreeWidgetItem (dependencies); item->setFlags (item->flags () | Qt::ItemIsEditable); @@ -240,7 +240,7 @@ SaltGrainPropertiesDialog::update_data () QString url = item->data (2, Qt::UserRole).toString ().simplified (); if (! name.isEmpty ()) { - lay::SaltGrain::Dependency dep = lay::SaltGrain::Dependency (); + lay::SaltGrainDependency dep = lay::SaltGrainDependency (); dep.name = tl::to_string (name); dep.version = tl::to_string (version); dep.url = tl::to_string (url); @@ -482,7 +482,7 @@ private: } } - for (std::vector::const_iterator d = current->dependencies ().begin (); d != current->dependencies ().end (); ++d) { + for (std::vector::const_iterator d = current->dependencies ().begin (); d != current->dependencies ().end (); ++d) { check_circular_follow (grain_for_name (d->name), path); } @@ -552,7 +552,7 @@ SaltGrainPropertiesDialog::accept () dependencies_alert->clear (); DependencyGraph dep (mp_salt); std::set dep_seen; - for (std::vector::const_iterator d = m_grain.dependencies ().begin (); d != m_grain.dependencies ().end (); ++d) { + for (std::vector::const_iterator d = m_grain.dependencies ().begin (); d != m_grain.dependencies ().end (); ++d) { if (! SaltGrain::valid_name (d->name)) { dependencies_alert->error () << tr ("'%1' is not a valid package name").arg (tl::to_qstring (d->name)) << tl::endl diff --git a/src/lay/unit_tests/laySalt.cc b/src/lay/unit_tests/laySalt.cc index c825c35db..9618a4410 100644 --- a/src/lay/unit_tests/laySalt.cc +++ b/src/lay/unit_tests/laySalt.cc @@ -127,7 +127,7 @@ TEST (1) EXPECT_EQ (QDateTime::fromMSecsSinceEpoch (0).msecsTo (g.installed_time ()), 2000000000); #endif - g.add_dependency (lay::SaltGrain::Dependency ()); + g.add_dependency (lay::SaltGrainDependency ()); g.dependencies ().back ().name = "depname"; g.dependencies ().back ().url = "depurl"; g.dependencies ().back ().version = "0.0"; @@ -156,7 +156,7 @@ TEST (1) EXPECT_EQ (int (gg.dependencies ().size ()), 1); EXPECT_EQ (g == gg, true); - gg.add_dependency (lay::SaltGrain::Dependency ()); + gg.add_dependency (lay::SaltGrainDependency ()); EXPECT_EQ (g == gg, false); gg.set_path (tl::to_string (QFileInfo (tl::to_qstring (tmp)).absolutePath ())); gg.save (); @@ -379,7 +379,7 @@ TEST (5) lay::SaltGrain g1; g1.set_name ("g1"); - lay::SaltGrain::Dependency dep; + lay::SaltGrainDependency dep; dep.name = "g2"; g1.dependencies ().push_back (dep); dep.name = "g3"; diff --git a/src/laybasic/laybasic/gsiDeclLayDialogs.cc b/src/laybasic/laybasic/gsiDeclLayDialogs.cc index 757376db9..050820b45 100644 --- a/src/laybasic/laybasic/gsiDeclLayDialogs.cc +++ b/src/laybasic/laybasic/gsiDeclLayDialogs.cc @@ -34,8 +34,10 @@ #include #if defined(HAVE_QTBINDINGS) + # include "gsiQtGuiExternals.h" # include "gsiQtWidgetsExternals.h" + FORCE_LINK_GSI_QTGUI FORCE_LINK_GSI_QTWIDGETS // for Qt5 diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc index 0f8eadc17..0c423baf7 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc @@ -343,7 +343,7 @@ Compressor::flush (db::OASISWriter *writer) tmp_rep_vector repetitions; std::vector > rep_vector; - for (typename std_ext::hash_map ::iterator n = m_normalized.begin (); n != m_normalized.end (); ++n) { + for (typename std::unordered_map ::iterator n = m_normalized.begin (); n != m_normalized.end (); ++n) { rep_vector.clear (); @@ -358,7 +358,7 @@ Compressor::flush (db::OASISWriter *writer) disp_vector::iterator d; tmp_rep_vector::iterator rw; - std_ext::hash_set xcoords, ycoords; + std::unordered_set xcoords, ycoords; if (m_level > 1) { for (d = n->second.begin (); d != n->second.end (); ++d) { xcoords.insert (d->x ()); diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.h b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.h index 6ae68c2fb..8a4eb2eb3 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.h +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.h @@ -90,7 +90,7 @@ public: private: typedef std::vector disp_vector; - std_ext::hash_map m_normalized; + std::unordered_map m_normalized; unsigned int m_level; }; diff --git a/src/plugins/tools/net_tracer/db_plugin/gsiDeclDbNetTracer.cc b/src/plugins/tools/net_tracer/db_plugin/gsiDeclDbNetTracer.cc index b2ee0c229..0260491ca 100644 --- a/src/plugins/tools/net_tracer/db_plugin/gsiDeclDbNetTracer.cc +++ b/src/plugins/tools/net_tracer/db_plugin/gsiDeclDbNetTracer.cc @@ -27,7 +27,7 @@ namespace db { - extern const std::string net_tracer_component_name; + extern std::string net_tracer_component_name; } namespace gsi diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc index f46dee9c1..886cfdbd6 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc @@ -49,7 +49,7 @@ namespace db { - extern std::string net_tracer_component_name; + DB_PLUGIN_PUBLIC std::string net_tracer_component_name; } namespace lay diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc index 472f93ce0..cdd46419b 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc @@ -32,7 +32,7 @@ namespace db { - extern std::string net_tracer_component_name; + DB_PLUGIN_PUBLIC std::string net_tracer_component_name; } namespace lay diff --git a/src/pya/pya/pya.cc b/src/pya/pya/pya.cc index 044151f4e..a89c3f27b 100644 --- a/src/pya/pya/pya.cc +++ b/src/pya/pya/pya.cc @@ -20,7 +20,6 @@ */ - #include #include // Python - for traceback diff --git a/src/pya/pya/pya.pro b/src/pya/pya/pya.pro index 4ca438b7e..9e514c318 100644 --- a/src/pya/pya/pya.pro +++ b/src/pya/pya/pya.pro @@ -15,9 +15,9 @@ SOURCES = \ pyaObject.cc \ pyaRefs.cc \ pyaUtils.cc \ - pyaModule.cc \ - pyaSignalHandler.cc \ - pyaStatusChangedListener.cc + pyaModule.cc \ + pyaSignalHandler.cc \ + pyaStatusChangedListener.cc HEADERS += \ pya.h \ @@ -29,16 +29,22 @@ HEADERS += \ pyaObject.h \ pyaRefs.h \ pyaUtils.h \ - pyaModule.h \ - pyaSignalHandler.h \ - pyaStatusChangedListener.h + pyaModule.h \ + pyaSignalHandler.h \ + pyaStatusChangedListener.h -INCLUDEPATH += $$PYTHONINCLUDE $$TL_INC $$GSI_INC -DEPENDPATH += $$PYTHONINCLUDE $$TL_INC $$GSI_INC -LIBS += $$PYTHONLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi +INCLUDEPATH += "$$PYTHONINCLUDE" $$TL_INC $$GSI_INC +DEPENDPATH += "$$PYTHONINCLUDE" $$TL_INC $$GSI_INC +LIBS += "$$PYTHONLIBFILE" -L$$DESTDIR -lklayout_tl -lklayout_gsi -# Python is somewhat sloppy and relies on the compiler initializing fields -# of strucs to 0: -QMAKE_CXXFLAGS_WARN_ON += \ - -Wno-missing-field-initializers +!msvc { + # Python is somewhat sloppy and relies on the compiler initializing fields + # of strucs to 0: + QMAKE_CXXFLAGS_WARN_ON += \ + -Wno-missing-field-initializers +} +msvc { + # pyconfig.h tries to tell us which library to link, but we know better .. + QMAKE_LINK_FLAGS += /NODEFAULTLIB:python* +} diff --git a/src/pya/pya/pyaConvert.h b/src/pya/pya/pyaConvert.h index 8aab23136..f64ab714d 100644 --- a/src/pya/pya/pyaConvert.h +++ b/src/pya/pya/pyaConvert.h @@ -47,7 +47,7 @@ namespace gsi class ClassBase; class ArgType; - const ClassBase *class_by_typeinfo_no_assert (const std::type_info &ti); + GSI_PUBLIC const ClassBase *class_by_typeinfo_no_assert (const std::type_info &ti); } namespace pya diff --git a/src/pya/pya/pyaObject.h b/src/pya/pya/pyaObject.h index 9e59c8790..a675ed325 100644 --- a/src/pya/pya/pyaObject.h +++ b/src/pya/pya/pyaObject.h @@ -28,6 +28,7 @@ #include "pyaRefs.h" #include "pyaCommon.h" +#include "pyaSignalHandler.h" #include "tlAssert.h" @@ -45,7 +46,6 @@ namespace pya { class PYAObjectBase; -class SignalHandler; class Callee; class StatusChangedListener; diff --git a/src/pymod/bridge_sample/bridge_sample.pro b/src/pymod/bridge_sample/bridge_sample.pro index 5c06e60fc..98ef0c6dd 100644 --- a/src/pymod/bridge_sample/bridge_sample.pro +++ b/src/pymod/bridge_sample/bridge_sample.pro @@ -56,9 +56,9 @@ equals(HAVE_QT, "0") { # - GSI (generic scripting interface) # - TL (basic toolkit) # - PYA (Python binding for GSI) -INCLUDEPATH += $$PYTHONINCLUDE $$INC/tl/tl $$INC/pya/pya -DEPENDPATH += $$PYTHONINCLUDE $$INC/tl/tl $$INC/pya/pya -LIBS += $$PYTHONLIBFILE -L$$LIBDIR -lklayout_tl -lklayout_pya -lklayout_gsi +INCLUDEPATH += "$$PYTHONINCLUDE" $$INC/tl/tl $$INC/pya/pya $$INC/gsi/gsi +DEPENDPATH += "$$PYTHONINCLUDE" $$INC/tl/tl $$INC/pya/pya $$INC/gsi/gsi +LIBS += "$$PYTHONLIBFILE" -L$$LIBDIR -lklayout_tl -lklayout_pya -lklayout_gsi # Also include DB as this is our sample INCLUDEPATH += $$INC/db/db @@ -70,29 +70,32 @@ LIBS += -L$$LIBDIR -lklayout_db QMAKE_RPATHDIR += $$RPATH } -# Some standard compiler warnings on -QMAKE_CXXFLAGS_WARN_ON += \ - -pedantic \ - -Woverloaded-virtual \ - -Wsign-promo \ - -Wsynth \ - -Wno-deprecated \ - -Wno-long-long \ - -Wno-strict-aliasing \ - -Wno-deprecated-declarations \ - -Wno-reserved-user-defined-literal \ +!msvc { -# Python is somewhat sloppy and relies on the compiler initializing fields -# of strucs to 0: -QMAKE_CXXFLAGS_WARN_ON += \ - -Wno-missing-field-initializers + # Some standard compiler warnings on + QMAKE_CXXFLAGS_WARN_ON += \ + -pedantic \ + -Woverloaded-virtual \ + -Wsign-promo \ + -Wsynth \ + -Wno-deprecated \ + -Wno-long-long \ + -Wno-strict-aliasing \ + -Wno-deprecated-declarations \ + -Wno-reserved-user-defined-literal \ + + # Python is somewhat sloppy and relies on the compiler initializing fields + # of strucs to 0: + QMAKE_CXXFLAGS_WARN_ON += \ + -Wno-missing-field-initializers +} win32 { # to avoid the major version being appended to the dll name - in this case -lxyz won't link it again # because the library is called xyx0.dll. CONFIG += skip_target_version_ext # make the proper library name for Python - QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$DESTDIR/$${TARGET}$${PYTHONEXTSUFFIX} + QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$shell_path($$DESTDIR/$${TARGET}$${PYTHONEXTSUFFIX}) } else { # Make the target library without the "lib" prefix on Linux QMAKE_POST_LINK += $(COPY) $(DESTDIR)$(TARGET) $$DESTDIR/$${TARGET}$${PYTHONEXTSUFFIX} diff --git a/src/pymod/pymod.pri b/src/pymod/pymod.pri index 778d5ccd9..1fd8cd1b0 100644 --- a/src/pymod/pymod.pri +++ b/src/pymod/pymod.pri @@ -7,20 +7,26 @@ TEMPLATE = lib include($$PWD/../klayout.pri) -INCLUDEPATH += $$PYTHONINCLUDE $$TL_INC $$GSI_INC $$PYA_INC -DEPENDPATH += $$PYTHONINCLUDE $$TL_INC $$GSI_INC $$PYA_INC -LIBS += $$PYTHONLIBFILE -L$$LIBDIR -lklayout_tl -lklayout_gsi -lklayout_pya +INCLUDEPATH += "$$PYTHONINCLUDE" $$TL_INC $$GSI_INC $$PYA_INC +DEPENDPATH += "$$PYTHONINCLUDE" $$TL_INC $$GSI_INC $$PYA_INC +LIBS += "$$PYTHONLIBFILE" -L$$LIBDIR -lklayout_tl -lklayout_gsi -lklayout_pya -# Python is somewhat sloppy and relies on the compiler initializing fields -# of strucs to 0: -QMAKE_CXXFLAGS_WARN_ON += \ - -Wno-missing-field-initializers +!msvc { + # Python is somewhat sloppy and relies on the compiler initializing fields + # of strucs to 0: + QMAKE_CXXFLAGS_WARN_ON += \ + -Wno-missing-field-initializers +} # Only on Windows, DESTDIR_TARGET is usable. On this platform, a blank happens to appear between # $(DESTDIR) and $(TARGET) win32 { - QMAKE_POST_LINK += $(MKDIR) $$DESTDIR_PYMOD && $(COPY) $(DESTDIR_TARGET) $$DESTDIR_PYMOD/$${TARGET}$${PYTHONEXTSUFFIX} + msvc { + QMAKE_POST_LINK += (if not exist $$shell_path($$DESTDIR_PYMOD) mkdir $$shell_path($$DESTDIR_PYMOD)) && $(COPY) $(DESTDIR_TARGET) $$shell_path($$DESTDIR_PYMOD/$${TARGET}$${PYTHONEXTSUFFIX}) + } else { + QMAKE_POST_LINK += $(MKDIR) $$shell_path($$DESTDIR_PYMOD) && $(COPY) $(DESTDIR_TARGET) $$shell_path($$DESTDIR_PYMOD/$${TARGET}$${PYTHONEXTSUFFIX}) + } # to avoid the major version being appended to the dll name - in this case -lxyz won't link it again # because the library is called xyx0.dll. diff --git a/src/pymod/unit_tests/unit_tests.pro b/src/pymod/unit_tests/unit_tests.pro index 2bffa92d1..60c2c380c 100644 --- a/src/pymod/unit_tests/unit_tests.pro +++ b/src/pymod/unit_tests/unit_tests.pro @@ -9,10 +9,23 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ pymod_tests.cc -DEFINES += \ - PYTHON=$$PYTHON \ - PYTHONPATH=$$DESTDIR_UT/pymod +msvc { + # "\\\\" is actually *one* backslash for replacement string and *two* backslashes in the + # substitution string in qmake ... so we replace \ by \\ here: + PYTHON_ESCAPED = $$replace(PYTHON, "\\\\", "\\\\") + PYTHONPATH = $$shell_path($$DESTDIR_UT/pymod) + PYTHONPATH_ESCAPED = $$replace(PYTHONPATH, "\\\\", "\\\\") + + QMAKE_CXXFLAGS += \ + "-DPYTHON=\"$$PYTHON_ESCAPED\"" \ + "-DPYTHONPATH=\"$$PYTHONPATH_ESCAPED\"" + +} else { + DEFINES += \ + PYTHON=$$PYTHON_ESCAPED \ + PYTHONPATH=$$PYTHONPATH_ESCAPED +} INCLUDEPATH += $$DB_INC $$TL_INC $$GSI_INC DEPENDPATH += $$DB_INC $$TL_INC $$GSI_INC diff --git a/src/rba/rba/rba.pro b/src/rba/rba/rba.pro index 83c7a2ae8..dbf3fda31 100644 --- a/src/rba/rba/rba.pro +++ b/src/rba/rba/rba.pro @@ -23,7 +23,7 @@ HEADERS += \ rbaCommon.h # NOTE: ../common needs to be before RUBYINCLUDE since there is a config.h too. -INCLUDEPATH += ../common $$RUBYINCLUDE $$RUBYINCLUDE2 $$TL_INC $$GSI_INC -DEPENDPATH += ../common $$RUBYINCLUDE $$RUBYINCLUDE2 $$TL_INC $$GSI_INC -LIBS += $$RUBYLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi +INCLUDEPATH += ../common "$$RUBYINCLUDE" "$$RUBYINCLUDE2" $$TL_INC $$GSI_INC +DEPENDPATH += ../common "$$RUBYINCLUDE" "$$RUBYINCLUDE2" $$TL_INC $$GSI_INC +LIBS += "$$RUBYLIBFILE" -L$$DESTDIR -lklayout_tl -lklayout_gsi diff --git a/src/unit_tests/utTestConsole.cc b/src/unit_tests/utTestConsole.cc index 22923f081..343ed4d6e 100644 --- a/src/unit_tests/utTestConsole.cc +++ b/src/unit_tests/utTestConsole.cc @@ -23,7 +23,9 @@ #include "utTestConsole.h" #include "tlUnitTest.h" -#include +#if !defined(_MSC_VER) +# include +#endif #if !defined(_WIN32) # include @@ -195,7 +197,11 @@ TestConsole::TestConsole (FILE *file) { ms_instance = this; +#if defined(_MSC_VER) + m_file_is_tty = false; +#else m_file_is_tty = isatty (fileno (file)); +#endif #if !defined(_WIN32) if (m_file_is_tty) { @@ -221,7 +227,8 @@ TestConsole::~TestConsole () int TestConsole::columns () { - return std::max (m_columns - tl::indent (), 0); + int c = m_columns - tl::indent (); + return c > 0 ? c : 0; } void diff --git a/src/with_all_libs.pri b/src/with_all_libs.pri index 9402fc851..d001761ea 100644 --- a/src/with_all_libs.pri +++ b/src/with_all_libs.pri @@ -2,7 +2,7 @@ INCLUDEPATH += $$RBA_INC $$PYA_INC $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LIB_INC $$VERSION_INC DEPENDPATH += $$RBA_INC $$PYA_INC $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LIB_INC $$VERSION_INC -LIBS += $$PYTHONLIBFILE $$RUBYLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lib +LIBS += "$$PYTHONLIBFILE" "$$RUBYLIBFILE" -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lib !equals(HAVE_QT, "0") { @@ -42,3 +42,7 @@ equals(HAVE_PYTHON, "1") { LIBS += -lklayout_drc } } + +msvc { + LIBS += user32.lib +}