From 11c70a7e60301580497b4e7086ca86e100b428c8 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Sun, 6 Oct 2024 15:33:36 +0200 Subject: [PATCH] Build with vcpkg deps --- .github/workflows/windows-qt6.yml | 132 ++++++++++++++++++ CMakeLists.txt | 71 ++++------ cmake/Bundle.cmake | 47 +++++++ cmake/NuGet.Config.in | 18 +++ cmake/VcpkgInstallDeps.cmake | 28 ++++ cmake/VcpkgToolchain.cmake | 58 ++++++++ .../ports/py-qgis-requirements/portfile.cmake | 18 +++ .../py-qgis-requirements/requirements.txt | 9 ++ vcpkg/ports/py-qgis-requirements/vcpkg.json | 16 +++ vcpkg/ports/py-qscintilla/fix-static.patch | 29 ++++ vcpkg/ports/py-qscintilla/portfile.cmake | 62 ++++++++ vcpkg/ports/py-qscintilla/vcpkg.json | 22 +++ vcpkg/triplets/x64-windows-release.cmake | 5 + vcpkg/vcpkg.json | 132 ++++++++++++++++++ 14 files changed, 606 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/windows-qt6.yml create mode 100644 cmake/Bundle.cmake create mode 100644 cmake/NuGet.Config.in create mode 100644 cmake/VcpkgInstallDeps.cmake create mode 100644 cmake/VcpkgToolchain.cmake create mode 100644 vcpkg/ports/py-qgis-requirements/portfile.cmake create mode 100644 vcpkg/ports/py-qgis-requirements/requirements.txt create mode 100644 vcpkg/ports/py-qgis-requirements/vcpkg.json create mode 100644 vcpkg/ports/py-qscintilla/fix-static.patch create mode 100644 vcpkg/ports/py-qscintilla/portfile.cmake create mode 100644 vcpkg/ports/py-qscintilla/vcpkg.json create mode 100644 vcpkg/triplets/x64-windows-release.cmake create mode 100644 vcpkg/vcpkg.json diff --git a/.github/workflows/windows-qt6.yml b/.github/workflows/windows-qt6.yml new file mode 100644 index 00000000000..68432d391f0 --- /dev/null +++ b/.github/workflows/windows-qt6.yml @@ -0,0 +1,132 @@ +--- +name: 🪟 Windows Qt6 +on: + push: + branches: + - master + - release-** + pull_request: + release: + types: ['published'] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + packages: write + +jobs: + build: + name: build (windows) + runs-on: windows-2022 + + steps: + - name: 🐣 Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: 🐩 Install CMake and Ninja + uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.29.6 + + - name: 🧽 Developer Command Prompt for Microsoft Visual C++ + uses: ilammy/msvc-dev-cmd@v1 + + - name: 🎡 Setup vcpkg + uses: ./.github/actions/setup-vcpkg + + - name: 🦬 Setup flex/bison + uses: robinraju/release-downloader@v1.10 + with: + repository: 'lexxmark/winflexbison' + fileName: '*.zip' + tag: 'v2.5.24' + extract: true + + - name: 🛍️ Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 1G + + - name: 🌱 Install dependencies and generate project files + shell: bash + run: | + BUILD_DIR=$( cygpath "${{ github.workspace }}/build" ) + SOURCE_DIR=$( cygpath "${{ github.workspace }}" ) + + cmake -S "${SOURCE_DIR}" \ + -B "${BUILD_DIR}" \ + -G Ninja \ + -D CMAKE_BUILD_TYPE=Release \ + -D WITH_VCPKG=ON \ + -D CREATE_ZIP=ON \ + -D VCPKG_TARGET_TRIPLET=x64-windows-release \ + -D VCPKG_HOST_TRIPLET=x64-windows-release \ + -D WITH_DESKTOP=ON \ + -D WITH_3D=ON \ + -D WITH_BINDINGS=ON \ + -D ENABLE_TESTS=OFF \ + -D BUILD_WITH_QT6=ON \ + -D USE_CCACHE=ON \ + -D FLEX_EXECUTABLE="${SOURCE_DIR}/win_flex.exe" \ + -D BISON_EXECUTABLE="${SOURCE_DIR}/win_bison.exe" \ + -D SIP_BUILD_EXECUTABLE="${BUILD_DIR}\vcpkg_installed\x64-windows-release\tools\python3\Scripts\sip-build.exe" \ + -D PYUIC_PROGRAM="${BUILD_DIR}\vcpkg_installed\x64-windows-release\tools\python3\pyuic5.bat" \ + -D PYRCC_PROGRAM="${BUILD_DIR}\vcpkg_installed\x64-windows-release\tools\python3\pyrcc5.bat" \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D WITH_QTWEBKIT=OFF \ + -D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \ + -D NUGET_USERNAME=${{ github.actor }} \ + -D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} + + - name: 🌋 Build + shell: bash + run: | + cmake --build "${{ github.workspace }}/build" --config Release + +# - uses: m-kuhn/action-tmate@patch-1 +# if: failure() + + - name: 📦 Package + shell: bash + run: | + cmake --build "${{ github.workspace }}/build" --target bundle --config Release + + - name: 📦 Create SDK +# if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' + run: | + vcpkg.exe 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: qgis-sdk-x64-windows + path: | + sdk/vcpkg-export-*.zip + + - name: 📑 Upload dep build logs + uses: actions/upload-artifact@v4 + if: failure() + with: + name: build-logs-x64-windows + path: | + C:/src/**/*.log + + - name: Save PR number to zips + run: | + echo ${{ github.event.number }} | tee pr_number + powershell Compress-Archive -update pr_number *-win64.zip + echo ${{ github.event.pull_request.head.sha }} | tee git_commit + powershell Compress-Archive -update git_commit *-win64.zip + + - name: 📤 Upload bundle + uses: actions/upload-artifact@v4 + with: + name: qgis-windows-qt6 + path: | + build/*-win64.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index 13aefcfe5e7..82c4f3e8108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,34 @@ endif() # don't relink it only the shared object changes set(CMAKE_LINK_DEPENDS_NO_SHARED ON) +set (WITH_BINDINGS TRUE CACHE BOOL "Determines whether Python bindings should be built") +set (WITH_3D TRUE CACHE BOOL "Determines whether QGIS 3D library should be built") +set (WITH_QGIS_PROCESS TRUE CACHE BOOL "Determines whether the standalone \"qgis_process\" tool should be built") +set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built") +set (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library should be built") +set(WITH_VCPKG FALSE CACHE BOOL "Use the vcpkg submodule for dependency management.") + +set(WITH_VCPKG TRUE CACHE BOOL "Use the vcpkg submodule for dependency management.") +set(SDK_PATH "" CACHE STRING "Build with VCPKG SDK") + +if(NOT SDK_PATH STREQUAL "") + message(STATUS "Building with SDK -- ${SDK_PATH}") + set(CMAKE_TOOLCHAIN_FILE "${SDK_PATH}/scripts/buildsystems/vcpkg.cmake") + if(APPLE AND NOT VCPKG_TARGET_TRIPLET) + set(VCPKG_TARGET_TRIPLET "x64-osx-dynamic") + endif() + set(WITH_VCPKG ON) +elseif(WITH_VCPKG) + message(STATUS "Building local dependencies with VCPKG --") + include(VcpkgToolchain) +else() + message(STATUS "Building with system libraries --") +endif() + +if(WITH_VCPKG) + list(APPEND CMAKE_PROGRAM_PATH "${VCPKG_INSTALL_PREFIX}/${VCPKG_TARGET_TRIPLET}/") +endif() + ############################################################# # Project and version set(CPACK_PACKAGE_VERSION_MAJOR "3") @@ -138,7 +166,6 @@ if(WITH_CORE) endif() endforeach (GRASS_SEARCH_VERSION) - set (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library (and everything built on top of it) should be built") set (WITH_OAUTH2_PLUGIN TRUE CACHE BOOL "Determines whether OAuth2 authentication method plugin should be built") if(WITH_OAUTH2_PLUGIN) @@ -149,8 +176,6 @@ if(WITH_CORE) set (WITH_ANALYSIS TRUE CACHE BOOL "Determines whether QGIS analysis library should be built") - set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built") - if(WITH_DESKTOP) if((WIN32 AND NOT MINGW) OR (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS)) set (CRASH_HANDLER_AVAILABLE TRUE) @@ -169,17 +194,12 @@ if(WITH_CORE) endif() endif() - set (WITH_3D TRUE CACHE BOOL "Determines whether QGIS 3D library should be built") - set (WITH_QUICK FALSE CACHE BOOL "Determines whether QGIS Quick library should be built") - set (WITH_QGIS_PROCESS TRUE CACHE BOOL "Determines whether the standalone \"qgis_process\" tool should be built") - set (NATIVE_CRSSYNC_BIN "" CACHE PATH "Path to a natively compiled synccrsdb binary. If set, crssync will not build but use provided bin instead.") mark_as_advanced (NATIVE_CRSSYNC_BIN) # try to configure and build python bindings by default - set (WITH_BINDINGS TRUE CACHE BOOL "Determines whether Python bindings should be built") if (WITH_BINDINGS) # By default bindings will be installed only to QGIS directory # Someone might want to install it to python site-packages directory @@ -1218,39 +1238,8 @@ endif() ############################################################# # Enable packaging if (WITH_CORE) - # Do not warn about runtime libs when building using VS Express - if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) - endif() - - if(QGIS_INSTALL_SYS_LIBS) - include(InstallRequiredSystemLibraries) - endif() - - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QGIS") - set(CPACK_PACKAGE_VENDOR "Open Source Geospatial Foundation") - set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "QGIS ${COMPLETE_VERSION}") - if(WIN32 AND NOT UNIX) - # There is a bug in NSI that does not handle full unix paths properly. Make - # sure there is at least one set of four (4) backslashes. - set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/win_build\\\\sidebar.bmp") - set(CPACK_NSIS_INSTALLED_ICON_NAME "\\\\qgis.exe") - set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} QGIS") - set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\qgis.org") - set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\qgis.org") - set(CPACK_NSIS_CONTACT "info@qgis.org") - set(CPACK_NSIS_MODIFY_PATH ON) - - # set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " !include \\\"${CMAKE_SOURCE_DIR}\\\\win_build\\\\extra.nsh\\\"") - else() - #set(CPACK_STRIP_FILES "QGIS") - #set(CPACK_SOURCE_STRIP_FILES "") - endif() - set(CPACK_PACKAGE_EXECUTABLES "qgis" "QGIS") - set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") - include(CPack) + include(Bundle) + include(VcpkgInstallDeps) endif() if (UNIX AND NOT APPLE) diff --git a/cmake/Bundle.cmake b/cmake/Bundle.cmake new file mode 100644 index 00000000000..a1ffffd26f4 --- /dev/null +++ b/cmake/Bundle.cmake @@ -0,0 +1,47 @@ +set(CPACK_GENERATOR) +set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake") + +add_custom_target(bundle + COMMAND ${CMAKE_CPACK_COMMAND} "--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake" + COMMENT "Running CPACK. Please wait..." + DEPENDS qgis) + +if(WIN32 AND NOT UNIX) + set (CREATE_NSIS FALSE CACHE BOOL "Create an installer using NSIS") +endif() +set (CREATE_ZIP FALSE CACHE BOOL "Create a ZIP package") + +# Do not warn about runtime libs when building using VS Express +if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) +endif() + +if(QGIS_INSTALL_SYS_LIBS) + include(InstallRequiredSystemLibraries) +endif() + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QGIS") +set(CPACK_PACKAGE_VENDOR "Open Source Geospatial Foundation") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "QGIS ${COMPLETE_VERSION}") +set(CPACK_PACKAGE_EXECUTABLES "qgis" "QGIS") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") + +if(CREATE_NSIS) + # There is a bug in NSI that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backslashes. + set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/win_build\\\\sidebar.bmp") + set(CPACK_NSIS_INSTALLED_ICON_NAME "\\\\qgis.exe") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} QGIS") + set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\qgis.org") + set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\qgis.org") + set(CPACK_NSIS_CONTACT "info@qgis.org") + set(CPACK_NSIS_MODIFY_PATH ON) +endif() + +if(CREATE_ZIP) + list(APPEND CPACK_GENERATOR "ZIP") +endif() + +include(CPack) diff --git a/cmake/NuGet.Config.in b/cmake/NuGet.Config.in new file mode 100644 index 00000000000..8b912c3be1e --- /dev/null +++ b/cmake/NuGet.Config.in @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/cmake/VcpkgInstallDeps.cmake b/cmake/VcpkgInstallDeps.cmake new file mode 100644 index 00000000000..0d45f584c84 --- /dev/null +++ b/cmake/VcpkgInstallDeps.cmake @@ -0,0 +1,28 @@ +if(NOT WITH_VCPKG) + return() +endif() + +set(VCPKG_BASE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + +if(MSVC) + # At least python3.dll, qgis_analysis.dll and gsl.dll are missing + # Copy everything + file(GLOB ALL_LIBS + "${VCPKG_BASE_DIR}/bin/*.dll" + ) + install(FILES ${ALL_LIBS} DESTINATION "bin") +endif() + +set(PROJ_DATA_PATH "${VCPKG_BASE_DIR}/share/proj") + +if(NOT EXISTS "${PROJ_DATA_PATH}/proj.db") + message(FATAL_ERROR "proj.db not found at ${PROJ_DATA_PATH}/proj.db") +endif() + +install(DIRECTORY "${PROJ_DATA_PATH}/" DESTINATION "${CMAKE_INSTALL_DATADIR}/proj") +install(DIRECTORY "${VCPKG_BASE_DIR}/share/gdal/" DESTINATION "${CMAKE_INSTALL_DATADIR}/gdal") +install(DIRECTORY "${VCPKG_BASE_DIR}/bin/Qca/" DESTINATION "bin/Qca") # QCA plugins +install(DIRECTORY "${VCPKG_BASE_DIR}/Qt6/" DESTINATION "bin/Qt6") # qt plugins (qml and others) +install(DIRECTORY "${VCPKG_BASE_DIR}/tools/python3/" + DESTINATION "bin" + PATTERN "*.sip" EXCLUDE) diff --git a/cmake/VcpkgToolchain.cmake b/cmake/VcpkgToolchain.cmake new file mode 100644 index 00000000000..cbcf923ceeb --- /dev/null +++ b/cmake/VcpkgToolchain.cmake @@ -0,0 +1,58 @@ +set(NUGET_SOURCE "https://nuget.pkg.github.com/qgis/index.json" CACHE STRING "Nuget source") +set(NUGET_USERNAME "qgis" CACHE STRING "Nuget user") + +# Setup features (dependencies) based on cmake configuration +if(WITH_BINDINGS) + list(APPEND VCPKG_MANIFEST_FEATURES "bindings") +endif() +if(WITH_3D) + list(APPEND VCPKG_MANIFEST_FEATURES "3d") +endif() +if(WITH_GUI) + list(APPEND VCPKG_MANIFEST_FEATURES "gui") +endif() + +# Setup binary cache +if(NOT "${NUGET_TOKEN}" STREQUAL "" AND WIN32) + set(_VCPKG_EXECUTABLE "vcpkg.exe") + + execute_process( + COMMAND ${_VCPKG_EXECUTABLE} fetch nuget + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE _FETCH_NUGET_OUTPUT) + + STRING(REGEX REPLACE "\n" ";" _FETCH_NUGET_OUTPUT "${_FETCH_NUGET_OUTPUT}") + list(GET _FETCH_NUGET_OUTPUT -1 _NUGET_PATH) + + set(_NUGET_EXE ${_NUGET_PATH}) + + set(_CONFIG_PATH "${CMAKE_BINARY_DIR}/github-NuGet.Config") + + configure_file( + "${CMAKE_SOURCE_DIR}/cmake/NuGet.Config.in" + "${_CONFIG_PATH}" + @ONLY) + execute_process( + COMMAND ${_NUGET_EXE} setapikey "${NUGET_TOKEN}" -src ${NUGET_SOURCE} -configfile ${_CONFIG_PATH} + OUTPUT_VARIABLE _OUTPUT + ERROR_VARIABLE _ERROR + RESULT_VARIABLE _RESULT) + if(_RESULT EQUAL 0) + message(STATUS "Setup nuget api key - done") + else() + message(STATUS "Setup nuget api key - failed") + message(STATUS "Output:") + message(STATUS ${_OUTPUT}) + message(STATUS "Error:") + message(STATUS ${_ERROR}) + endif() + + file(TO_NATIVE_PATH "${_CONFIG_PATH}" _CONFIG_PATH_NATIVE) + set(ENV{VCPKG_BINARY_SOURCES} "$ENV{VCPKG_BINARY_SOURCES};nugetconfig,${_CONFIG_PATH_NATIVE},readwrite") +endif() + +set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") +set(VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/vcpkg") +# Copies DLLs built by vcpkg when an install() command is run. +# Only works on Windows and even there not reliably ... +# set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON CACHE BOOL "Copy dependency DLLs on install") diff --git a/vcpkg/ports/py-qgis-requirements/portfile.cmake b/vcpkg/ports/py-qgis-requirements/portfile.cmake new file mode 100644 index 00000000000..ff3a4c26521 --- /dev/null +++ b/vcpkg/ports/py-qgis-requirements/portfile.cmake @@ -0,0 +1,18 @@ +set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + +file(MAKE_DIRECTORY "${BUILD_DIR}") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}") + +if(VCPKG_TARGET_IS_WINDOWS) + set(PYTHON_EXECUTABLE "${CURRENT_INSTALLED_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}") +else() + set(PYTHON_EXECUTABLE "${CURRENT_INSTALLED_DIR}/tools/python3/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}") +endif() + +vcpkg_execute_required_process( + COMMAND "${PYTHON_EXECUTABLE}" "-m" "pip" "install" "-r" "${CURRENT_PORT_DIR}/requirements.txt" "--target" "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}" "--no-deps" + WORKING_DIRECTORY "${BUILD_DIR}" + LOGNAME "requirements-install-${TARGET_TRIPLET}-rel" + ) + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) diff --git a/vcpkg/ports/py-qgis-requirements/requirements.txt b/vcpkg/ports/py-qgis-requirements/requirements.txt new file mode 100644 index 00000000000..c9acbc76cee --- /dev/null +++ b/vcpkg/ports/py-qgis-requirements/requirements.txt @@ -0,0 +1,9 @@ +isort==5.13.2 +autopep8==2.1.0 +jinja2==3.1.4 +OWSLib==0.31.0 +lxml==5.2.2 +python-dateutil==2.9.0.post0 +six==1.16.0 +pytz==2024.1 +requests==2.32.3 diff --git a/vcpkg/ports/py-qgis-requirements/vcpkg.json b/vcpkg/ports/py-qgis-requirements/vcpkg.json new file mode 100644 index 00000000000..c874880aeec --- /dev/null +++ b/vcpkg/ports/py-qgis-requirements/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "py-qgis-requirements", + "version-date": "2024-05-14", + "description": "pip installed python requirements", + "dependencies": [ + { + "name": "py-setuptools", + "host": true + }, + { + "name": "py-pip", + "host": true + }, + "python3" + ] +} diff --git a/vcpkg/ports/py-qscintilla/fix-static.patch b/vcpkg/ports/py-qscintilla/fix-static.patch new file mode 100644 index 00000000000..ab1cf546d0f --- /dev/null +++ b/vcpkg/ports/py-qscintilla/fix-static.patch @@ -0,0 +1,29 @@ +diff --git a/src/qscintilla.pro b/src/qscintilla.pro +index 8d0acd2..2246442 100644 +--- a/src/qscintilla.pro ++++ b/src/qscintilla.pro +@@ -37,13 +37,13 @@ CONFIG(debug, debug|release) { + TARGET = qscintilla2_qt$${QT_MAJOR_VERSION} + } + +-macx:!CONFIG(staticlib) { ++macx:!CONFIG(static) { + QMAKE_POST_LINK += install_name_tool -id @rpath/$(TARGET1) $(TARGET) + } + + INCLUDEPATH += . ../scintilla/include ../scintilla/lexlib ../scintilla/src + +-!CONFIG(staticlib) { ++!CONFIG(static) { + DEFINES += QSCINTILLA_MAKE_DLL + + # Comment this in to build a dynamic library supporting multiple +@@ -86,7 +86,7 @@ qsci.files = ../qsci + INSTALLS += qsci + + features.path = $$[QT_HOST_DATA]/mkspecs/features +-CONFIG(staticlib) { ++CONFIG(static) { + features.files = $$PWD/features_staticlib/qscintilla2.prf + } else { + features.files = $$PWD/features/qscintilla2.prf diff --git a/vcpkg/ports/py-qscintilla/portfile.cmake b/vcpkg/ports/py-qscintilla/portfile.cmake new file mode 100644 index 00000000000..7c2ec76ab54 --- /dev/null +++ b/vcpkg/ports/py-qscintilla/portfile.cmake @@ -0,0 +1,62 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://www.riverbankcomputing.com/static/Downloads/QScintilla/${VERSION}/QScintilla_src-${VERSION}.tar.gz" + FILENAME "QScintilla-${VERSION}.tar.gz" + SHA512 19e2f9e0a14947501c575018df368d24eb7f8c74e74faa5246db36415bf28dc0beee507ed0e73107c02b36a99bbaf55f0ef3349f479d2332e1b92b2c4a32788a +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES + fix-static.patch +) + +file(RENAME "${SOURCE_PATH}/Python/pyproject-qt5.toml" "${SOURCE_PATH}/Python/pyproject.toml") + +set(SIPBUILD_ARGS + "--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}" + "--api-dir" "${CURRENT_PACKAGES_DIR}/share/Qt6/qsci/api/python" + "--qsci-features-dir" "${SOURCE_PATH}/src/features" + "--qsci-include-dir" "${SITE_PACKAGES}/src" + "--qsci-library-dir" "${SOURCE_PATH}/src" + "--no-make" + "--verbose" + "--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + "--target-dir" "${CURRENT_INSTALLED_DIR}/tools/python3/Lib/site-packages/" +) + +# TODO: help it find sip include dirs, manually patched into sipbuild/project.py for now +# "--sip-include-dirs" "${CURRENT_INSTALLED_DIR}/tools/python3/Lib/site-packages/" + +vcpkg_backup_env_variables(VARS PATH) + +vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/python3/Scripts/") + +message(STATUS "Running sipbuild...") +vcpkg_execute_required_process( + COMMAND "${PYTHON3}" "-m" "sipbuild.tools.build" ${SIPBUILD_ARGS} + WORKING_DIRECTORY "${SOURCE_PATH}/Python" + LOGNAME "sipbuild-${TARGET_TRIPLET}" +) +message(STATUS "Running sipbuild...finished.") + +# 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}") + +vcpkg_qmake_build(SKIP_MAKEFILE BUILD_LOGNAME "install" TARGETS "install") + +vcpkg_restore_env_variables(VARS PATH) + +vcpkg_python_test_import(MODULE "PyQt6.Qsci") + +vcpkg_copy_pdbs() + + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/vcpkg/ports/py-qscintilla/vcpkg.json b/vcpkg/ports/py-qscintilla/vcpkg.json new file mode 100644 index 00000000000..f83167b9637 --- /dev/null +++ b/vcpkg/ports/py-qscintilla/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "py-qscintilla", + "version": "2.14.1", + "description": "Python bindings for QScintilla, which is a port to Qt of the Scintilla editing component. Features syntax highlighting, code-completion and much more (Barebone build without python bindings (missing dependeny PyQt) and without QtDesigner plugin)", + "homepage": "https://www.riverbankcomputing.com/software/qscintilla", + "license": "GPL-3.0-or-later", + "supports": "!xbox", + "dependencies": [ + { + "name": "qscintilla" + }, + "py-pyqt6", + { + "name": "vcpkg-python-scripts", + "host": true + }, + { + "name": "vcpkg-qmake", + "host": true + } + ] +} diff --git a/vcpkg/triplets/x64-windows-release.cmake b/vcpkg/triplets/x64-windows-release.cmake new file mode 100644 index 00000000000..1ae9006118f --- /dev/null +++ b/vcpkg/triplets/x64-windows-release.cmake @@ -0,0 +1,5 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +set(VCPKG_BUILD_TYPE release) diff --git a/vcpkg/vcpkg.json b/vcpkg/vcpkg.json new file mode 100644 index 00000000000..02d35cb68a3 --- /dev/null +++ b/vcpkg/vcpkg.json @@ -0,0 +1,132 @@ +{ + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "reference": "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3", + "baseline": "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "git", + "baseline": "6f244bbbd70800bc478cd19664f57fc96347fb3d", + "reference": "6f244bbbd70800bc478cd19664f57fc96347fb3d", + "repository": "https://github.com/open-vcpkg/python-registry", + "packages": [ + "python3", + "py-*", + "gdal", + "swig", + "vcpkg-python-scripts" + ] + } + ], + "overlay-ports": [ + "ports" + ], + "overlay-triplets": [ + "triplets" + ] + }, + "name": "qgis", + "version-string": "current", + "description": "QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)", + "homepage": "https://qgis.org", + "dependencies": [ + { + "name": "exiv2", + "features": [ + "xmp" + ] + }, + "expat", + { + "name": "gdal", + "default-features": false, + "features": [ + "poppler" + ] + }, + "geos", + "gsl", + "jhasse-poly2tri", + "libpq", + "libspatialindex", + "libspatialite", + { + "name": "libtasn1", + "platform": "ios | osx" + }, + "libxml2", + "libzip", + "pdal", + "proj", + "protobuf", + { + "default-features": false, + "name": "qca", + "features": [ + "ossl" + ] + }, + "qtbase", + "qtkeychain-qt6", + "qtlocation", + "qtsvg", + "qttools", + "zlib" + ], + "features": { + "3d": { + "description": "Determines whether QGIS 3D library should be built", + "dependencies": [ + "qt3d" + ] + }, + "bindings": { + "description": "Determines whether Python bindings should be built", + "dependencies": [ + { + "name": "gdal", + "features": [ + "python" + ] + }, + "py-pip", + "py-pyqt6", + "py-qscintilla", + "py-pyyaml", + "py-psycopg2", + "py-qgis-requirements", + "python3" + ] + }, + "gui": { + "description": "Determines whether the QGIS gui should be built", + "dependencies": [ + "qscintilla", + "qtmultimedia", + "qwt" + ] + }, + "opencl": { + "description": "Should OpenCL support be added", + "dependencies": [ + "opencl" + ] + }, + "quick": { + "description": "Build the QGIS quick components for mobile interfaces", + "dependencies": [ + "qtdeclarative", + "qtquickcontrols2" + ] + }, + "server": { + "description": "Determines whether QGIS server should be built", + "dependencies": [ + "fastcgi" + ] + } + } +}