-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59177 from m-kuhn/macvcpkg
Mac Qt6 Builds
- Loading branch information
Showing
10 changed files
with
256 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
name: 🍎 Build - MacOS Qt6 | ||
on: | ||
# push: | ||
# branches: | ||
# - main | ||
# pull_request: | ||
# release: | ||
# types: ['published'] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
# - os: macos-13 | ||
# triplet: x64-osx | ||
# deployment-target: "10.15" | ||
- os: macos-14 | ||
triplet: arm64-osx-dynamic-release | ||
deployment-target: "11.0" | ||
name: build (macos) | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: 🐣 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🐩 Install CMake and Ninja | ||
uses: lukka/get-cmake@latest | ||
with: | ||
# Pin to specific version to avoid rebuilding too often | ||
# Also helps to avoid spurious build failures like https://github.com/qgis/QGIS/pull/47098 | ||
cmakeVersion: 3.30.4 | ||
|
||
- name: 🎡 Setup vcpkg | ||
id: setup-vcpkg | ||
uses: ./.github/actions/setup-vcpkg | ||
|
||
- name: 🔨 Prepare build env | ||
run: | | ||
brew install automake bison flex gnu-sed create-dmg autoconf-archive nasm libtool fdupes | ||
echo $(brew --prefix bison)/bin >> $GITHUB_PATH | ||
echo $(brew --prefix flex)/bin >> $GITHUB_PATH | ||
echo $(brew --prefix libtool)/bin >> $GITHUB_PATH | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: 🍭 Setup XCode | ||
uses: maxim-lobanov/[email protected] | ||
with: | ||
xcode-version: latest-stable | ||
|
||
- name: 🌱 Install dependencies and generate project files | ||
run: | | ||
echo "VCPKG_ROOT: ${VCPKG_ROOT}" | ||
# Install first only with binarycaching, then deduplicate binaries and replace copies with symlinks. | ||
# Nuget doesn't understand the symlink concept | ||
cmake -S . \ | ||
-G Ninja \ | ||
-B build \ | ||
-D WITH_VCPKG=ON \ | ||
-D BUILD_WITH_QT6=ON \ | ||
-D WITH_QTWEBKIT=OFF \ | ||
-D WITH_BINDINGS=ON \ | ||
-D QGIS_MACAPP_FRAMEWORK=OFF \ | ||
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \ | ||
-D VCPKG_HOST_TRIPLET="${{ matrix.triplet }}" \ | ||
-D VCPKG_INSTALL_OPTIONS="--only-binarycaching" \ | ||
-D NUGET_USERNAME=${{ github.actor }} \ | ||
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} || true | ||
fdupes -r -1 build/vcpkg_installed/arm64-osx-dynamic/lib | grep libQt | while read line; do master=""; for file in ${line[*]}; do if [[ "x${master}" == "x" ]]; then master=$file; else rm "${file}"; ln -s $(basename "${master}") "${file}"; fi; done; done | ||
cmake -D VCPKG_INSTALL_OPTIONS="" build | ||
- name: 📑 Upload vcpkg build logs | ||
uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: build-logs-${{ matrix.triplet }} | ||
path: | | ||
${{ env.VCPKG_ROOT }}/buildtrees/**/*.log | ||
- name: 📦 Create SDK | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' | ||
run: | | ||
./build/_deps/vcpkg-src/vcpkg export --zip --output-dir=./sdk --x-install-root=./build/vcpkg_installed --x-manifest-root=vcpkg | ||
- name: 📤 Upload sdk | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: kadas-albireo2-sdk-${{ matrix.triplet }} | ||
path: | | ||
sdk/vcpkg-export-*.zip | ||
- name: 🌋 Build | ||
run: | | ||
cmake --build build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
diff --git a/setuptools/_distutils/command/build_ext.py b/setuptools/_distutils/command/build_ext.py | ||
index 06d949a..0dee0fe 100644 | ||
--- a/setuptools/_distutils/command/build_ext.py | ||
+++ b/setuptools/_distutils/command/build_ext.py | ||
@@ -209,6 +209,14 @@ class build_ext(Command): | ||
elif isinstance(self.rpath, str): | ||
self.rpath = self.rpath.split(os.pathsep) | ||
|
||
+ prefix = os.path.normpath(sys.prefix) | ||
+ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) # Add debug compile? | ||
+ | ||
+ if self.debug: | ||
+ self.library_dirs.append(os.path.join(vcpkg_prefix, 'debug', 'lib')) | ||
+ else: | ||
+ self.library_dirs.append(os.path.join(vcpkg_prefix, 'lib')) | ||
+ | ||
# for extensions under windows use different directories | ||
# for Release and Debug builds. | ||
# also Python's library directory must be appended to library_dirs | ||
@@ -216,9 +224,9 @@ class build_ext(Command): | ||
# the 'libs' directory is for binary installs - we assume that | ||
# must be the *native* platform. But we don't really support | ||
# cross-compiling via a binary install anyway, so we let it go. | ||
- self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) | ||
- if sys.base_exec_prefix != sys.prefix: # Issue 16116 | ||
- self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) | ||
+ # self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) | ||
+ # if sys.base_exec_prefix != sys.prefix: # Issue 16116 | ||
+ # self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) | ||
if self.debug: | ||
self.build_temp = os.path.join(self.build_temp, "Debug") | ||
else: | ||
diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py | ||
index 1a38e9f..2c8174d 100644 | ||
--- a/setuptools/_distutils/sysconfig.py | ||
+++ b/setuptools/_distutils/sysconfig.py | ||
@@ -191,18 +191,21 @@ def _get_python_inc_from_config(plat_specific, spec_prefix): | ||
def _get_python_inc_posix_prefix(prefix): | ||
implementation = 'pypy' if IS_PYPY else 'python' | ||
python_dir = implementation + get_python_version() + build_flags | ||
- return os.path.join(prefix, "include", python_dir) | ||
+ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) | ||
+ return os.path.join(vcpkg_prefix, "include", python_dir) | ||
|
||
|
||
def _get_python_inc_nt(prefix, spec_prefix, plat_specific): | ||
+ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) | ||
+ python_dir = 'python' + get_python_version() | ||
if python_build: | ||
# Include both include dirs to ensure we can find pyconfig.h | ||
return ( | ||
- os.path.join(prefix, "include") | ||
+ os.path.join(vcpkg_prefix, "include", python_dir) | ||
+ os.path.pathsep | ||
+ os.path.dirname(sysconfig.get_config_h_filename()) | ||
) | ||
- return os.path.join(prefix, "include") | ||
+ return os.path.join(vcpkg_prefix, "include", python_dir) | ||
|
||
|
||
# allow this behavior to be monkey-patched. Ref pypa/distutils#2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
vcpkg_from_pythonhosted( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
PACKAGE_NAME setuptools | ||
VERSION ${VERSION} | ||
SHA512 d0a34f16dfa6bb9a6df39076cd43528cf854d343f6f801c448ea0ebab2a259aec3d03571e2a26709df6082ed2fcb6c43b86448be556fd559b6af41831b4f38e0 | ||
PATCHES | ||
fix-prefix.patch | ||
) | ||
|
||
vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}") | ||
|
||
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) | ||
|
||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") | ||
#execute_process(COMMAND ${PYTHON3} "${SOURCE_PATH}/setup.py" install "--prefix=${CURRENT_INSTALLED_DIR}/tools/python3" "--root=${CURRENT_PACKAGES_DIR}" | ||
# COMMAND_ERROR_IS_FATAL ANY | ||
# WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/python3" | ||
#) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "py-setuptools", | ||
"version": "72.1.0", | ||
"description": "Official project repository for the Setuptools build system ", | ||
"homepage": "https://pypi.org/project/setuptools/", | ||
"license": "MIT", | ||
"dependencies": [ | ||
"py-packaging", | ||
"py-wheel", | ||
"python3", | ||
{ | ||
"name": "vcpkg-python-scripts", | ||
"host": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(VCPKG_TARGET_ARCHITECTURE arm64) | ||
set(VCPKG_CRT_LINKAGE dynamic) | ||
set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
|
||
set(VCPKG_CMAKE_SYSTEM_NAME Darwin) | ||
set(VCPKG_OSX_ARCHITECTURES arm64) | ||
set(VCPKG_BUILD_TYPE release) | ||
|
||
set(VCPKG_FIXUP_MACHO_RPATH ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
set(VCPKG_TARGET_ARCHITECTURE x64) | ||
set(VCPKG_CRT_LINKAGE dynamic) | ||
set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
|
||
set(VCPKG_CMAKE_SYSTEM_NAME Darwin) | ||
set(VCPKG_OSX_ARCHITECTURES x86_64) | ||
set(VCPKG_BUILD_TYPE release) | ||
|
||
set(VCPKG_FIXUP_MACHO_RPATH ON) | ||
set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15) | ||
|