Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix klayout build on macos #298

Merged
merged 2 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
proppy marked this conversation as resolved.
Show resolved Hide resolved
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}
proppy marked this conversation as resolved.
Show resolved Hide resolved
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