Skip to content

Commit

Permalink
Merge pull request #298 from xobs/klayout-macos
Browse files Browse the repository at this point in the history
Fix klayout build on macos
  • Loading branch information
proppy authored Feb 25, 2023
2 parents 58f8777 + bb381ad commit 0ff90c1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@ jobs:
- uses: actions/checkout@v3
- uses: ./ci

klayout-osx:
runs-on: "macos-latest"
env:
PACKAGE: "misc/klayout"
OS_NAME: "osx"
steps:
- uses: actions/checkout@v3
- uses: ./ci

magic-osx:
runs-on: "macos-latest"
env:
Expand Down
31 changes: 29 additions & 2 deletions misc/klayout/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,30 @@ set -x
UNAME_OUT="$(uname -s)"
case "${UNAME_OUT}" in
Linux*) OS=Linux;;
Darwin*) OS=Mac;;
*) OS="${UNAME_OUT}"
echo "Unknown OS: ${OS}"
exit;;
esac

if [[ $OS == "Linux" ]]; then
bin_ext=""
lib_ext=".so"
elif [[ $OS == "Mac" ]]; then
export bin_ext=".app"
export lib_ext=".dylib"
cd ${PREFIX}
if grep -q -- '-isysroot $$sysroot_path $$version_min_flag' mkspecs/features/mac/default_post.prf; then
sed 's|-isysroot $$sysroot_path $$version_min_flag|-isysroot '$CONDA_BUILD_SYSROOT' -mmacosx-version-min='$MACOSX_DEPLOYMENT_TARGET'|g' mkspecs/features/mac/default_post.prf > mkspecs/features/mac/default_post.prf.bkp
mv mkspecs/features/mac/default_post.prf.bkp mkspecs/features/mac/default_post.prf
elif grep -q -- '-isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag' mkspecs/features/mac/default_post.prf; then
sed 's|-isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag|-isysroot '$CONDA_BUILD_SYSROOT' -mmacosx-version-min='$MACOSX_DEPLOYMENT_TARGET'|g' mkspecs/features/mac/default_post.prf > mkspecs/features/mac/default_post.prf.bkp
mv mkspecs/features/mac/default_post.prf.bkp mkspecs/features/mac/default_post.prf
fi
sed 's|^QMAKE_MAC_SDK_PATH =.*|QMAKE_MAC_SDK_PATH = "'$CONDA_BUILD_SYSROOT'"|g' mkspecs/features/mac/sdk.prf > mkspecs/features/mac/sdk.prf.bkp
mv mkspecs/features/mac/sdk.prf.bkp mkspecs/features/mac/sdk.prf
fi

cd ${SRC_DIR}
./build.sh -build "${SRC_DIR}/build" -python "${PYTHON}" -expert -without-qtbinding -libpng -libexpat -dry-run

Expand All @@ -20,5 +39,13 @@ make V=1 -j$CPU_COUNT
make V=1 install

cd ${SRC_DIR}/bin-release
cp -a klayout strm* ${PREFIX}/bin/
cp -ar *.so* pymod *_plugins ${PREFIX}/lib/
cp -a klayout${bin_ext} strm* ${PREFIX}/bin/
cp -a *${lib_ext}* pymod *_plugins ${PREFIX}/lib/

if [[ $OS == "Mac" ]]; then
# Add a symlink to allow it to run from the command line
cd ${PREFIX}/bin/
ln -s klayout${bin_ext}/Contents/MacOS/klayout .
cd ${SRC_DIR}
cp -a build/pymod/*${lib_ext}* ${PREFIX}/lib/pymod/
fi
30 changes: 17 additions & 13 deletions misc/klayout/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,36 @@ build:
requirements:
build:
- make
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- {{ cdt('libxext') }} # [linux]
- {{ cdt('libxfixes') }} # [linux]
- {{ cdt('libxau') }} # [linux]
- {{ cdt('libxcb') }} # [linux]
- {{ cdt('expat') }} # [linux]
- {{ cdt('libpng') }} # [linux]
- {{ cdt('mesa-libgl-devel') }} [linux]
- {{ cdt('mesa-dri-drivers') }} [linux]
- {{ cdt('libselinux') }} [linux]
- {{ cdt('libxdamage') }} [linux]
- {{ cdt('libxxf86vm') }} [linux]
- {{ cdt('libxext') }} [linux]
- {{ cdt('libxfixes') }} [linux]
- {{ cdt('libxau') }} [linux]
- {{ cdt('libxcb') }} [linux]
- {{ cdt('expat') }} [linux]
- {{ cdt('libpng') }} [linux]
host:
- python {{ python_version }}
- ruby
- qt
- qt >=5.0,<6.0
- zlib
run:
- python {{ python_version }}
- ruby
- qt
- qt >=5.0,<6.0
- zlib

test:
commands:
- klayout -v
requires:
- ruby
- python {{ python_version }}

about:
home: https://www.klayout.de/
Expand Down

0 comments on commit 0ff90c1

Please sign in to comment.