From 4deb368e4d1620ec3de9e68bd3a710e55779ab48 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Fri, 29 Dec 2017 00:11:19 +0900 Subject: [PATCH 01/10] Prepare Python scripts for building for Mac OSX. This refs #4 and #6. # Conflicts: # macbuild/build4mac.py --- macbuild/ReadMe.txt | 50 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/macbuild/ReadMe.txt b/macbuild/ReadMe.txt index 080317a54..2f16e7e4e 100644 --- a/macbuild/ReadMe.txt +++ b/macbuild/ReadMe.txt @@ -1,25 +1,39 @@ -<< Draft Version 0.001>> +<< Draft Version 0.002>> -This directory "macbuild" contains different files required to build KLayout -version 0.25 or later for different Max OSX including: - * Yosemite (10.10) - * El Capitan (10.11) - * Sierra (10.12) - * High Sierra (10.13) +1. Introduction: + This directory "macbuild" contains different files required to build KLayout + version 0.25 or later for different Max OSX including: + * Yosemite (10.10) + * El Capitan (10.11) + * Sierra (10.12) + * High Sierra (10.13) -By default, Qt framework is Qt5 from Mac Ports (https://www.macports.org/) which -is usually located under: - /opt/local/libexec/qt5/ + By default, Qt framework is Qt5 from Mac Ports (https://www.macports.org/) which + is usually located under: + /opt/local/libexec/qt5/ -Also by default, supported script languages, i.e,, Ruby and Python, are those -standard ones bundled with the OS. -However, you are able to choose other options like Python from Anaconda. - -bla bla bla ... + Also by default, supported script languages, i.e, Ruby and Python, are those + standard ones bundled with the OS. + However, you are able to choose other options like Python from Anaconda. + : + : + : + : -To use the top script "build4mac.py" make a symbolic link from the parent directory like: - build4mac.py -> macbuild/build4mac.py -then execute the Python script to build with appropriate options if required. +2. How to use: + (1) Make a symbolic link from the parent directory (where 'build.sh' exists) to + 'build4mac.py', that is, + build4mac.py -> macbuild/build4mac.py + + (2) Build KLayout by appropriate options, for example, for debug-build: + $ cd /where/'build.sh'/exists + $ ./build4mac.py -d + + (3) Confirm successful build. + + (4) Run 'build4mac.py' again with the same options used in (2) with "-y" + to deploy executables and libraries under "klayout.app" bundle. + $ ./build4mac.py -d -y [End of File] From 063811edc49edbbae71d474a5df72968118e05b8 Mon Sep 17 00:00:00 2001 From: matthias Date: Sat, 30 Dec 2017 14:28:09 -0800 Subject: [PATCH 02/10] Solved the clang/MacOS startup failure and menu issue 1.) Startup issue: This is solved by making sure templates with virtual functions are made visible in the DSO. This way, dynamic_cast is possible across DSO's. Scary: clang/MacOS wants the forward declarations be declared visible as well. 2.) Menu issue: The best solution is to have only one QMenuBar. The navigator now gets a synthetic menu bar composed of QToolButtons. --- src/ant/ant/antCommon.h | 2 +- src/buddies/src/bd/bdCommon.h | 2 +- src/db/db/dbBox.h | 2 +- src/db/db/dbCommon.h | 2 +- src/db/db/dbEdge.h | 2 +- src/db/db/dbEdgePair.h | 2 +- src/db/db/dbPoint.h | 2 +- src/db/db/dbPolygon.h | 4 +-- src/db/db/dbText.h | 2 +- src/db/db/dbTrans.h | 8 ++--- src/db/db/dbVector.h | 2 +- src/drc/drc/drcCommon.h | 2 +- src/edt/edt/edtCommon.h | 2 +- src/ext/ext/extCommon.h | 2 +- src/gsi/gsi/gsiClass.h | 10 +++--- src/gsi/gsi/gsiCommon.h | 2 +- src/gsi/gsi/gsiExpression.h | 4 +-- src/gsi/gsi/gsiObject.h | 2 +- src/gsi/gsi/gsiObjectHolder.h | 2 +- src/gsi/gsi/gsiTypes.h | 22 ++++++------ src/gsiqt/gsiQtCommon.h | 2 +- src/img/img/imgCommon.h | 2 +- src/lay/lay/layCommon.h | 2 +- src/lay/lay/layNativePlugin.h | 2 +- src/lay/lay/layNavigator.cc | 5 +-- src/lay/lay/layNavigator.h | 4 +-- src/laybasic/laybasic/layAbstractMenu.cc | 46 +++++++++++++++++++----- src/laybasic/laybasic/layAbstractMenu.h | 3 +- src/laybasic/laybasic/laybasicCommon.h | 2 +- src/lym/lym/lymCommon.h | 2 +- src/pya/pya/pyaCommon.h | 2 +- src/pya/pya/pyaConvert.h | 4 +-- src/pyastub/pyaCommon.h | 2 +- src/rba/rba/rbaCommon.h | 2 +- src/rbastub/rbaCommon.h | 2 +- src/rdb/rdb/rdbCommon.h | 2 +- src/tl/tl/tlCommon.h | 26 +++++++++++++- src/tl/tl/tlEvents.h | 12 +++---- src/tl/tl/tlEventsVar.h | 12 +++---- src/tl/tl/tlObject.h | 6 ++-- src/tl/tl/tlVariant.h | 6 ++-- 41 files changed, 140 insertions(+), 84 deletions(-) diff --git a/src/ant/ant/antCommon.h b/src/ant/ant/antCommon.h index a748222a9..93991d9b4 100644 --- a/src/ant/ant/antCommon.h +++ b/src/ant/ant/antCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define ANT_PUBLIC __attribute__ ((visibility ("default"))) # define ANT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/buddies/src/bd/bdCommon.h b/src/buddies/src/bd/bdCommon.h index fc9120f92..33fd0c01e 100644 --- a/src/buddies/src/bd/bdCommon.h +++ b/src/buddies/src/bd/bdCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define BD_PUBLIC __attribute__ ((visibility ("default"))) # define BD_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/db/db/dbBox.h b/src/db/db/dbBox.h index 53965fe85..2a95b9f90 100644 --- a/src/db/db/dbBox.h +++ b/src/db/db/dbBox.h @@ -57,7 +57,7 @@ class ArrayRepository; */ template -struct box +struct DB_PUBLIC box { typedef C coord_type; typedef box box_type; diff --git a/src/db/db/dbCommon.h b/src/db/db/dbCommon.h index 620893506..5d31d991c 100644 --- a/src/db/db/dbCommon.h +++ b/src/db/db/dbCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define DB_PUBLIC __attribute__ ((visibility ("default"))) # define DB_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/db/db/dbEdge.h b/src/db/db/dbEdge.h index ba8cf2568..91f866935 100644 --- a/src/db/db/dbEdge.h +++ b/src/db/db/dbEdge.h @@ -42,7 +42,7 @@ template class generic_repository; class ArrayRepository; template -class edge +class DB_PUBLIC edge { public: typedef C coord_type; diff --git a/src/db/db/dbEdgePair.h b/src/db/db/dbEdgePair.h index 5ff1a9542..e00f91bdf 100644 --- a/src/db/db/dbEdgePair.h +++ b/src/db/db/dbEdgePair.h @@ -40,7 +40,7 @@ namespace db { template -class edge_pair +class DB_PUBLIC edge_pair { public: typedef C coord_type; diff --git a/src/db/db/dbPoint.h b/src/db/db/dbPoint.h index 3c11d0534..4d07d0ea6 100644 --- a/src/db/db/dbPoint.h +++ b/src/db/db/dbPoint.h @@ -43,7 +43,7 @@ template class vector; */ template -class point +class DB_PUBLIC point { public: typedef C coord_type; diff --git a/src/db/db/dbPolygon.h b/src/db/db/dbPolygon.h index 46ea03ec8..27c22ecbe 100644 --- a/src/db/db/dbPolygon.h +++ b/src/db/db/dbPolygon.h @@ -1364,7 +1364,7 @@ private: */ template -class polygon +class DB_PUBLIC polygon { public: typedef C coord_type; @@ -2324,7 +2324,7 @@ private: */ template -class simple_polygon +class DB_PUBLIC simple_polygon { public: typedef C coord_type; diff --git a/src/db/db/dbText.h b/src/db/db/dbText.h index 94cb83d8e..598742575 100644 --- a/src/db/db/dbText.h +++ b/src/db/db/dbText.h @@ -222,7 +222,7 @@ private: */ template -class text +class DB_PUBLIC text { public: typedef C coord_type; diff --git a/src/db/db/dbTrans.h b/src/db/db/dbTrans.h index 07b49bc5c..21bf9d763 100644 --- a/src/db/db/dbTrans.h +++ b/src/db/db/dbTrans.h @@ -42,8 +42,8 @@ namespace tl { namespace db { -template class complex_trans; -template class simple_trans; +template class DB_PUBLIC complex_trans; +template class DB_PUBLIC simple_trans; template class disp_trans; template class fixpoint_trans; @@ -1035,7 +1035,7 @@ operator<< (std::ostream &os, const disp_trans &t) */ template -class simple_trans +class DB_PUBLIC simple_trans : public fixpoint_trans { public: @@ -1439,7 +1439,7 @@ operator<< (std::ostream &os, const simple_trans &t) * type used internally for representing the floating-point members). */ template -class complex_trans +class DB_PUBLIC complex_trans { public: typedef I coord_type; diff --git a/src/db/db/dbVector.h b/src/db/db/dbVector.h index e70928e6c..69411553b 100644 --- a/src/db/db/dbVector.h +++ b/src/db/db/dbVector.h @@ -45,7 +45,7 @@ template class point; */ template -class vector +class DB_PUBLIC vector { public: typedef C coord_type; diff --git a/src/drc/drc/drcCommon.h b/src/drc/drc/drcCommon.h index f93d63d98..be76a31dd 100644 --- a/src/drc/drc/drcCommon.h +++ b/src/drc/drc/drcCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define DRC_PUBLIC __attribute__ ((visibility ("default"))) # define DRC_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/edt/edt/edtCommon.h b/src/edt/edt/edtCommon.h index 22c53a329..9bdda5552 100644 --- a/src/edt/edt/edtCommon.h +++ b/src/edt/edt/edtCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define EDT_PUBLIC __attribute__ ((visibility ("default"))) # define EDT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/ext/ext/extCommon.h b/src/ext/ext/extCommon.h index 1b6de2e2d..3c05d13ee 100644 --- a/src/ext/ext/extCommon.h +++ b/src/ext/ext/extCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define EXT_PUBLIC __attribute__ ((visibility ("default"))) # define EXT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/gsi/gsi/gsiClass.h b/src/gsi/gsi/gsiClass.h index b40407f28..600c85abc 100644 --- a/src/gsi/gsi/gsiClass.h +++ b/src/gsi/gsi/gsiClass.h @@ -116,7 +116,7 @@ void _var_user_read_impl (T * /*a*/, tl::Extractor & /*ex*/, tl::false_tag) * @brief A VariantUserClassBase specialization that links GSI classes and Variant classes */ template -class VariantUserClass +class GSI_PUBLIC VariantUserClass : public tl::VariantUserClass, private VariantUserClassImpl { public: @@ -551,7 +551,7 @@ public: * the given methods. */ template -class ClassExt +class GSI_PUBLIC ClassExt : public ClassBase { public: @@ -708,7 +708,7 @@ struct adaptor_type_info * or to call it's methods in some generic way. */ template -class Class +class GSI_PUBLIC Class : public ClassBase { public: @@ -937,7 +937,7 @@ public: * a subclass of the parent. */ template -class ChildClass +class GSI_PUBLIC ChildClass : public Class { public: @@ -970,7 +970,7 @@ public: * a subclass of the parent. */ template -class ChildSubClass +class GSI_PUBLIC ChildSubClass : public SubClass { public: diff --git a/src/gsi/gsi/gsiCommon.h b/src/gsi/gsi/gsiCommon.h index c6a5d2d6d..2b83715cc 100644 --- a/src/gsi/gsi/gsiCommon.h +++ b/src/gsi/gsi/gsiCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define GSI_PUBLIC __attribute__ ((visibility ("default"))) # define GSI_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/gsi/gsi/gsiExpression.h b/src/gsi/gsi/gsiExpression.h index 331ea8c59..b7b63a11a 100644 --- a/src/gsi/gsi/gsiExpression.h +++ b/src/gsi/gsi/gsiExpression.h @@ -34,9 +34,9 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; struct NoAdaptorTag; -template class Class; +template class GSI_PUBLIC Class; /** * @brief The implementation delegate for the VariantUserClass diff --git a/src/gsi/gsi/gsiObject.h b/src/gsi/gsi/gsiObject.h index 6204088b3..f16c2c17b 100644 --- a/src/gsi/gsi/gsiObject.h +++ b/src/gsi/gsi/gsiObject.h @@ -35,7 +35,7 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; /** * @brief Definition of the client indexes diff --git a/src/gsi/gsi/gsiObjectHolder.h b/src/gsi/gsi/gsiObjectHolder.h index f9bd695ef..a3bb140a7 100644 --- a/src/gsi/gsi/gsiObjectHolder.h +++ b/src/gsi/gsi/gsiObjectHolder.h @@ -30,7 +30,7 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; /** * @brief Implements an object holder diff --git a/src/gsi/gsi/gsiTypes.h b/src/gsi/gsi/gsiTypes.h index 4e8dea99d..64a46a93b 100644 --- a/src/gsi/gsi/gsiTypes.h +++ b/src/gsi/gsi/gsiTypes.h @@ -55,19 +55,19 @@ namespace gsi // --------------------------------------------------------------------------------- // Type system of GSI -class SerialArgs; -class VectorAdaptor; -class MapAdaptor; -class StringAdaptor; -class VariantAdaptor; -class ClassBase; +class GSI_PUBLIC SerialArgs; +class GSI_PUBLIC VectorAdaptor; +class GSI_PUBLIC MapAdaptor; +class GSI_PUBLIC StringAdaptor; +class GSI_PUBLIC VariantAdaptor; +class GSI_PUBLIC ClassBase; struct NoAdaptorTag; -template class Class; +template class GSI_PUBLIC Class; template struct ClassTag; -template class IterAdaptor; -template class IterPtrAdaptor; -template class ConstIterPtrAdaptor; -template class FreeIterAdaptor; +template class GSI_PUBLIC IterAdaptor; +template class GSI_PUBLIC IterPtrAdaptor; +template class GSI_PUBLIC ConstIterPtrAdaptor; +template class GSI_PUBLIC FreeIterAdaptor; template const ClassBase *cls_decl (); /** diff --git a/src/gsiqt/gsiQtCommon.h b/src/gsiqt/gsiQtCommon.h index ebb74197e..990775a70 100644 --- a/src/gsiqt/gsiQtCommon.h +++ b/src/gsiqt/gsiQtCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define GSIQT_PUBLIC __attribute__ ((visibility ("default"))) # define GSIQT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/img/img/imgCommon.h b/src/img/img/imgCommon.h index af8c183fe..411442a14 100644 --- a/src/img/img/imgCommon.h +++ b/src/img/img/imgCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define IMG_PUBLIC __attribute__ ((visibility ("default"))) # define IMG_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lay/lay/layCommon.h b/src/lay/lay/layCommon.h index b14cfdfb4..b4ae166ab 100644 --- a/src/lay/lay/layCommon.h +++ b/src/lay/lay/layCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LAY_PUBLIC __attribute__ ((visibility ("default"))) # define LAY_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lay/lay/layNativePlugin.h b/src/lay/lay/layNativePlugin.h index 8ecb4194c..46d0f94d2 100644 --- a/src/lay/lay/layNativePlugin.h +++ b/src/lay/lay/layNativePlugin.h @@ -55,7 +55,7 @@ typedef void (*klp_init_func_t) (void (**autorun) (), void (**autorun_early) (), # if defined _WIN32 || defined __CYGWIN__ # define KLP_PUBLIC __declspec(dllexport) # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define KLP_PUBLIC __attribute__ ((visibility ("default"))) # else # define KLP_PUBLIC diff --git a/src/lay/lay/layNavigator.cc b/src/lay/lay/layNavigator.cc index 40a1a0ea4..a527d71d8 100644 --- a/src/lay/lay/layNavigator.cc +++ b/src/lay/lay/layNavigator.cc @@ -30,7 +30,7 @@ #include "imgService.h" #include -#include +#include #include namespace lay @@ -443,7 +443,8 @@ Navigator::Navigator (MainWindow *main_window) { setObjectName (QString::fromUtf8 ("navigator")); - mp_menu_bar = new QMenuBar (this); + mp_menu_bar = new QFrame (this); + mp_menu_bar->setFrameShape (QFrame::NoFrame); mp_menu_bar->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred); mp_view = new LayoutView (0, false, mp_main_window, this, "navigator", LayoutView::LV_Naked + LayoutView::LV_NoZoom + LayoutView::LV_NoServices + LayoutView::LV_NoGrid); diff --git a/src/lay/lay/layNavigator.h b/src/lay/lay/layNavigator.h index db8a715f5..19dd944fc 100644 --- a/src/lay/lay/layNavigator.h +++ b/src/lay/lay/layNavigator.h @@ -33,7 +33,7 @@ class QCloseEvent; class QShowEvent; -class QMenuBar; +class QFrame; class QLabel; namespace lay @@ -102,7 +102,7 @@ private: MainWindow *mp_main_window; LayoutView *mp_view; QLabel *mp_placeholder_label; - QMenuBar *mp_menu_bar; + QFrame *mp_menu_bar; LayoutView *mp_source_view; NavigatorService *mp_service; tl::DeferredMethod m_do_view_changed; diff --git a/src/laybasic/laybasic/layAbstractMenu.cc b/src/laybasic/laybasic/layAbstractMenu.cc index 9bc65effa..40577bbba 100644 --- a/src/laybasic/laybasic/layAbstractMenu.cc +++ b/src/laybasic/laybasic/layAbstractMenu.cc @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -903,31 +904,61 @@ AbstractMenu::make_exclusive_group (const std::string &name) } void -AbstractMenu::build_detached (const std::string &name, QMenuBar *mbar) +AbstractMenu::build_detached (const std::string &name, QFrame *mbar) { + // Clean up the menu bar before rebuilding + if (mbar->layout ()) { + delete mbar->layout (); + } + QObjectList children = mbar->children (); + for (QObjectList::const_iterator c = children.begin (); c != children.end (); ++c) { + if (dynamic_cast (*c)) { + delete *c; + } + } + + QHBoxLayout *menu_layout = new QHBoxLayout (mbar); + menu_layout->setMargin (0); + mbar->setLayout (menu_layout); + AbstractMenuItem *item = find_item_exact ("@@" + name); tl_assert (item != 0); - mbar->clear (); - for (std::list::iterator c = item->children.begin (); c != item->children.end (); ++c) { if (c->has_submenu ()) { + QToolButton *menu_button = new QToolButton (mbar); + menu_layout->addWidget (menu_button); + menu_button->setAutoRaise (true); + menu_button->setPopupMode (QToolButton::MenuButtonPopup); + menu_button->setText (tl::to_qstring (c->action ().get_title ())); + if (c->menu () == 0) { - c->set_menu (mbar->addMenu (tl::to_qstring (c->action ().get_title ()))); - c->set_action (Action (new ActionHandle (c->menu ()->menuAction (), false)), true); + QMenu *menu = new QMenu (mbar); + menu_button->setMenu (menu); + c->set_menu (menu); + c->set_action (Action (new ActionHandle (menu->menuAction (), false)), true); } else { - mbar->addMenu (c->menu ()); + menu_button->setMenu (c->menu ()); } build (c->menu (), c->children); } else { - mbar->addAction (c->action ().qaction ()); + + QAction *action = c->action ().qaction (); + + QToolButton *menu_button = new QToolButton (mbar); + menu_layout->addWidget (menu_button); + menu_button->setAutoRaise (true); + menu_button->setDefaultAction (action); + } } + + menu_layout->addStretch (1); } void @@ -1521,4 +1552,3 @@ AbstractMenu::collect_group (std::vector &grp, const std::string &n } } - diff --git a/src/laybasic/laybasic/layAbstractMenu.h b/src/laybasic/laybasic/layAbstractMenu.h index e5ece7024..ecbf9091f 100644 --- a/src/laybasic/laybasic/layAbstractMenu.h +++ b/src/laybasic/laybasic/layAbstractMenu.h @@ -42,6 +42,7 @@ #include "tlObject.h" #include "laybasicCommon.h" +class QFrame; class QMenuBar; class QToolBar; class QMenu; @@ -681,7 +682,7 @@ public: * @param name The name of the detached menu, without the "@" * @param mbar The menu bar into which to build the menu */ - void build_detached (const std::string &name, QMenuBar *mbar); + void build_detached (const std::string &name, QFrame *mbar); /** * @brief Get the reference to a QMenu object diff --git a/src/laybasic/laybasic/laybasicCommon.h b/src/laybasic/laybasic/laybasicCommon.h index 13c438ce4..18cc3946c 100644 --- a/src/laybasic/laybasic/laybasicCommon.h +++ b/src/laybasic/laybasic/laybasicCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LAYBASIC_PUBLIC __attribute__ ((visibility ("default"))) # define LAYBASIC_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lym/lym/lymCommon.h b/src/lym/lym/lymCommon.h index 7cd484ea5..3465ff4f4 100644 --- a/src/lym/lym/lymCommon.h +++ b/src/lym/lym/lymCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LYM_PUBLIC __attribute__ ((visibility ("default"))) # define LYM_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/pya/pya/pyaCommon.h b/src/pya/pya/pyaCommon.h index 8d0e9756b..8af7f41ee 100644 --- a/src/pya/pya/pyaCommon.h +++ b/src/pya/pya/pyaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define PYA_PUBLIC __attribute__ ((visibility ("default"))) # define PYA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/pya/pya/pyaConvert.h b/src/pya/pya/pyaConvert.h index 48c55d023..051ea4b28 100644 --- a/src/pya/pya/pyaConvert.h +++ b/src/pya/pya/pyaConvert.h @@ -36,8 +36,8 @@ namespace gsi { - class ClassBase; - class ArgType; + class GSI_PUBLIC ClassBase; + class GSI_PUBLIC ArgType; } namespace pya diff --git a/src/pyastub/pyaCommon.h b/src/pyastub/pyaCommon.h index 8d0e9756b..8af7f41ee 100644 --- a/src/pyastub/pyaCommon.h +++ b/src/pyastub/pyaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define PYA_PUBLIC __attribute__ ((visibility ("default"))) # define PYA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rba/rba/rbaCommon.h b/src/rba/rba/rbaCommon.h index 886648672..60510c739 100644 --- a/src/rba/rba/rbaCommon.h +++ b/src/rba/rba/rbaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RBA_PUBLIC __attribute__ ((visibility ("default"))) # define RBA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rbastub/rbaCommon.h b/src/rbastub/rbaCommon.h index 886648672..60510c739 100644 --- a/src/rbastub/rbaCommon.h +++ b/src/rbastub/rbaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RBA_PUBLIC __attribute__ ((visibility ("default"))) # define RBA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rdb/rdb/rdbCommon.h b/src/rdb/rdb/rdbCommon.h index d241ed53f..7cec4f6ed 100644 --- a/src/rdb/rdb/rdbCommon.h +++ b/src/rdb/rdb/rdbCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RDB_PUBLIC __attribute__ ((visibility ("default"))) # define RDB_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/tl/tl/tlCommon.h b/src/tl/tl/tlCommon.h index 91f2d67cc..7a6d202ee 100644 --- a/src/tl/tl/tlCommon.h +++ b/src/tl/tl/tlCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define TL_PUBLIC __attribute__ ((visibility ("default"))) # define TL_LOCAL __attribute__ ((visibility ("hidden"))) # else @@ -45,4 +45,28 @@ # endif +// NOTE: this is required because we have some forward declarations to +// gsi::Class and gsi::ClassBase in tlVariant.h. +// TODO: there should not be any dependency of tl on gsi. +# if defined _WIN32 || defined __CYGWIN__ + +# ifdef MAKE_GSI_LIBRARY +# define GSI_PUBLIC __declspec(dllexport) +# else +# define GSI_PUBLIC __declspec(dllimport) +# endif +# define GSI_LOCAL + +# else + +# if __GNUC__ >= 4 || defined(__clang__) +# define GSI_PUBLIC __attribute__ ((visibility ("default"))) +# define GSI_LOCAL __attribute__ ((visibility ("hidden"))) +# else +# define GSI_PUBLIC +# define GSI_LOCAL +# endif + +# endif + #endif diff --git a/src/tl/tl/tlEvents.h b/src/tl/tl/tlEvents.h index c077dafea..08af5a123 100644 --- a/src/tl/tl/tlEvents.h +++ b/src/tl/tl/tlEvents.h @@ -114,12 +114,12 @@ void handle_event_exception (std::exception &ex); * @endcode */ -template class event_function_base; -template class event_function; -template class event_function_with_data; -template class generic_event_function; -template class generic_event_function_with_data; -template class event; +template class TL_PUBLIC event_function_base; +template class TL_PUBLIC event_function; +template class TL_PUBLIC event_function_with_data; +template class TL_PUBLIC generic_event_function; +template class TL_PUBLIC generic_event_function_with_data; +template class TL_PUBLIC event; typedef event<> Event; #define _COUNT 0 diff --git a/src/tl/tl/tlEventsVar.h b/src/tl/tl/tlEventsVar.h index d84e90c84..cca4c78e3 100644 --- a/src/tl/tl/tlEventsVar.h +++ b/src/tl/tl/tlEventsVar.h @@ -31,7 +31,7 @@ #endif template <_TMPLARGS> -class event_function_base<_TMPLARGLISTP> +class TL_PUBLIC event_function_base<_TMPLARGLISTP> : public tl::Object { public: @@ -42,7 +42,7 @@ public: }; template <_JOIN(class T, _TMPLARGS)> -class event_function +class TL_PUBLIC event_function : public event_function_base<_TMPLARGLIST> { public: @@ -71,7 +71,7 @@ private: }; template -class event_function_with_data +class TL_PUBLIC event_function_with_data : public event_function_base<_TMPLARGLIST> { public: @@ -101,7 +101,7 @@ private: }; template <_JOIN(class T, _TMPLARGS)> -class generic_event_function +class TL_PUBLIC generic_event_function : public event_function_base<_TMPLARGLIST> { public: @@ -131,7 +131,7 @@ private: }; template -class generic_event_function_with_data +class TL_PUBLIC generic_event_function_with_data : public event_function_base<_TMPLARGLIST> { public: @@ -162,7 +162,7 @@ private: }; template <_TMPLARGS> -class event<_TMPLARGLISTP> +class TL_PUBLIC event<_TMPLARGLISTP> { public: typedef event_function_base<_TMPLARGLISTP> func; diff --git a/src/tl/tl/tlObject.h b/src/tl/tl/tlObject.h index e9f9beca8..e786d19a5 100644 --- a/src/tl/tl/tlObject.h +++ b/src/tl/tl/tlObject.h @@ -240,7 +240,7 @@ private: * This class represents a weak or shared pointer for the given type T. */ template -class weak_or_shared_ptr +class TL_PUBLIC weak_or_shared_ptr : public WeakOrSharedPtr { public: @@ -376,7 +376,7 @@ public: * See description of tl::Object for details. */ template -class weak_ptr +class TL_PUBLIC weak_ptr : public weak_or_shared_ptr { public: @@ -404,7 +404,7 @@ public: * See description of tl::Object for details. */ template -class shared_ptr +class TL_PUBLIC shared_ptr : public weak_or_shared_ptr { public: diff --git a/src/tl/tl/tlVariant.h b/src/tl/tl/tlVariant.h index a20c0a528..3e1f6074c 100644 --- a/src/tl/tl/tlVariant.h +++ b/src/tl/tl/tlVariant.h @@ -42,9 +42,9 @@ namespace gsi { - class ClassBase; + class GSI_PUBLIC ClassBase; struct NoAdaptorTag; - template class Class; + template class GSI_PUBLIC Class; template const ClassBase *cls_decl (); } @@ -102,7 +102,7 @@ protected: * We will employ RTTI to identify a type through that base class. */ template -class VariantUserClass +class TL_PUBLIC VariantUserClass : public VariantUserClassBase { public: From 167df7eae6389e54868409947dd797d5632a5ca6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 30 Dec 2017 16:46:49 -0800 Subject: [PATCH 03/10] Fixed a unit test bug - the dbCell test was working by coincidence on other systems. --- src/db/unit_tests/dbCell.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/db/unit_tests/dbCell.cc b/src/db/unit_tests/dbCell.cc index 4461dd7ae..d4f6c9658 100644 --- a/src/db/unit_tests/dbCell.cc +++ b/src/db/unit_tests/dbCell.cc @@ -570,13 +570,13 @@ TEST(2) } - c0.erase (i4); - EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,3[r0 *1 0,0]#13"); - EXPECT_EQ (c0.cell_instances (), size_t (2)); c0.erase (i5); + EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + EXPECT_EQ (c0.cell_instances (), size_t (2)); + c0.erase (i4); EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2"); EXPECT_EQ (c0.cell_instances (), size_t (1)); - // not yet: EXPECT_EQ (c0.empty (), false); + // Not yet: EXPECT_EQ (c0.empty (), false); // note: double delete is not supported in non-editable mode if (db::default_editable_mode ()) { @@ -608,7 +608,7 @@ TEST(2) c0.erase (i3); EXPECT_EQ (c2s_unsorted(c0), ""); EXPECT_EQ (c0.cell_instances (), size_t (0)); - // not yet: EXPECT_EQ (c0.empty (), true); + // Not yet: EXPECT_EQ (c0.empty (), true); } TEST(3) From 93572a8f0b5c85d7b6e8fdec23c2e5ad6364b889 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 30 Dec 2017 17:15:24 -0800 Subject: [PATCH 04/10] Fixed dbEdges iterator (ported fix of dbRegion iterator for MacOS/clang to dbEdges too) --- src/db/db/dbEdges.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index 68fe606d2..17788cde3 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -229,8 +229,11 @@ private: * @brief ctor from a recursive shape iterator */ EdgesIterator (const db::RecursiveShapeIterator &iter, const db::ICplxTrans &trans) - : m_rec_iter (iter), m_iter_trans (trans) - { + : m_rec_iter (iter), m_iter_trans (trans), m_from (), m_to () + { + // NOTE: the following initialization appears to be required on some compilers + // (specifically MacOS/clang) to ensure the proper initialization of the iterators + m_from = m_to; set (); } From f5b7a037adc0ad0c7e42a5d9e31cfabd959912b9 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:51:38 -0800 Subject: [PATCH 05/10] Turn the unit test runner into a ordinary binary too. --- src/unit_tests/unit_tests.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index 7e45e19fd..68df3dffc 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -6,6 +6,11 @@ include($$PWD/../with_all_libs.pri) TEMPLATE = app +# Don't build the ut_runner app as ordinary command line tool on MacOS +mac { + CONFIG -= app_bundle +} + TARGET = ut_runner SOURCES = \ From 2084a7e85c9dcee376ebec52032af0bf28778f6c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:52:54 -0800 Subject: [PATCH 06/10] Don't crash if no unit test libs are found in the unit test runner. --- src/unit_tests/unit_test_main.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unit_tests/unit_test_main.cc b/src/unit_tests/unit_test_main.cc index 1d0bc6b79..80d64c7b5 100644 --- a/src/unit_tests/unit_test_main.cc +++ b/src/unit_tests/unit_test_main.cc @@ -365,6 +365,10 @@ main_cont (int argc, char **argv) } + if (! tl::TestRegistrar::instance()) { + throw tl::Exception ("No test libraries found - make sure, the *.ut files are next to the ut_runner executable."); + } + // No side effects lay::set_klayout_path (std::vector ()); From 48a6b4b57a1246ded75ffc0ed620c7a6b01621be Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:54:47 -0800 Subject: [PATCH 07/10] Exceptions have to be exported from DSO's too to make the recognized in catch statements. --- src/tl/tl/tlException.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tl/tl/tlException.h b/src/tl/tl/tlException.h index 306af3c95..0b1baafc0 100644 --- a/src/tl/tl/tlException.h +++ b/src/tl/tl/tlException.h @@ -137,7 +137,7 @@ private: * @brief A "neutral" exception thrown to terminate some operation * This exception is not shown. */ -struct CancelException +struct TL_PUBLIC CancelException : public Exception { CancelException () @@ -148,7 +148,7 @@ struct CancelException /** * @brief A special "internal" exception class used by tl_assert */ -struct InternalException +struct TL_PUBLIC InternalException : public Exception { InternalException (const char *file, int line, const char *cond) From b7a18b3278a150688f471a738b31d06fe4594bdc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:55:23 -0800 Subject: [PATCH 08/10] Added method to derive application path for MacOS (/proc isn't there on MacOS) --- src/lay/lay/laySystemPaths.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lay/lay/laySystemPaths.cc b/src/lay/lay/laySystemPaths.cc index 6e458716c..2f5645c32 100644 --- a/src/lay/lay/laySystemPaths.cc +++ b/src/lay/lay/laySystemPaths.cc @@ -30,6 +30,9 @@ #ifdef _WIN32 # include +#elif __APPLE__ +# include +# include #else # include #endif @@ -79,6 +82,15 @@ get_inst_path_internal () return tl::to_string (fi.absolutePath ()); } +#elif __APPLE__ + + char buffer[PROC_PIDPATHINFO_MAXSIZE]; + int ret = proc_pidpath (getpid (), buffer, sizeof (buffer)); + if (ret > 0) { + // TODO: does this correctly translate paths? (MacOS uses UTF-8 encoding with D-like normalization) + return tl::to_string (QFileInfo (QString::fromUtf8 (buffer)).absolutePath ()); + } + #else QFileInfo proc_exe (tl::to_qstring (tl::sprintf ("/proc/%d/exe", getpid ()))); From 6b4d24b4424c1410de49101ab0591c002dee611f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 10:23:54 -0800 Subject: [PATCH 09/10] One more external visibility ... --- src/gsi/gsi/gsiDeclBasic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsi/gsi/gsiDeclBasic.h b/src/gsi/gsi/gsiDeclBasic.h index 7bafa8000..b77d46fda 100644 --- a/src/gsi/gsi/gsiDeclBasic.h +++ b/src/gsi/gsi/gsiDeclBasic.h @@ -37,7 +37,7 @@ namespace gsi /** * @brief Provides a basic implementation for a "boxed" plain value using a Variant as the basic type */ -class Value +class GSI_PUBLIC Value { public: /** From c4cf394719fe5be997352093d4c87f22d1fe5f37 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 10:56:46 -0800 Subject: [PATCH 10/10] One more external visibility ... --- src/gsi/gsi/gsiCallback.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsi/gsi/gsiCallback.h b/src/gsi/gsi/gsiCallback.h index 21a78ab62..f173bf0e7 100644 --- a/src/gsi/gsi/gsiCallback.h +++ b/src/gsi/gsi/gsiCallback.h @@ -34,7 +34,7 @@ namespace gsi * * This class is specialized to implement the actual call process later. */ -struct Callee +struct GSI_PUBLIC Callee : public tl::Object { Callee () { } @@ -49,7 +49,7 @@ struct Callee * This object holds informations about the actual implementation of the callback * on the scripting client's side. */ -struct Callback +struct Callback { Callback () : id (-1), callee (0), argsize (0), retsize (0)