Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Kazunari Sekigawa 2018-02-13 10:53:46 +09:00
commit 095115956c
2411 changed files with 11293 additions and 4645 deletions

View File

@ -9,14 +9,10 @@ For more details see http://www.klayout.org.
## Building requirements
* Qt 4.8 or later (4.6 with some restrictions)
* gcc 4.x or later
* Qt 4.7 or later (4.6 with some restrictions) or Qt 5
* gcc 4.6 or later or clang 3.8 or later
Here is a list of packages required for various Linux flavors:
* CentOS (6, 7): gcc gcc-c++ make qt qt-devel ruby ruby-devel python python-devel
* OpenSuSE: (13.2, 41.1): gcc gcc-c++ make libqt4 libqt4-devel ruby ruby-devel python3 python3-devel
* Ubuntu (14.04, 16.10): gcc g++ make libz-dev libqt4-dev-bin libqt4-dev ruby ruby-dev python3 python3-dev
For more build instructions see http://www.klayout.de/build.html.
## Build options

View File

@ -2,7 +2,7 @@
#
# KLayout Layout Viewer
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

30
macbuild/LICENSE Normal file
View File

@ -0,0 +1,30 @@
The following two files are derivative works of:
https://github.com/andreyvit/create-dmg.git
(1) makeDMG4mac.py
(2) Resources/template-KLayoutDMG.applescript
The original "LICENSE" file is quoted below.
===============================================================================
The MIT License (MIT)
Copyright (c) 2008-2014 Andrey Tarantsov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===============================================================================

87
macbuild/ReadMe.md Normal file
View File

@ -0,0 +1,87 @@
Relevant KLayout version: 0.25.1
# 1. Introduction
This directory "macbuild" contains different files required for building KLayout (http://www.klayout.de/) version 0.25 or later for different Mac OSXs 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/
```
### IMPORTANT
```
* Please DO NOT USE "Qt 5.10.0" which is problematic in showing your design in the main canvas.
* Please USE "Qt 5.9.x" instead (5.9.3 is recommended).
* Building with Qt4 will lead to some compile errors.
```
Also by default, supported script languages, i.e, Ruby and Python, are those standard ones bundled with the OS.
# 2. Non-OS-standard script language support
You may want to use a non-OS-standard script language such as Python 3.6 from Anaconda2 (https://www.anaconda.com/download/#macos) in combination with KLayout.
Since Anaconda2 is a popular Python development environment, this is worth trying.
Unfortunately, however, some dynamic linkage problems are observed as of today.
On the other hand, Python 3.6 provided by Mac Ports is usable.
Please try this (refer to 3B below) if you feel it's useful.
# 3. Use-cases
### 3A. Debug build using the OS-standard script languages
1. Make a symbolic link from the parent directory (where 'build.sh' exists) to
'build4mac.py', that is,
```
build4mac.py -> macbuild/build4mac.py
```
2. Invoke 'build4mac.py' with appropriate options ("-d" 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. PLUS "-y" to deploy executables and libraries (including Qt's frameworks) under "klayout.app" bundle. The buddy command line tools (strm*) will also be deployed.
```
$ ./build4mac.py -d -y
```
5. Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your "/Applications" directory for installation.
### 3B. Release build using the non-OS-standard Ruby 2.4 and Python 3.6 both from MacPorts
1. Make a symbolic link from the parent directory (where 'build.sh' exists) to 'build4mac.py', that is,
```
build4mac.py -> macbuild/build4mac.py
```
2. Invoke 'build4mac.py' with appropriate options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -r mp24 -p mp36
```
3. Confirm successful build.
4. Run 'build4mac.py' again with the same options used in 2. PLUS "-Y" to deploy executables and libraries under "klayout.app" bundle. The buddy command line tools (strm*) will also be deployed.
```
$ ./build4mac.py -r mp24 -p mp36 -Y
```
* [-Y|--DEPOLY] option deploys KLayout's dylibs and executables only.
That is, paths to other modules (Ruby, Python, and Qt5 Frameworks) remain unchanged (absolute paths in your development environment).
5. Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your "/Applications" directory for installation.
----
# 4. Making a DMG installer
You can make a DMG installer using another Python script 'makeDMG4mac.py'.
This script requires a directory generated by 'build4mac.py' with [-y|-Y] option (refer to 3A.4 & 3B.4)
1. Make a symbolic link from the parent directory (where 'build.sh' exists) to 'makeDMG4mac.py', that is,
```
makeDMG4mac.py -> macbuild/makeDMG4mac.py
```
2. Invoke 'makeDMG4mac.py' with -p and -m options, for example,
```
$ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m
```
By: Kazzz (January 16, 2018)
[End of File]

80
macbuild/ReadMe.txt Normal file
View File

@ -0,0 +1,80 @@
<< Draft Version 0.004>>
Relevant KLayout version: 0.25.1
1. Introduction:
This directory "macbuild" contains different files required for building KLayout (http://www.klayout.de/)
version 0.25 or later for different Mac OSXs 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/
<IMPORTANT>:
* Please DO NOT USE "5.10.0" which is problematic in showing your design in the main canvas.
* Please USE "5.9.x" instead (5.9.3 is recommended).
* Building with Qt4 will lead to some compile errors.
Also by default, supported script languages, i.e, Ruby and Python, are those
standard ones bundled with the OS.
2. Non-OS-standard script language support:
You may want to use a non-OS-standard script language such as Python 3.6 from
Anaconda2 (https://www.anaconda.com/download/#macos) in combination with KLayout.
Since Anaconda2 is a popular Python development environment, this is worth trying.
Unfortunately, however, some dynamic linkage problems are observed as of today.
On the other hand, Python 3.6 provided by Mac Ports is usable.
Please try this (refer to 3B below) if you feel it's useful.
3. Use-cases:
3A. Debug build using the OS-standard script languages:
(1) Make a symbolic link from the parent directory (where 'build.sh' exists) to
'build4mac.py', that is,
build4mac.py -> macbuild/build4mac.py
(2) Invoke 'build4mac.py' with appropriate options ("-d" 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) PLUS "-y"
to deploy executables and libraries (including Qt's frameworks) under "klayout.app" bundle.
The buddy command line tools (strm*) will also be deployed.
$ ./build4mac.py -d -y
(5) Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your
"/Applications" directory for installation.
3B. Release build using the non-OS-standard Ruby 2.4 and Python 3.6 both from MacPorts:
(1) Make a symbolic link from the parent directory (where 'build.sh' exists) to
'build4mac.py', that is,
build4mac.py -> macbuild/build4mac.py
(2) Invoke 'build4mac.py' with appropriate options:
$ cd /where/'build.sh'/exists
$ ./build4mac.py -r mp24 -p mp36
(3) Confirm successful build.
(4) Run 'build4mac.py' again with the same options used in (2) PLUS "-Y"
to deploy executables and libraries under "klayout.app" bundle.
The buddy command line tools (strm*) will also be deployed.
$ ./build4mac.py -r mp24 -p mp36 -Y
* [-Y|--DEPOLY] option deploys KLayout's dylibs and executables only.
That is, paths to other modules (Ruby, Python, and Qt5 Frameworks)
remain unchanged (absolute paths in your development environment).
(5) Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your
"/Applications" directory for installation.
4. Making a DMG installer
You can make a DMG installer using another Python script 'makeDMG4mac.py'.
This script requires a directory generated by 'build4mac.py' with [-y|-Y] option (refer to 3A.4 & 3B.4)
(1) Make a symbolic link from the parent directory (where 'build.sh' exists) to 'makeDMG4mac.py', that is,
makeDMG4mac.py -> macbuild/makeDMG4mac.py
(2) Invoke 'makeDMG4mac.py' with -p and -m options, for example,
$ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m
By: Kazzz (January 16, 2018)
[End of File]

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NOTE</key>
<string>This file was originally generated by Qt/QMake.</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE}</string>
<key>CFBundleIconFile</key>
<string>${ICONFILE}</string>
<key>CFBundleIdentifier</key>
<string>de.klayout</string>
<key>CFBundleName</key>
<string>${BUNDLENAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

View File

@ -0,0 +1,36 @@
#!/bin/bash
#-------------------------------------------------------------------------------------
# File: KLayoutEditor.sh
#
# Descriptions:
# This is to invoke "klayout" with Qt5 distributed as a binary package for Mac
# in "editor" mode.
#
# You may specify style and other options as you like by setting
# "opt_style" and "opt_others" variable in this script.
#-------------------------------------------------------------------------------------
#---------------------------------------------------------
# With "-n" option, multiple instances can be invoked
#---------------------------------------------------------
myKLayout="open -n -a /Applications/klayout.app --args "
#===================================================
# Pass command line parameters to klayout
# vvvvvvvvvv You may edit the block below vvvvvvvvvv
opt_mode="-e"
opt_style="-style=fusion"
opt_others=""
# ^^^^^^^^^^ You may edit the block above ^^^^^^^^^^
#===================================================
options="$opt_mode $opt_style $opt_others"
targetfiles=$@
echo "### Starting KLayout in Editor mode..."
$myKLayout $options $targetfiles &
exit 0
#-------------------
# End of file
#-------------------

Binary file not shown.

View File

@ -0,0 +1,36 @@
#!/bin/bash
#-------------------------------------------------------------------------------------
# File: KLayoutViewer.sh
#
# Descriptions:
# This is to invoke "klayout" with Qt5 distributed as a binary package for Mac
# in "viewer" mode.
#
# You may specify style and other options as you like by setting
# "opt_style" and "opt_others" variable in this script.
#-------------------------------------------------------------------------------------
#---------------------------------------------------------
# With "-n" option, multiple instances can be invoked
#---------------------------------------------------------
myKLayout="open -n -a /Applications/klayout.app --args "
#===================================================
# Pass command line parameters to klayout
# vvvvvvvvvv You may edit the block below vvvvvvvvvv
opt_mode="-ne"
opt_style="-style=windows"
opt_others=""
# ^^^^^^^^^^ You may edit the block above ^^^^^^^^^^
#===================================================
options="$opt_mode $opt_style $opt_others"
targetfiles=$@
echo "### Starting KLayout in Viewer mode..."
$myKLayout $options $targetfiles &
exit 0
#-------------------
# End of file
#-------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,116 @@
-------------------------------------------------------------------------------------------------
(*
* Template File:
* macbuild/Resources/template-KLayoutDMG.applescript
*
* Actual AppleScrip File to be generated:
* macbuild/Resources/KLayoutDMG.applescript
*
* Description:
* A template AppleScript to make a fancy DMG installer of KLayout
* (http://www.klayout.de/index.php) bundles.
* "makeDMG4mac.py" will read this template and generate the actual AppleScript to execute.
* Values to be found and replaced by "makeDMG4mac.py" are marked by ${KEYWORD}.
*
* The background image was designed using Logoist2 (http://www.syniumsoftware.com/en/logoist)
* and exported to a PNG file of 1000 x 700 pix size.
*-----------------------------------------------------------------------------------------------
* This is a derivative work of Ref. 2) below. Refer to "macbuild/LICENSE" file.
* Ref.
* 1) https://el-tramo.be/guides/fancy-dmg/
* 2) https://github.com/andreyvit/create-dmg.git
*)
-------------------------------------------------------------------------------------------------
on run (volumeName) -- most likely, the volume name is "KLayout"
tell application "Finder"
tell disk (volumeName as string)
-- [1] Open the volume
open
-- [2] Set the key coordinates and windows size
-- The size of given background PNG image is 1000 x 700 pix
-- ORGX = [50] pix
-- ORGY = [100] pix
-- WIN_WIDTH = [1000] pix
-- WIN_HEIGHT = [700] pix
set posMargin to 50
set negMargin to 10
set theTopLeftX to ${ORGX}
set theTopLeftY to ${ORGY}
set theWidth to ${WIN_WIDTH}
set theHeight to ${WIN_HEIGHT}
set theBottomRightX to (theTopLeftX + theWidth + posMargin)
set theBottomRightY to (theTopLeftY + theHeight + posMargin)
-- [3] Set the full path to .DS_Store file
set dotDSStore to "${FULL_PATH_DS_STORE}"
-- [4] Set global view options
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set statusbar visible to false
set bounds to {theTopLeftX, theTopLeftY, theBottomRightX, theBottomRightY}
set position of every item to {theTopLeftX + 150, theTopLeftY + 350}
end tell
-- [5] Set icon view options
set opts to the icon view options of container window
tell opts
set icon size to 80
set text size to 16
set arrangement to not arranged
end tell
-- [6] Set the background PNG image (1000 x 700 pix) file name stored
set background picture of opts to file ".background:${BACKGROUND_PNG_FILE}"
-- [7] Set positions of each icon
-- ITEM_1 = klayout.app {960, 140}
-- ITEM_2 = klayout.scripts {610, 140}
-- ITEM_3 = Applications {790, 140}
set position of item "${ITEM_1}" to {${X1}, ${Y1}}
set position of item "${ITEM_2}" to {${X2}, ${Y2}}
set position of item "${ITEM_3}" to {${X3}, ${Y3}}
-- [8] Update the contents of container
close
open
update without registering applications
-- [9] Force save the negatively resized window size
delay 2
tell container window
set statusbar visible to false
set bounds to {theTopLeftX, theTopLeftY, theBottomRightX - negMargin, theBottomRightY - negMargin}
end tell
update without registering applications
end tell
-- [10] Restore back the original window size
delay 2
tell disk (volumeName as string)
tell container window
set statusbar visible to false
set bounds to {theTopLeftX, theTopLeftY, theBottomRightX, theBottomRightY}
end tell
update without registering applications
end tell
-- [11] Wait for some time so that "Finder" can complete writing to .DS_Store file
delay 3
set elapsedTime to 0
set ejected to false
repeat while ejected is false
delay 1
set elapsedTime to elapsedTime + 1
if (do shell script "${CHECK_BASH}") = "0" then set ejected to true
end repeat
log "### Elapsed <" & elapsedTime & "> [sec] for writing .DS_Store file."
end tell
end run
--
-- End of file
--

901
macbuild/build4mac.py Executable file
View File

@ -0,0 +1,901 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/build4mac.py"
#
# The top Python script for building KLayout (http://www.klayout.de/index.php)
# version 0.25 or later on different Apple Mac OSX platforms.
#===============================================================================
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
import sys
import os
import shutil
import glob
import platform
import optparse
import subprocess
#-------------------------------------------------------------------------------
## To import global dictionaries of different modules and utility functions
#-------------------------------------------------------------------------------
mydir = os.path.dirname(os.path.abspath(__file__))
sys.path.append( mydir + "/macbuild" )
from build4mac_env import *
from build4mac_util import *
#-------------------------------------------------------------------------------
## To set global variables including present directory and platform info.
#-------------------------------------------------------------------------------
def SetGlobals():
global ProjectDir # project directory where "build.sh" exists
global Usage # string on usage
global BuildBash # the main build Bash script
global Platform # platform
global ModuleQt # Qt module to be used
global ModuleRuby # Ruby module to be used
global ModulePython # Python module to be used
global NonOSStdLang # True if non-OS-standard language is chosen
global NoQtBindings # True if not creating Qt bindings for Ruby scripts
global MakeOptions # options passed to `make`
global DebugMode # True if debug mode build
global CheckComOnly # True if only for checking the command line parameters to "build.sh"
global DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles
global DeploymentP # True if partially deploy the binaries excluding Qt's Frameworks
global DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool
global Version # KLayout's version
# auxiliary variables on platform
global System # 6-tuple from platform.uname()
global Node # - do -
global Release # - do -
global Version # - do -
global Machine # - do -
global Processor # - do -
global Bit # machine bit-size
Usage = "\n"
Usage += "--------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'build4mac.py' >>\n"
Usage += " for building KLayout 0.25 or later on different Apple Mac OSX platforms.\n"
Usage += "\n"
Usage += "$ [python] ./build4mac.py \n"
Usage += " option & argument : descriptions | default value\n"
Usage += " ----------------------------------------------------------------------------------+---------------\n"
Usage += " : * key type names below are case insensitive * | \n"
Usage += " : 'nil' = not to support the script language | \n"
Usage += " : 'Sys' = using the OS standard script language | \n"
Usage += " : Refer to 'macbuild/build4mac_env.py' for details | \n"
Usage += " [-q|--qt <type>] : type=['Qt4MacPorts', 'Qt5MacPorts'] | qt5macports \n"
Usage += " [-r|--ruby <type>] : type=['nil', 'Sys', 'Src24', 'MP24'] | sys \n"
Usage += " [-p|--python <type>] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36'] | sys \n"
Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n"
Usage += " [-m|--make <option>] : option passed to 'make' | -j4 \n"
Usage += " [-d|--debug] : enable debug mode build | disabled \n"
Usage += " [-c|--checkcom] : check command line and exit without building | disabled \n"
Usage += " [-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled \n"
Usage += " [-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled \n"
Usage += " : from the source code and use the tools in the same machine | \n"
Usage += " : ! After confirmation of successful build of | \n"
Usage += " : KLayout, rerun this script with BOTH: | \n"
Usage += " : 1) the same options used for building AND | \n"
Usage += " : 2) <-y|--deploy> OR <-Y|--DEPLOY> | \n"
Usage += " : optionally with [-v|--verbose <0-3>] | \n"
Usage += " [-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1 \n"
Usage += " : 0 = no output, 1 = error/warning (default), | \n"
Usage += " : 2 = normal, 3 = debug | \n"
Usage += " [-?|--?] : print this usage and exit | disabled \n"
Usage += "--------------------------------------------------------------------------------------------------------\n"
ProjectDir = os.getcwd()
BuildBash = "./build.sh"
(System, Node, Release, Version, Machine, Processor) = platform.uname()
if not System == "Darwin":
print("")
print( "!!! Sorry. Your system <%s> looks like non-Mac" % System, file=sys.stderr )
print(Usage)
quit()
release = int( Release.split(".")[0] ) # take the first of ['14', '5', '0']
if release == 14:
Platform = "Yosemite"
elif release == 15:
Platform = "ElCapitan"
elif release == 16:
Platform = "Sierra"
elif release == 17:
Platform = "HighSierra"
else:
Platform = ""
print("")
print( "!!! Sorry. Unsupported major OS release <%d>" % release, file=sys.stderr )
print(Usage)
quit()
if not Machine == "x86_64":
print("")
print( "!!! Sorry. Only x86_64 architecture machine is supported but found <%s>" % Machine, file=sys.stderr )
print(Usage)
quit()
# default modules
ModuleQt = "Qt5MacPorts"
if Platform == "Yosemite":
ModuleRuby = "RubyYosemite"
ModulePython = "PythonYosemite"
elif Platform == "ElCapitan":
ModuleRuby = "RubyElCapitan"
ModulePytyon = "PythonElCapitan"
elif Platform == "Sierra":
ModuleRuby = "RubySierra"
ModulePython = "PythonSierra"
elif Platform == "HighSierra":
ModuleRuby = "RubyHighSierra"
ModulePython = "PythonHighSierra"
else:
ModuleRuby = "nil"
ModulePython = "nil"
NonOSStdLang = False
NoQtBindings = False
MakeOptions = "-j4"
DebugMode = False
CheckComOnly = False
DeploymentF = False
DeploymentP = False
DeployVerbose = 1
Version = GetKLayoutVersionFrom( "./version.sh" )
#------------------------------------------------------------------------------
## To get command line parameters
#------------------------------------------------------------------------------
def ParseCommandLineArguments():
global Usage
global Platform
global ModuleQt
global ModuleRuby
global ModulePython
global NonOSStdLang
global NoQtBindings
global MakeOptions
global DebugMode
global CheckComOnly
global DeploymentF
global DeploymentP
global DeployVerbose
p = optparse.OptionParser( usage=Usage )
p.add_option( '-q', '--qt',
dest='type_qt',
help="Qt type=['Qt4MacPorts', 'Qt5MacPorts']" )
p.add_option( '-r', '--ruby',
dest='type_ruby',
help="Ruby type=['nil', 'Sys', 'Src24', 'MP24']" )
p.add_option( '-p', '--python',
dest='type_python',
help="Python type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36']" )
p.add_option( '-n', '--noqtbinding',
action='store_true',
dest='no_qt_binding',
default=False,
help="do not create Qt bindings for Ruby scripts" )
p.add_option( '-m', '--make',
dest='make_option',
help="options passed to `make`" )
p.add_option( '-d', '--debug',
action='store_true',
dest='debug_build',
default=False,
help="enable debug mode build" )
p.add_option( '-c', '--checkcom',
action='store_true',
dest='check_command',
default=False,
help="check command line and exit without building" )
p.add_option( '-y', '--deploy',
action='store_true',
dest='deploy_full',
default=False,
help="fully deploy built binaries" )
p.add_option( '-Y', '--DEPLOY',
action='store_true',
dest='deploy_partial',
default=False,
help="deploy built binaries when non-OS-standard script language is chosen" )
p.add_option( '-v', '--verbose',
dest='deploy_verbose',
help="verbose level of `macdeployqt` tool" )
p.add_option( '-?', '--??',
action='store_true',
dest='checkusage',
default=False,
help='check usage' )
p.set_defaults( type_qt = "qt5macports",
type_ruby = "sys",
type_python = "sys",
no_qt_binding = False,
make_option = "-j4",
debug_build = False,
check_command = False,
deploy_full = False,
deploy_partial = False,
deploy_verbose = "1",
checkusage = False )
opt, args = p.parse_args()
if (opt.checkusage):
print(Usage)
quit()
# Determine Qt type
candidates = [ i.upper() for i in ['Qt4MacPorts', 'Qt5MacPorts'] ]
ModuleQt = ""
index = 0
for item in candidates:
if opt.type_qt.upper() == item:
if index == 0:
ModuleQt = 'Qt4MacPorts'
break
elif index == 1:
ModuleQt = 'Qt5MacPorts'
break
else:
index += 1
if ModuleQt == "":
print("")
print( "!!! Unknown Qt type", file=sys.stderr )
print(Usage)
quit()
# By default, OS-standard script languages (Ruby and Python) are used
NonOSStdLang = False
# Determine Ruby type
candidates = [ i.upper() for i in ['nil', 'Sys', 'Src24', 'MP24'] ]
ModuleRuby = ""
index = 0
for item in candidates:
if opt.type_ruby.upper() == item:
if index == 0:
ModuleRuby = 'nil'
break
elif index == 1:
if Platform == "Yosemite":
ModuleRuby = 'RubyYosemite'
elif Platform == "ElCapitan":
ModuleRuby = 'RubyElCapitan'
elif Platform == "Sierra":
ModuleRuby = 'RubySierra'
elif Platform == "HighSierra":
ModuleRuby = 'RubyHighSierra'
else:
ModuleRuby = ''
break
elif index == 2:
ModuleRuby = 'Ruby24SrcBuild'
NonOSStdLang = True
elif index == 3:
ModuleRuby = 'Ruby24MacPorts'
NonOSStdLang = True
else:
index += 1
if ModuleRuby == "":
print("")
print( "!!! Unknown Ruby type", file=sys.stderr )
print(Usage)
quit()
# Determine Python type
candidates = [ i.upper() for i in ['nil', 'Sys', 'Ana27', 'Ana36', 'MP36'] ]
ModulePython = ""
index = 0
for item in candidates:
if opt.type_python.upper() == item:
if index == 0:
ModulePython = 'nil'
break
elif index == 1:
if Platform == "Yosemite":
ModulePython = 'PythonYosemite'
elif Platform == "ElCapitan":
ModulePython = 'PythonElCapitan'
elif Platform == "Sierra":
ModulePython = 'PythonSierra'
elif Platform == "HighSierra":
ModulePython = 'PythonHighSierra'
else:
ModulePython = ''
break
elif index == 2:
ModulePython = 'Anaconda27'
NonOSStdLang = True
elif index == 3:
ModulePython = 'Anaconda36'
NonOSStdLang = True
elif index == 4:
ModulePython = 'Python36MacPorts'
NonOSStdLang = True
else:
index += 1
if ModulePython == "":
print("")
print( "!!! Unknown Python type", file=sys.stderr )
print(Usage)
quit()
NoQtBindings = opt.no_qt_binding
MakeOptions = opt.make_option
DebugMode = opt.debug_build
CheckComOnly = opt.check_command
DeploymentF = opt.deploy_full
DeploymentP = opt.deploy_partial
if DeploymentF and DeploymentP:
print("")
print( "!!! Choose either [-y|--deploy] or [-Y|--DEPLOY]", file=sys.stderr )
print(Usage)
quit()
DeployVerbose = int(opt.deploy_verbose)
if not DeployVerbose in [0, 1, 2, 3]:
print("")
print( "!!! Unsupported verbose level passed to `macdeployqt` tool", file=sys.stderr )
print(Usage)
quit()
if not DeploymentF and not DeploymentP:
target = "%s %s %s" % (Platform, Release, Machine)
modules = "Qt=%s, Ruby=%s, Python=%s" % (ModuleQt, ModuleRuby, ModulePython)
message = "### You are going to build KLayout\n for <%s>\n with <%s>...\n"
print("")
print( message % (target, modules) )
#------------------------------------------------------------------------------
## To run the main Bash script "build.sh" with appropriate options
#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
def RunMainBuildBash():
global ProjectDir
global Platform
global BuildBash
global ModuleQt
global ModuleRuby
global ModulePython
global NoQtBindings
global MakeOptions
global DebugMode
global CheckComOnly
global DeploymentF
global MacPkgDir # relative path to package directory
global MacBinDir # relative path to binary directory
global MacBuildDir # relative path to build directory
global MacBuildLog # relative path to build log file
global AbsMacPkgDir # absolute path to package directory
global AbsMacBinDir # absolute path to binary directory
global AbsMacBuildDir # absolute path to build directory
global AbsMacBuildLog # absolute path to build log file
#-----------------------------------------------------
# [1] Set parameters passed to the main Bash script
#-----------------------------------------------------
parameters = ""
# (A) debug or release
if DebugMode:
mode = "debug"
parameters += " -debug"
else:
mode = "release"
parameters += " -release"
# (B) Qt4 or Qt5
if ModuleQt == 'Qt4MacPorts':
parameters += " \\\n -qt4"
parameters += " \\\n -qmake %s" % Qt4MacPorts['qmake']
MacPkgDir = "./qt4.pkg.macos-%s-%s" % (Platform, mode)
MacBinDir = "./qt4.bin.macos-%s-%s" % (Platform, mode)
MacBuildDir = "./qt4.build.macos-%s-%s" % (Platform, mode)
MacBuildLog = "./qt4.build.macos-%s-%s.log" % (Platform, mode)
AbsMacPkgDir = "%s/qt4.pkg.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBinDir = "%s/qt4.bin.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBuildDir = "%s/qt4.build.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBuildLog = "%s/qt4.build.macos-%s-%s.log" % (ProjectDir, Platform, mode)
parameters += " \\\n -bin %s" % MacBinDir
parameters += " \\\n -build %s" % MacBuildDir
elif ModuleQt == 'Qt5MacPorts':
parameters += " \\\n -qt5"
parameters += " \\\n -qmake %s" % Qt5MacPorts['qmake']
MacPkgDir = "./qt5.pkg.macos-%s-%s" % (Platform, mode)
MacBinDir = "./qt5.bin.macos-%s-%s" % (Platform, mode)
MacBuildDir = "./qt5.build.macos-%s-%s" % (Platform, mode)
MacBuildLog = "./qt5.build.macos-%s-%s.log" % (Platform, mode)
AbsMacPkgDir = "%s/qt5.pkg.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBinDir = "%s/qt5.bin.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBuildDir = "%s/qt5.build.macos-%s-%s" % (ProjectDir, Platform, mode)
AbsMacBuildLog = "%s/qt5.build.macos-%s-%s.log" % (ProjectDir, Platform, mode)
parameters += " \\\n -bin %s" % MacBinDir
parameters += " \\\n -build %s" % MacBuildDir
# (C) want Qt bindings with Ruby scripts?
if NoQtBindings:
parameters += " \\\n -without-qtbinding"
else:
parameters += " \\\n -with-qtbinding"
# (D) options to `make` tool
if not MakeOptions == "":
parameters += " \\\n -option %s" % MakeOptions
# (E) about Ruby
if ModuleRuby == "nil":
parameters += " \\\n -noruby"
else:
parameters += " \\\n -ruby %s" % RubyDictionary[ModuleRuby]['exe']
parameters += " \\\n -rbinc %s" % RubyDictionary[ModuleRuby]['inc']
parameters += " \\\n -rblib %s" % RubyDictionary[ModuleRuby]['lib']
# (F) about Python
if ModulePython == "nil":
parameters += " \\\n -nopython"
else:
parameters += " \\\n -python %s" % PythonDictionary[ModulePython]['exe']
parameters += " \\\n -pyinc %s" % PythonDictionary[ModulePython]['inc']
parameters += " \\\n -pylib %s" % PythonDictionary[ModulePython]['lib']
#-----------------------------------------------------
# [2] Make the consolidated command line
#-----------------------------------------------------
command = "time"
command += " \\\n %s" % BuildBash
command += parameters
command += " 2>&1 | tee %s" % MacBuildLog
if CheckComOnly:
print(command)
quit()
#-----------------------------------------------------
# [3] Invoke the main Bash script; takes time:-)
#-----------------------------------------------------
if DeploymentF:
return 0
elif DeploymentP:
return 0
else:
myscript = "build4mac.py"
if subprocess.call( command, shell=True ) != 0:
print( "", file=sys.stderr )
print( "-------------------------------------------------------------", file=sys.stderr )
print( "!!! <%s>: failed to build KLayout" % myscript, file=sys.stderr )
print( "-------------------------------------------------------------", file=sys.stderr )
print( "", file=sys.stderr )
return 1
else:
print( "", file=sys.stderr )
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr )
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
print( "", file=sys.stderr )
return 0
#------------------------------------------------------------------------------
## For making a bundle (klayout.app), deploy built binaries and libraries
# on which those binaries depend.
#
# Reference: "Deploying an Application on Mac OS X" of Qt Assistant.
#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
def DeployBinariesForBundle():
global ProjectDir
global ModuleQt
global NonOSStdLang
global DeploymentF
global DeploymentP
global MacPkgDir
global MacBinDir
global MacBuildDir
global MacBuildLog
global AbsMacPkgDir
global AbsMacBinDir
global AbsMacBuildDir
global AbsMacBuildLog
global Version
global DeployVerbose
print("")
print( "##### Started deploying libraries and executables for <klayout.app> #####" )
print( " [1] Checking the status of working directory ..." )
#-------------------------------------------------------------
# [1] Check the status of working directory
#-------------------------------------------------------------
os.chdir(ProjectDir)
if not DeploymentF and not DeploymentP:
return 1
if DeploymentF and NonOSStdLang:
print( "!!! You chose <-y|--deploy> while using non-OS-standard script language.", file=sys.stderr )
print( " Use <-Y|--DEPLOY> instead", file=sys.stderr )
return 1
if not os.path.isfile(MacBuildLog):
print( "!!! Build log file <%s> does not present !!!" % MacBuildLog, file=sys.stderr )
return 1
if not os.path.isdir(MacBuildDir):
print( "!!! Build directory <%s> does not present !!!" % MacBuildDir, file=sys.stderr )
return 1
if not os.path.isdir(MacBinDir):
print( "!!! Binary directory <%s> does not present !!!" % MacBinDir, file=sys.stderr )
return 1
print( " [2] Creating a new empty directory <%s> for deployment ..." % MacPkgDir )
#-------------------------------------------------------------
# [2] Create a new empty directory for deploying binaries
#-------------------------------------------------------------
os.chdir(ProjectDir)
if os.path.isfile(MacPkgDir):
os.remove(MacPkgDir)
if os.path.isdir(MacPkgDir):
shutil.rmtree(MacPkgDir)
os.mkdir(MacPkgDir)
print( " [3] Creating the standard directory structure for 'klayout.app' bundle ..." )
#-----------------------------------------------------------------
# [3] Create the directory skeleton for "klayout.app" bundle
# and command line buddy tools such as "strm2cif".
# They are stored in the directory structure below.
#
# klayout.app/+
# +-- Contents/+
# +-- Info.plist
# +-- PkgInfo
# +-- Resources/+
# | +-- 'klayout.icns'
# +-- Frameworks/+
# | +-- '*.framework'
# | +-- '*.dylib'
# +-- MacOS/+
# | +-- 'klayout'
# +-- Buddy/+
# +-- 'strm2cif'
# +-- 'strm2dxf'
# :
# +-- 'strmxor'
#-----------------------------------------------------------------
targetDir0 = "%s/klayout.app/Contents" % AbsMacPkgDir
targetDirR = targetDir0 + "/Resources"
targetDirF = targetDir0 + "/Frameworks"
targetDirM = targetDir0 + "/MacOS"
targetDirB = targetDir0 + "/Buddy"
os.makedirs(targetDirR)
os.makedirs(targetDirF)
os.makedirs(targetDirM)
os.makedirs(targetDirB)
print( " [4] Copying KLayout's dynamic link libraries to 'Frameworks' ..." )
#-------------------------------------------------------------------------------
# [4] Copy KLayout's dynamic link libraries to "Frameworks/" and create
# the library dependency dictionary.
# <<< Do this job in "Frameworks/" >>>
#
# Note:
# KLayout's dynamic link library is built as below:
# (1) libklayout_lay.0.25.0.dylib
# (2) libklayout_lay.0.25.dylib -> libklayout_lay.0.25.0.dylib
# (3) libklayout_lay.0.dylib -> libklayout_lay.0.25.0.dylib
# (4) libklayout_lay.dylib -> libklayout_lay.0.25.0.dylib
# where,
# (1) is an ordinary file with full version number 'major.minor.teeny'
# between "library_name."='libklayout_lay.' and '.dylib'
# (2) is a symbolic link with 'major.minor' version number
# (3) is a symbolic link with 'major' version number
# (4) is a symbolic link without version number number
#
# The dynamic linker tries to find a library name in style (3) as shown
# in the example below.
#
# Example:
# MacBookPro(1)$ otool -L klayout
# klayout:
# :
# :
# libklayout_tl.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_gsi.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_db.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# :
#-------------------------------------------------------------------------------
os.chdir( targetDirF )
dynamicLinkLibs = glob.glob( AbsMacBinDir + "/*.dylib" )
depDicOrdinary = {} # inter-library dependency dictionary
for item in dynamicLinkLibs:
if os.path.isfile(item) and not os.path.islink(item):
#-------------------------------------------------------------------
# (A) Copy an ordinary *.dylib file here by changing the name
# to style (3) and set its mode to 0755 (sanity check).
#-------------------------------------------------------------------
fullName = os.path.basename(item).split('.')
# e.g. [ 'libklayout_lay', '0', '25', '0', 'dylib' ]
nameStyle3 = fullName[0] + "." + fullName[1] + ".dylib"
shutil.copy2( item, nameStyle3 )
os.chmod( nameStyle3, 0755 )
#-------------------------------------------------------------------
# (B) Then get inter-library dependencies
#-------------------------------------------------------------------
otoolCm = "otool -L %s | grep libklayout" % nameStyle3
otoolOut = os.popen( otoolCm ).read()
dependDic = DecomposeLibraryDependency(otoolOut)
depDicOrdinary.update(dependDic)
'''
PrintLibraryDependencyDictionary( depDicOrdinary, "Style (3)" )
quit()
'''
print( " [5] Setting and changing the identification names among KLayout's libraries ..." )
#-------------------------------------------------------------
# [5] Set the identification names for KLayout's libraries
# and make the library aware of the locations of libraries
# on which it depends; that is, inter-library dependency
#-------------------------------------------------------------
ret = SetChangeIdentificationNameOfDyLib( depDicOrdinary )
if not ret == 0:
msg = "!!! Failed to set and change to new identification names !!!"
print(msg)
return 1
print( " [6] Copying built executables and resource files ..." )
#-------------------------------------------------------------
# [6] Copy some known files in source directories to
# relevant target directories
#-------------------------------------------------------------
os.chdir(ProjectDir)
sourceDir0 = "%s/klayout.app/Contents" % MacBinDir
sourceDir1 = sourceDir0 + "/MacOS"
sourceDir2 = "%s/macbuild/Resources" % ProjectDir
sourceDir3 = "%s" % MacBinDir
tmpfileM = ProjectDir + "/macbuild/Resources/Info.plist.template"
keydicM = { 'exe': 'klayout', 'icon': 'klayout.icns', 'bname': 'klayout', 'ver': Version }
plistM = GenerateInfoPlist( keydicM, tmpfileM )
file = open( targetDir0 + "/Info.plist", "w" )
file.write(plistM)
file.close()
shutil.copy2( sourceDir0 + "/PkgInfo", targetDir0 ) # this file is not mandatory
shutil.copy2( sourceDir1 + "/klayout", targetDirM )
shutil.copy2( sourceDir2 + "/klayout.icns", targetDirR )
os.chmod( targetDir0 + "/PkgInfo", 0644 )
os.chmod( targetDir0 + "/Info.plist", 0644 )
os.chmod( targetDirM + "/klayout", 0755 )
os.chmod( targetDirR + "/klayout.icns", 0644 )
buddies = glob.glob( sourceDir3 + "/strm*" )
for item in buddies:
shutil.copy2( item, targetDirB )
buddy = os.path.basename(item)
os.chmod( targetDirB + "/" + buddy, 0755 )
print( " [7] Setting and changing the identification names of KLayout's libraries in each executable ..." )
#-------------------------------------------------------------
# [7] Set and change the library identification name(s) of
# different executables
#-------------------------------------------------------------
os.chdir(ProjectDir)
os.chdir(MacPkgDir)
klayoutexec = "klayout.app/Contents/MacOS/klayout"
ret = SetChangeLibIdentificationName( klayoutexec, "../Frameworks" )
if not ret == 0:
os.chdir(ProjectDir)
msg = "!!! Failed to set/change library identification name for <%s> !!!"
print( msg % klayoutexec, file=sys.stderr )
return 1
buddies = glob.glob( "klayout.app/Contents/Buddy/strm*" )
macdepQtOpt = ""
for buddy in buddies:
macdepQtOpt += "-executable=%s " % buddy
ret = SetChangeLibIdentificationName( buddy, "../Frameworks" )
if not ret == 0:
os.chdir(ProjectDir)
msg = "!!! Failed to set/change library identification name for <%s> !!!"
print( msg % buddy, file=sys.stderr )
return 1
if DeploymentF:
print( " [8] Finally, deploying Qt's Frameworks ..." )
#-------------------------------------------------------------
# [8] Deploy Qt Frameworks
#-------------------------------------------------------------
verbose = " -verbose=%d" % DeployVerbose
if ModuleQt == 'Qt4MacPorts':
deploytool = Qt4MacPorts['deploy']
app_bundle = "klayout.app"
options = macdepQtOpt + verbose
elif ModuleQt == 'Qt5MacPorts':
deploytool = Qt5MacPorts['deploy']
app_bundle = "klayout.app"
options = macdepQtOpt + verbose
os.chdir(ProjectDir)
os.chdir(MacPkgDir)
command = "%s %s %s" % ( deploytool, app_bundle, options )
if subprocess.call( command, shell=True ) != 0:
msg = "!!! Failed to deploy applications on OSX !!!"
print( msg, file=sys.stderr )
print("")
os.chdir(ProjectDir)
return 1
else:
print( "##### Finished deploying libraries and executables for <klayout.app> #####" )
print("")
os.chdir(ProjectDir)
return 0
else:
print( " [8] Skipped deploying Qt's Frameworks ..." )
print( "##### Finished deploying libraries and executables for <klayout.app> #####" )
print("")
os.chdir(ProjectDir)
return 0
#------------------------------------------------------------------------------
## To deploy script bundles that invoke the main bundle (klayout.app) in
# editor mode or viewer mode
#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
def DeployScriptBundles():
global ProjectDir
global MacPkgDir
global AbsMacPkgDir
print("")
print( "##### Started deploying files for <KLayoutEditor.app> and <KLayoutViewer.app> #####" )
print( " [1] Checking the status of working directory ..." )
#-------------------------------------------------------------
# [1] Check the status of working directory
#-------------------------------------------------------------
os.chdir(ProjectDir)
if not os.path.isdir(MacPkgDir):
print( "!!! Package directory <%s> does not present !!!" % MacPkgDir, file=sys.stderr )
return 1
print( " [2] Creating a new empty directory <%s> for deployment ..." % (MacPkgDir + "/klayout.scripts") )
#-------------------------------------------------------------
# [2] Create a new empty directory for deploying binaries
#-------------------------------------------------------------
os.chdir(MacPkgDir)
scriptDir = "klayout.scripts"
if os.path.isfile(scriptDir):
os.remove(scriptDir)
if os.path.isdir(scriptDir):
shutil.rmtree(scriptDir)
os.mkdir(scriptDir)
print( " [3] Creating the standard directory structure for the script bundles ..." )
#--------------------------------------------------------------------------------------------
# [3] Create the directory skeleton for the two script bundles.
#
# klayout.scripts/+
# +-- KLayoutEditor.app/+
# | +-- Contents/+
# | +-- Info.plist
# | +-- Resources/+
# | | +-- 'klayout-red.icns'
# | +-- MacOS/+
# | +-- 'KLayoutEditor.sh'
# +-- KLayoutViewer.app/+
# +-- Contents/+
# +-- Info.plist
# +-- Resources/+
# | +-- 'klayout-blue.icns'
# +-- MacOS/+
# +-- 'KLayoutViewer.sh'
#--------------------------------------------------------------------------------------------
os.chdir(ProjectDir)
targetDir0E = "%s/%s/KLayoutEditor.app/Contents" % ( AbsMacPkgDir, scriptDir )
targetDir0V = "%s/%s/KLayoutViewer.app/Contents" % ( AbsMacPkgDir, scriptDir )
targetDirME = targetDir0E + "/MacOS"
targetDirMV = targetDir0V + "/MacOS"
targetDirRE = targetDir0E + "/Resources"
targetDirRV = targetDir0V + "/Resources"
os.makedirs(targetDirME)
os.makedirs(targetDirMV)
os.makedirs(targetDirRE)
os.makedirs(targetDirRV)
print( " [4] Copying script files and icon files ..." )
#-------------------------------------------------------------------------------
# [4] Copy different script files icon files
#-------------------------------------------------------------------------------
os.chdir(ProjectDir)
resourceDir = "macbuild/Resources"
shutil.copy2( resourceDir + "/KLayoutEditor.sh", targetDirME )
shutil.copy2( resourceDir + "/KLayoutViewer.sh", targetDirMV )
shutil.copy2( resourceDir + "/klayout-red.icns", targetDirRE )
shutil.copy2( resourceDir + "/klayout-blue.icns", targetDirRV )
os.chmod( targetDirME + "/KLayoutEditor.sh", 0755 )
os.chmod( targetDirMV + "/KLayoutViewer.sh", 0755 )
os.chmod( targetDirRE + "/klayout-red.icns", 0644 )
os.chmod( targetDirRV + "/klayout-blue.icns", 0644 )
tmpfileE = ProjectDir + "/macbuild/Resources/Info.plist.template"
keydicE = { 'exe': 'KLayoutEditor.sh', 'icon': 'klayout-red.icns', 'bname': 'klayout', 'ver': Version }
plistE = GenerateInfoPlist( keydicE, tmpfileE )
fileE = open( targetDir0E + "/Info.plist", "w" )
fileE.write(plistE)
fileE.close()
tmpfileV = ProjectDir + "/macbuild/Resources/Info.plist.template"
keydicV = { 'exe': 'KLayoutViewer.sh', 'icon': 'klayout-blue.icns', 'bname': 'klayout', 'ver': Version }
plistV = GenerateInfoPlist( keydicV, tmpfileV )
fileV = open( targetDir0V + "/Info.plist", "w" )
fileV.write(plistV)
fileV.close()
print( "##### Finished deploying files for <KLayoutEditor.app> and <KLayoutViewer.app> #####" )
print("")
os.chdir(ProjectDir)
return 0
#------------------------------------------------------------------------------
## The main function
#------------------------------------------------------------------------------
def main():
SetGlobals()
ParseCommandLineArguments()
#----------------------------------------------------------
# [The main build stage]
#----------------------------------------------------------
ret = RunMainBuildBash()
if not DeploymentF and not DeploymentP:
if ret == 0:
sys.exit(0)
else:
sys.exit(1)
else:
#----------------------------------------------------------
# [Deployment stage-1]
# Deployment of dynamic link libraries, executables and
# resources to make the main "klayout.app" bundle
#----------------------------------------------------------
ret1 = DeployBinariesForBundle()
if not ret1 == 0:
sys.exit(1)
#----------------------------------------------------------
# [Deployment stage-2]
# Deployment of wrapper Bash scripts and resources
# to make "KLayoutEditor.app" and "KLayoutViewer.app"
#----------------------------------------------------------
ret2 = DeployScriptBundles()
if ret2 == 0:
sys.exit(1)
else:
sys.exit(0)
#===================================================================================
if __name__ == "__main__":
main()
#---------------
# End of file
#---------------

193
macbuild/build4mac_env.py Executable file
View File

@ -0,0 +1,193 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/build4mac_env.py"
#
# Here are dictionaries of ...
# different modules for building KLayout (http://www.klayout.de/index.php)
# version 0.25 or later on different Apple Mac OSX platforms.
#
# This file is imported by 'build4mac.py' script.
#===============================================================================
#-----------------------------------------------------
# [0] Xcode's tools
#-----------------------------------------------------
XcodeToolChain = { 'nameID': '/usr/bin/install_name_tool -id ',
'nameCH': '/usr/bin/install_name_tool -change '
}
#-----------------------------------------------------
# [1] Qt
#-----------------------------------------------------
Qts = [ 'Qt4MacPorts', 'Qt5MacPorts' ]
#-----------------------------------------------------
# Whereabout of different components of Qt4
#-----------------------------------------------------
# Qt4 from MacPorts (https://www.macports.org/)
# [Key Type Name] = 'Qt4MacPorts'
Qt4MacPorts = { 'qmake' : '/opt/local/libexec/qt4/bin/qmake',
'deploy': '/opt/local/libexec/qt4/bin/macdeployqt'
}
#-----------------------------------------------------
# Whereabout of different components of Qt5
#-----------------------------------------------------
# Qt5 from MacPorts (https://www.macports.org/)
# [Key Type Name] = 'Qt5MacPorts'
Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake',
'deploy': '/opt/local/libexec/qt5/bin/macdeployqt'
}
#-----------------------------------------------------
# [2] Ruby
#-----------------------------------------------------
Rubies = [ 'nil', 'RubyYosemite', 'RubyElCapitan', 'RubySierra', 'RubyHighSierra' ]
Rubies += [ 'Ruby24SrcBuild', 'Ruby24MacPorts' ]
#-----------------------------------------------------
# Whereabout of different components of Ruby
#-----------------------------------------------------
# Bundled with Yosemite (10.10)
# [Key Type Name] = 'Sys'
RubyYosemite = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby' ,
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib'
}
# Bundled with El Capitan (10.11)
# [Key Type Name] = 'Sys'
RubyElCapitan = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby' ,
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib'
}
# Bundled with Sierra (10.12)
# [Key Type Name] = 'Sys'
RubySierra = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby' ,
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib'
}
# Bundled with High Sierra (10.13)
# [Key Type Name] = 'Sys'
RubyHighSierra = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby' ,
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib'
}
# Ruby 2.4 built from source code (https://github.com/ruby): *+*+*+ EXPERIMENTAL *+*+*+
# configured by:
# $ ./configure --prefix=$HOME/Ruby24/ --enable-shared --program-suffix=2.4
# [Key Type Name] = 'Src24'
Ruby24SrcBuild = { 'exe': '$HOME/Ruby24/bin/ruby2.4',
'inc': '$HOME/Ruby24/include/ruby-2.4.0',
'lib': '$HOME/Ruby24/lib/libruby.2.4.dylib'
}
# Ruby 2.4 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# [Key Type Name] = 'MP24'
Ruby24MacPorts = { 'exe': '/opt/local/bin/ruby2.4',
'inc': '/opt/local/include/ruby-2.4.0',
'lib': '/opt/local/lib/libruby.2.4.dylib'
}
# Consolidated dictionary kit for Ruby
RubyDictionary = { 'nil' : None,
'RubyYosemite' : RubyYosemite,
'RubyElCapitan' : RubyElCapitan,
'RubySierra' : RubySierra,
'RubyHighSierra': RubyHighSierra,
'Ruby24SrcBuild': Ruby24SrcBuild,
'Ruby24MacPorts': Ruby24MacPorts
}
#-----------------------------------------------------
# [3] Python
#-----------------------------------------------------
Pythons = [ 'nil', 'PythonYosemite', 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra' ]
Pythons += [ 'Anaconda27', 'Anaconda36', 'Python36MacPorts' ]
#-----------------------------------------------------
# Whereabout of different components of Python
#-----------------------------------------------------
# Bundled with Yosemite (10.10)
# [Key Type Name] = 'Sys'
PythonYosemite = { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python' ,
'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
# Bundled with El Capitan (10.11)
# [Key Type Name] = 'Sys'
PythonElCapitan = { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python' ,
'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
# Bundled with Sierra (10.12)
# [Key Type Name] = 'Sys'
PythonSierra = { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python' ,
'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
# Bundled with High Sierra (10.13)
# [Key Type Name] = 'Sys'
PythonHighSierra= { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python' ,
'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
# Using anaconda2 (https://www.anaconda.com/download/#macos) 5.0.1: *+*+*+ EXPERIMENTAL *+*+*+
# If the path to your `conda` command is '$HOME/anaconda2/bin/conda'
# and your Python environment was prepared by: $ conda create -n py27klayout python=2.7
#
# No additional modules are installed in the experiment.
# [Key Type Name] = 'Ana27'
Anaconda27 = { 'exe': '$HOME/anaconda2/envs/py27klayout/bin/python2.7' ,
'inc': '$HOME/anaconda2/envs/py27klayout/include/python2.7',
'lib': '$HOME/anaconda2/envs/py27klayout/lib/libpython2.7.dylib'
}
# Using anaconda2 (https://www.anaconda.com/download/#macos) 5.0.1: *+*+*+ EXPERIMENTAL *+*+*+
# If the path to your `conda` command is '$HOME/anaconda2/bin/conda'
# and your Python environment was prepared by: $ conda create -n py36klayout python=3.6
#
# No additional modules are installed in the experiment.
# [Key Type Name] = 'Ana36'
Anaconda36 = { 'exe': '$HOME/anaconda2/envs/py36klayout/bin/python3.6' ,
'inc': '$HOME/anaconda2/envs/py36klayout/include/python3.6m',
'lib': '$HOME/anaconda2/envs/py36klayout/lib/libpython3.6m.dylib'
}
# Python 3.6 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# [Key Type Name] = 'MP36'
Python36MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m' ,
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib'
}
# Consolidated dictionary kit for Python
PythonDictionary= { 'nil' : None,
'PythonYosemite' : PythonYosemite,
'PythonElCapitan' : PythonElCapitan,
'PythonSierra' : PythonSierra,
'PythonHighSierra': PythonHighSierra,
'Anaconda27' : Anaconda27,
'Anaconda36' : Anaconda36,
'Python36MacPorts': Python36MacPorts
}
#-----------------------------------------------------
# [4] KLayout executables including buddy tools
#-----------------------------------------------------
KLayoutExecs = ['klayout']
KLayoutExecs += ['strm2cif', 'strm2dxf', 'strm2gds', 'strm2gdstxt', 'strm2oas']
KLayoutExecs += ['strm2txt', 'strmclip', 'strmcmp', 'strmrun', 'strmxor']
#----------------
# End of File
#----------------

231
macbuild/build4mac_util.py Executable file
View File

@ -0,0 +1,231 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/build4mac_util.py"
#
# Here are utility functions and classes ...
# for building KLayout (http://www.klayout.de/index.php)
# version 0.25 or later on different Apple Mac OSX platforms.
#
# This file is imported by 'build4mac.py' script.
#===============================================================================
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
import sys
import os
import re
import string
import subprocess
#-------------------------------------------------------------------------------
## To import global dictionaries of different modules
#-------------------------------------------------------------------------------
mydir = os.path.dirname(os.path.abspath(__file__))
sys.path.append( mydir )
from build4mac_env import *
#------------------------------------------------------------------------------
## To decompose strings obtained by 'otool -L <*.dylib>' command and to
# generate a dictionary of KLayout's inter-library dependency.
#
# @param[in] depstr strings that tell dependency such as:
#
# libklayout_edt.0.dylib:
# libklayout_edt.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_tl.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_gsi.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_laybasic.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# libklayout_db.0.dylib (compatibility version 0.25.0, current version 0.25.0)
# :
# :
#
# @return a dictionary
#------------------------------------------------------------------------------
def DecomposeLibraryDependency( depstr ):
alllines = depstr.split('\n')
numlines = len(alllines)
dependent = alllines[0].split(':')[0].strip(' ').strip('\t')
supporters = []
for i in range(1, numlines):
supporter = alllines[i].split(' ')[0].strip(' ').strip('\t')
if not supporter == '':
supporters.append(supporter)
return { dependent: supporters }
#------------------------------------------------------------------------------
## To print the contents of a library dependency dictionary
#
# @param[in] depdic dictionary
# @param[in] namedic dictionary name
#------------------------------------------------------------------------------
def PrintLibraryDependencyDictionary( depdic, namedic ):
keys = depdic.keys()
print("")
print("##### Contents of <%s> #####:" % namedic )
for key in keys:
supporters = depdic[key]
print( " %s:" % key )
for item in supporters:
print( " %s" % item )
#------------------------------------------------------------------------------
## To set and change identification name of KLayout's dylib
#
# @param[in] libdic inter-library dependency dictionary
#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
def SetChangeIdentificationNameOfDyLib( libdic ):
cmdNameId = XcodeToolChain['nameID']
cmdNameChg = XcodeToolChain['nameCH']
dependentLibs = libdic.keys()
for lib in dependentLibs:
#-----------------------------------------------------------
# [1] Set the identification name of each dependent library
#-----------------------------------------------------------
nameOld = "%s" % lib
nameNew = "@executable_path/../Frameworks/%s" % lib
command = "%s %s %s" % ( cmdNameId, nameNew, nameOld )
if subprocess.call( command, shell=True ) != 0:
msg = "!!! Failed to set the new identification name to <%s> !!!"
print( msg % lib, file=sys.stderr )
return 1
#-------------------------------------------------------------------------
# [2] Make the library aware of the new identifications of all supporters
#-------------------------------------------------------------------------
supporters = libdic[lib]
for sup in supporters:
nameOld = "%s" % sup
nameNew = "@executable_path/../Frameworks/%s" % sup
command = "%s %s %s %s" % ( cmdNameChg, nameOld, nameNew, lib )
if subprocess.call( command, shell=True ) != 0:
msg = "!!! Failed to make the library aware of the new identification name <%s> of supporter <%s> !!!"
print( msg % (nameNew, sup), file=sys.stderr )
return 1
# for-lib
return 0
#------------------------------------------------------------------------------
## To set the identification names of KLayout's libraries to an executable
# and make the application aware of the library locations
#
# @param[in] executable path/to/executable -- (1)
# @param[in] relativedir directory of dylib relative to executable -- (2)
#
# Example: (1) "klayout.app/Contents/MacOS/klayout"
# (2) "../Frameworks"
#
# klayout.app/+
# +-- Contents/+
# +-- Info.plist
# +-- PkgInfo
# +-- Resources/+
# | +-- 'klayout.icns'
# +-- Frameworks/+
# | +-- '*.framework'
# | +-- '*.dylib'
# +-- MacOS/+
# | +-- 'klayout'
# +-- Buddy/+
# +-- 'strm2cif'
# +-- 'strm2dxf'
# :
# +-- 'strmxor'
#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
def SetChangeLibIdentificationName( executable, relativedir ):
cmdNameId = XcodeToolChain['nameID']
cmdNameChg = XcodeToolChain['nameCH']
otoolCm = "otool -L %s | grep libklayout" % executable
otoolOut = os.popen( otoolCm ).read()
exedepdic = DecomposeLibraryDependency( executable + ":\n" + otoolOut )
keys = exedepdic.keys()
deplibs = exedepdic[ keys[0] ]
for lib in deplibs:
#-----------------------------------------------------------
# [1] Set the identification names for the library
#-----------------------------------------------------------
nameOld = "klayout.app/Contents/Frameworks/%s" % lib
nameNew = "@executable_path/%s/%s" % ( relativedir, lib )
command = "%s %s %s" % ( cmdNameId, nameNew, nameOld )
if subprocess.call( command, shell=True ) != 0:
msg = "!!! Failed to set the new identification name to <%s> !!!"
print( msg % lib, file=sys.stderr )
return 1
#-----------------------------------------------------------
# [2] Make the application aware of the new identification
#-----------------------------------------------------------
nameOld = "%s" % lib
nameNew = "@executable_path/%s/%s" % ( relativedir, lib )
command = "%s %s %s %s" % ( cmdNameChg, nameOld, nameNew, executable )
if subprocess.call( command, shell=True ) != 0:
msg = "!!! Failed to make the application aware of the new identification name <%s> !!!"
print( msg % nameNew, file=sys.stderr )
return 1
# for-lib
return 0
#------------------------------------------------------------------------------
## To get KLayout's version from a file; most likely from 'version.sh'
#
# @param[in] verfile version file from which version is retrieved
#
# @return version string
#------------------------------------------------------------------------------
def GetKLayoutVersionFrom( verfile='version.h' ):
version = "?.?.?"
try:
fd = open( verfile, "r" )
contents = fd.readlines()
fd.close()
except Exception as e:
return version
verReg = re.compile( u'(KLAYOUT_VERSION=\")([0-9A-Z_a-z\.]+)(\")' )
for line in contents:
m = verReg.match(line)
if m:
# print(m.group(0)) # KLAYOUT_VERSION="0.25.1"
# print(m.group(1)) # KLAYOUT_VERSION="
# print(m.group(2)) # 0.25.1
# print(m.group(3)) # "
version = m.group(2)
return version
return version
#------------------------------------------------------------------------------
## To generate the contents of "Info.plist" file from a template
#
# @param[in] keydic dictionary of four key words ['exe', 'icon', 'bname', 'ver']
# @param[in] templfile template file ("macbuild/Resources/Info.plist.template")
#
# @return generated strings
#------------------------------------------------------------------------------
def GenerateInfoPlist( keydic, templfile ):
val_exe = keydic['exe']
val_icon = keydic['icon']
val_bname = keydic['bname']
val_ver = keydic['ver']
try:
fd = open( templfile, "r" )
template = fd.read()
fd.close()
except Exception as e:
return "???"
t = string.Template(template)
s = t.substitute( EXECUTABLE = val_exe,
ICONFILE = val_icon,
BUNDLENAME = val_bname,
VERSION = val_ver)
return s
#----------------
# End of File
#----------------

View File

@ -1,21 +0,0 @@
#!/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-high-sierra \
-bin ./qt4.bin.macos-high-sierra \
-option -j2 \
-with-qtbinding \
-qt4 \
-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.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

View File

@ -1,21 +0,0 @@
#!/bin/bash
# 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-high-sierra \
-bin ./qt5.bin.macos-high-sierra \
-option -j2 \
-with-qtbinding \
-qt5 \
-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.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

540
macbuild/makeDMG4mac.py Executable file
View File

@ -0,0 +1,540 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#=============================================================================================
# File: "macbuild/makeDMG4mac.py"
#
# Python script for making a DMG file of KLayout (http://www.klayout.de/index.php) bundles.
#
# This is a derivative work of Ref. 2) below. Refer to "macbuild/LICENSE" file.
# Ref.
# 1) https://el-tramo.be/guides/fancy-dmg/
# 2) https://github.com/andreyvit/create-dmg.git
#=============================================================================================
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
from time import sleep
import sys
import os
import shutil
import glob
import platform
import optparse
import subprocess
import hashlib
#-------------------------------------------------------------------------------
## To import global dictionaries of different modules and utility functions
#-------------------------------------------------------------------------------
mydir = os.path.dirname(os.path.abspath(__file__))
sys.path.append( mydir + "/macbuild" )
from build4mac_util import *
#-------------------------------------------------------------------------------
## To set global variables including present directory and platform info.
#-------------------------------------------------------------------------------
def SetGlobals():
global ProjectDir # project directory where "build.sh" exists
global Usage # string on usage
global GenOSName # generic OS name
global Platform # platform
global PkgDir # the package directory where "klayout.app" and "klayout.scripts" exist
global OpClean # 'clean' operation
global OpMake # 'make' operation
global DMGSerialNum # the DMG serial number
global QtIdentification # Qt identification
global Version # KLayout's version
global OccupiedDS # approx. occupied disc space
global BackgroundPNG # the background PNG image file
global VolumeIcons # the volume icon file
global AppleScriptDMG # the AppleScript for KLayout DMG
global WorkDMG # work DMG file created under ProjectDir/
global VolumeDMG # the volume name of DMG
global TargetDMG # the name of target DMG file
global RootApplications # reserved directory name for applications
# auxiliary variables on platform
global System # 6-tuple from platform.uname()
global Node # - do -
global Release # - do -
global Version # - do -
global Machine # - do -
global Processor # - do -
global Bit # machine bit-size
Usage = "\n"
Usage += "--------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.25 or later on different Apple Mac OSX platforms.\n"
Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py \n"
Usage += " option & argument : descriptions | default value\n"
Usage += " ----------------------------------------------------------------------------------+---------------\n"
Usage += " <-p|--pkg <dir>> : package directory created by `build4mac.py` with [-y|-Y] | `` \n"
Usage += " : like 'qt5.pkg.macos-HighSierra-release' | \n"
Usage += " <-c|--clean> : clean the work directory | disabled \n"
Usage += " <-m|--make> : make a compressed DMG file | disabled \n"
Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
Usage += " [-q|--qt <ID>] : ID name of deployed Qt | Qt593mp \n"
Usage += " [-s|--serial <num>] : DMG serial number | 1 \n"
Usage += " [-?|--?] : print this usage and exit | disabled \n"
Usage += "--------------------------------------------------------------------------------------------------------\n"
ProjectDir = os.getcwd()
(System, Node, Release, Version, Machine, Processor) = platform.uname()
if not System == "Darwin":
print("")
print( "!!! Sorry. Your system <%s> looks like non-Mac" % System, file=sys.stderr )
print(Usage)
quit()
release = int( Release.split(".")[0] ) # take the first of ['14', '5', '0']
if release == 14:
GenOSName = "MacOSX"
Platform = "Yosemite"
elif release == 15:
GenOSName = "MacOSX"
Platform = "ElCapitan"
elif release == 16:
GenOSName = "macOS"
Platform = "Sierra"
elif release == 17:
GenOSName = "macOS"
Platform = "HighSierra"
else:
Platform = ""
print("")
print( "!!! Sorry. Unsupported major OS release <%d>" % release, file=sys.stderr )
print(Usage)
quit()
if not Machine == "x86_64":
print("")
print( "!!! Sorry. Only x86_64 architecture machine is supported but found <%s>" % Machine, file=sys.stderr )
print(Usage)
quit()
PkgDir = ""
OpClean = False
OpMake = False
DMGSerialNum = 1
QtIdentification = "Qt593mp"
Version = GetKLayoutVersionFrom( "./version.sh" )
OccupiedDS = -1
BackgroundPNG = "KLayoutDMG-Back.png"
VolumeIcons = "KLayoutHDD.icns"
AppleScriptDMG = "macbuild/Resources/KLayoutDMG.applescript"
WorkDMG = "work-KLayout.dmg"
VolumeDMG = "KLayout"
TargetDMG = ""
RootApplications = "/Applications"
#------------------------------------------------------------------------------
## To check the contents of the package directory
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
#------------------------------------------------------------------------------
def CheckPkgDirectory():
if PkgDir == "":
print( "! Package directory is not specified", file=sys.stderr )
print(Usage)
return -1
if not os.path.isdir(PkgDir):
print( "! Specified package directory <%s> does not exist" % PkgDir, file=sys.stderr )
print( "" )
return -1
os.chdir(PkgDir)
items = glob.glob( "*" ) # must be ['klayout.app', 'klayout.scripts']
if not len(items) == 2:
print( "! The package directory <%s> must have just <2> directories ['klayout.app', 'klayout.scripts']" % PkgDir, file=sys.stderr )
print( "" )
os.chdir(ProjectDir)
return -1
if not os.path.isdir( "klayout.app" ):
print( "! The package directory <%s> does not hold <klayout.app> bundle" % PkgDir, file=sys.stderr )
print( "" )
os.chdir(ProjectDir)
return -1
if not os.path.isdir( "klayout.scripts" ):
print( "! The package directory <%s> does not hold <klayout.scripts> subdirectory" % PkgDir, file=sys.stderr )
print( "" )
os.chdir(ProjectDir)
return -1
os.chdir( "klayout.scripts" )
if not os.path.isdir( "KLayoutEditor.app" ):
print( "! The package directory <%s> does not hold <KLayoutEditor.app> bundle under 'klayout.scripts/'" % PkgDir, file=sys.stderr )
print( "" )
os.chdir(ProjectDir)
return -1
if not os.path.isdir( "KLayoutViewer.app" ):
print( "! The package directory <%s> does not hold <KLayoutViewer.app> bundle under 'klayout.scripts/'" % PkgDir, file=sys.stderr )
print( "" )
os.chdir(ProjectDir)
return -1
os.chdir(ProjectDir)
os.chdir(PkgDir)
size1 = int( os.popen( "\du -sm klayout.app" ) .read().strip("\n").split("\t")[0] )
size2 = int( os.popen( "\du -sm klayout.scripts" ).read().strip("\n").split("\t")[0] )
os.chdir(ProjectDir)
return size1+size2
#------------------------------------------------------------------------------
## To get command line parameters
#------------------------------------------------------------------------------
def ParseCommandLineArguments():
global ProjectDir
global Usage
global GenOSName
global Platform
global PkgDir
global OpClean
global OpMake
global DMGSerialNum
global QtIdentification
global Version
global OccupiedDS
global TargetDMG
p = optparse.OptionParser( usage=Usage )
p.add_option( '-p', '--pkg',
dest='pkg_dir',
help="the pkg directory" )
p.add_option( '-c', '--clean',
action='store_true',
dest='operation_clean',
default=False,
help="clean operation" )
p.add_option( '-m', '--make',
action='store_true',
dest='operation_make',
default=False,
help="make operation" )
p.add_option( '-q', '--qt',
dest='qt_identification',
help="Qt's ID" )
p.add_option( '-s', '--serial',
dest='dmg_serial',
help="DMG serial number" )
p.add_option( '-?', '--??',
action='store_true',
dest='checkusage',
default=False,
help='check usage' )
p.set_defaults( pkg_dir = "",
operation_clean = False,
operation_make = False,
qt_identification = "Qt593mp",
dmg_serial = "1",
checkusage = False )
opt, args = p.parse_args()
if (opt.checkusage):
print(Usage)
quit()
PkgDir = opt.pkg_dir
OpClean = opt.operation_clean
OpMake = opt.operation_make
QtIdentification = opt.qt_identification
DMGSerialNum = int(opt.dmg_serial)
TargetDMG = "klayout-%s-%s-%s-%d-%s.dmg" % (Version, GenOSName, Platform, DMGSerialNum, QtIdentification)
OccupiedDS = CheckPkgDirectory()
if not OccupiedDS > 0:
quit()
if (OpClean and OpMake) or (not OpClean and not OpMake):
print( "! Specify <-c|--clean> OR <-m|--make>", file=sys.stderr )
print(Usage)
quit()
#------------------------------------------------------------------------------
## Make the target DMG file
#
# @param[in] msg message to print
#
# @return True on success; False on failure
#------------------------------------------------------------------------------
def MakeTargetDMGFile(msg=""):
#-----------------------------------------------------------------------
# The work DMG is mounted like:
# /dev/disk6s1 248Mi 228Mi 20Mi 93% 58449 5027 92% /Volumes/KLayout
#-----------------------------------------------------------------------
global MountDir # the mount directory: eg. /Volumes/KLayout
global FileSys # the file system : eg. /dev/disk6s1
#-------------------------------------------------------------
# [1] Print message
#-------------------------------------------------------------
if not msg == "":
print(msg)
#-------------------------------------------------------------
# [2] Do the following jobs (0) through (14) sequentially
#-------------------------------------------------------------
#--------------------------------------------------------
# (0) Cleanup ProjectDir/
#--------------------------------------------------------
CleanUp()
#--------------------------------------------------------
# (1) Read the AppleScript template file and generate
# the actual one to execute later
#--------------------------------------------------------
os.chdir(ProjectDir)
print( ">>> (1) Preparing AppleScript to execute later..." )
tempScr = "macbuild/Resources/template-KLayoutDMG.applescript"
try:
fd = open( tempScr, "r" )
tmpl = fd.read()
fd.close()
except Exception as e:
print( " ! Failed to read <%s>" % tempScr, file=sys.stderr )
return False
else:
t = string.Template(tmpl)
# Figures below were determined by experiments for best fit
applescript = t.safe_substitute(
ORGX='50', ORGY='100',
WIN_WIDTH='1000', WIN_HEIGHT='700',
FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG,
BACKGROUND_PNG_FILE=BackgroundPNG,
ITEM_1='klayout.app', X1='960', Y1='140',
ITEM_2='klayout.scripts', X2='610', Y2='140',
ITEM_3='Applications', X3='790', Y3='140',
CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?'
)
try:
# print(applescript)
fd = open( AppleScriptDMG, "w" )
fd.write(applescript)
fd.close()
except Exception as e:
print( "! Failed to write <%s>" % AppleScriptDMG, file=sys.stderr )
return False
else:
print( " saved <%s>" % AppleScriptDMG )
#----------------------------------------------------
# (2) Create a work disk image under ProjectDir/
#----------------------------------------------------
if os.path.exists(WorkDMG):
os.remove(WorkDMG)
dmgsize = OccupiedDS + 20 # approx. occupied size plus 20[MB]
cmdline = 'hdiutil create -srcfolder %s -volname %s -fs HFS+ -fsargs "-c c=64,a=16,e=16" '
cmdline += '-format UDRW -size %dm %s'
command = cmdline % (PkgDir, VolumeDMG, dmgsize, WorkDMG)
print( ">>> (2) Creating a work DMG file <%s> of <%d> [MB] with the volume name of <%s>..." % (WorkDMG, dmgsize, VolumeDMG) )
os.system(command)
MountDir = "/Volumes/%s" % VolumeDMG
#--------------------------------------------------------
# (3) Check if the mount point 'MountDir' already exists.
# If so, unmount it first.
#--------------------------------------------------------
command1 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
print ( ">>> (3) Checking if the mount point <%s> already exists..." % MountDir)
FileSys = os.popen(command1).read().strip('\n')
if os.path.isdir(MountDir) and not FileSys == "":
command2 = "hdiutil detach %s" % FileSys
os.system(command2)
print( " Mount directory <%s> was detached" % MountDir )
else:
print( " Mount directory <%s> does not exist; nothing to do" % MountDir )
#--------------------------------------------------------
# (4) Mount the DMG
#--------------------------------------------------------
print( ">>> (4) Mounting <%s> to <%s>" % (WorkDMG, MountDir ) )
command1 = "hdiutil attach %s -readwrite -noverify -noautoopen -quiet" % WorkDMG
os.system(command1)
command2 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
FileSys = os.popen(command2).read().strip('\n')
if FileSys == "":
print( "! Failed to identify the file system on which <%s> is mounted" % VolumeDMG )
return False
else:
print( " File System = %s" % FileSys )
#--------------------------------------------------------
# (5) Copy the background image
#--------------------------------------------------------
print( ">>> (5) Copying the background image..." )
imageSrc = "macbuild/Resources/%s" % BackgroundPNG
imageDest = "%s/.background" % MountDir
if not os.path.isdir(imageDest):
os.mkdir(imageDest)
command = "\cp -p %s %s/%s" % (imageSrc, imageDest, BackgroundPNG)
os.system(command)
#--------------------------------------------------------
# (6) Create a symbolic link to /Applications
#--------------------------------------------------------
print( ">>> (6) Creating a symbolic link to /Applications..." )
command = "\ln -s %s %s/%s" % (RootApplications, MountDir, RootApplications)
os.system(command)
#--------------------------------------------------------
# (7) Run the AppleScript
#--------------------------------------------------------
print( ">>> (7) Running the AppleScript..." )
command = "/usr/bin/osascript %s %s" % (AppleScriptDMG, VolumeDMG)
process = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True )
output, error = process.communicate()
if not output == "":
print( " STDOUT: %s" % output )
if not error == "":
print( " STDERR: %s" % error )
#--------------------------------------------------------
# (8) Copy the custom volume icon
#--------------------------------------------------------
sleep(4)
print( ">>> (8) Copying the volume icon..." )
iconsSrc = "macbuild/Resources/%s" % VolumeIcons
iconsDest = "%s/.VolumeIcon.icns" % MountDir
command1 = "\cp -p %s %s" % (iconsSrc, iconsDest)
command2 = "SetFile -c icnC %s" % iconsDest
os.system(command1)
sleep(2)
os.system(command2)
sleep(2)
#--------------------------------------------------------
# (9) Change the permission
#--------------------------------------------------------
print( ">>> (9) Changing permission to 755..." )
command = "\chmod -Rf 755 %s &> /dev/null" % MountDir
os.system(command)
#--------------------------------------------------------
# (10) Set volume bootability and startup disk options.
# The folder will open on mount.
#--------------------------------------------------------
print( ">>> (10) Setting volume bootability and startup disk options..." )
command = "bless --folder %s --openfolder %s" % (MountDir, MountDir)
os.system(command)
sleep(2)
#--------------------------------------------------------
# (11) Set attributes of files and directories
#--------------------------------------------------------
print( ">>> (11) Setting attributes of files and directories..." )
command = "SetFile -a C %s" % MountDir # Custom icon (allowed on folders)
os.system(command)
sleep(2)
#--------------------------------------------------------
# (12) Unmount the disk image
#--------------------------------------------------------
print( ">>> (12) Unmounting the disk image..." )
command = "hdiutil detach %s" % FileSys
os.system(command)
#--------------------------------------------------------
# (13) Compress the disk image
#--------------------------------------------------------
print( "" )
print( ">>> (13) Compressing the disk image..." )
command = "hdiutil convert %s -format UDZO -imagekey zlib-level=9 -o %s" % (WorkDMG, TargetDMG)
os.system(command)
os.remove(WorkDMG)
print( "" )
print( " generated compressed target DMG <%s>" % TargetDMG )
#--------------------------------------------------------
# (14) Compute MD5 checksum
#--------------------------------------------------------
print( "" )
print( ">>> (14) Computing MD5 checksum..." )
with open( TargetDMG, "rb" ) as f:
data = f.read()
md5 = hashlib.md5(data).hexdigest()
md5 += " *%s\n" % TargetDMG
f.close()
path, ext = os.path.splitext( os.path.basename(TargetDMG) )
md5TargetDMG = path + ".dmg.md5"
with open( md5TargetDMG, "w" ) as f:
f.write(md5)
f.close()
print( " generated MD5 checksum file <%s>" % md5TargetDMG )
print( "" )
return True
#------------------------------------------------------------------------------
## Clean up
#
# @param[in] msg message to print
#
#------------------------------------------------------------------------------
def CleanUp(msg=""):
#----------------------------------------------------
# [1] Print message
#----------------------------------------------------
if not msg == "":
print(msg)
#----------------------------------------------------
# [2] Clean up *.dmg*
#----------------------------------------------------
os.chdir(ProjectDir)
dmgs = glob.glob( "*.dmg*" )
for item in dmgs:
os.system( "rm -Rf %s" % item )
#----------------------------------------------------
# [3] Clean up AppleScript if any
#----------------------------------------------------
if os.path.exists(AppleScriptDMG) and os.path.isfile(AppleScriptDMG):
os.remove(AppleScriptDMG)
#------------------------------------------------------------------------------
## The main function
#------------------------------------------------------------------------------
def Main():
SetGlobals()
ParseCommandLineArguments()
if OpMake:
print( "" )
print( " ### You are going to make <%s> from <%s>" % (TargetDMG, PkgDir) )
print( " KLayout bundles occupy about <%d> [MB] of disc space." % OccupiedDS )
print( "" )
ok = MakeTargetDMGFile()
if not ok:
print( " !!! Failed to make the target DMG <%s> ..." % TargetDMG, file=sys.stderr )
print( "", file=sys.stderr )
else:
print( " ### Done making the target DMG" )
print( "" )
else:
print( "" )
print( " ### You are going to clean up <%s> directory" % ProjectDir )
CleanUp()
print( " ### Done cleaning up" )
print( "" )
#===================================================================================
if __name__ == "__main__":
Main()
#---------------
# End of file
#---------------

View File

@ -20,7 +20,7 @@
# ./scripts/mkqtdecl.sh -h
#
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -10,6 +10,8 @@
# drops enum members
drop_enum_const "Qt", /WindowType::WindowSoftkeysVisibleHint/
drop_enum_const "Qt", /WindowType::WindowSoftkeysRespondHint/
drop_enum_const "Qt", /WindowType::WindowOkButtonHint/ # only available on CE
drop_enum_const "Qt", /WindowType::WindowCancelButtonHint/ # only available on CE
# --------------------------------------------------------------
# QtCore
@ -1359,6 +1361,7 @@ drop_method "QXmlAttributes", /QXmlAttributes::index\(\s*const\s+QLatin1String/
drop_method "QXmlInputSource", /QXmlInputSource::setData\(.*QByteArray/ # clashes with QString version
drop_method "QXmlEntityResolver", /QXmlEntityResolver::resolveEntity/ # requires pointer return value
drop_method "QXmlDefaultHandler", /QXmlDefaultHandler::resolveEntity/ # requires pointer return value
drop_method "QXmlSimpleReader", /QXmlSimpleReader::parse\(.*QXmlInputSource\s*&/ # clashes with QXmlInputSource * version
rename "QDomElement", /QDomElement::setAttribute\(.*qulonglong/, "setAttribute_ull|attribute_ull="
rename "QDomElement", /QDomElement::setAttribute\(.*qlonglong/, "setAttribute_ll|attribute_ll="
rename "QDomElement", /QDomElement::setAttribute\(.*unsigned int/, "setAttribute_ui|attribute_ui="
@ -1418,6 +1421,8 @@ drop_class "QSqlDriverPlugin" # not required ?
drop_method "QFormBuilder", /QFormBuilder::customWidgets\(\s*\)/ # Requires QDesignerCustomWidgetInterface which is not (yet) available
return_new "QAbstractFormBuilder", /::load/ # returns a free object
no_copy_ctor "QAbstractFormBuilder"
no_copy_ctor "QFormBuilder"

View File

@ -10,6 +10,8 @@
# drops enum members
drop_enum_const "Qt", /WindowType::WindowSoftkeysVisibleHint/
drop_enum_const "Qt", /WindowType::WindowSoftkeysRespondHint/
drop_enum_const "Qt", /WindowType::WindowOkButtonHint/ # only available on CE
drop_enum_const "Qt", /WindowType::WindowCancelButtonHint/ # only available on CE
# --------------------------------------------------------------
# QtCore
@ -1497,6 +1499,7 @@ no_imports "QXmlStreamAttributes" # base class is a template.
drop_method "QXmlStreamAttributes", /QXmlStreamAttributes::append\(const\s+QVector/ # QVector is a template
drop_method "QXmlStreamAttributes", /QXmlStreamAttributes::hasAttribute\(\s*QLatin1String/ # QLatin1String is not available
drop_method "QXmlStreamAttributes", /QXmlStreamAttributes::value\(.*QLatin1String/ # QLatin1String is not available
drop_method "QXmlSimpleReader", /QXmlSimpleReader::parse\(.*QXmlInputSource\s*&/ # clashes with QXmlInputSource * version
drop_method "QAbstractXmlNodeModel", /QAbstractXmlNodeModel::sequencedTypedValue/ # QExplicitlySharedDataPointer template not available
drop_method "QAbstractXmlNodeModel", /QAbstractXmlNodeModel::type/ # QExplicitlySharedDataPointer template not available
drop_method "QAbstractXmlNodeModel", /QAbstractXmlNodeModel::iterate/ # QExplicitlySharedDataPointer template not available
@ -1604,6 +1607,8 @@ drop_class "QSqlDriverPlugin" # not required ?
drop_method "QFormBuilder", /QFormBuilder::customWidgets\(\s*\)/ # Requires QDesignerCustomWidgetInterface which is not (yet) available
return_new "QAbstractFormBuilder", /::load/ # returns a free object
no_copy_ctor "QAbstractFormBuilder"
no_copy_ctor "QFormBuilder"

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -1404,7 +1404,7 @@ class BindingProducer
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -2892,7 +2892,7 @@ END
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -2971,7 +2971,7 @@ END
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2006-2017 Matthias Koefferlein
# Copyright (C) 2006-2018 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -32,14 +32,17 @@
# define ANT_PUBLIC __declspec(dllimport)
# endif
# define ANT_LOCAL
# define ANT_PUBLIC_TEMPLATE
# else
# if __GNUC__ >= 4
# if __GNUC__ >= 4 || defined(__clang__)
# define ANT_PUBLIC __attribute__ ((visibility ("default")))
# define ANT_PUBLIC_TEMPLATE __attribute__ ((visibility ("default")))
# define ANT_LOCAL __attribute__ ((visibility ("hidden")))
# else
# define ANT_PUBLIC
# define ANT_PUBLIC_TEMPLATE
# define ANT_LOCAL
# endif

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -32,14 +32,17 @@
# define BD_PUBLIC __declspec(dllimport)
# endif
# define BD_LOCAL
# define BD_PUBLIC_TEMPLATE
# else
# if __GNUC__ >= 4
# if __GNUC__ >= 4 || defined(__clang__)
# define BD_PUBLIC __attribute__ ((visibility ("default")))
# define BD_PUBLIC_TEMPLATE __attribute__ ((visibility ("default")))
# define BD_LOCAL __attribute__ ((visibility ("hidden")))
# else
# define BD_PUBLIC
# define BD_PUBLIC_TEMPLATE
# define BD_LOCAL
# endif

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -25,6 +25,8 @@
#include "tlProgress.h"
#include "version.h"
#include <list>
namespace bd
{

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -189,6 +189,11 @@ GenericWriterOptions::add_options (tl::CommandLineOptions &cmd, const std::strin
"With this option, shape arrays will be expanded and recompressed. This may result in a better "
"compression ratio, but at the cost of slower execution."
)
<< tl::arg (group +
"#--permissive", &m_oasis_writer_options.permissive, "Permissive mode",
"In permissive mode, certain forbidden objects are reported as warnings, not as errors: "
"paths with odd width, polygons with less than three points etc."
)
<< tl::arg (group +
"#--write-std-properties", &m_oasis_writer_options.write_std_properties, "Writes some global standard properties",
"This is an integer describing what standard properties shall be written. 0 is \"none\", "

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@ BD_PUBLIC int BD_TARGET (int argc, char *argv []);
/**
* @brief The continuation function to support Ruby's special top-level hook
*/
static int main_cont (int argc, char **argv)
static int main_cont (int &argc, char **argv)
{
QCoreApplication app (argc, argv);
return bd::_main_impl (&BD_TARGET, argc, argv);

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -7,6 +7,12 @@ DESTDIR = $$OUT_PWD/../../..
include($$PWD/../../app.pri)
# On Mac OSX, these buddy tools have to be built as ordinary command line tools;
# not as bundles (*.app)
mac {
CONFIG -= app_bundle
}
# Since the main function is entirely unspecific, we can put it into a common
# place - it's not part of the bd sources.
SOURCES = $$PWD/bd/main.cc

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@ class ArrayRepository;
*/
template <class C, class R = C>
struct box
struct DB_PUBLIC_TEMPLATE box
{
typedef C coord_type;
typedef box<C, R> box_type;

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2017 Matthias Koefferlein
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show More