fix libgit2

This commit is contained in:
rzlamrr
2026-03-06 20:40:06 +07:00
parent 38a077a110
commit 244923903c
2 changed files with 94 additions and 1 deletions
+13 -1
View File
@@ -14,6 +14,12 @@ jobs:
VCPKG_ROOT: C:\vcpkg VCPKG_ROOT: C:\vcpkg
steps: steps:
# ── 0. Checkout this build repo (for patches) ────────────────────────
- name: Checkout fritzing-build
uses: actions/checkout@v4
with:
path: fritzing-build
# ── 1. Checkout Fritzing source ────────────────────────────────────── # ── 1. Checkout Fritzing source ──────────────────────────────────────
- name: Checkout fritzing-app - name: Checkout fritzing-app
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -27,6 +33,12 @@ jobs:
repository: fritzing/fritzing-parts repository: fritzing/fritzing-parts
path: fritzing-parts path: fritzing-parts
# ── 1b. Apply build patches ──────────────────────────────────────────
- name: Patch libgit2detect.pri for vcpkg
working-directory: fritzing-app
run: git apply ../fritzing-build/patches/libgit2detect-vcpkg.patch
shell: bash
# ── 2. Setup MSVC 2022 64-bit environment ──────────────────────────── # ── 2. Setup MSVC 2022 64-bit environment ────────────────────────────
- name: Setup MSVC environment - name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
@@ -52,7 +64,7 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: C:\vcpkg\installed path: C:\vcpkg\installed
key: vcpkg-x64-windows-${{ hashFiles('**/build-windows.yml') }} key: vcpkg-x64-windows-${{ hashFiles('**/windows.yml') }}
restore-keys: | restore-keys: |
vcpkg-x64-windows- vcpkg-x64-windows-
+81
View File
@@ -0,0 +1,81 @@
--- a/pri/libgit2detect.pri
+++ b/pri/libgit2detect.pri
@@ -28,30 +28,51 @@
}
win32 {
- if ($$LIBGIT_STATIC) {
- LIBGIT2INCLUDE = "$$_PRO_FILE_PWD_/../libgit2/include"
+ # If LIBGIT2_PATH is passed on the qmake command line (e.g. from vcpkg),
+ # use its standard include/ and lib/ layout. Otherwise fall back to the
+ # legacy ../libgit2 sibling-directory layout.
+ !isEmpty(LIBGIT2_PATH) {
+ LIBGIT2INCLUDE = "$$LIBGIT2_PATH/include"
+ LIBGIT2LIB = "$$LIBGIT2_PATH/lib"
exists($$LIBGIT2INCLUDE/git2.h) {
- message("found libgit2 include path at $$LIBGIT2INCLUDE")
- } else {
- message("Fritzing requires libgit2")
- message("Build it from the repo at https://github.com/libgit2")
- message("See https://github.com/fritzing/fritzing-app/wiki for details.")
-
- error("libgit2 include path not found in $$LIBGIT2INCLUDE")
- }
- }
-
- contains(QMAKE_TARGET.arch, x86_64) {
- LIBGIT2LIB = "$$_PRO_FILE_PWD_/../libgit2/build64/Release"
- } else {
- LIBGIT2LIB = "$$_PRO_FILE_PWD_/../libgit2/build32/Release"
- }
-
- exists($$LIBGIT2LIB/git2.lib) {
- message("found libgit2 library in $$LIBGIT2LIB")
- } else {
- error("libgit2 library not found in $$LIBGIT2LIB")
- }
+ message("found libgit2 include path at $$LIBGIT2INCLUDE (from LIBGIT2_PATH)")
+ } else {
+ error("libgit2 include path not found in $$LIBGIT2INCLUDE (LIBGIT2_PATH was set)")
+ }
+
+ exists($$LIBGIT2LIB/git2.lib) {
+ message("found libgit2 library in $$LIBGIT2LIB (from LIBGIT2_PATH)")
+ } else {
+ error("libgit2 library not found in $$LIBGIT2LIB (LIBGIT2_PATH was set)")
+ }
+ } else {
+ # Legacy layout: ../libgit2/include + ../libgit2/build{32,64}/Release
+ if ($$LIBGIT_STATIC) {
+ LIBGIT2INCLUDE = "$$_PRO_FILE_PWD_/../libgit2/include"
+
+ exists($$LIBGIT2INCLUDE/git2.h) {
+ message("found libgit2 include path at $$LIBGIT2INCLUDE")
+ } else {
+ message("Fritzing requires libgit2")
+ message("Build it from the repo at https://github.com/libgit2")
+ message("See https://github.com/fritzing/fritzing-app/wiki for details.")
+
+ error("libgit2 include path not found in $$LIBGIT2INCLUDE")
+ }
+ }
+
+ contains(QMAKE_TARGET.arch, x86_64) {
+ LIBGIT2LIB = "$$_PRO_FILE_PWD_/../libgit2/build64/Release"
+ } else {
+ LIBGIT2LIB = "$$_PRO_FILE_PWD_/../libgit2/build32/Release"
+ }
+
+ exists($$LIBGIT2LIB/git2.lib) {
+ message("found libgit2 library in $$LIBGIT2LIB")
+ } else {
+ error("libgit2 library not found in $$LIBGIT2LIB")
+ }
+ }
INCLUDEPATH += $$LIBGIT2INCLUDE
- LIBS += -L$$LIBGIT2LIB -lgit2
+ LIBS += -L$$LIBGIT2LIB -lgit2
}