Skip to content

Commit

Permalink
Merge pull request #3 from open-vcpkg/fix-pyqt6
Browse files Browse the repository at this point in the history
Test pyqt6
  • Loading branch information
m-kuhn authored Mar 5, 2024
2 parents 50981d2 + 8a48ae5 commit 9e7e663
Show file tree
Hide file tree
Showing 34 changed files with 307 additions and 119 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: 🔨 Prepare build env
run: |
brew install autoconf automake autoconf-archive
brew install autoconf automake autoconf-archive libtool
- name: 🐕 Checkout vcpkg
uses: actions/checkout@v4
Expand All @@ -59,6 +59,7 @@ jobs:
mono $NUGET_EXE sources add -Name ghpkg -Source "https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json" -UserName "$PKG_SOURCE_USER" -Password "${{ secrets.GITHUB_TOKEN }}" -StorePasswordInClearText
mono $NUGET_EXE setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json"
echo "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json,readwrite" >> $GITHUB_ENV
VCPKG_ROOT=$(pwd)/vcpkg
echo "PATH=$VCPKG_ROOT;$PATH" >> $GITHUB_ENV
echo "VCPKG_ROOT=$VCPKG_ROOT" >> $GITHUB_ENV
Expand All @@ -67,7 +68,8 @@ jobs:
VCPKG_OPTIONS="--overlay-ports="${{ github.workspace }}/ports" --host-triplet=${{ matrix.triplet }} --triplet=${{ matrix.triplet }} --x-buildtrees-root=${{ env.buildtrees }}"
./vcpkg/vcpkg install $VCPKG_OPTIONS py-pip
./vcpkg/vcpkg install $VCPKG_OPTIONS py-sip
# ./vcpkg/vcpkg install $VCPKG_OPTIONS py-pyqt6
- name: 📑 Upload logs
uses: actions/upload-artifact@v4
if: failure()
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ jobs:
$NUGET_EXE sources add -Name ghpkg -Source "https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json" -UserName "$PKG_SOURCE_USER" -Password "${{ secrets.GITHUB_TOKEN }}" -StorePasswordInClearText
$NUGET_EXE setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json"
echo "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/$PKG_SOURCE_USER/index.json,readwrite" >> $GITHUB_ENV
VCPKG_ROOT=$(cygpath -w $(pwd)/vcpkg)
echo "PATH=$VCPKG_ROOT;$PATH" >> $GITHUB_ENV
echo "VCPKG_ROOT=$VCPKG_ROOT" >> $GITHUB_ENV
- name: 🌋 Build
run: |
.\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} py-sip
.\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} --x-buildtrees-root=C:/vcpkg-build py-pyqt6
- name: 📑 Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs-${{ matrix.triplet }}
path: /c/vcpkg/buildtrees/**/*.log
path: C:/vcpkg-build/**/*.log
2 changes: 1 addition & 1 deletion ports/py-packaging/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"homepage": "packaging.pypa.io/",
"license": "MIT",
"dependencies": [
"python3",
"py-flit-core",
"py-gpep517",
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
Expand Down
2 changes: 1 addition & 1 deletion ports/py-pip/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"description": "Tool for installing and managing Python packages",
"homepage": "https://pypi.org/project/setuptools",
"dependencies": [
"python3",
{
"name": "py-setuptools",
"host": true
},
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
Expand Down
2 changes: 1 addition & 1 deletion ports/py-ply/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"description": "Python Lex & Yacc",
"homepage": "https://www.dabeaz.com/ply/",
"dependencies": [
"python3",
{
"name": "py-setuptools",
"host": true
},
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
Expand Down
2 changes: 1 addition & 1 deletion ports/py-pyparsing/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"homepage": "https://github.com/pyparsing/pyparsing",
"license": "MIT",
"dependencies": [
"python3",
{
"name": "py-setuptools",
"host": true
},
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
Expand Down
14 changes: 14 additions & 0 deletions ports/py-pyqt-builder/libpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/pyqtbuild/project.py b/pyqtbuild/project.py
index 20ab60f..4f4d105 100644
--- a/pyqtbuild/project.py
+++ b/pyqtbuild/project.py
@@ -73,7 +73,8 @@ class PyQtProject(Project):
# these are actually non-user options but we need the 'link_full_dll'
# user option in order to set them.
if self.py_platform == 'win32':
- pylib_dir = os.path.join(sys.base_prefix, 'libs')
+ # vcpkg install python3.lib into [installed]/lib
+ pylib_dir = os.path.join(sys.base_prefix, '..', '..', 'lib')

debug_suffix = '_d' if self.py_debug else ''

2 changes: 2 additions & 0 deletions ports/py-pyqt-builder/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ vcpkg_from_pythonhosted(
PACKAGE_NAME PyQt-builder
VERSION ${VERSION}
SHA512 ec0b9f7784a32af744111615b93f98d73f284bb752fd71359c798d3b093a01925823effea72c866a5f49f77e3dfc5dee4125bbb289f647d84000bf34b5db6931
PATCHES
libpath.patch
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
Expand Down
4 changes: 2 additions & 2 deletions ports/py-pyqt-builder/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "py-pyqt-builder",
"version": "1.15.4",
"port-version": 2,
"port-version": 3,
"description": "PyQt-builder is the PEP 517 compliant build system for PyQt and projects that extend PyQt. It extends the SIP build system and uses Qt’s qmake to perform the actual compilation and installation of extension modules.",
"homepage": "https://www.riverbankcomputing.com/software/pyqt-builder",
"dependencies": [
"python3",
{
"name": "py-setuptools",
"host": true
},
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
Expand Down
16 changes: 16 additions & 0 deletions ports/py-pyqt6-sip/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME PyQt6_sip
VERSION ${VERSION}
SHA512 bd2fa70d64544d8104d3477cb650a0e6bcefa0008680afcf7d187ba3fb1117871c0237d3a7f047144c8a8a8eeb8da941a3b206f8ee0601cb2cc734243cdb9d46
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

vcpkg_python_test_import(MODULE "PyQt6.sip")

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
18 changes: 18 additions & 0 deletions ports/py-pyqt6-sip/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "py-pyqt6-sip",
"version": "13.6.0",
"description": "Python bindings for the Qt cross platform application toolkit",
"homepage": "https://www.riverbankcomputing.com/software/pyqt/",
"dependencies": [
{
"name": "py-setuptools",
"host": true
},
"py-sip",
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
106 changes: 35 additions & 71 deletions ports/py-pyqt6/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(VCPKG_BUILD_TYPE release)

vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -7,91 +8,54 @@ vcpkg_from_pythonhosted(
SHA512 c2ff8c47c9b0e43c009d0c90f565a54344e6f384c67dd30c2d422465d0702c07713acc0095c8b67827d1146675611c07d548ba282a26e41bb60a0a21977a7a64
)

# https://www.riverbankcomputing.com/static/Docs/PyQt6/installation.html
set(SIPBUILD_ARGS
"--confirm-license"
"--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake.exe" #TODO: append .exe only on windows
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/qt6/qsci/api/python"
"--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}"
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/Qt6/qsci/api/python"
"--verbose"
"--qt-shared"
"--no-make"
"--disable" "QtDesigner"
"--pep484-pyi"
"--debug"
"--target-dir" "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages"
"--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
"--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
"--target-dir" "${PYTHON3_SITEPACKAGES}"
)

set(SIPBUILD_ARGS
"--confirm-license"
"--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake.exe" #TODO: append .exe only on windows
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/qt6/qsci/api/python"
"--verbose"
"--qt-shared"
"--no-make"
"--disable" "QtDesigner"
"--pep484-pyi"
# "--debug" # will create debuggable bindings
"--target-dir" "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages"
"--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
)
if(VCPKG_TARGET_IS_OSX)
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
vcpkg_list(APPEND SIPBUILD_ARGS "--qmake-setting" "QMAKE_MACOSX_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
else()
# https://doc.qt.io/qt-6/macos.html
vcpkg_list(APPEND SIPBUILD_ARGS "--qmake-setting" "QMAKE_MACOSX_DEPLOYMENT_TARGET=10.15")
endif()
vcpkg_list(APPEND SIPBUILD_ARGS "--no-dbus-python")
endif()

message(STATUS "Running sipbuild... (${PYTHON3})")
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "-m" "sipbuild.tools.build" ${SIPBUILD_ARGS}
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "sipbuild-${TARGET_TRIPLET}-0"
)
message(STATUS "Running sipbuild...finished.")

# TODO: Can we use vcpkg_install_make here instead of duplicating code?
set(MAKEFILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build/Makefile")
vcpkg_backup_env_variables(VARS PATH)

vcpkg_list(SET make_opts)
vcpkg_list(SET install_opts)
set(path_backup "$ENV{PATH}")
if (CMAKE_HOST_WIN32)
vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper")
if(NOT DEFINED Z_VCPKG_MAKE)
vcpkg_acquire_msys(MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts -j ${VCPKG_CONCURRENCY} --trace -f ${MAKEFILE})
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/python3/Scripts/" "${CURRENT_HOST_INSTALLED_DIR}/tools/Qt6/bin/" "${CURRENT_HOST_INSTALLED_DIR}/bin")

string(REPLACE " " [[\ ]] vcpkg_package_prefix "${CURRENT_PACKAGES_DIR}")
string(REGEX REPLACE [[([a-zA-Z]):/]] [[/\1/]] vcpkg_package_prefix "${vcpkg_package_prefix}")
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} --trace -f ${MAKEFILE} DESTDIR=${vcpkg_package_prefix}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages)
#TODO: optimize for install-data (release) and install-exec (release/debug)
message(STATUS "Running sipbuild...")
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "-m" "sipbuild.tools.build" ${SIPBUILD_ARGS}
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "sipbuild-${TARGET_TRIPLET}"
)
message(STATUS "Running sipbuild...finished.")

else()
if(VCPKG_HOST_IS_OPENBSD)
find_program(Z_VCPKG_MAKE gmake REQUIRED)
else()
find_program(Z_VCPKG_MAKE make REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts V=1 -j ${VCPKG_CONCURRENCY} -f ${MAKEFILE})
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} -f ${MAKEFILE} DESTDIR=${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages)
# inventory.txt is consumed by the distinfo tool which is run during make and should be run against the package directory
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/inventory.txt"
"${CURRENT_INSTALLED_DIR}"
"${CURRENT_PACKAGES_DIR}")
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/inventory.txt"
"${NATIVE_INSTALLED_DIR}"
"${CURRENT_PACKAGES_DIR}")

# To find sip-distinfo and python3 during install
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/tools:${CURRENT_INSTALLED_DIR}/tools/python3:$ENV{PATH}")
endif()
vcpkg_qmake_build(BUILD_LOGNAME "install" TARGETS "install")

vcpkg_list(SET make_cmd_line ${make_command} ${make_opts})
vcpkg_list(SET install_cmd_line ${make_command} install ${install_opts})
vcpkg_restore_env_variables(VARS PATH)

message(STATUS "Running build...")
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
LOGNAME "build-${TARGET_TRIPLET}${short_buildtype}"
)
message(STATUS "Running build... finished.")
message(STATUS "Running install...")
vcpkg_execute_build_process(
COMMAND ${install_cmd_line}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
LOGNAME "install-${TARGET_TRIPLET}${short_buildtype}"
)
message(STATUS "Running install... finished.")
set(ENV{PATH} "${path_backup}")
vcpkg_python_test_import(MODULE "PyQt6.QtCore")
21 changes: 15 additions & 6 deletions ports/py-pyqt6/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
{
"name": "py-pyqt6",
"version": "6.6.1",
"port-version": 1,
"port-version": 2,
"description": "Python bindings for the Qt cross platform application toolkit",
"homepage": "https://www.riverbankcomputing.com/software/pyqt/",
"dependencies": [
"python3",
"py-sip",
"py-pyqt-builder",
"py-ply",
"py-packaging",
"py-ply",
"py-pyqt-builder",
"py-pyqt6-sip",
"python3",
{
"name": "qtactiveqt",
"platform": "windows"
},
"qtbase",
"qtmultimedia",
"qtsensors",
"qtsvg",
"qtwebchannel",
"qtwebsockets",
{
"name": "vcpkg-python-scripts",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"name": "vcpkg-qmake",
"host": true
}
]
Expand Down
13 changes: 0 additions & 13 deletions ports/py-sip/add_dll_directory.patch

This file was deleted.

2 changes: 0 additions & 2 deletions ports/py-sip/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ vcpkg_from_pythonhosted(
PACKAGE_NAME sip
VERSION ${VERSION}
SHA512 885c32a051e882b82b59bf1365050933f8fc1c619b19f4bc03235edc5741a5e14aae8edf90479ad0283f74ba5c5233a2589c151ec865b130199a6db9800a2294
PATCHES
add_dll_directory.patch
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
Expand Down
2 changes: 1 addition & 1 deletion ports/py-sip/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "py-sip",
"version": "6.7.12",
"port-version": 2,
"port-version": 3,
"description": "A tool that makes it easy to create Python bindings for C and C++ libraries",
"homepage": "https://www.riverbankcomputing.com/software/sip",
"dependencies": [
Expand Down
Loading

0 comments on commit 9e7e663

Please sign in to comment.