mirror of https://github.com/KLayout/klayout.git
Adjustments for Windows build with MSVC2019 (VC 16.10.31419.357)
1. removed some duplicate symbol linker error 2. removed many compiler warnings (mainly size_t/int compatibility) 3. consistent definition of db::pcell_id_type 4. removed UTF-8 character codes from string constants 5. float constants for float arguments 6. timeout in tlHttp when no openssl lib is found (instead of stalling app)
This commit is contained in:
parent
7031c6faf4
commit
1555daf68c
582
build.bat
582
build.bat
|
|
@ -1,291 +1,291 @@
|
|||
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem KLAYOUT build script
|
||||
rem See build.bat -h for details
|
||||
rem
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem parse command lines
|
||||
|
||||
set CONFIG=release
|
||||
set HAVE_QTBINDINGS=1
|
||||
set HAVE_QT=1
|
||||
set HAVE_64BIT_COORD=0
|
||||
set HAVE_PYTHON=1
|
||||
set HAVE_RUBY=1
|
||||
set MAKE_OPT=
|
||||
set HAVE_CURL=0
|
||||
set HAVE_EXPAT=0
|
||||
set HAVE_PTHREADS=0
|
||||
|
||||
set arch=x64
|
||||
set compiler=msvc2017
|
||||
set dry_run=0
|
||||
set option-qmake=qmake
|
||||
set "option-bits=c:\klayout-bits"
|
||||
set "option-build=%TEMP%\klayout-build"
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
|
||||
set "option="
|
||||
for %%a in (%*) do (
|
||||
if not defined option (
|
||||
set arg=%%a
|
||||
if "!arg:~0,1!" equ "-" (
|
||||
if "!arg!" equ "-h" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "--help" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "-help" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "-bits" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-qmake" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-build" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-bin" (
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-prefix" (
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-build" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-debug" (
|
||||
set "CONFIG=debug"
|
||||
) else if "!arg!" equ "-release" (
|
||||
set "CONFIG=release"
|
||||
) else if "!arg!" equ "-with-qtbinding" (
|
||||
set "HAVE_QTBINDINGS=1"
|
||||
) else if "!arg!" equ "-without-qtbinding" (
|
||||
set "HAVE_QTBINDINGS=0"
|
||||
) else if "!arg!" equ "-without-qt" (
|
||||
set "HAVE_QT=0"
|
||||
set "HAVE_CURL=1"
|
||||
set "HAVE_EXPAT=1"
|
||||
set "HAVE_PTHREADS=1"
|
||||
set "HAVE_QTBINDINGS=0"
|
||||
) else if "!arg!" equ "-with-64bit-coord" (
|
||||
set "HAVE_64BIT_COORD=1"
|
||||
) else if "!arg!" equ "-without-64bit-coord" (
|
||||
set "HAVE_64BIT_COORD=0"
|
||||
) else if "!arg!" equ "-nopython" (
|
||||
set "HAVE_PYTHON=0"
|
||||
) else if "!arg!" equ "-noruby" (
|
||||
set "HAVE_RUBY=0"
|
||||
) else if "!arg!" equ "-dry-run" (
|
||||
set "dry_run=1"
|
||||
) else if "!arg!" equ "-x64" (
|
||||
set "arch=x64"
|
||||
) else if "!arg!" equ "-x86" (
|
||||
set "arch=x86"
|
||||
)
|
||||
) else (
|
||||
set "MAKE_OPT=!MAKE_OPT! !arg!"
|
||||
)
|
||||
) else (
|
||||
set "option!option!=%%a"
|
||||
set "option="
|
||||
)
|
||||
)
|
||||
|
||||
if defined option-h (
|
||||
echo build.bat - KLayout build script
|
||||
echo.
|
||||
echo Mandatory options:
|
||||
echo -bits [path] Path to the 3rd party binary kit
|
||||
echo -build [path] Path to the build directory
|
||||
echo -bin [path] Path to the installation directory
|
||||
echo -prefix [path] Same as -bin
|
||||
echo -x86 32 bit build
|
||||
echo -x64 64 bit build [default]
|
||||
echo.
|
||||
echo Other options:
|
||||
echo -h -help --help Show this help
|
||||
echo -qmake [path] Path to the qmake binary
|
||||
echo -debug Perform a debug build
|
||||
echo -release Perform a release build [the default]
|
||||
echo -with-qtbinding Enable Qt support for Ruby/Python [the default]
|
||||
echo -without-qtbinding Disable Qt support for Ruby/Python
|
||||
echo -without-qt Entirely Qt-free build of a tool subset
|
||||
echo -with-64bit-coord Enable 64bit coordinate support [experimental]
|
||||
echo -without-64bit-coord Disable 64bit coordinate support [default]
|
||||
echo -nopython Dont include Python support
|
||||
echo -noruby Dont include Ruby support
|
||||
echo -dry-run Dont actually make
|
||||
goto :eof
|
||||
)
|
||||
|
||||
echo Analysing installation ...
|
||||
echo.
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem locate MSVC on the system
|
||||
|
||||
set MSVC_COMPILER_INST=notfound
|
||||
rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there.
|
||||
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul
|
||||
if NOT ERRORLEVEL 1 (
|
||||
for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') do (
|
||||
if "%%i"=="15.0" (
|
||||
if exist "%%k\VC\Auxiliary\Build" (
|
||||
set "MSVC_COMPILER_INST=%%k\VC\Auxiliary\Build"
|
||||
set "msg=Found MSVC installation at !MSVC_COMPILER_INST!"
|
||||
echo !msg!
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem alternative way (VS2019)
|
||||
if "%MSVC_COMPILER_INST%" == "notfound" (
|
||||
set vs_path=notfound
|
||||
for /f "delims=" %%i in ('"c:\program files (x86)\microsoft visual studio\installer\vswhere" -latest -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -products *') do (
|
||||
set "vs_path=%%i"
|
||||
)
|
||||
if not "vs_path" == "notfound" (
|
||||
set "MSVC_COMPILER_INST=!vs_path!\vc\Auxiliary\Build"
|
||||
)
|
||||
)
|
||||
if "%MSVC_COMPILER_INST%" == "notfound" (
|
||||
echo ERROR: Unable to find MSVC installation
|
||||
goto :eof
|
||||
)
|
||||
if %arch% equ x64 (
|
||||
call "%MSVC_COMPILER_INST%\vcvars64"
|
||||
) else (
|
||||
call "%MSVC_COMPILER_INST%\vcvars32"
|
||||
)
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem check the kit
|
||||
|
||||
if not exist "%option-bits%"\%compiler%\%arch% (
|
||||
echo ERROR: no 3rd party binary kit found in %option-bits%\%compiler%\%arch%
|
||||
goto :eof
|
||||
)
|
||||
if not exist "%option-bits%\%compiler%\%arch%\ruby\bin\ruby.exe" (
|
||||
echo ERROR: %option-bits% not installed properly or
|
||||
echo path does not point to architecture folder.
|
||||
echo Use -bits to specfiy the path to the 3rd party binary kit.
|
||||
goto :eof
|
||||
)
|
||||
echo Using bits from %option-bits%\%compiler%\%arch%
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem check the qmake binary
|
||||
|
||||
"%option-qmake%" -v >nul 2>nul
|
||||
if ERRORLEVEL 1 (
|
||||
echo ERROR: Not a valid qmake: %option-qmake%
|
||||
echo Use -qmake option to specify the path to the qmake binary.
|
||||
goto :eof
|
||||
)
|
||||
echo Using qmake from %option-qmake%
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem read klayout Version
|
||||
|
||||
for /F "tokens=1" %%i in ('type version.sh') do (
|
||||
set line=%%i
|
||||
if "!line:~0,16!" equ "KLAYOUT_VERSION=" (
|
||||
set "version=!line:~16,100!"
|
||||
set "KLAYOUT_VERSION=!version:"=!"
|
||||
)
|
||||
)
|
||||
|
||||
date /t >%TEMP%\klayout-build-tmp.txt
|
||||
set /P KLAYOUT_VERSION_DATE=<%TEMP%\klayout-build-tmp.txt
|
||||
del %TEMP%\klayout-build-tmp.txt
|
||||
|
||||
rem The short SHA hash of the commit
|
||||
git rev-parse --short HEAD 2>nul >%TEMP%\klayout-build-tmp.txt
|
||||
set /P KLAYOUT_VERSION_REV=<%TEMP%\klayout-build-tmp.txt
|
||||
if ERRORLEVEL 1 (
|
||||
set "KLAYOUT_VERSION_REV=LatestSourcePackage"
|
||||
)
|
||||
del %TEMP%\klayout-build-tmp.txt
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem dump settings
|
||||
|
||||
echo.
|
||||
echo Architecture: %arch%
|
||||
echo Compiler: %compiler%
|
||||
echo.
|
||||
echo CONFIG: %CONFIG%
|
||||
echo KLAYOUT_VERSION: %KLAYOUT_VERSION%
|
||||
echo KLAYOUT_VERSION_DATE: %KLAYOUT_VERSION_DATE%
|
||||
echo KLAYOUT_VERSION_REV: %KLAYOUT_VERSION_REV%
|
||||
echo HAVE_QTBINDINGS: %HAVE_QTBINDINGS%
|
||||
echo HAVE_QT: %HAVE_QT%
|
||||
echo HAVE_64BIT_COORD: %HAVE_64BIT_COORD%
|
||||
echo HAVE_PYTHON: %HAVE_PYTHON%
|
||||
echo HAVE_RUBY: %HAVE_RUBY%
|
||||
echo HAVE_CURL: %HAVE_CURL%
|
||||
echo HAVE_PTHREADS: %HAVE_PTHREADS%
|
||||
echo HAVE_EXPAT: %HAVE_EXPAT%
|
||||
echo MAKE_OPT: %MAKE_OPT%
|
||||
echo.
|
||||
echo qmake binary: %option-qmake%
|
||||
echo Build directory: %option-build%
|
||||
echo Installation directory: %option-bin%
|
||||
|
||||
if %dry_run% equ 1 (
|
||||
echo.
|
||||
echo Dry run ... stopping now.
|
||||
goto :eof
|
||||
)
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem Run qmake
|
||||
|
||||
set "inst_path=%~dp0"
|
||||
mkdir "%option-build%" 2>nul
|
||||
cd "%option-build%"
|
||||
if not exist "%option-build%" (
|
||||
echo ERROR: build directory does not exists and cannot be created
|
||||
goto :eof
|
||||
)
|
||||
|
||||
echo on
|
||||
"%option-qmake%" ^
|
||||
HAVE_QT5=1 ^
|
||||
HAVE_QT_UITOOLS=1 ^
|
||||
HAVE_QT_NETWORK=1 ^
|
||||
HAVE_QT_SQL=1 ^
|
||||
HAVE_QT_SVG=1 ^
|
||||
HAVE_QT_PRINTSUPPORT=1 ^
|
||||
HAVE_QT_MULTIMEDIA=1 ^
|
||||
HAVE_QT_DESIGNER=1 ^
|
||||
HAVE_QT_XML=1 ^
|
||||
-recursive ^
|
||||
-spec win32-msvc ^
|
||||
"CONFIG+=%CONFIG%" ^
|
||||
"KLAYOUT_VERSION=%KLAYOUT_VERSION%" ^
|
||||
"KLAYOUT_VERSION_DATE=%KLAYOUT_VERSION_DATE%" ^
|
||||
"KLAYOUT_VERSION_REV=%KLAYOUT_VERSION_REV%" ^
|
||||
"HAVE_QTBINDINGS=%HAVE_QTBINDINGS%" ^
|
||||
"HAVE_QT=%HAVE_QT%" ^
|
||||
"HAVE_EXPAT=%HAVE_EXPAT%" ^
|
||||
"HAVE_CURL=%HAVE_CURL%" ^
|
||||
"HAVE_PTHREADS=%HAVE_PTHREADS%" ^
|
||||
"HAVE_RUBY=%HAVE_RUBY%" ^
|
||||
"HAVE_PYTHON=%HAVE_PYTHON%" ^
|
||||
"HAVE_64BIT_COORD=%HAVE_64BIT_COORD%" ^
|
||||
"PREFIX=%option-bin%" ^
|
||||
"BITS_PATH=%option-bits%\%compiler%\%arch%" ^
|
||||
%inst_path%\src\klayout.pro || exit /b 1
|
||||
|
||||
rem start the build
|
||||
nmake %MAKE_OPT% || exit /b 2
|
||||
|
||||
rem install the binaries
|
||||
nmake install || exit /b 3
|
||||
|
||||
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem KLAYOUT build script
|
||||
rem See build.bat -h for details
|
||||
rem
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem parse command lines
|
||||
|
||||
set CONFIG=release
|
||||
set HAVE_QTBINDINGS=1
|
||||
set HAVE_QT=1
|
||||
set HAVE_64BIT_COORD=0
|
||||
set HAVE_PYTHON=1
|
||||
set HAVE_RUBY=1
|
||||
set MAKE_OPT=
|
||||
set HAVE_CURL=0
|
||||
set HAVE_EXPAT=0
|
||||
set HAVE_PTHREADS=0
|
||||
|
||||
set arch=x64
|
||||
set compiler=msvc2017
|
||||
set dry_run=0
|
||||
set option-qmake=qmake
|
||||
set "option-bits=c:\klayout-bits"
|
||||
set "option-build=%TEMP%\klayout-build"
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
|
||||
set "option="
|
||||
for %%a in (%*) do (
|
||||
if not defined option (
|
||||
set arg=%%a
|
||||
if "!arg:~0,1!" equ "-" (
|
||||
if "!arg!" equ "-h" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "--help" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "-help" (
|
||||
set "option-h=1"
|
||||
set "option="
|
||||
) else if "!arg!" equ "-bits" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-qmake" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-build" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-bin" (
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-prefix" (
|
||||
set "option-bin=%TEMP%\klayout-bin"
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-build" (
|
||||
set "option=!arg!"
|
||||
) else if "!arg!" equ "-debug" (
|
||||
set "CONFIG=debug"
|
||||
) else if "!arg!" equ "-release" (
|
||||
set "CONFIG=release"
|
||||
) else if "!arg!" equ "-with-qtbinding" (
|
||||
set "HAVE_QTBINDINGS=1"
|
||||
) else if "!arg!" equ "-without-qtbinding" (
|
||||
set "HAVE_QTBINDINGS=0"
|
||||
) else if "!arg!" equ "-without-qt" (
|
||||
set "HAVE_QT=0"
|
||||
set "HAVE_CURL=1"
|
||||
set "HAVE_EXPAT=1"
|
||||
set "HAVE_PTHREADS=1"
|
||||
set "HAVE_QTBINDINGS=0"
|
||||
) else if "!arg!" equ "-with-64bit-coord" (
|
||||
set "HAVE_64BIT_COORD=1"
|
||||
) else if "!arg!" equ "-without-64bit-coord" (
|
||||
set "HAVE_64BIT_COORD=0"
|
||||
) else if "!arg!" equ "-nopython" (
|
||||
set "HAVE_PYTHON=0"
|
||||
) else if "!arg!" equ "-noruby" (
|
||||
set "HAVE_RUBY=0"
|
||||
) else if "!arg!" equ "-dry-run" (
|
||||
set "dry_run=1"
|
||||
) else if "!arg!" equ "-x64" (
|
||||
set "arch=x64"
|
||||
) else if "!arg!" equ "-x86" (
|
||||
set "arch=x86"
|
||||
)
|
||||
) else (
|
||||
set "MAKE_OPT=!MAKE_OPT! !arg!"
|
||||
)
|
||||
) else (
|
||||
set "option!option!=%%a"
|
||||
set "option="
|
||||
)
|
||||
)
|
||||
|
||||
if defined option-h (
|
||||
echo build.bat - KLayout build script
|
||||
echo.
|
||||
echo Mandatory options:
|
||||
echo -bits [path] Path to the 3rd party binary kit
|
||||
echo -build [path] Path to the build directory
|
||||
echo -bin [path] Path to the installation directory
|
||||
echo -prefix [path] Same as -bin
|
||||
echo -x86 32 bit build
|
||||
echo -x64 64 bit build [default]
|
||||
echo.
|
||||
echo Other options:
|
||||
echo -h -help --help Show this help
|
||||
echo -qmake [path] Path to the qmake binary
|
||||
echo -debug Perform a debug build
|
||||
echo -release Perform a release build [the default]
|
||||
echo -with-qtbinding Enable Qt support for Ruby/Python [the default]
|
||||
echo -without-qtbinding Disable Qt support for Ruby/Python
|
||||
echo -without-qt Entirely Qt-free build of a tool subset
|
||||
echo -with-64bit-coord Enable 64bit coordinate support [experimental]
|
||||
echo -without-64bit-coord Disable 64bit coordinate support [default]
|
||||
echo -nopython Dont include Python support
|
||||
echo -noruby Dont include Ruby support
|
||||
echo -dry-run Dont actually make
|
||||
goto :eof
|
||||
)
|
||||
|
||||
echo Analysing installation ...
|
||||
echo.
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem locate MSVC on the system
|
||||
|
||||
set MSVC_COMPILER_INST=notfound
|
||||
rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there.
|
||||
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul
|
||||
if NOT ERRORLEVEL 1 (
|
||||
for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') do (
|
||||
if "%%i"=="15.0" (
|
||||
if exist "%%k\VC\Auxiliary\Build" (
|
||||
set "MSVC_COMPILER_INST=%%k\VC\Auxiliary\Build"
|
||||
set "msg=Found MSVC installation at !MSVC_COMPILER_INST!"
|
||||
echo !msg!
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem alternative way (VS2019)
|
||||
if "%MSVC_COMPILER_INST%" == "notfound" (
|
||||
set vs_path=notfound
|
||||
for /f "delims=" %%i in ('"c:\program files (x86)\microsoft visual studio\installer\vswhere" -latest -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -products *') do (
|
||||
set "vs_path=%%i"
|
||||
)
|
||||
if not "vs_path" == "notfound" (
|
||||
set "MSVC_COMPILER_INST=!vs_path!\vc\Auxiliary\Build"
|
||||
)
|
||||
)
|
||||
if "%MSVC_COMPILER_INST%" == "notfound" (
|
||||
echo ERROR: Unable to find MSVC installation
|
||||
goto :eof
|
||||
)
|
||||
if %arch% equ x64 (
|
||||
call "%MSVC_COMPILER_INST%\vcvars64"
|
||||
) else (
|
||||
call "%MSVC_COMPILER_INST%\vcvars32"
|
||||
)
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem check the kit
|
||||
|
||||
if not exist "%option-bits%"\%compiler%\%arch% (
|
||||
echo ERROR: no 3rd party binary kit found in %option-bits%\%compiler%\%arch%
|
||||
goto :eof
|
||||
)
|
||||
if not exist "%option-bits%\%compiler%\%arch%\ruby\bin\ruby.exe" (
|
||||
echo ERROR: %option-bits% not installed properly or
|
||||
echo path does not point to architecture folder.
|
||||
echo Use -bits to specfiy the path to the 3rd party binary kit.
|
||||
goto :eof
|
||||
)
|
||||
echo Using bits from %option-bits%\%compiler%\%arch%
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem check the qmake binary
|
||||
|
||||
"%option-qmake%" -v >nul 2>nul
|
||||
if ERRORLEVEL 1 (
|
||||
echo ERROR: Not a valid qmake: %option-qmake%
|
||||
echo Use -qmake option to specify the path to the qmake binary.
|
||||
goto :eof
|
||||
)
|
||||
echo Using qmake from %option-qmake%
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem read klayout Version
|
||||
|
||||
for /F "tokens=1" %%i in ('type version.sh') do (
|
||||
set line=%%i
|
||||
if "!line:~0,16!" equ "KLAYOUT_VERSION=" (
|
||||
set "version=!line:~16,100!"
|
||||
set "KLAYOUT_VERSION=!version:"=!"
|
||||
)
|
||||
)
|
||||
|
||||
date /t >%TEMP%\klayout-build-tmp.txt
|
||||
set /P KLAYOUT_VERSION_DATE=<%TEMP%\klayout-build-tmp.txt
|
||||
del %TEMP%\klayout-build-tmp.txt
|
||||
|
||||
rem The short SHA hash of the commit
|
||||
git rev-parse --short HEAD 2>nul >%TEMP%\klayout-build-tmp.txt
|
||||
set /P KLAYOUT_VERSION_REV=<%TEMP%\klayout-build-tmp.txt
|
||||
if ERRORLEVEL 1 (
|
||||
set "KLAYOUT_VERSION_REV=LatestSourcePackage"
|
||||
)
|
||||
del %TEMP%\klayout-build-tmp.txt
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem dump settings
|
||||
|
||||
echo.
|
||||
echo Architecture: %arch%
|
||||
echo Compiler: %compiler%
|
||||
echo.
|
||||
echo CONFIG: %CONFIG%
|
||||
echo KLAYOUT_VERSION: %KLAYOUT_VERSION%
|
||||
echo KLAYOUT_VERSION_DATE: %KLAYOUT_VERSION_DATE%
|
||||
echo KLAYOUT_VERSION_REV: %KLAYOUT_VERSION_REV%
|
||||
echo HAVE_QTBINDINGS: %HAVE_QTBINDINGS%
|
||||
echo HAVE_QT: %HAVE_QT%
|
||||
echo HAVE_64BIT_COORD: %HAVE_64BIT_COORD%
|
||||
echo HAVE_PYTHON: %HAVE_PYTHON%
|
||||
echo HAVE_RUBY: %HAVE_RUBY%
|
||||
echo HAVE_CURL: %HAVE_CURL%
|
||||
echo HAVE_PTHREADS: %HAVE_PTHREADS%
|
||||
echo HAVE_EXPAT: %HAVE_EXPAT%
|
||||
echo MAKE_OPT: %MAKE_OPT%
|
||||
echo.
|
||||
echo qmake binary: %option-qmake%
|
||||
echo Build directory: %option-build%
|
||||
echo Installation directory: %option-bin%
|
||||
|
||||
if %dry_run% equ 1 (
|
||||
echo.
|
||||
echo Dry run ... stopping now.
|
||||
goto :eof
|
||||
)
|
||||
|
||||
rem ----------------------------------------------------------
|
||||
rem Run qmake
|
||||
|
||||
set "inst_path=%~dp0"
|
||||
mkdir "%option-build%" 2>nul
|
||||
cd "%option-build%"
|
||||
if not exist "%option-build%" (
|
||||
echo ERROR: build directory does not exists and cannot be created
|
||||
goto :eof
|
||||
)
|
||||
|
||||
echo on
|
||||
"%option-qmake%" ^
|
||||
HAVE_QT5=1 ^
|
||||
HAVE_QT_UITOOLS=1 ^
|
||||
HAVE_QT_NETWORK=1 ^
|
||||
HAVE_QT_SQL=1 ^
|
||||
HAVE_QT_SVG=1 ^
|
||||
HAVE_QT_PRINTSUPPORT=1 ^
|
||||
HAVE_QT_MULTIMEDIA=1 ^
|
||||
HAVE_QT_DESIGNER=1 ^
|
||||
HAVE_QT_XML=1 ^
|
||||
-recursive ^
|
||||
-spec win32-msvc ^
|
||||
"CONFIG+=%CONFIG%" ^
|
||||
"KLAYOUT_VERSION=%KLAYOUT_VERSION%" ^
|
||||
"KLAYOUT_VERSION_DATE=%KLAYOUT_VERSION_DATE%" ^
|
||||
"KLAYOUT_VERSION_REV=%KLAYOUT_VERSION_REV%" ^
|
||||
"HAVE_QTBINDINGS=%HAVE_QTBINDINGS%" ^
|
||||
"HAVE_QT=%HAVE_QT%" ^
|
||||
"HAVE_EXPAT=%HAVE_EXPAT%" ^
|
||||
"HAVE_CURL=%HAVE_CURL%" ^
|
||||
"HAVE_PTHREADS=%HAVE_PTHREADS%" ^
|
||||
"HAVE_RUBY=%HAVE_RUBY%" ^
|
||||
"HAVE_PYTHON=%HAVE_PYTHON%" ^
|
||||
"HAVE_64BIT_COORD=%HAVE_64BIT_COORD%" ^
|
||||
"PREFIX=%option-bin%" ^
|
||||
"BITS_PATH=%option-bits%\%compiler%\%arch%" ^
|
||||
%inst_path%\src\klayout.pro || exit /b 1
|
||||
|
||||
rem start the build
|
||||
nmake %MAKE_OPT% || exit /b 2
|
||||
|
||||
rem install the binaries
|
||||
nmake install || exit /b 3
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,322 +1,322 @@
|
|||
#! /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.26.1 or later on different Apple Mac OSX platforms.
|
||||
#
|
||||
# This file is imported by 'build4mac.py' script.
|
||||
#===============================================================================
|
||||
import os
|
||||
import glob
|
||||
import platform
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
# [0] Xcode's tools
|
||||
# and
|
||||
# Default Homebrew root
|
||||
# Ref. https://github.com/Homebrew/brew/blob/master/docs/Installation.md#alternative-installs
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
XcodeToolChain = { 'nameID': '/usr/bin/install_name_tool -id ',
|
||||
'nameCH': '/usr/bin/install_name_tool -change '
|
||||
}
|
||||
|
||||
(System, Node, Release, MacVersion, Machine, Processor) = platform.uname()
|
||||
if Machine == "arm64": # Apple Silicon!
|
||||
DefaultHomebrewRoot = '/opt/homebrew'
|
||||
else:
|
||||
DefaultHomebrewRoot = '/usr/local'
|
||||
del System, Node, Release, MacVersion, Machine, Processor
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [1] Qt
|
||||
#-----------------------------------------------------
|
||||
Qts = [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Qt5
|
||||
#-----------------------------------------------------
|
||||
# Qt5 from MacPorts (https://www.macports.org/)
|
||||
# install with 'sudo port install qt5'
|
||||
# [Key Type Name] = 'Qt5MacPorts'
|
||||
Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake',
|
||||
'deploy': '/opt/local/libexec/qt5/bin/macdeployqt'
|
||||
}
|
||||
|
||||
# Qt5 from Homebrew (https://brew.sh/)
|
||||
# install with 'brew install qt'
|
||||
# [Key Type Name] = 'Qt5Brew'
|
||||
Qt5Brew = { 'qmake' : '%s/opt/qt@5/bin/qmake' % DefaultHomebrewRoot,
|
||||
'deploy': '%s/opt/qt@5/bin/macdeployqt' % DefaultHomebrewRoot
|
||||
}
|
||||
|
||||
# Qt5 bundled with anaconda3 installed under /Applications/anaconda3/
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Qt5Ana3'
|
||||
Qt5Ana3 = { 'qmake' : '/Applications/anaconda3/bin/qmake',
|
||||
'deploy': '/Applications/anaconda3/bin/macdeployqt'
|
||||
}
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [2] Ruby
|
||||
#-----------------------------------------------------
|
||||
RubyNil = [ 'nil' ]
|
||||
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina', 'RubyBigSur' ]
|
||||
RubyExt = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
|
||||
Rubies = RubyNil + RubySys + RubyExt
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Ruby
|
||||
#-----------------------------------------------------
|
||||
# Bundled with Yosemite (10.10)
|
||||
# !!! Yosemite is no longer supported (KLayout 0.26 ~) but remains here to keep the record of
|
||||
# the directory structure of earlier generations.
|
||||
# [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.3/usr/bin/ruby',
|
||||
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
|
||||
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/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'
|
||||
}
|
||||
|
||||
# Bundled with Mojave (10.14)
|
||||
# The missing Ruby header files under "/System/Library/Frameworks/Ruby.framework/" were manually deployed there
|
||||
# from "Xcode-10.1-beta2" with the corresponding Ruby version.
|
||||
# [Key Type Name] = 'Sys'
|
||||
RubyMojave = { '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'
|
||||
}
|
||||
|
||||
# Bundled with Catalina (10.15)
|
||||
# !!! Catalina does not allow to hack the "/System" directory; it's READ ONLY even for the super user!
|
||||
# Hence, we need to refer to the Ruby header file in "Xcode.app" directly.
|
||||
#
|
||||
# With the major release of "macOS Big Sur (11.0)" in November 2020, Xcode has been updated, too.
|
||||
# (base) MacBookPro2{kazzz-s}(1)$ pwd
|
||||
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
|
||||
#
|
||||
# (base) MacBookPro2{kazzz-s}(2)$ ll
|
||||
# total 4
|
||||
# drwxr-xr-x 6 root wheel 192 11 15 20:57 .
|
||||
# drwxr-xr-x 3 root wheel 96 10 20 05:33 ..
|
||||
# drwxr-xr-x 23 root wheel 736 10 24 11:57 ruby
|
||||
# -rw-r--r-- 1 root wheel 868 10 19 19:32 ruby.h
|
||||
# lrwxr-xr-x 1 root wheel 19 11 15 20:57 universal-darwin19 -> universal-darwin20/ <=== manually created this symbolic link
|
||||
# drwxr-xr-x 6 root wheel 192 10 20 05:33 universal-darwin20
|
||||
# [Key Type Name] = 'Sys'
|
||||
CatalinaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
|
||||
RubyCatalina = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
|
||||
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % CatalinaSDK,
|
||||
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % CatalinaSDK,
|
||||
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % CatalinaSDK
|
||||
}
|
||||
|
||||
# Bundled with Big Sur (11.0)
|
||||
# Refer to the "Catalina" section above
|
||||
# [Key Type Name] = 'Sys'
|
||||
BigSurSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
|
||||
RubyBigSur = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
|
||||
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % BigSurSDK,
|
||||
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % BigSurSDK,
|
||||
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % BigSurSDK
|
||||
}
|
||||
|
||||
# Ruby 2.7 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'sudo port install ruby27'
|
||||
# [Key Type Name] = 'MP27'
|
||||
Ruby27MacPorts = { 'exe': '/opt/local/bin/ruby2.7',
|
||||
'inc': '/opt/local/include/ruby-2.7.0',
|
||||
'lib': '/opt/local/lib/libruby.2.7.dylib'
|
||||
}
|
||||
|
||||
# Ruby 2.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install ruby'
|
||||
# [Key Type Name] = 'HB27'
|
||||
HBRuby27Path = '%s/opt/ruby@2.7' % DefaultHomebrewRoot
|
||||
Ruby27Brew = { 'exe': '%s/bin/ruby' % HBRuby27Path,
|
||||
'inc': '%s/include/ruby-2.7.0' % HBRuby27Path,
|
||||
'lib': '%s/lib/libruby.2.7.dylib' % HBRuby27Path
|
||||
}
|
||||
|
||||
# Ruby 2.5 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Ana3'
|
||||
RubyAnaconda3 = { 'exe': '/Applications/anaconda3/bin/ruby',
|
||||
'inc': '/Applications/anaconda3/include/ruby-2.5.0',
|
||||
'lib': '/Applications/anaconda3/lib/libruby.2.5.1.dylib'
|
||||
}
|
||||
|
||||
# Consolidated dictionary kit for Ruby
|
||||
RubyDictionary = { 'nil' : None,
|
||||
'RubyYosemite' : RubyYosemite,
|
||||
'RubyElCapitan' : RubyElCapitan,
|
||||
'RubySierra' : RubySierra,
|
||||
'RubyHighSierra': RubyHighSierra,
|
||||
'RubyMojave' : RubyMojave,
|
||||
'RubyCatalina' : RubyCatalina,
|
||||
'RubyBigSur' : RubyBigSur,
|
||||
'Ruby27MacPorts': Ruby27MacPorts,
|
||||
'Ruby27Brew' : Ruby27Brew,
|
||||
'RubyAnaconda3' : RubyAnaconda3
|
||||
}
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [3] Python
|
||||
#-----------------------------------------------------
|
||||
PythonNil = [ 'nil' ]
|
||||
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave', 'PythonCatalina', 'PythonBigSur' ]
|
||||
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
|
||||
Pythons = PythonNil + PythonSys + PythonExt
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Python
|
||||
#-----------------------------------------------------
|
||||
# Bundled with Yosemite (10.10)
|
||||
# !!! Yosemite is no longer supported but remains here to keep the record of the directory structure
|
||||
# of earlier generations.
|
||||
# [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'
|
||||
}
|
||||
|
||||
# Bundled with Mojave (10.14)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonMojave = { '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 Catalina (10.15)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonCatalina = { '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 Big Sur (11.0)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonBigSur = { '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'
|
||||
}
|
||||
|
||||
# Python 3.8 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'sudo port install python38'
|
||||
# [Key Type Name] = 'MP38'
|
||||
Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8',
|
||||
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8',
|
||||
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib'
|
||||
}
|
||||
|
||||
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install python'
|
||||
# [Key Type Name] = 'HB38'
|
||||
HBPython38FrameworkPath = '%s/opt/python@3.8/Frameworks/Python.framework' % DefaultHomebrewRoot
|
||||
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath,
|
||||
'inc': '%s/Versions/3.8/include/python3.8' % HBPython38FrameworkPath,
|
||||
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath
|
||||
}
|
||||
|
||||
# Python 3.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Ana3'
|
||||
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.8',
|
||||
'inc': '/Applications/anaconda3/include/python3.8',
|
||||
'lib': '/Applications/anaconda3/lib/libpython3.8.dylib'
|
||||
}
|
||||
|
||||
# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install python'
|
||||
# There can be multiple candidates such as: (python, python3, python@3, python@3.8, python@3.9)
|
||||
# Hard to tell which is going to be available to the user. Picking the last one.
|
||||
# [Key Type Name] = 'HBAuto'
|
||||
HBPythonAutoFrameworkPath = ""
|
||||
HBPythonAutoVersion = ""
|
||||
try:
|
||||
HBPythonAutoFrameworkPath = glob.glob( "%s/opt/python*/Frameworks/Python.framework" % DefaultHomebrewRoot )[-1]
|
||||
# expand 3* into HBPythonAutoVersion, there should be only one, but I am taking no chances.
|
||||
HBAutoFrameworkVersionPath, HBPythonAutoVersion = os.path.split( glob.glob( "%s/Versions/3*" % HBPythonAutoFrameworkPath )[0] )
|
||||
PythonAutoBrew = { 'exe': '%s/%s/bin/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
|
||||
'inc': '%s/%s/include/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
|
||||
'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0]
|
||||
}
|
||||
except Exception as e:
|
||||
_have_Homebrew_Python = False
|
||||
print( " WARNING!!! Since you don't have the Homebrew Python Frameworks, you cannot use the '-p HBAuto' option. " )
|
||||
pass
|
||||
else:
|
||||
_have_Homebrew_Python = True
|
||||
|
||||
# Consolidated dictionary kit for Python
|
||||
PythonDictionary = { 'nil' : None,
|
||||
'PythonElCapitan' : PythonElCapitan,
|
||||
'PythonSierra' : PythonSierra,
|
||||
'PythonHighSierra': PythonHighSierra,
|
||||
'PythonMojave' : PythonMojave,
|
||||
'PythonCatalina' : PythonCatalina,
|
||||
'PythonBigSur' : PythonBigSur,
|
||||
'Python38MacPorts': Python38MacPorts,
|
||||
'Python38Brew' : Python38Brew,
|
||||
'PythonAnaconda3' : PythonAnaconda3
|
||||
}
|
||||
if _have_Homebrew_Python:
|
||||
PythonDictionary['PythonAutoBrew'] = PythonAutoBrew
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [4] KLayout executables including buddy tools
|
||||
#-----------------------------------------------------
|
||||
KLayoutExecs = [ 'klayout' ]
|
||||
KLayoutExecs += [ 'strm2cif', 'strm2dxf', 'strm2gds', 'strm2gdstxt', 'strm2oas' ]
|
||||
KLayoutExecs += [ 'strm2txt', 'strmclip', 'strmcmp', 'strmrun', 'strmxor' ]
|
||||
|
||||
#----------------
|
||||
# End of File
|
||||
#----------------
|
||||
#! /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.26.1 or later on different Apple Mac OSX platforms.
|
||||
#
|
||||
# This file is imported by 'build4mac.py' script.
|
||||
#===============================================================================
|
||||
import os
|
||||
import glob
|
||||
import platform
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
# [0] Xcode's tools
|
||||
# and
|
||||
# Default Homebrew root
|
||||
# Ref. https://github.com/Homebrew/brew/blob/master/docs/Installation.md#alternative-installs
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
XcodeToolChain = { 'nameID': '/usr/bin/install_name_tool -id ',
|
||||
'nameCH': '/usr/bin/install_name_tool -change '
|
||||
}
|
||||
|
||||
(System, Node, Release, MacVersion, Machine, Processor) = platform.uname()
|
||||
if Machine == "arm64": # Apple Silicon!
|
||||
DefaultHomebrewRoot = '/opt/homebrew'
|
||||
else:
|
||||
DefaultHomebrewRoot = '/usr/local'
|
||||
del System, Node, Release, MacVersion, Machine, Processor
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [1] Qt
|
||||
#-----------------------------------------------------
|
||||
Qts = [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Qt5
|
||||
#-----------------------------------------------------
|
||||
# Qt5 from MacPorts (https://www.macports.org/)
|
||||
# install with 'sudo port install qt5'
|
||||
# [Key Type Name] = 'Qt5MacPorts'
|
||||
Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake',
|
||||
'deploy': '/opt/local/libexec/qt5/bin/macdeployqt'
|
||||
}
|
||||
|
||||
# Qt5 from Homebrew (https://brew.sh/)
|
||||
# install with 'brew install qt'
|
||||
# [Key Type Name] = 'Qt5Brew'
|
||||
Qt5Brew = { 'qmake' : '%s/opt/qt@5/bin/qmake' % DefaultHomebrewRoot,
|
||||
'deploy': '%s/opt/qt@5/bin/macdeployqt' % DefaultHomebrewRoot
|
||||
}
|
||||
|
||||
# Qt5 bundled with anaconda3 installed under /Applications/anaconda3/
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Qt5Ana3'
|
||||
Qt5Ana3 = { 'qmake' : '/Applications/anaconda3/bin/qmake',
|
||||
'deploy': '/Applications/anaconda3/bin/macdeployqt'
|
||||
}
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [2] Ruby
|
||||
#-----------------------------------------------------
|
||||
RubyNil = [ 'nil' ]
|
||||
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina', 'RubyBigSur' ]
|
||||
RubyExt = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
|
||||
Rubies = RubyNil + RubySys + RubyExt
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Ruby
|
||||
#-----------------------------------------------------
|
||||
# Bundled with Yosemite (10.10)
|
||||
# !!! Yosemite is no longer supported (KLayout 0.26 ~) but remains here to keep the record of
|
||||
# the directory structure of earlier generations.
|
||||
# [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.3/usr/bin/ruby',
|
||||
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
|
||||
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/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'
|
||||
}
|
||||
|
||||
# Bundled with Mojave (10.14)
|
||||
# The missing Ruby header files under "/System/Library/Frameworks/Ruby.framework/" were manually deployed there
|
||||
# from "Xcode-10.1-beta2" with the corresponding Ruby version.
|
||||
# [Key Type Name] = 'Sys'
|
||||
RubyMojave = { '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'
|
||||
}
|
||||
|
||||
# Bundled with Catalina (10.15)
|
||||
# !!! Catalina does not allow to hack the "/System" directory; it's READ ONLY even for the super user!
|
||||
# Hence, we need to refer to the Ruby header file in "Xcode.app" directly.
|
||||
#
|
||||
# With the major release of "macOS Big Sur (11.0)" in November 2020, Xcode has been updated, too.
|
||||
# (base) MacBookPro2{kazzz-s}(1)$ pwd
|
||||
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
|
||||
#
|
||||
# (base) MacBookPro2{kazzz-s}(2)$ ll
|
||||
# total 4
|
||||
# drwxr-xr-x 6 root wheel 192 11 15 20:57 .
|
||||
# drwxr-xr-x 3 root wheel 96 10 20 05:33 ..
|
||||
# drwxr-xr-x 23 root wheel 736 10 24 11:57 ruby
|
||||
# -rw-r--r-- 1 root wheel 868 10 19 19:32 ruby.h
|
||||
# lrwxr-xr-x 1 root wheel 19 11 15 20:57 universal-darwin19 -> universal-darwin20/ <=== manually created this symbolic link
|
||||
# drwxr-xr-x 6 root wheel 192 10 20 05:33 universal-darwin20
|
||||
# [Key Type Name] = 'Sys'
|
||||
CatalinaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
|
||||
RubyCatalina = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
|
||||
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % CatalinaSDK,
|
||||
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % CatalinaSDK,
|
||||
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % CatalinaSDK
|
||||
}
|
||||
|
||||
# Bundled with Big Sur (11.0)
|
||||
# Refer to the "Catalina" section above
|
||||
# [Key Type Name] = 'Sys'
|
||||
BigSurSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
|
||||
RubyBigSur = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
|
||||
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % BigSurSDK,
|
||||
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % BigSurSDK,
|
||||
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % BigSurSDK
|
||||
}
|
||||
|
||||
# Ruby 2.7 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'sudo port install ruby27'
|
||||
# [Key Type Name] = 'MP27'
|
||||
Ruby27MacPorts = { 'exe': '/opt/local/bin/ruby2.7',
|
||||
'inc': '/opt/local/include/ruby-2.7.0',
|
||||
'lib': '/opt/local/lib/libruby.2.7.dylib'
|
||||
}
|
||||
|
||||
# Ruby 2.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install ruby'
|
||||
# [Key Type Name] = 'HB27'
|
||||
HBRuby27Path = '%s/opt/ruby@2.7' % DefaultHomebrewRoot
|
||||
Ruby27Brew = { 'exe': '%s/bin/ruby' % HBRuby27Path,
|
||||
'inc': '%s/include/ruby-2.7.0' % HBRuby27Path,
|
||||
'lib': '%s/lib/libruby.2.7.dylib' % HBRuby27Path
|
||||
}
|
||||
|
||||
# Ruby 2.5 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Ana3'
|
||||
RubyAnaconda3 = { 'exe': '/Applications/anaconda3/bin/ruby',
|
||||
'inc': '/Applications/anaconda3/include/ruby-2.5.0',
|
||||
'lib': '/Applications/anaconda3/lib/libruby.2.5.1.dylib'
|
||||
}
|
||||
|
||||
# Consolidated dictionary kit for Ruby
|
||||
RubyDictionary = { 'nil' : None,
|
||||
'RubyYosemite' : RubyYosemite,
|
||||
'RubyElCapitan' : RubyElCapitan,
|
||||
'RubySierra' : RubySierra,
|
||||
'RubyHighSierra': RubyHighSierra,
|
||||
'RubyMojave' : RubyMojave,
|
||||
'RubyCatalina' : RubyCatalina,
|
||||
'RubyBigSur' : RubyBigSur,
|
||||
'Ruby27MacPorts': Ruby27MacPorts,
|
||||
'Ruby27Brew' : Ruby27Brew,
|
||||
'RubyAnaconda3' : RubyAnaconda3
|
||||
}
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [3] Python
|
||||
#-----------------------------------------------------
|
||||
PythonNil = [ 'nil' ]
|
||||
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave', 'PythonCatalina', 'PythonBigSur' ]
|
||||
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
|
||||
Pythons = PythonNil + PythonSys + PythonExt
|
||||
|
||||
#-----------------------------------------------------
|
||||
# Whereabout of different components of Python
|
||||
#-----------------------------------------------------
|
||||
# Bundled with Yosemite (10.10)
|
||||
# !!! Yosemite is no longer supported but remains here to keep the record of the directory structure
|
||||
# of earlier generations.
|
||||
# [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'
|
||||
}
|
||||
|
||||
# Bundled with Mojave (10.14)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonMojave = { '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 Catalina (10.15)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonCatalina = { '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 Big Sur (11.0)
|
||||
# [Key Type Name] = 'Sys'
|
||||
PythonBigSur = { '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'
|
||||
}
|
||||
|
||||
# Python 3.8 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'sudo port install python38'
|
||||
# [Key Type Name] = 'MP38'
|
||||
Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8',
|
||||
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8',
|
||||
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib'
|
||||
}
|
||||
|
||||
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install python'
|
||||
# [Key Type Name] = 'HB38'
|
||||
HBPython38FrameworkPath = '%s/opt/python@3.8/Frameworks/Python.framework' % DefaultHomebrewRoot
|
||||
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath,
|
||||
'inc': '%s/Versions/3.8/include/python3.8' % HBPython38FrameworkPath,
|
||||
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath
|
||||
}
|
||||
|
||||
# Python 3.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
|
||||
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
|
||||
# [Key Type Name] = 'Ana3'
|
||||
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.8',
|
||||
'inc': '/Applications/anaconda3/include/python3.8',
|
||||
'lib': '/Applications/anaconda3/lib/libpython3.8.dylib'
|
||||
}
|
||||
|
||||
# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
|
||||
# install with 'brew install python'
|
||||
# There can be multiple candidates such as: (python, python3, python@3, python@3.8, python@3.9)
|
||||
# Hard to tell which is going to be available to the user. Picking the last one.
|
||||
# [Key Type Name] = 'HBAuto'
|
||||
HBPythonAutoFrameworkPath = ""
|
||||
HBPythonAutoVersion = ""
|
||||
try:
|
||||
HBPythonAutoFrameworkPath = glob.glob( "%s/opt/python*/Frameworks/Python.framework" % DefaultHomebrewRoot )[-1]
|
||||
# expand 3* into HBPythonAutoVersion, there should be only one, but I am taking no chances.
|
||||
HBAutoFrameworkVersionPath, HBPythonAutoVersion = os.path.split( glob.glob( "%s/Versions/3*" % HBPythonAutoFrameworkPath )[0] )
|
||||
PythonAutoBrew = { 'exe': '%s/%s/bin/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
|
||||
'inc': '%s/%s/include/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
|
||||
'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0]
|
||||
}
|
||||
except Exception as e:
|
||||
_have_Homebrew_Python = False
|
||||
print( " WARNING!!! Since you don't have the Homebrew Python Frameworks, you cannot use the '-p HBAuto' option. " )
|
||||
pass
|
||||
else:
|
||||
_have_Homebrew_Python = True
|
||||
|
||||
# Consolidated dictionary kit for Python
|
||||
PythonDictionary = { 'nil' : None,
|
||||
'PythonElCapitan' : PythonElCapitan,
|
||||
'PythonSierra' : PythonSierra,
|
||||
'PythonHighSierra': PythonHighSierra,
|
||||
'PythonMojave' : PythonMojave,
|
||||
'PythonCatalina' : PythonCatalina,
|
||||
'PythonBigSur' : PythonBigSur,
|
||||
'Python38MacPorts': Python38MacPorts,
|
||||
'Python38Brew' : Python38Brew,
|
||||
'PythonAnaconda3' : PythonAnaconda3
|
||||
}
|
||||
if _have_Homebrew_Python:
|
||||
PythonDictionary['PythonAutoBrew'] = PythonAutoBrew
|
||||
|
||||
#-----------------------------------------------------
|
||||
# [4] KLayout executables including buddy tools
|
||||
#-----------------------------------------------------
|
||||
KLayoutExecs = [ 'klayout' ]
|
||||
KLayoutExecs += [ 'strm2cif', 'strm2dxf', 'strm2gds', 'strm2gdstxt', 'strm2oas' ]
|
||||
KLayoutExecs += [ 'strm2txt', 'strmclip', 'strmcmp', 'strmrun', 'strmxor' ]
|
||||
|
||||
#----------------
|
||||
# End of File
|
||||
#----------------
|
||||
|
|
|
|||
|
|
@ -1,467 +1,467 @@
|
|||
#! /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.26.1 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
|
||||
import shutil
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## 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.26.0, current version 0.26.1)
|
||||
# libklayout_tl.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_gsi.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_laybasic.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_db.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# :
|
||||
# :
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def DecomposeLibraryDependency( depstr ):
|
||||
alllines = depstr.split('\n')
|
||||
numlines = len(alllines)
|
||||
dependent = alllines[0].split(':')[0].strip()
|
||||
supporters = []
|
||||
for line in alllines[1:]:
|
||||
supporter = line.strip().split(' ')[0].strip()
|
||||
if not supporter == '':
|
||||
supporters.append(supporter)
|
||||
return { dependent: supporters }
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To print the contents of a library dependency dictionary
|
||||
#
|
||||
# @param[in] depdic dictionary
|
||||
# @param[in] pathdic path dictionary
|
||||
# @param[in] namedic dictionary name
|
||||
#----------------------------------------------------------------------------------------
|
||||
def PrintLibraryDependencyDictionary( depdic, pathdic, namedic ):
|
||||
keys = depdic.keys()
|
||||
print("")
|
||||
print("##### Contents of <%s> #####:" % namedic )
|
||||
for key in keys:
|
||||
supporters = depdic[key]
|
||||
keyName = os.path.basename(key)
|
||||
print( " %s: (%s)" % (key, pathdic[keyName]) )
|
||||
for item in supporters:
|
||||
itemName = os.path.basename(item)
|
||||
if itemName != keyName and (itemName in pathdic):
|
||||
print( " %s (%s)" % (item, pathdic[itemName]) )
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## 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, pathDic ):
|
||||
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
|
||||
libName = os.path.basename(lib)
|
||||
nameNew = pathDic[libName]
|
||||
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:
|
||||
supName = os.path.basename(sup)
|
||||
if libName != supName and (supName in pathDic):
|
||||
nameOld = "%s" % sup
|
||||
nameNew = pathDic[supName]
|
||||
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'
|
||||
# | +-- 'db_plugins' --slink--> ../MacOS/db_plugins/
|
||||
# +-- MacOS/+
|
||||
# | +-- 'klayout'
|
||||
# | +-- db_plugins/
|
||||
# | +-- lay_plugins/
|
||||
# +-- 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[ list(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 make a library dependency dictionary by recursively walk down the lib hierarchy
|
||||
#
|
||||
# @param[in] dylibPath: dylib path
|
||||
# @param[in] depth: hierarchy depth (< 5)
|
||||
# @param[in] filter_regex: filter regular expression
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkLibDependencyTree( dylibPath, depth=0, filter_regex=r'\t+/usr/local/opt' ):
|
||||
otoolCm = 'otool -L %s | grep -E "%s"' % (dylibPath, filter_regex)
|
||||
otoolOut = os.popen( otoolCm ).read()
|
||||
exedepdic = DecomposeLibraryDependency( dylibPath + ":\n" + otoolOut )
|
||||
keys = exedepdic.keys()
|
||||
deplibs = exedepdic[ list(keys)[0] ]
|
||||
|
||||
if depth < 5:
|
||||
if len(deplibs) > 0:
|
||||
for idx, lib in enumerate(deplibs):
|
||||
lib = str(lib)
|
||||
if lib != list(keys)[0]:
|
||||
deplibs[idx] = WalkLibDependencyTree(lib, depth+1, filter_regex)
|
||||
if depth == 0:
|
||||
return deplibs
|
||||
return exedepdic
|
||||
else:
|
||||
raise RuntimeError( "Exceeded maximum recursion depth." )
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To make a library dependency dictionary by recursively walk down the Framework
|
||||
#
|
||||
# @param[in] frameworkPaths: Framework path
|
||||
# @param[in] filter_regex: filter regular expression
|
||||
# @param[in] search_path_filter: search path filter regular expression
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkFrameworkPaths( frameworkPaths, filter_regex=r'\.(so|dylib)$',
|
||||
search_path_filter=r'\t+/usr/local/opt' ):
|
||||
|
||||
if isinstance(frameworkPaths, str):
|
||||
frameworkPathsIter = [frameworkPaths]
|
||||
else:
|
||||
frameworkPathsIter = frameworkPaths
|
||||
|
||||
dependency_dict = dict()
|
||||
|
||||
for frameworkPath in frameworkPathsIter:
|
||||
# print("Calling:", 'find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex))
|
||||
find_grep_results = os.popen('find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex)).read().split('\n')
|
||||
framework_files = filter(lambda x: x != '',
|
||||
map(lambda x: x.strip(),
|
||||
find_grep_results))
|
||||
|
||||
dependency_dict[frameworkPath] = list()
|
||||
for idx, file in enumerate(framework_files):
|
||||
dict_file = {file: WalkLibDependencyTree(file, filter_regex=search_path_filter)}
|
||||
dependency_dict[frameworkPath].append(dict_file)
|
||||
return dependency_dict
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To make a list of changed libraries
|
||||
#
|
||||
# @param[in] dependencyDict: library dependency dictionary
|
||||
# @param[in] visited_files: list of visited files
|
||||
#
|
||||
# @return a list
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkDictTree( dependencyDict, visited_files ):
|
||||
libNameChanges = list()
|
||||
for lib, dependencies in dependencyDict.items():
|
||||
if lib in visited_files:
|
||||
continue
|
||||
|
||||
dependency_list = list()
|
||||
if isinstance(dependencies, list):
|
||||
for deplib in dependencies:
|
||||
if isinstance(deplib, str):
|
||||
dependency_list.append(deplib)
|
||||
if deplib not in visited_files:
|
||||
visited_files.append(deplib)
|
||||
elif isinstance(deplib, dict):
|
||||
dependency_list.append(next(iter(deplib)))
|
||||
libNameChanges.extend(WalkDictTree(deplib, visited_files))
|
||||
else:
|
||||
#raise RuntimeError("Unexpected value: %s" % deplib)
|
||||
pass
|
||||
else:
|
||||
raise RuntimeError("Unexpected value: %s" % dependencies)
|
||||
if len(dependency_list) > 0:
|
||||
libNameChanges.append((lib, dependency_list))
|
||||
else:
|
||||
libNameChanges.append((lib, ))
|
||||
visited_files.append(lib)
|
||||
return libNameChanges
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To find the Framework name from a library name
|
||||
#
|
||||
# @param[in] path: path to a library
|
||||
# @param[in] root_path: root path
|
||||
#
|
||||
# @return the path to a Framework
|
||||
#----------------------------------------------------------------------------------------
|
||||
def FindFramework( path, root_path ):
|
||||
relPath = os.path.relpath(path, root_path)
|
||||
frmPath = os.path.join(root_path, relPath.split(os.sep)[0])
|
||||
#print( "###", frmPath, path, root_path )
|
||||
return frmPath
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To resolve an executable path
|
||||
#
|
||||
# @param[in] path: a path to resolve
|
||||
# @param[in] executable_path: an executable path
|
||||
#
|
||||
# @return the resolved path
|
||||
#----------------------------------------------------------------------------------------
|
||||
def ResolveExecutablePath( path, executable_path ):
|
||||
""" Transforms @executable_path into executable_path"""
|
||||
p = path.replace("@executable_path", "/%s/" % executable_path)
|
||||
return p
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To detect the changed library names
|
||||
#
|
||||
# @param[in] frameworkDependencyDict: framework dependency dictionary
|
||||
#
|
||||
# @return a list of changes, each of which is stored in the form of
|
||||
# * ('lib.dylib', ['dep1.dylib', ...])
|
||||
# OR
|
||||
# * ('lib.dylib',)
|
||||
#----------------------------------------------------------------------------------------
|
||||
def DetectChanges(frameworkDependencyDict):
|
||||
visited_files = list()
|
||||
libNameChanges = list()
|
||||
for framework, libraries in frameworkDependencyDict.items():
|
||||
for libraryDict in libraries:
|
||||
libNameChanges.extend(WalkDictTree(libraryDict, visited_files))
|
||||
return libNameChanges
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To perform the required changes
|
||||
#
|
||||
# @param[in] frameworkDependencyDict: framework dependency dictionary
|
||||
# @param[in] replaceFromToPairs: (from, to)-pair for replacement
|
||||
# @param[in] executable_path: executable path
|
||||
#
|
||||
# @return 0 on success; > 0 on failure
|
||||
#----------------------------------------------------------------------------------------
|
||||
def PerformChanges( frameworkDependencyDict, replaceFromToPairs=None, executable_path="/tmp/klayout" ):
|
||||
libNameChanges = DetectChanges(frameworkDependencyDict)
|
||||
#print(libNameChanges)
|
||||
cmdNameId = XcodeToolChain['nameID']
|
||||
cmdNameChg = XcodeToolChain['nameCH']
|
||||
|
||||
if replaceFromToPairs is None:
|
||||
return 0
|
||||
else:
|
||||
for libNameChange in libNameChanges:
|
||||
libNameChangeIterator = iter(libNameChange)
|
||||
lib = next(libNameChangeIterator)
|
||||
try:
|
||||
dependencies = next(libNameChangeIterator)
|
||||
except StopIteration:
|
||||
dependencies = list()
|
||||
for replaceFrom, replaceTo, libdir in replaceFromToPairs:
|
||||
fileName = ResolveExecutablePath(lib.replace(replaceFrom, replaceTo), executable_path)
|
||||
if fileName.startswith('/usr'):
|
||||
# print(f'skipping fileName: {fileName}')
|
||||
continue
|
||||
|
||||
if lib.find(replaceFrom) >= 0:
|
||||
if libdir:
|
||||
frameworkPath = FindFramework(lib, replaceFrom)
|
||||
else:
|
||||
frameworkPath = lib
|
||||
destFrameworkPath = frameworkPath.replace(replaceFrom, replaceTo)
|
||||
destFrameworkPath = ResolveExecutablePath(destFrameworkPath, executable_path)
|
||||
|
||||
if not os.path.exists(fileName):
|
||||
print( " NOT FOUND:", lib.replace(replaceFrom, replaceTo) )
|
||||
print( " COPYING:", frameworkPath, " -> ", destFrameworkPath )
|
||||
shutil.copytree(frameworkPath, destFrameworkPath)
|
||||
|
||||
nameId = lib.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s" % ( cmdNameId, nameId, fileName )
|
||||
if not os.access(fileName, os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
|
||||
for dependency in dependencies:
|
||||
if dependency.find(replaceFrom) >= 0:
|
||||
print( " IN:", fileName )
|
||||
print( " RENAMING:", dependency, " -> ", dependency.replace(replaceFrom, replaceTo) )
|
||||
|
||||
# Try changing id first
|
||||
nameId = dependency.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s" % ( cmdNameId, nameId, fileName)
|
||||
if not os.access(str(fileName), os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
|
||||
# Rename dependencies
|
||||
nameOld = dependency
|
||||
nameNew = dependency.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s %s" % ( cmdNameChg, nameOld, nameNew, str(fileName) )
|
||||
if not os.access(str(fileName), os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
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.26.1"
|
||||
# print(m.group(1)) # KLAYOUT_VERSION="
|
||||
# print(m.group(2)) # 0.26.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
|
||||
#----------------
|
||||
#! /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.26.1 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
|
||||
import shutil
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## 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.26.0, current version 0.26.1)
|
||||
# libklayout_tl.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_gsi.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_laybasic.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# libklayout_db.0.dylib (compatibility version 0.26.0, current version 0.26.1)
|
||||
# :
|
||||
# :
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def DecomposeLibraryDependency( depstr ):
|
||||
alllines = depstr.split('\n')
|
||||
numlines = len(alllines)
|
||||
dependent = alllines[0].split(':')[0].strip()
|
||||
supporters = []
|
||||
for line in alllines[1:]:
|
||||
supporter = line.strip().split(' ')[0].strip()
|
||||
if not supporter == '':
|
||||
supporters.append(supporter)
|
||||
return { dependent: supporters }
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To print the contents of a library dependency dictionary
|
||||
#
|
||||
# @param[in] depdic dictionary
|
||||
# @param[in] pathdic path dictionary
|
||||
# @param[in] namedic dictionary name
|
||||
#----------------------------------------------------------------------------------------
|
||||
def PrintLibraryDependencyDictionary( depdic, pathdic, namedic ):
|
||||
keys = depdic.keys()
|
||||
print("")
|
||||
print("##### Contents of <%s> #####:" % namedic )
|
||||
for key in keys:
|
||||
supporters = depdic[key]
|
||||
keyName = os.path.basename(key)
|
||||
print( " %s: (%s)" % (key, pathdic[keyName]) )
|
||||
for item in supporters:
|
||||
itemName = os.path.basename(item)
|
||||
if itemName != keyName and (itemName in pathdic):
|
||||
print( " %s (%s)" % (item, pathdic[itemName]) )
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## 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, pathDic ):
|
||||
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
|
||||
libName = os.path.basename(lib)
|
||||
nameNew = pathDic[libName]
|
||||
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:
|
||||
supName = os.path.basename(sup)
|
||||
if libName != supName and (supName in pathDic):
|
||||
nameOld = "%s" % sup
|
||||
nameNew = pathDic[supName]
|
||||
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'
|
||||
# | +-- 'db_plugins' --slink--> ../MacOS/db_plugins/
|
||||
# +-- MacOS/+
|
||||
# | +-- 'klayout'
|
||||
# | +-- db_plugins/
|
||||
# | +-- lay_plugins/
|
||||
# +-- 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[ list(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 make a library dependency dictionary by recursively walk down the lib hierarchy
|
||||
#
|
||||
# @param[in] dylibPath: dylib path
|
||||
# @param[in] depth: hierarchy depth (< 5)
|
||||
# @param[in] filter_regex: filter regular expression
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkLibDependencyTree( dylibPath, depth=0, filter_regex=r'\t+/usr/local/opt' ):
|
||||
otoolCm = 'otool -L %s | grep -E "%s"' % (dylibPath, filter_regex)
|
||||
otoolOut = os.popen( otoolCm ).read()
|
||||
exedepdic = DecomposeLibraryDependency( dylibPath + ":\n" + otoolOut )
|
||||
keys = exedepdic.keys()
|
||||
deplibs = exedepdic[ list(keys)[0] ]
|
||||
|
||||
if depth < 5:
|
||||
if len(deplibs) > 0:
|
||||
for idx, lib in enumerate(deplibs):
|
||||
lib = str(lib)
|
||||
if lib != list(keys)[0]:
|
||||
deplibs[idx] = WalkLibDependencyTree(lib, depth+1, filter_regex)
|
||||
if depth == 0:
|
||||
return deplibs
|
||||
return exedepdic
|
||||
else:
|
||||
raise RuntimeError( "Exceeded maximum recursion depth." )
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To make a library dependency dictionary by recursively walk down the Framework
|
||||
#
|
||||
# @param[in] frameworkPaths: Framework path
|
||||
# @param[in] filter_regex: filter regular expression
|
||||
# @param[in] search_path_filter: search path filter regular expression
|
||||
#
|
||||
# @return a dictionary
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkFrameworkPaths( frameworkPaths, filter_regex=r'\.(so|dylib)$',
|
||||
search_path_filter=r'\t+/usr/local/opt' ):
|
||||
|
||||
if isinstance(frameworkPaths, str):
|
||||
frameworkPathsIter = [frameworkPaths]
|
||||
else:
|
||||
frameworkPathsIter = frameworkPaths
|
||||
|
||||
dependency_dict = dict()
|
||||
|
||||
for frameworkPath in frameworkPathsIter:
|
||||
# print("Calling:", 'find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex))
|
||||
find_grep_results = os.popen('find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex)).read().split('\n')
|
||||
framework_files = filter(lambda x: x != '',
|
||||
map(lambda x: x.strip(),
|
||||
find_grep_results))
|
||||
|
||||
dependency_dict[frameworkPath] = list()
|
||||
for idx, file in enumerate(framework_files):
|
||||
dict_file = {file: WalkLibDependencyTree(file, filter_regex=search_path_filter)}
|
||||
dependency_dict[frameworkPath].append(dict_file)
|
||||
return dependency_dict
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To make a list of changed libraries
|
||||
#
|
||||
# @param[in] dependencyDict: library dependency dictionary
|
||||
# @param[in] visited_files: list of visited files
|
||||
#
|
||||
# @return a list
|
||||
#----------------------------------------------------------------------------------------
|
||||
def WalkDictTree( dependencyDict, visited_files ):
|
||||
libNameChanges = list()
|
||||
for lib, dependencies in dependencyDict.items():
|
||||
if lib in visited_files:
|
||||
continue
|
||||
|
||||
dependency_list = list()
|
||||
if isinstance(dependencies, list):
|
||||
for deplib in dependencies:
|
||||
if isinstance(deplib, str):
|
||||
dependency_list.append(deplib)
|
||||
if deplib not in visited_files:
|
||||
visited_files.append(deplib)
|
||||
elif isinstance(deplib, dict):
|
||||
dependency_list.append(next(iter(deplib)))
|
||||
libNameChanges.extend(WalkDictTree(deplib, visited_files))
|
||||
else:
|
||||
#raise RuntimeError("Unexpected value: %s" % deplib)
|
||||
pass
|
||||
else:
|
||||
raise RuntimeError("Unexpected value: %s" % dependencies)
|
||||
if len(dependency_list) > 0:
|
||||
libNameChanges.append((lib, dependency_list))
|
||||
else:
|
||||
libNameChanges.append((lib, ))
|
||||
visited_files.append(lib)
|
||||
return libNameChanges
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To find the Framework name from a library name
|
||||
#
|
||||
# @param[in] path: path to a library
|
||||
# @param[in] root_path: root path
|
||||
#
|
||||
# @return the path to a Framework
|
||||
#----------------------------------------------------------------------------------------
|
||||
def FindFramework( path, root_path ):
|
||||
relPath = os.path.relpath(path, root_path)
|
||||
frmPath = os.path.join(root_path, relPath.split(os.sep)[0])
|
||||
#print( "###", frmPath, path, root_path )
|
||||
return frmPath
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To resolve an executable path
|
||||
#
|
||||
# @param[in] path: a path to resolve
|
||||
# @param[in] executable_path: an executable path
|
||||
#
|
||||
# @return the resolved path
|
||||
#----------------------------------------------------------------------------------------
|
||||
def ResolveExecutablePath( path, executable_path ):
|
||||
""" Transforms @executable_path into executable_path"""
|
||||
p = path.replace("@executable_path", "/%s/" % executable_path)
|
||||
return p
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To detect the changed library names
|
||||
#
|
||||
# @param[in] frameworkDependencyDict: framework dependency dictionary
|
||||
#
|
||||
# @return a list of changes, each of which is stored in the form of
|
||||
# * ('lib.dylib', ['dep1.dylib', ...])
|
||||
# OR
|
||||
# * ('lib.dylib',)
|
||||
#----------------------------------------------------------------------------------------
|
||||
def DetectChanges(frameworkDependencyDict):
|
||||
visited_files = list()
|
||||
libNameChanges = list()
|
||||
for framework, libraries in frameworkDependencyDict.items():
|
||||
for libraryDict in libraries:
|
||||
libNameChanges.extend(WalkDictTree(libraryDict, visited_files))
|
||||
return libNameChanges
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## To perform the required changes
|
||||
#
|
||||
# @param[in] frameworkDependencyDict: framework dependency dictionary
|
||||
# @param[in] replaceFromToPairs: (from, to)-pair for replacement
|
||||
# @param[in] executable_path: executable path
|
||||
#
|
||||
# @return 0 on success; > 0 on failure
|
||||
#----------------------------------------------------------------------------------------
|
||||
def PerformChanges( frameworkDependencyDict, replaceFromToPairs=None, executable_path="/tmp/klayout" ):
|
||||
libNameChanges = DetectChanges(frameworkDependencyDict)
|
||||
#print(libNameChanges)
|
||||
cmdNameId = XcodeToolChain['nameID']
|
||||
cmdNameChg = XcodeToolChain['nameCH']
|
||||
|
||||
if replaceFromToPairs is None:
|
||||
return 0
|
||||
else:
|
||||
for libNameChange in libNameChanges:
|
||||
libNameChangeIterator = iter(libNameChange)
|
||||
lib = next(libNameChangeIterator)
|
||||
try:
|
||||
dependencies = next(libNameChangeIterator)
|
||||
except StopIteration:
|
||||
dependencies = list()
|
||||
for replaceFrom, replaceTo, libdir in replaceFromToPairs:
|
||||
fileName = ResolveExecutablePath(lib.replace(replaceFrom, replaceTo), executable_path)
|
||||
if fileName.startswith('/usr'):
|
||||
# print(f'skipping fileName: {fileName}')
|
||||
continue
|
||||
|
||||
if lib.find(replaceFrom) >= 0:
|
||||
if libdir:
|
||||
frameworkPath = FindFramework(lib, replaceFrom)
|
||||
else:
|
||||
frameworkPath = lib
|
||||
destFrameworkPath = frameworkPath.replace(replaceFrom, replaceTo)
|
||||
destFrameworkPath = ResolveExecutablePath(destFrameworkPath, executable_path)
|
||||
|
||||
if not os.path.exists(fileName):
|
||||
print( " NOT FOUND:", lib.replace(replaceFrom, replaceTo) )
|
||||
print( " COPYING:", frameworkPath, " -> ", destFrameworkPath )
|
||||
shutil.copytree(frameworkPath, destFrameworkPath)
|
||||
|
||||
nameId = lib.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s" % ( cmdNameId, nameId, fileName )
|
||||
if not os.access(fileName, os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
|
||||
for dependency in dependencies:
|
||||
if dependency.find(replaceFrom) >= 0:
|
||||
print( " IN:", fileName )
|
||||
print( " RENAMING:", dependency, " -> ", dependency.replace(replaceFrom, replaceTo) )
|
||||
|
||||
# Try changing id first
|
||||
nameId = dependency.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s" % ( cmdNameId, nameId, fileName)
|
||||
if not os.access(str(fileName), os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
|
||||
# Rename dependencies
|
||||
nameOld = dependency
|
||||
nameNew = dependency.replace(replaceFrom, replaceTo)
|
||||
command = "%s %s %s %s" % ( cmdNameChg, nameOld, nameNew, str(fileName) )
|
||||
if not os.access(str(fileName), os.W_OK):
|
||||
command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName)
|
||||
|
||||
# print("\t%s" % command)
|
||||
if subprocess.call( command, shell=True ) != 0:
|
||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||
print( msg % fileName, file=sys.stderr )
|
||||
return 1
|
||||
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.26.1"
|
||||
# print(m.group(1)) # KLAYOUT_VERSION="
|
||||
# print(m.group(2)) # 0.26.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
|
||||
#----------------
|
||||
|
|
|
|||
|
|
@ -114,13 +114,15 @@ bool bs_boxes_overlap (const Box &b1, const Box &b2, typename Box::coord_type en
|
|||
template <class Obj, class Prop>
|
||||
struct box_scanner_receiver
|
||||
{
|
||||
virtual ~box_scanner_receiver () { }
|
||||
|
||||
/**
|
||||
* @brief Indicates that the given object is no longer used
|
||||
*
|
||||
* The finish method is called when an object is no longer in the queue and can be
|
||||
* discarded.
|
||||
*/
|
||||
void finish (const Obj * /*obj*/, const Prop & /*prop*/) { }
|
||||
virtual void finish (const Obj * /*obj*/, const Prop & /*prop*/) { }
|
||||
|
||||
/**
|
||||
* @brief Callback for an interaction of o1 with o2.
|
||||
|
|
@ -128,7 +130,7 @@ struct box_scanner_receiver
|
|||
* This method is called when the object o1 interacts with o2 within the current
|
||||
* definition.
|
||||
*/
|
||||
void add (const Obj * /*o1*/, const Prop & /*p1*/, const Obj * /*o2*/, const Prop & /*p2*/) { }
|
||||
virtual void add (const Obj * /*o1*/, const Prop & /*p1*/, const Obj * /*o2*/, const Prop & /*p2*/) { }
|
||||
|
||||
/**
|
||||
* @brief Indicates whether the scanner may stop
|
||||
|
|
@ -136,14 +138,14 @@ struct box_scanner_receiver
|
|||
* The scanner will stop if this method returns true. This feature can be used to
|
||||
* terminate the scan process early if the outcome is known.
|
||||
*/
|
||||
bool stop () const { return false; }
|
||||
virtual bool stop () const { return false; }
|
||||
|
||||
/**
|
||||
* @brief Pre-scanning operations
|
||||
*
|
||||
* This method is called before the scanning starts.
|
||||
*/
|
||||
void initialize () { }
|
||||
virtual void initialize () { }
|
||||
|
||||
/**
|
||||
* @brief Post-scanning operations
|
||||
|
|
@ -151,7 +153,7 @@ struct box_scanner_receiver
|
|||
* This method is called after the scan has finished (without exception). The argument is the
|
||||
* return value (false if "stop" stopped the process).
|
||||
*/
|
||||
void finalize (bool) { }
|
||||
virtual void finalize (bool) { }
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ CommonReader::cell_by_name (const std::string &cn) const
|
|||
if (iname != m_name_map.end ()) {
|
||||
return std::make_pair (true, iname->second.second);
|
||||
} else {
|
||||
return std::make_pair (false, size_t (0));
|
||||
return std::make_pair (false, db::cell_index_type (0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ CommonReader::cell_by_id (size_t id) const
|
|||
if (iid != m_id_map.end ()) {
|
||||
return std::make_pair (true, iid->second.second);
|
||||
} else {
|
||||
return std::make_pair (false, size_t (0));
|
||||
return std::make_pair (false, db::cell_index_type (0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -981,9 +981,9 @@ CompoundRegionLogicalCaseSelectOperationNode::result_type () const
|
|||
ResultType result = Region;
|
||||
for (size_t i = 1; i < children (); i += 2) {
|
||||
if (i == 1) {
|
||||
result = child (i)->result_type ();
|
||||
result = child ((unsigned int) i)->result_type ();
|
||||
} else {
|
||||
tl_assert (result == child (i)->result_type ());
|
||||
tl_assert (result == child ((unsigned int) i)->result_type ());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
@ -1136,9 +1136,9 @@ CompoundRegionJoinOperationNode::result_type () const
|
|||
ResultType result = Region;
|
||||
for (size_t i = 0; i < children (); ++i) {
|
||||
if (i == 0) {
|
||||
result = child (i)->result_type ();
|
||||
result = child ((unsigned int) i)->result_type ();
|
||||
} else {
|
||||
tl_assert (result == child (i)->result_type ());
|
||||
tl_assert (result == child ((unsigned int) i)->result_type ());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ protected:
|
|||
|
||||
unsigned int children () const
|
||||
{
|
||||
return m_children.size ();
|
||||
return (unsigned int) m_children.size ();
|
||||
}
|
||||
|
||||
CompoundRegionOperationNode *child (unsigned int index);
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void Device::init_terminal_routes ()
|
|||
|
||||
size_t n = device_class ()->terminal_definitions ().size ();
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
m_reconnected_terminals [i].push_back (DeviceReconnectedTerminal (0, i));
|
||||
m_reconnected_terminals [(unsigned int) i].push_back (DeviceReconnectedTerminal (0, (unsigned int) i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ public:
|
|||
|
||||
for (unsigned int ir = 0; ir < (unsigned int) std::abs (rows_per_columns); ++ir) {
|
||||
|
||||
db::Vector dr = m_row_step * long ((rows_per_columns > 0 ? -(ir + 1) : ir) + m_row_steps);
|
||||
db::Vector dc = m_column_step * long ((columns_per_rows > 0 ? -(ic + 1) : ic) + m_column_steps);
|
||||
db::Vector dr = m_row_step * long ((rows_per_columns > 0 ? -int (ir + 1) : ir) + m_row_steps);
|
||||
db::Vector dc = m_column_step * long ((columns_per_rows > 0 ? -int (ic + 1) : ic) + m_column_steps);
|
||||
|
||||
am.reinitialize (db::Point (fp_left, fp_bottom) + dr + dc, db::Vector (ddx, ddy), m_dim, nx, ny);
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ public:
|
|||
|
||||
unsigned int area_maps () const
|
||||
{
|
||||
return m_area_maps.size ();
|
||||
return (unsigned int) m_area_maps.size ();
|
||||
}
|
||||
|
||||
const db::AreaMap &area_map (unsigned int i) const
|
||||
|
|
@ -308,7 +308,7 @@ fill_polygon_impl (db::Cell *cell, const db::Polygon &fp0, db::cell_index_type f
|
|||
|
||||
if (remaining_parts) {
|
||||
if (am1.d ().y () == am1.p ().y ()) {
|
||||
filled_regions.push_back (db::Polygon (db::Box (db::Point (), db::Point (am1.p ().x (), am1.p ().y () * (jj - j))).moved (kernel_origin + p0)));
|
||||
filled_regions.push_back (db::Polygon (db::Box (db::Point (), db::Point (am1.p ().x (), am1.p ().y () * db::Coord (jj - j))).moved (kernel_origin + p0)));
|
||||
} else {
|
||||
for (size_t k = 0; k < jj - j; ++k) {
|
||||
filled_regions.push_back (db::Polygon (db::Box (db::Point (), db::Point () + am1.p ()).moved (kernel_origin + p0 + db::Vector (0, am1.d ().y () * db::Coord (k)))));
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ subtract (std::unordered_set<db::PolygonRef> &res, const std::unordered_set<db::
|
|||
|
||||
template <class TS, class TI>
|
||||
static void
|
||||
subtract (std::unordered_set<db::Edge> &res, const std::unordered_set<db::Edge> &other, db::Layout *layout, const db::local_processor<TS, TI, db::Edge> *proc)
|
||||
subtract (std::unordered_set<db::Edge> &res, const std::unordered_set<db::Edge> &other, db::Layout * /*layout*/, const db::local_processor<TS, TI, db::Edge> *proc)
|
||||
{
|
||||
if (other.empty ()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -514,7 +514,6 @@ private:
|
|||
void next () const;
|
||||
size_t get_progress () const;
|
||||
void compute_contexts (db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, const typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
void do_compute_contexts (db::local_processor_cell_context<TS, TI, TR> *cell_context, const db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, const typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
void issue_compute_contexts (db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
void push_results (db::Cell *cell, unsigned int output_layer, const std::unordered_set<TR> &result) const;
|
||||
void compute_local_cell (const db::local_processor_contexts<TS, TI, TR> &contexts, db::Cell *subject_cell, const db::Cell *intruder_cell, const local_operation<TS, TI, TR> *op, const typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, std::vector<std::unordered_set<TR> > &result) const;
|
||||
|
|
|
|||
|
|
@ -2253,7 +2253,7 @@ Layout::register_pcell (const std::string &name, pcell_declaration_type *declara
|
|||
|
||||
} else {
|
||||
|
||||
id = m_pcells.size ();
|
||||
id = (unsigned int) m_pcells.size ();
|
||||
m_pcells.push_back (new pcell_header_type (id, name, declaration));
|
||||
m_pcell_ids.insert (std::make_pair (std::string (name), id));
|
||||
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ public:
|
|||
typedef cell_index_vector::const_iterator top_down_const_iterator;
|
||||
typedef tl::vector<cell_type *> cell_ptr_vector;
|
||||
typedef db::properties_id_type properties_id_type;
|
||||
typedef size_t pcell_id_type;
|
||||
typedef db::pcell_id_type pcell_id_type;
|
||||
typedef std::map<std::string, pcell_id_type> pcell_name_map;
|
||||
typedef pcell_name_map::const_iterator pcell_iterator;
|
||||
typedef std::map<std::pair<lib_id_type, cell_index_type>, cell_index_type> lib_proxy_map;
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ LayoutToNetlistStandardReader::read_device (db::Netlist *netlist, db::LayoutToNe
|
|||
size_t touter_id = terminal_id (dm.second, touter);
|
||||
size_t tinner_id = terminal_id (dm.second, tinner);
|
||||
|
||||
device->reconnected_terminals () [touter_id].push_back (db::DeviceReconnectedTerminal (size_t (device_comp_index), tinner_id));
|
||||
device->reconnected_terminals () [(unsigned int) touter_id].push_back (db::DeviceReconnectedTerminal (size_t (device_comp_index), (unsigned int) tinner_id));
|
||||
|
||||
} else if (test (skeys::terminal_key) || test (lkeys::terminal_key)) {
|
||||
|
||||
|
|
@ -859,7 +859,7 @@ LayoutToNetlistStandardReader::read_device (db::Netlist *netlist, db::LayoutToNe
|
|||
br.done ();
|
||||
|
||||
if (id > 0) {
|
||||
map.id2device.insert (std::make_pair (id, device.get ()));
|
||||
map.id2device.insert (std::make_pair ((unsigned int) id, device.get ()));
|
||||
}
|
||||
|
||||
device->set_trans (trans);
|
||||
|
|
@ -896,7 +896,7 @@ LayoutToNetlistStandardReader::read_device (db::Netlist *netlist, db::LayoutToNe
|
|||
|
||||
if (! device->reconnected_terminals ().empty ()) {
|
||||
|
||||
const std::vector<db::DeviceReconnectedTerminal> *tr = device->reconnected_terminals_for (tid);
|
||||
const std::vector<db::DeviceReconnectedTerminal> *tr = device->reconnected_terminals_for ((unsigned int) tid);
|
||||
if (tr) {
|
||||
|
||||
for (std::vector<db::DeviceReconnectedTerminal>::const_iterator i = tr->begin (); i != tr->end (); ++i) {
|
||||
|
|
@ -1040,7 +1040,7 @@ LayoutToNetlistStandardReader::read_subcircuit (db::Netlist *netlist, db::Layout
|
|||
br.done ();
|
||||
|
||||
if (id > 0) {
|
||||
map.id2subcircuit.insert (std::make_pair (id, subcircuit.get ()));
|
||||
map.id2subcircuit.insert (std::make_pair ((unsigned int) id, subcircuit.get ()));
|
||||
}
|
||||
|
||||
subcircuit->set_name (name);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ static std::string net_id_to_s (const db::Net *net, const std::map<const db::Net
|
|||
static void build_pin_index_map (const db::Circuit *c, std::map<const db::Pin *, unsigned int> &pin2index)
|
||||
{
|
||||
if (c) {
|
||||
size_t pi = 0;
|
||||
unsigned int pi = 0;
|
||||
for (db::Circuit::const_pin_iterator p = c->begin_pins (); p != c->end_pins (); ++p, ++pi) {
|
||||
pin2index.insert (std::make_pair (p.operator-> (), pi));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@
|
|||
namespace db
|
||||
{
|
||||
|
||||
typedef size_t pcell_id_type;
|
||||
typedef std::vector<tl::Variant> pcell_parameters_type;
|
||||
|
||||
/**
|
||||
* @brief A declaration for one PCell parameter
|
||||
/**
|
||||
* @brief A declaration for one PCell parameter
|
||||
*
|
||||
* A parameter is described by a name (potentially a variable name), a description text (for a UI label),
|
||||
* a default value (a variant), a type (requested type for the variant), a choice list (if the parameter can
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@
|
|||
namespace db
|
||||
{
|
||||
|
||||
PCellVariant::PCellVariant (db::cell_index_type ci, db::Layout &layout, size_t pcell_id, const pcell_parameters_type ¶meters)
|
||||
PCellVariant::PCellVariant (db::cell_index_type ci, db::Layout &layout, db::pcell_id_type pcell_id, const pcell_parameters_type ¶meters)
|
||||
: Cell (ci, layout), m_parameters (parameters), m_pcell_id (pcell_id), m_registered (false)
|
||||
{
|
||||
reregister (); // actually, no "re-register", but the first registration ..
|
||||
PCellVariant::reregister (); // actually, no "re-register", but the first registration ..
|
||||
}
|
||||
|
||||
PCellVariant::~PCellVariant ()
|
||||
{
|
||||
unregister ();
|
||||
PCellVariant::unregister ();
|
||||
}
|
||||
|
||||
Cell *
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public:
|
|||
*
|
||||
* The constructor gets the parameters that are unique for this variant.
|
||||
*/
|
||||
PCellVariant (db::cell_index_type ci, db::Layout &layout, size_t pcell_id, const pcell_parameters_type ¶meters);
|
||||
PCellVariant (db::cell_index_type ci, db::Layout &layout, db::pcell_id_type pcell_id, const pcell_parameters_type ¶meters);
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
|
|
@ -83,7 +83,7 @@ public:
|
|||
/**
|
||||
* @brief Get the PCell Id for this variant
|
||||
*/
|
||||
size_t pcell_id () const
|
||||
db::pcell_id_type pcell_id () const
|
||||
{
|
||||
return m_pcell_id;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ protected:
|
|||
private:
|
||||
pcell_parameters_type m_parameters;
|
||||
mutable std::string m_display_name;
|
||||
size_t m_pcell_id;
|
||||
db::pcell_id_type m_pcell_id;
|
||||
bool m_registered;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ Edge2EdgeCheckBase::finish (const Edge *o, const size_t &p)
|
|||
|
||||
if (! any) {
|
||||
|
||||
put_negative (*o, p);
|
||||
put_negative (*o, (int) p);
|
||||
|
||||
} else if (! fully_removed) {
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ Edge2EdgeCheckBase::finish (const Edge *o, const size_t &p)
|
|||
ec.finish ();
|
||||
|
||||
for (std::set<db::Edge>::const_iterator e = partial_edges.begin (); e != partial_edges.end (); ++e) {
|
||||
put_negative (*e, p);
|
||||
put_negative (*e, (int) p);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ inline ld_type relative_ld (ld_type ld)
|
|||
}
|
||||
}
|
||||
|
||||
inline ld_type is_relative_ld (ld_type ld)
|
||||
inline bool is_relative_ld (ld_type ld)
|
||||
{
|
||||
return ld < 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ typedef size_t property_names_id_type;
|
|||
/**
|
||||
* @brief The type of the PCell id
|
||||
*/
|
||||
typedef size_t pcell_id_type;
|
||||
typedef unsigned int pcell_id_type;
|
||||
|
||||
/**
|
||||
* @brief The type of the library id
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static size_t get_other_terminal_id (const db::DeviceReconnectedTerminal *obj)
|
|||
return obj->other_terminal_id;
|
||||
}
|
||||
|
||||
static void set_other_terminal_id (db::DeviceReconnectedTerminal *obj, size_t other_terminal_id)
|
||||
static void set_other_terminal_id (db::DeviceReconnectedTerminal *obj, unsigned int other_terminal_id)
|
||||
{
|
||||
obj->other_terminal_id = other_terminal_id;
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ static std::vector<db::DeviceReconnectedTerminal>::const_iterator begin_reconnec
|
|||
{
|
||||
static std::vector<db::DeviceReconnectedTerminal> empty;
|
||||
|
||||
const std::vector<db::DeviceReconnectedTerminal> *ti = device->reconnected_terminals_for (terminal_id);
|
||||
const std::vector<db::DeviceReconnectedTerminal> *ti = device->reconnected_terminals_for ((unsigned int) terminal_id);
|
||||
if (! ti) {
|
||||
return empty.begin ();
|
||||
} else {
|
||||
|
|
@ -213,7 +213,7 @@ static std::vector<db::DeviceReconnectedTerminal>::const_iterator end_reconnecte
|
|||
{
|
||||
static std::vector<db::DeviceReconnectedTerminal> empty;
|
||||
|
||||
const std::vector<db::DeviceReconnectedTerminal> *ti = device->reconnected_terminals_for (terminal_id);
|
||||
const std::vector<db::DeviceReconnectedTerminal> *ti = device->reconnected_terminals_for ((unsigned int) terminal_id);
|
||||
if (! ti) {
|
||||
return empty.end ();
|
||||
} else {
|
||||
|
|
@ -228,7 +228,7 @@ static void clear_reconnected_terminals (db::Device *device)
|
|||
|
||||
static void add_reconnected_terminals (db::Device *device, size_t outer_terminal, const db::DeviceReconnectedTerminal &t)
|
||||
{
|
||||
device->reconnected_terminals () [outer_terminal].push_back (t);
|
||||
device->reconnected_terminals () [(unsigned int) outer_terminal].push_back (t);
|
||||
}
|
||||
|
||||
static std::vector<db::DeviceAbstractRef>::const_iterator begin_other_abstracts (const db::Device *device)
|
||||
|
|
|
|||
|
|
@ -1373,7 +1373,7 @@ TEST(62)
|
|||
return;
|
||||
}
|
||||
|
||||
size_t text_id = basic_lib->layout ().pcell_by_name ("TEXT").second;
|
||||
db::pcell_id_type text_id = basic_lib->layout ().pcell_by_name ("TEXT").second;
|
||||
const db::PCellDeclaration *text_decl = basic_lib->layout ().pcell_declaration (text_id);
|
||||
|
||||
std::vector<tl::Variant> values;
|
||||
|
|
@ -1389,7 +1389,7 @@ TEST(62)
|
|||
}
|
||||
}
|
||||
|
||||
size_t v1t1 = basic_lib->layout ().get_pcell_variant (text_id, values);
|
||||
db::cell_index_type v1t1 = basic_lib->layout ().get_pcell_variant (text_id, values);
|
||||
|
||||
values.clear ();
|
||||
for (std::vector<db::PCellParameterDeclaration>::const_iterator p = pd.begin (); p != pd.end (); ++p) {
|
||||
|
|
@ -1402,13 +1402,13 @@ TEST(62)
|
|||
}
|
||||
}
|
||||
|
||||
size_t v1t2 = basic_lib->layout ().get_pcell_variant (text_id, values);
|
||||
db::cell_index_type v1t2 = basic_lib->layout ().get_pcell_variant (text_id, values);
|
||||
|
||||
db::Layout g;
|
||||
init_layout (g);
|
||||
|
||||
size_t c3index = g.get_lib_proxy (basic_lib, db::cell_index_type (v1t1));
|
||||
size_t c4index = g.get_lib_proxy (basic_lib, db::cell_index_type (v1t2));
|
||||
size_t c3index = g.get_lib_proxy (basic_lib, v1t1);
|
||||
size_t c4index = g.get_lib_proxy (basic_lib, v1t2);
|
||||
|
||||
db::Cell &c1 (g.cell (g.add_cell ("c1")));
|
||||
db::Cell &c2 (g.cell (g.add_cell ("c2")));
|
||||
|
|
|
|||
|
|
@ -238,6 +238,8 @@ TEST(1_ReaderBasic)
|
|||
|
||||
TEST(1b_ReaderBasicShort)
|
||||
{
|
||||
EXPECT_EQ (true, true); // removes "unreferenced _this" compiler warning
|
||||
|
||||
db::LayoutToNetlist l2n;
|
||||
|
||||
std::string in_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_in_s.txt");
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ struct A
|
|||
return int (x.size ());
|
||||
}
|
||||
int a3_ba (const std::vector<char> &x) {
|
||||
return x.size ();
|
||||
return int (x.size ());
|
||||
}
|
||||
#if defined(HAVE_QT)
|
||||
int a3_qstr (const QString &x) {
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ struct cmp_cell_tree_item_vs_name_f
|
|||
// --------------------------------------------------------------------
|
||||
// CellTreeItem implementation
|
||||
|
||||
CellTreeItem::CellTreeItem (const db::Layout *layout, bool is_pcell, size_t cell_or_pcell_index, bool flat, CellTreeModel::Sorting s)
|
||||
CellTreeItem::CellTreeItem (const db::Layout *layout, bool is_pcell, unsigned int cell_or_pcell_index, bool flat, CellTreeModel::Sorting s)
|
||||
: mp_layout (layout), mp_parent (0), m_sorting (s), m_is_pcell (is_pcell),
|
||||
m_index (0), m_tree_index (0),
|
||||
m_children (), m_cell_or_pcell_index (cell_or_pcell_index)
|
||||
{
|
||||
if (! flat && ! is_pcell) {
|
||||
m_child_count = int (mp_layout->cell (cell_or_pcell_index).child_cells ());
|
||||
m_child_count = int (mp_layout->cell (db::cell_index_type (cell_or_pcell_index)).child_cells ());
|
||||
} else {
|
||||
m_child_count = 0;
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ CellTreeItem::children () const
|
|||
int
|
||||
CellTreeItem::children_in (const std::set<const CellTreeItem *> &sel) const
|
||||
{
|
||||
size_t count = 0;
|
||||
int count = 0;
|
||||
for (std::vector<CellTreeItem *>::const_iterator c = m_children.begin (); c != m_children.end (); ++c) {
|
||||
if (sel.find (*c) != sel.end ()) {
|
||||
++count;
|
||||
|
|
@ -885,7 +885,7 @@ CellTreeModel::rowCount (const QModelIndex &parent) const
|
|||
}
|
||||
} else {
|
||||
if (m_filter_mode && m_is_filtered) {
|
||||
size_t n = 0;
|
||||
int n = 0;
|
||||
for (std::vector <CellTreeItem *>::const_iterator i = m_toplevel.begin (); i != m_toplevel.end (); ++i) {
|
||||
if (m_visible_cell_set.find (*i) != m_visible_cell_set.end ()) {
|
||||
++n;
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ private:
|
|||
class CellTreeItem
|
||||
{
|
||||
public:
|
||||
CellTreeItem (const db::Layout *layout, bool is_pcell, size_t cell_or_pcell_index, bool flat, CellTreeModel::Sorting sorting);
|
||||
CellTreeItem (const db::Layout *layout, bool is_pcell, unsigned int cell_or_pcell_index, bool flat, CellTreeModel::Sorting sorting);
|
||||
~CellTreeItem ();
|
||||
|
||||
int children () const;
|
||||
|
|
@ -338,7 +338,7 @@ private:
|
|||
size_t m_index, m_tree_index;
|
||||
std::vector<CellTreeItem *> m_children;
|
||||
int m_child_count;
|
||||
size_t m_cell_or_pcell_index;
|
||||
unsigned int m_cell_or_pcell_index;
|
||||
|
||||
const char *name () const;
|
||||
void ensure_children ();
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ LayerTreeModel::signal_layers_changed ()
|
|||
for (QModelIndexList::const_iterator i = indexes.begin (); i != indexes.end (); ++i) {
|
||||
lay::LayerPropertiesConstIterator li = iterator (*i);
|
||||
if (! li.at_end ()) {
|
||||
new_indexes.push_back (createIndex (li.child_index (), i->column (), (void *) (li.uint () + m_id_start)));
|
||||
new_indexes.push_back (createIndex (int (li.child_index ()), i->column (), (void *) (li.uint () + m_id_start)));
|
||||
} else {
|
||||
new_indexes.push_back (QModelIndex ());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -669,8 +669,8 @@ LibrariesView::do_update_content (int lib_index)
|
|||
mp_cell_lists.pop_back ();
|
||||
}
|
||||
|
||||
for (unsigned int i = imin; i < m_libraries.size () && i < (unsigned int) mp_selector->count () && i <= imax; ++i) {
|
||||
mp_selector->setItemText (i, tl::to_qstring (display_string (i)));
|
||||
for (size_t i = imin; i < m_libraries.size () && i < mp_selector->count () && i <= imax; ++i) {
|
||||
mp_selector->setItemText (int (i), tl::to_qstring (display_string (int (i))));
|
||||
}
|
||||
while (mp_selector->count () < int (m_libraries.size ())) {
|
||||
mp_selector->addItem (tl::to_qstring (display_string (mp_selector->count ())));
|
||||
|
|
@ -687,11 +687,11 @@ LibrariesView::do_update_content (int lib_index)
|
|||
mp_selector->setCurrentIndex (m_active_index);
|
||||
mp_selector->setVisible (mp_cell_lists.size () > 1 && ! split_mode);
|
||||
|
||||
for (unsigned int i = imin; i < m_libraries.size () && i <= imax; ++i) {
|
||||
for (size_t i = imin; i < m_libraries.size () && i <= imax; ++i) {
|
||||
|
||||
if (m_needs_update [i]) {
|
||||
|
||||
mp_cell_list_headers [i]->setText (tl::to_qstring (display_string (i)));
|
||||
mp_cell_list_headers [i]->setText (tl::to_qstring (display_string (int (i))));
|
||||
|
||||
// draw the cells in the level of the current cell,
|
||||
// add an "above" entry if there is a level above.
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ static std::string str_from_name (const Obj *obj, bool indicate_empty = false)
|
|||
}
|
||||
}
|
||||
|
||||
const std::string var_sep (" ⇔ ");
|
||||
const std::string var_sep (" \u21D4 ");
|
||||
|
||||
template <class Obj>
|
||||
static std::string str_from_expanded_names (const std::pair<const Obj *, const Obj *> &objs, bool is_single)
|
||||
|
|
@ -3049,7 +3049,7 @@ NetlistBrowserModel::parent (const QModelIndex &index) const
|
|||
if (! d || ! d->parent ()) {
|
||||
return QModelIndex ();
|
||||
} else {
|
||||
return createIndex (d->parent ()->index (), 0, (void *) d->parent ());
|
||||
return createIndex ((int) d->parent ()->index (), 0, (void *) d->parent ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace lay
|
|||
// ----------------------------------------------------------------------------------
|
||||
// NetlistBrowserTreeModel implementation
|
||||
|
||||
const std::string var_sep (" ⇔ ");
|
||||
const std::string var_sep (" \u21D4 ");
|
||||
|
||||
static inline size_t pop (void *&idp, size_t n)
|
||||
{
|
||||
|
|
@ -287,7 +287,7 @@ NetlistBrowserTreeModel::index_from_netpath (const NetlistObjectsPath &path) con
|
|||
std::pair<const db::Circuit *, const db::Circuit *> cc = mp_indexer->child_circuit_from_index (circuit, n).first;
|
||||
if (is_compatible (sc, cc)) {
|
||||
circuit = cc;
|
||||
idx = index (n, 0, idx);
|
||||
idx = index (int (n), 0, idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ NetlistBrowserTreeModel::index (int row, int column, const QModelIndex &parent)
|
|||
{
|
||||
if (! parent.isValid ()) {
|
||||
|
||||
return createIndex (row, column, reinterpret_cast<void *> (row + 1));
|
||||
return createIndex (row, column, reinterpret_cast<void *> (size_t (row + 1)));
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ TEST (2)
|
|||
EXPECT_EQ (model->rowCount (QModelIndex ()), 4);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::UserRole).toString ()), "INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "- ⇔ INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "- \u21D4 INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, QModelIndex ()), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, QModelIndex ()), Qt::DisplayRole).toString ()), "INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "INV2");
|
||||
|
|
@ -308,7 +308,7 @@ TEST (2)
|
|||
|
||||
// first of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::UserRole).toString ()), "$1|1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$1 ⇔ 1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$1 \u21D4 1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_nets), Qt::DisplayRole).toString ()), "$1 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_nets), Qt::DisplayRole).toString ()), "1 (2)");
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ TEST (2)
|
|||
|
||||
// second of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_nets), Qt::UserRole).toString ()), "BULK|6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_nets), Qt::DisplayRole).toString ()), "BULK ⇔ 6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_nets), Qt::DisplayRole).toString ()), "BULK \u21D4 6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 2, sn_nets), Qt::DisplayRole).toString ()), "BULK (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 3, sn_nets), Qt::DisplayRole).toString ()), "6 (2)");
|
||||
|
||||
|
|
@ -371,13 +371,13 @@ TEST (2)
|
|||
|
||||
// first of pins in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::DisplayRole).toString ()), "- ⇔ $4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::DisplayRole).toString ()), "- \u21D4 $4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_pins), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_pins), Qt::DisplayRole).toString ()), "");
|
||||
|
||||
// first of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$4 ⇔ -");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$4 \u21D4 -");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_nets), Qt::DisplayRole).toString ()), "$4 (3)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_nets), Qt::DisplayRole).toString ()), "");
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ TEST (2)
|
|||
|
||||
// The first subcircuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairNet0Index), Qt::UserRole).toString ()), "OUT|INV2|$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairNet0Index), Qt::DisplayRole).toString ()), "OUT ⇔ - / <a href='int:netlist?path=1'>INV2 ⇔ -</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairNet0Index), Qt::DisplayRole).toString ()), "OUT \u21D4 - / <a href='int:netlist?path=1'>INV2 \u21D4 -</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 2, inv2PairNet0Index), Qt::DisplayRole).toString ()), "<a href='int:netlist?path=2,2,1'>$1</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 3, inv2PairNet0Index), Qt::DisplayRole).toString ()), "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ TEST (2)
|
|||
// two top circuits
|
||||
EXPECT_EQ (model->rowCount (QModelIndex ()), 2);
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::UserRole).toString ()), "INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "- ⇔ INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "- \u21D4 INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, QModelIndex ()), Qt::UserRole).toString ()), "RINGO|RINGO");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "RINGO");
|
||||
EXPECT_EQ (model->parent (model->index (0, 0, QModelIndex ())).isValid (), false);
|
||||
|
|
@ -92,9 +92,9 @@ TEST (2)
|
|||
EXPECT_EQ (model->parent (inv2PairIndex) == ringoIndex, true);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairIndex), Qt::UserRole).toString ()), "INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "- ⇔ INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "- \u21D4 INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairIndex), Qt::UserRole).toString ()), "INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "INV2 ⇔ -");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "INV2 \u21D4 -");
|
||||
|
||||
EXPECT_EQ (model->hasChildren (model->index (0, 0, inv2PairIndex)), false);
|
||||
EXPECT_EQ (model->rowCount (model->index (0, 0, inv2PairIndex)), 0);
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ MAGWriter::write_single_instance (db::cell_index_type ci, db::ICplxTrans trans,
|
|||
throw tl::Exception (tl::to_string (tr ("Cannot write magnified instance to MAG files: ")) + trans.to_string () + tl::to_string (tr (" of cell ")) + layout.cell_name (ci));
|
||||
}
|
||||
|
||||
int id = (m_cell_id [ci] += 1);
|
||||
int id = int (m_cell_id [ci] += 1);
|
||||
std::string cn = layout.cell_name (ci);
|
||||
os << "use " << make_string (cn) << " " << make_string (cn + "_" + tl::to_string (id)) << "\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ public:
|
|||
{
|
||||
for (iterator c = begin (); c != end (); ++c) {
|
||||
ctx->glVertexAttribPointer (location, 3, gl_type2enum<Obj> () (), GL_FALSE, 0, c->front ());
|
||||
ctx->glDrawArrays (mode, 0, c->size () / 3);
|
||||
ctx->glDrawArrays (mode, 0, GLsizei (c->size () / 3));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1113,49 +1113,49 @@ D25ViewWidget::paintGL ()
|
|||
vertexes.clear ();
|
||||
|
||||
// A "K" at the front
|
||||
vertexes.add (-0.8, -0.8, 1.0);
|
||||
vertexes.add (-0.8, 0.8, 1.0);
|
||||
vertexes.add (-0.2, 0.8, 1.0);
|
||||
vertexes.add (-0.8f, -0.8f, 1.0f);
|
||||
vertexes.add (-0.8f, 0.8f, 1.0f);
|
||||
vertexes.add (-0.2f, 0.8f, 1.0f);
|
||||
|
||||
vertexes.add (-0.8, -0.8, 1.0);
|
||||
vertexes.add (-0.2, -0.8, 1.0);
|
||||
vertexes.add (-0.2, 0.8, 1.0);
|
||||
vertexes.add (-0.8f, -0.8f, 1.0f);
|
||||
vertexes.add (-0.2f, -0.8f, 1.0f);
|
||||
vertexes.add (-0.2f, 0.8f, 1.0f);
|
||||
|
||||
vertexes.add (0.2, 0.8, 1.0);
|
||||
vertexes.add (0.8, 0.8, 1.0);
|
||||
vertexes.add (0.8, 0.6, 1.0);
|
||||
vertexes.add (0.2f, 0.8f, 1.0f);
|
||||
vertexes.add (0.8f, 0.8f, 1.0f);
|
||||
vertexes.add (0.8f, 0.6f, 1.0f);
|
||||
|
||||
vertexes.add (0.2, 0.8, 1.0);
|
||||
vertexes.add (0.8, 0.6, 1.0);
|
||||
vertexes.add (0.6, 0.4, 1.0);
|
||||
vertexes.add (0.2f, 0.8f, 1.0f);
|
||||
vertexes.add (0.8f, 0.6f, 1.0f);
|
||||
vertexes.add (0.6f, 0.4f, 1.0f);
|
||||
|
||||
vertexes.add (-0.2, 0.4, 1.0);
|
||||
vertexes.add (0.2, 0.8, 1.0);
|
||||
vertexes.add (0.6, 0.4, 1.0);
|
||||
vertexes.add (-0.2f, 0.4f, 1.0f);
|
||||
vertexes.add (0.2f, 0.8f, 1.0f);
|
||||
vertexes.add (0.6f, 0.4f, 1.0f);
|
||||
|
||||
vertexes.add (-0.2, 0.4, 1.0);
|
||||
vertexes.add (0.6, 0.4, 1.0);
|
||||
vertexes.add (0.2, 0.0, 1.0);
|
||||
vertexes.add (-0.2f, 0.4f, 1.0f);
|
||||
vertexes.add (0.6f, 0.4f, 1.0f);
|
||||
vertexes.add (0.2f, 0.0f, 1.0f);
|
||||
|
||||
vertexes.add (-0.2, 0.4, 1.0);
|
||||
vertexes.add (0.2, 0.0, 1.0);
|
||||
vertexes.add (-0.2, -0.4, 1.0);
|
||||
vertexes.add (-0.2f, 0.4f, 1.0f);
|
||||
vertexes.add (0.2f, 0.0f, 1.0f);
|
||||
vertexes.add (-0.2f, -0.4f, 1.0f);
|
||||
|
||||
vertexes.add (-0.2, -0.4, 1.0);
|
||||
vertexes.add (0.6, -0.4, 1.0);
|
||||
vertexes.add (0.2, -0.0, 1.0);
|
||||
vertexes.add (-0.2f, -0.4f, 1.0f);
|
||||
vertexes.add (0.6f, -0.4f, 1.0f);
|
||||
vertexes.add (0.2f, -0.0f, 1.0f);
|
||||
|
||||
vertexes.add (-0.2, -0.4, 1.0);
|
||||
vertexes.add (0.2, -0.8, 1.0);
|
||||
vertexes.add (0.6, -0.4, 1.0);
|
||||
vertexes.add (-0.2f, -0.4f, 1.0f);
|
||||
vertexes.add (0.2f, -0.8f, 1.0f);
|
||||
vertexes.add (0.6f, -0.4f, 1.0f);
|
||||
|
||||
vertexes.add (0.2, -0.8, 1.0);
|
||||
vertexes.add (0.8, -0.6, 1.0);
|
||||
vertexes.add (0.6, -0.4, 1.0);
|
||||
vertexes.add (0.2f, -0.8f, 1.0f);
|
||||
vertexes.add (0.8f, -0.6f, 1.0f);
|
||||
vertexes.add (0.6f, -0.4f, 1.0f);
|
||||
|
||||
vertexes.add (0.2, -0.8, 1.0);
|
||||
vertexes.add (0.8, -0.8, 1.0);
|
||||
vertexes.add (0.8, -0.6, 1.0);
|
||||
vertexes.add (0.2f, -0.8f, 1.0f);
|
||||
vertexes.add (0.8f, -0.8f, 1.0f);
|
||||
vertexes.add (0.8f, -0.6f, 1.0f);
|
||||
|
||||
m_gridplane_program->setUniformValue ("color", foreground_rgb, foreground_rgb, foreground_rgb, 0.3f);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "tlStaticObjects.h"
|
||||
#include "tlDeferredExecution.h"
|
||||
#include "tlObject.h"
|
||||
#include "tlTimer.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
|
|
@ -412,12 +413,25 @@ InputHttpStreamPrivateData::read (char *b, size_t n)
|
|||
issue_request (QUrl (tl::to_qstring (m_url)));
|
||||
}
|
||||
|
||||
// TODO: progress, timeout
|
||||
while (mp_reply == 0) {
|
||||
// TODO: progress
|
||||
tl::Clock start_time = tl::Clock::current ();
|
||||
double timeout = 10; // TODO: make variable
|
||||
while (mp_reply == 0 && (tl::Clock::current() - start_time).seconds () < timeout) {
|
||||
QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
|
||||
if (mp_reply->error () != QNetworkReply::NoError) {
|
||||
if (! mp_reply) {
|
||||
|
||||
// Reason for this may be HTTPS initialization failure (OpenSSL)
|
||||
|
||||
std::string em = tl::to_string (QObject::tr ("Request creation failed"));
|
||||
if (tl::verbosity() >= 30) {
|
||||
tl::info << "HTTP request creation failed";
|
||||
}
|
||||
|
||||
throw HttpErrorException (em, 0, m_url);
|
||||
|
||||
} else if (mp_reply->error () != QNetworkReply::NoError) {
|
||||
|
||||
// throw an error
|
||||
std::string em = tl::to_string (mp_reply->attribute (QNetworkRequest::HttpReasonPhraseAttribute).toString ());
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ TextInputStream::read_all (size_t max_count)
|
|||
const std::string &
|
||||
TextInputStream::get_line ()
|
||||
{
|
||||
int line = m_next_line;
|
||||
size_t line = m_next_line;
|
||||
m_line_buffer.clear ();
|
||||
|
||||
while (! at_end ()) {
|
||||
|
|
|
|||
|
|
@ -1568,7 +1568,7 @@ Variant::to_qbytearray () const
|
|||
if (m_type == t_qbytearray) {
|
||||
return *m_var.m_qbytearray;
|
||||
} else if (m_type == t_bytearray) {
|
||||
return QByteArray (&m_var.m_bytearray->front (), m_var.m_bytearray->size ());
|
||||
return QByteArray (&m_var.m_bytearray->front (), int (m_var.m_bytearray->size ()));
|
||||
} else if (m_type == t_qstring) {
|
||||
return m_var.m_qstring->toUtf8 ();
|
||||
} else if (m_type == t_stdstring) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue