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

Dynamic windows builds #5187

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 23 additions & 10 deletions .github/workflows/windows.yml
Expand Up @@ -68,10 +68,10 @@ jobs:
-D CMAKE_C_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe" \
-D CMAKE_CXX_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe" \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D VCPKG_TARGET_TRIPLET="x64-windows-static" \
-D VCPKG_HOST_TRIPLET="x64-windows-static" \
-D VCPKG_TARGET_TRIPLET="x64-windows" \
-D VCPKG_HOST_TRIPLET="x64-windows" \
-D WITH_VCPKG=ON \
-D WITH_SPIX=ON \
-D WITH_SPIX=OFF \
-D WITH_NFC=OFF \
-D APP_VERSION="${APP_VERSION}" \
-D APP_VERSION_STR="${APP_VERSION_STR}" \
Expand All @@ -81,17 +81,30 @@ jobs:
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D SENTRY_DSN=${{ secrets.SENTRY_DSN }} \
-D SENTRY_ENV="${APP_ENV}" \
-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded\$<\$<CONFIG:Debug>:Debug>" \
-D PKG_CONFIG_EXECUTABLE=${CMAKE_BUILD_DIR}/vcpkg_installed/x64-windows-static/tools/pkgconf/pkgconf.exe \
-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded\$<\$<CONFIG:Debug>:Debug>DLL" \
-D PKG_CONFIG_EXECUTABLE=${CMAKE_BUILD_DIR}/vcpkg_installed/x64-windows/tools/pkgconf/pkgconf.exe \
-D WITH_BLUETOOTH=ON \
-D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \
${EXTRA_CMAKE_ARGS}

- name: 📦 Create SDK
# if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
run: |
${{ env.CMAKE_BUILD_DIR }}/_deps/vcpkg-src/vcpkg.exe export --zip --output-dir=./sdk --x-install-root=${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed

- name: 📤 Upload sdk
# if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: qfield-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-static
name: build-logs-x64-windows
path: |
C:/src/**/*.log

Expand All @@ -102,7 +115,7 @@ jobs:
- name: 🧫 Test
shell: bash
env:
PROJ_LIB: ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/x64-windows-static/share/proj
PROJ_LIB: ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/x64-windows/share/proj
run: |
SOURCE_DIR=$( cygpath "${{ github.workspace }}" )
pip install -r "${SOURCE_DIR}/test/spix/requirements.txt"
Expand All @@ -122,20 +135,20 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: package-logs-x64-windows-static
name: package-logs-x64-windows
path: ${{ env.CMAKE_BUILD_DIR }}/_CPack_Packages/**/*.log

- name: 📦 Upload package
if: ${{ env.ARTIFACT_NAME != null }}
uses: actions/upload-artifact@v4
with:
name: "QField-dev-x64-windows-static-${{ env.BUILD_TYPE }}"
name: "QField-dev-x64-windows-${{ env.BUILD_TYPE }}"
path: ${{ env.ARTIFACT_PATHNAME }}

- name: 📊 Upload test report
uses: actions/upload-artifact@v4
with:
name: "test-report-x64-windows-static-${{ env.BUILD_TYPE }}"
name: "test-report-x64-windows-${{ env.BUILD_TYPE }}"
path: "${{ env.CMAKE_BUILD_DIR }}/report"

- name: 🚀 Upload release asset
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Expand Up @@ -276,6 +276,17 @@ if(WITH_VCPKG)
install(DIRECTORY "${PROJ_DATA_PATH}/" DESTINATION "${CMAKE_INSTALL_DATADIR}/proj/")
install(DIRECTORY "${VCPKG_BASE_DIR}/share/gdal/" DESTINATION "${CMAKE_INSTALL_DATADIR}/gdal")

if(VCPKG_TARGET_TRIPLET STREQUAL "x64-windows")
install(DIRECTORY "${VCPKG_BASE_DIR}/bin/" DESTINATION "${CMAKE_INSTALL_BINDIR}" FILES_MATCHING PATTERN "*.dll")
install(DIRECTORY "${VCPKG_BASE_DIR}/Qt6/"
DESTINATION "${CMAKE_INSTALL_BINDIR}/Qt6"
FILES_MATCHING
PATTERN "*.dll"
PATTERN "qmldir"
PATTERN "*.qmltypes"
)
endif()

add_dependencies(qfield deploy)
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/qgis-cmake-wrapper.cmake
Expand Up @@ -63,7 +63,7 @@ endfunction()
# set(CMAKE_USE_PTHREADS_INIT 1)
#endif()

if(TRUE) # Should possibly have a "static only" check
if(FALSE) # Should possibly have a "static only" check
find_package(PkgConfig QUIET)

_find_and_link_library(authmethod_basic_a QGIS::Core)
Expand Down
2 changes: 1 addition & 1 deletion src/app/CMakeLists.txt
Expand Up @@ -120,7 +120,7 @@ function(create_executable)
endif()

if(WITH_VCPKG) # this triggers the initialisation of static qca ossl plugin.
target_compile_definitions(${exe_TARGET} PUBLIC HAVE_STATIC_QCA_PLUGINS)
# target_compile_definitions(${exe_TARGET} PUBLIC HAVE_STATIC_QCA_PLUGINS)
endif()

set_target_properties(${exe_TARGET} PROPERTIES AUTORCC TRUE)
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Expand Up @@ -56,7 +56,7 @@
"features": [
{
"name": "ffmpeg",
"platform": "linux | android"
"platform": "linux | android | (windows & !static)"
},
"qml"
]
Expand Down
38 changes: 38 additions & 0 deletions vcpkg/ports/qgis/libprotobuf-lite.patch
@@ -0,0 +1,38 @@
From e3a41d679edfd64d5fa4caa33c8564d9163ebdcd Mon Sep 17 00:00:00 2001
From: Matthias Kuhn <matthias@opengis.ch>
Date: Fri, 15 Mar 2024 16:50:00 +0100
Subject: [PATCH] Switch to conditional protobuf-lite target

The original version number check was completely random numbers
---
CMakeLists.txt | 3 ---
src/core/CMakeLists.txt | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 564a1fe30bb4..e6f1278f7bf4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -375,9 +375,6 @@ if(WITH_CORE)

find_package(Protobuf CONFIG)
find_package(Protobuf REQUIRED)
- if(Protobuf_VERSION GREATER_EQUAL 4.23)
- set(Protobuf_LITE_LIBRARY protobuf::libprotobuf-lite)
- endif()

message(STATUS "Found Protobuf: ${Protobuf_LIBRARIES}")
if (NOT Protobuf_PROTOC_EXECUTABLE)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 26fca1e2bf99..692753b4e273 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -2460,7 +2460,7 @@ target_link_libraries(qgis_core
EXPAT::EXPAT
${SQLITE3_LIBRARY}
${LIBZIP_LIBRARY}
- ${Protobuf_LITE_LIBRARY}
+ $<TARGET_NAME_IF_EXISTS:protobuf::libprotobuf-lite>
${ZLIB_LIBRARIES}
${EXIV2_LIBRARY}
PROJ::proj
2 changes: 2 additions & 0 deletions vcpkg/ports/qgis/portfile.cmake
Expand Up @@ -18,6 +18,8 @@ vcpkg_from_github(
crssync-no-install.patch
include-qthread.patch
invoke.patch
libprotobuf-lite.patch
windowsqt6fixes.patch
)

file(REMOVE ${SOURCE_PATH}/cmake/FindGDAL.cmake)
Expand Down