From 8378e59b41f8dc2e068f1f5eca6bf417711419de Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 16 Nov 2017 22:51:54 +0100 Subject: [PATCH 1/8] Fixed a build issue with Ruby libraries. --- src/buddies/src/buddy_app.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/buddies/src/buddy_app.pri b/src/buddies/src/buddy_app.pri index 644bb5944..907d0e225 100644 --- a/src/buddies/src/buddy_app.pri +++ b/src/buddies/src/buddy_app.pri @@ -35,3 +35,5 @@ equals(HAVE_PYTHON, "1") { DEFINES += BD_TARGET=$$TARGET + +LIBS += $$RUBYLIBFILE From 19df2e06d967d43fb978168919a5a0e18a835c25 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 26 Nov 2017 22:12:55 +0100 Subject: [PATCH 2/8] Integrated changes by Kazunari for MacOS build. --- build.sh | 51 ++++++++++++++++++++++++++++++++++++--------------- version.sh | 7 +++++-- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/build.sh b/build.sh index 6a6190433..ece48ac1b 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# +# # KLayout Layout Viewer # Copyright (C) 2006-2017 Matthias Koefferlein # @@ -17,10 +17,11 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# +# CURR_DIR=`pwd` RUN_MAKE=1 +IS_MAC="no" HAVE_QTBINDINGS=1 HAVE_64BIT_COORD=0 @@ -46,6 +47,16 @@ MAKE_OPT="" CONFIG="release" BUILD_EXPERT=0 +# Check if building on Mac OSX Darwin family +case `uname` in + Darwin*) + IS_MAC="yes" + ;; + *) + IS_MAC="no" + ;; +esac + # Check, whether build.sh is run from the top level folder if ! [ -e src ] || ! [ -e src/klayout.pro ]; then echo "*** ERROR: run build.sh from the top level folder" @@ -200,7 +211,7 @@ done echo "Scanning installation .." echo "" -# Import version info +# Import version info . ./version.sh echo "Version Info:" @@ -212,8 +223,8 @@ echo "" # if not given, try to detect the qmake binary if [ "$QMAKE" = "" ]; then for qmake in "qmake5" "qmake-qt5" "qmake4" "qmake-qt4" "qmake"; do - if [ "$QMAKE" = "" ] && [ "`$qmake -v 2>/dev/null`" != "" ]; then - QMAKE="$qmake" + if [ "$QMAKE" = "" ] && [ "`$qmake -v 2>/dev/null`" != "" ]; then + QMAKE="$qmake" fi done fi @@ -246,8 +257,8 @@ echo "" # if not given, locate ruby interpreter (prefer 1.9, then default, finally 1.8 as fallback) if [ "$RUBY" = "" ]; then for ruby in "ruby2.4" "ruby2.3" "ruby2.2" "ruby2.1" "ruby2" "ruby1.9" "ruby" "ruby1.8"; do - if [ "$RUBY" = "" ] && [ "`$ruby -e 'puts 1' 2>/dev/null`" = "1" ]; then - RUBY="$ruby" + if [ "$RUBY" = "" ] && [ "`$ruby -e 'puts 1' 2>/dev/null`" = "1" ]; then + RUBY="$ruby" fi done fi @@ -314,7 +325,7 @@ if [ "$RUBY" != "" ] && [ "$RUBY" != "-" ]; then RUBYINCLUDE2=`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['rubyarchhdrdir'] || '')"` fi if [ "$RUBYINCLUDE2" = "" ]; then - RUBYINCLUDE2="$RUBYHDRDIR"/`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['arch'] || '')"` + RUBYINCLUDE2="$RUBYHDRDIR"/`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['arch'] || '')"` fi echo " Ruby headers found: $RUBYINCLUDE and $RUBYINCLUDE2" fi @@ -329,11 +340,11 @@ if [ "$RUBY" != "" ] && [ "$RUBY" != "-" ]; then fi -# if not given, locate Python interpreter +# if not given, locate Python interpreter if [ "$PYTHON" = "" ]; then for python in "python3.5" "python3.4" "python3.3" "python3.2" "python3.1" "python3" "python2.8" "python2.7" "python2" "python"; do - if [ "$PYTHON" = "" ] && [ "`$python -c 'print(1)' 2>/dev/null`" = "1" ]; then - PYTHON="$python" + if [ "$PYTHON" = "" ] && [ "`$python -c 'print(1)' 2>/dev/null`" = "1" ]; then + PYTHON="$python" fi done fi @@ -468,11 +479,21 @@ mkdir -p $BUILD . $(dirname $(which $0))/version.sh # qmake needs absolute paths, so we get them now: -BUILD=`readlink -f $BUILD` -BIN=`readlink -f $BIN` +# OSX does not have `readlink -f` command. Use equivalent Perl script. +if [ "$IS_MAC" = "no" ]; then + BUILD=`readlink -f $BUILD` + BIN=`readlink -f $BIN` +else + BUILD=`perl -MCwd -le 'print Cwd::abs_path(shift)' $BUILD` + BIN=`perl -MCwd -le 'print Cwd::abs_path(shift)' $BIN` +fi -if ( gmake -v >/dev/null 2>/dev/null ); then - MAKE_PRG=gmake +if [ "$IS_MAC" = "no" ]; then + if ( gmake -v >/dev/null 2>/dev/null ); then + MAKE_PRG=gmake + else + MAKE_PRG=make + fi else MAKE_PRG=make fi diff --git a/version.sh b/version.sh index 192f149dc..700ecbd8d 100644 --- a/version.sh +++ b/version.sh @@ -5,8 +5,11 @@ KLAYOUT_VERSION="0.25" # The build date -KLAYOUT_VERSION_DATE=$(date --iso-8601) +KLAYOUT_VERSION_DATE=$(date "+%Y-%m-%d") # The short SHA hash of the commit -KLAYOUT_VERSION_REV=$(git rev-parse --short HEAD) +KLAYOUT_VERSION_REV=$(git rev-parse --short HEAD 2>/dev/null) +if [ "$KLAYOUT_VERSION_REV" = "" ]; then + KLAYOUT_VERSION_REV="LatestSourcePackage" +fi From 4dbe28e9faa718293cab4fa2b297c937f4269603 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 26 Nov 2017 22:50:35 +0100 Subject: [PATCH 3/8] MacOS build fix. --- src/db/db/dbHash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/db/dbHash.h b/src/db/db/dbHash.h index 57c9a5f45..28d56fc26 100644 --- a/src/db/db/dbHash.h +++ b/src/db/db/dbHash.h @@ -74,7 +74,7 @@ namespace DB_HASH_NAMESPACE }; #endif -#if defined(_WIN64) +#if defined(_WIN64) || defined(__APPLE__) /** * @brief Specialization missing for long long on WIN64 */ From 11cb5eb99836e043d71b556af010b29624c3f569 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 26 Nov 2017 22:51:36 +0100 Subject: [PATCH 4/8] Qt 5.8.0 compatibility --- scripts/mkqtdecl5/mkqtdecl.conf | 2 ++ src/gsiqt5/gsiDeclQtTypeTraits.h | 1 + 2 files changed, 3 insertions(+) diff --git a/scripts/mkqtdecl5/mkqtdecl.conf b/scripts/mkqtdecl5/mkqtdecl.conf index a704ebc95..ee58b82a4 100644 --- a/scripts/mkqtdecl5/mkqtdecl.conf +++ b/scripts/mkqtdecl5/mkqtdecl.conf @@ -1484,6 +1484,8 @@ final_class "QAccessibleObject" # because navigate cannot be implemented # final_class "QAccessiblePlugin" # because navigate cannot be implemented final_class "QAccessibleWidget" # because navigate cannot be implemented +no_copy_ctor "QIconEngine" + # -------------------------------------------------------------- # QtXml diff --git a/src/gsiqt5/gsiDeclQtTypeTraits.h b/src/gsiqt5/gsiDeclQtTypeTraits.h index eba0986d8..dd68128e6 100644 --- a/src/gsiqt5/gsiDeclQtTypeTraits.h +++ b/src/gsiqt5/gsiDeclQtTypeTraits.h @@ -3418,6 +3418,7 @@ template <> struct type_traits : public type_traits { class QIconEngine_Adaptor; namespace tl { template <> struct type_traits : public type_traits { + typedef tl::false_tag has_copy_constructor; }; } From 9a3c026ef470223dc4f6f67e2cefe5581a4783e8 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Tue, 28 Nov 2017 18:59:22 +0900 Subject: [PATCH 5/8] To add my Bash script for building KLayout on Mac OSX. --- macbuild/macbuildQt4.sh | 21 +++++++++++++++++++++ macbuild/macbuildQt5.sh | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 macbuild/macbuildQt4.sh create mode 100755 macbuild/macbuildQt5.sh diff --git a/macbuild/macbuildQt4.sh b/macbuild/macbuildQt4.sh new file mode 100755 index 000000000..e04c0b150 --- /dev/null +++ b/macbuild/macbuildQt4.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Using Qt 4.8.7 from Mac Ports. +# +# Ruby: OSX native +# Python: OSX native +./build.sh \ + -release \ + -qmake /opt/local/libexec/qt4/bin/qmake \ + -build ./qt4.build.macos-yosemite \ + -bin ./qt4.bin.macos-yosemite \ + -option -j4 \ + -with-qtbinding \ + -qt4 \ + -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby \ + -python /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python \ + -rbinc /System/Library/Frameworks/Ruby.framework/Headers \ + -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib \ + -pyinc /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \ + -pylib /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib 2>&1 \ + | tee macbuildQt4.log diff --git a/macbuild/macbuildQt5.sh b/macbuild/macbuildQt5.sh new file mode 100755 index 000000000..6114a572d --- /dev/null +++ b/macbuild/macbuildQt5.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Using Qt 5.8.0 from Mac Ports. +# +# Ruby: OSX native +# Python: OSX native +./build.sh \ + -release \ + -qmake /opt/local/libexec/qt5/bin/qmake \ + -build ./qt5.build.macos-yosemite \ + -bin ./qt5.bin.macos-yosemite \ + -option -j4 \ + -with-qtbinding \ + -qt5 \ + -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby \ + -python /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python \ + -rbinc /System/Library/Frameworks/Ruby.framework/Headers \ + -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib \ + -pyinc /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \ + -pylib /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib 2>&1 \ + | tee macbuildQt5.log From 14894e6ab75df20656a8419ca11529fd09216e89 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Sun, 10 Dec 2017 16:42:35 +0900 Subject: [PATCH 6/8] Qt::WindowOkButtonHint and Qt::WindowCancelButtonHint are supported for Windows CE. This refs #1. --- src/gsiqt5/gsiDeclQt_4.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gsiqt5/gsiDeclQt_4.cc b/src/gsiqt5/gsiDeclQt_4.cc index b7686491a..fdceadbce 100644 --- a/src/gsiqt5/gsiDeclQt_4.cc +++ b/src/gsiqt5/gsiDeclQt_4.cc @@ -21,9 +21,9 @@ */ /** -* @file gsiDeclQt_4.cc +* @file gsiDeclQt_4.cc * -* DO NOT EDIT THIS FILE. +* DO NOT EDIT THIS FILE. * This file has been created automatically */ @@ -153,9 +153,15 @@ static gsi::Enum decl_Qt_WindowType_Enum ("Qt_WindowType", gsi::enum_const ("MacWindowToolBarButtonHint", Qt::MacWindowToolBarButtonHint, "@brief Enum constant Qt::MacWindowToolBarButtonHint") + gsi::enum_const ("BypassGraphicsProxyWidget", Qt::BypassGraphicsProxyWidget, "@brief Enum constant Qt::BypassGraphicsProxyWidget") + gsi::enum_const ("NoDropShadowWindowHint", Qt::NoDropShadowWindowHint, "@brief Enum constant Qt::NoDropShadowWindowHint") + +#if defined(__APPLE__) + // Qt::WindowOkButtonHint and Qt::WindowCancelButtonHint are supported for Windows CE. + // By Kazunari Sekigawa (December 10, 2017) + gsi::enum_const ("WindowFullscreenButtonHint", Qt::WindowFullscreenButtonHint, "@brief Enum constant Qt::WindowFullscreenButtonHint"), +#else gsi::enum_const ("WindowFullscreenButtonHint", Qt::WindowFullscreenButtonHint, "@brief Enum constant Qt::WindowFullscreenButtonHint") + gsi::enum_const ("WindowOkButtonHint", Qt::WindowOkButtonHint, "@brief Enum constant Qt::WindowOkButtonHint") + gsi::enum_const ("WindowCancelButtonHint", Qt::WindowCancelButtonHint, "@brief Enum constant Qt::WindowCancelButtonHint"), +#endif "@qt\n@brief This class represents the Qt::WindowType enum"); static gsi::QFlagsClass decl_Qt_WindowType_Enums ("Qt_QFlags_WindowType", From bbe87ad5d9098de59a4313aa1592a7d6a8c0aee5 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Mon, 11 Dec 2017 22:45:28 +0900 Subject: [PATCH 7/8] To build klayout 0.25 on MacOS High-Sierra with Qt 5.9.3 from MacPorts. This refs #1. --- macbuild/macbuildQt4.sh | 10 +++++----- macbuild/macbuildQt5.sh | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/macbuild/macbuildQt4.sh b/macbuild/macbuildQt4.sh index e04c0b150..4153ebc0d 100755 --- a/macbuild/macbuildQt4.sh +++ b/macbuild/macbuildQt4.sh @@ -7,15 +7,15 @@ ./build.sh \ -release \ -qmake /opt/local/libexec/qt4/bin/qmake \ - -build ./qt4.build.macos-yosemite \ - -bin ./qt4.bin.macos-yosemite \ - -option -j4 \ + -build ./qt4.build.macos-high-sierra \ + -bin ./qt4.bin.macos-high-sierra \ + -option -j2 \ -with-qtbinding \ -qt4 \ - -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby \ + -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby \ -python /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python \ -rbinc /System/Library/Frameworks/Ruby.framework/Headers \ - -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib \ + -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib \ -pyinc /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \ -pylib /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib 2>&1 \ | tee macbuildQt4.log diff --git a/macbuild/macbuildQt5.sh b/macbuild/macbuildQt5.sh index 6114a572d..32034dc0f 100755 --- a/macbuild/macbuildQt5.sh +++ b/macbuild/macbuildQt5.sh @@ -1,21 +1,21 @@ #!/bin/bash -# Using Qt 5.8.0 from Mac Ports. +# Using Qt 5.9.3 from Mac Ports. # # Ruby: OSX native # Python: OSX native ./build.sh \ -release \ -qmake /opt/local/libexec/qt5/bin/qmake \ - -build ./qt5.build.macos-yosemite \ - -bin ./qt5.bin.macos-yosemite \ - -option -j4 \ + -build ./qt5.build.macos-high-sierra \ + -bin ./qt5.bin.macos-high-sierra \ + -option -j2 \ -with-qtbinding \ -qt5 \ - -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby \ + -ruby /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby \ -python /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python \ -rbinc /System/Library/Frameworks/Ruby.framework/Headers \ - -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib \ + -rblib /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib \ -pyinc /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \ -pylib /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib 2>&1 \ | tee macbuildQt5.log From b49db04fb4ed9f21fb54ed1c0ff4517a6566955d Mon Sep 17 00:00:00 2001 From: klayoutmatthias Date: Mon, 11 Dec 2017 23:19:01 +0000 Subject: [PATCH 8/8] Fixed MacOS build The LLVM STL implementation does not recognize "typedef void iterator_traits" as dummy declaration. It will fall back to an empty traits struct. Using the default "forward_iterator_tag" for the iterator_traits solves this compile issue. --- src/db/db/dbArray.h | 2 +- src/db/db/gsiDeclDbLayoutQuery.cc | 2 +- src/db/db/gsiDeclDbShape.cc | 4 ++-- src/gsi/gsi/gsiIterators.h | 2 ++ src/laybasic/laybasic/gsiDeclLayLayoutView.cc | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/db/db/dbArray.h b/src/db/db/dbArray.h index 083a02843..253a043bb 100644 --- a/src/db/db/dbArray.h +++ b/src/db/db/dbArray.h @@ -1208,7 +1208,7 @@ struct array_iterator typedef void pointer_type; typedef void difference_type; typedef void pointer; - typedef void iterator_category; + typedef std::forward_iterator_tag iterator_category; /** * @brief The default constructor diff --git a/src/db/db/gsiDeclDbLayoutQuery.cc b/src/db/db/gsiDeclDbLayoutQuery.cc index 5f2b47ec2..0c417e0fc 100644 --- a/src/db/db/gsiDeclDbLayoutQuery.cc +++ b/src/db/db/gsiDeclDbLayoutQuery.cc @@ -70,7 +70,7 @@ struct LayoutQueryIteratorWrapper { typedef db::LayoutQueryIterator &reference; // Dummy declarations - typedef void iterator_category; + typedef std::forward_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; diff --git a/src/db/db/gsiDeclDbShape.cc b/src/db/db/gsiDeclDbShape.cc index 69b926d5d..96dbf44c1 100644 --- a/src/db/db/gsiDeclDbShape.cc +++ b/src/db/db/gsiDeclDbShape.cc @@ -954,7 +954,7 @@ struct ConvertingIteratorWrapper typedef T value_type; typedef T reference; typedef void pointer; - typedef void iterator_category; + typedef std::forward_iterator_tag iterator_category; ConvertingIteratorWrapper (double dbu, const I &b, const I &e) : m_b (b), m_e (e), m_dbu (dbu) @@ -989,7 +989,7 @@ struct ConvertingFreeIteratorWrapper typedef T value_type; typedef T reference; typedef void pointer; - typedef void iterator_category; + typedef std::forward_iterator_tag iterator_category; ConvertingFreeIteratorWrapper (double dbu, const I &b) : m_b (b), m_dbu (dbu) diff --git a/src/gsi/gsi/gsiIterators.h b/src/gsi/gsi/gsiIterators.h index 35c53253f..87d69fdcd 100644 --- a/src/gsi/gsi/gsiIterators.h +++ b/src/gsi/gsi/gsiIterators.h @@ -28,6 +28,8 @@ #include "tlTypeTraits.h" #include "gsiSerialisation.h" +#include + // For a comprehensive documentation see gsi.h namespace gsi diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc index 0d28c0693..3ce4c3c90 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc @@ -320,7 +320,7 @@ namespace { typedef lay::LayerPropertiesNodeRef value_type; typedef lay::LayerPropertiesNodeRef reference; // Dummy declarations required for std::iterator_traits - typedef void iterator_category; + typedef std::forward_iterator_tag iterator_category; typedef void difference_type; typedef void pointer;