From 6848702743f8f6ae5bcb6f130178f7177ab2c995 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sat, 18 Feb 2023 11:19:16 +0800 Subject: [PATCH 1/2] ci: build klayout on macos Signed-off-by: Sean Cross --- .github/workflows/Build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 5ea0e126..a0c88d3a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -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: From bb381ade15326d75f2926888241b74df6d33bb1c Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 23 Feb 2023 20:57:04 +0800 Subject: [PATCH 2/2] misc/klayout: add build for macos Add support for klayout to build on macos. This involves some rather egregeous hacks to the Qt build system to work around the fact that Conda builds things using a custom Mac SDK. Signed-off-by: Sean Cross --- misc/klayout/build.sh | 31 +++++++++++++++++++++++++++++-- misc/klayout/meta.yaml | 30 +++++++++++++++++------------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/misc/klayout/build.sh b/misc/klayout/build.sh index c1368111..82a352de 100644 --- a/misc/klayout/build.sh +++ b/misc/klayout/build.sh @@ -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 @@ -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 diff --git a/misc/klayout/meta.yaml b/misc/klayout/meta.yaml index 2b8f1cfd..80fc85c4 100644 --- a/misc/klayout/meta.yaml +++ b/misc/klayout/meta.yaml @@ -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/