From ed226b4de844107ad5166453500ba0567c11ef46 Mon Sep 17 00:00:00 2001 From: kas Date: Thu, 17 Nov 2022 19:17:45 +0100 Subject: [PATCH] Fix build (at least on Windows using Clang) --- dep/CMakeLists.txt | 10 ---------- dep/libgit2/CMakeLists.txt | 16 +++++----------- src/git/CMakeLists.txt | 16 ++++------------ src/git/Filter.cpp | 6 ++---- test/dep/zip | 2 +- 5 files changed, 12 insertions(+), 38 deletions(-) diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 104d62caf..54cb4ae42 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -3,16 +3,6 @@ find_package(PkgConfig) add_subdirectory(openssl) add_subdirectory(libssh2) add_subdirectory(libgit2) -# otherwise the zlib is not available in the src/git -set(LIBGIT2_DEPENDENCY_OBJECTS - ${LIBGIT2_DEPENDENCY_OBJECTS} - PARENT_SCOPE) -set(LIBGIT2_SYSTEM_LIBS - ${LIBGIT2_SYSTEM_LIBS} - PARENT_SCOPE) -set(LIBGIT2_INCLUDES - ${LIBGIT2_INCLUDES} - PARENT_SCOPE) add_subdirectory(cmark) add_subdirectory(lua) diff --git a/dep/libgit2/CMakeLists.txt b/dep/libgit2/CMakeLists.txt index 36bf8f350..473a21e9f 100644 --- a/dep/libgit2/CMakeLists.txt +++ b/dep/libgit2/CMakeLists.txt @@ -2,7 +2,7 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -set(BUILD_CLAR +set(BUILD_TESTS OFF CACHE BOOL "" FORCE) set(STATIC_CRT @@ -34,14 +34,8 @@ endif() if(NOT USE_SYSTEM_LIBGIT2) add_subdirectory(libgit2) - # otherwise the zlib is not available in the src/git - set(LIBGIT2_DEPENDENCY_OBJECTS - ${LIBGIT2_DEPENDENCY_OBJECTS} - PARENT_SCOPE) - set(LIBGIT2_SYSTEM_LIBS - ${LIBGIT2_SYSTEM_LIBS} - PARENT_SCOPE) - set(LIBGIT2_INCLUDES - ${LIBGIT2_INCLUDES} - PARENT_SCOPE) + + # Include the generated experimental.h + target_include_directories( + libgit2 INTERFACE ${PROJECT_BINARY_DIR}/dep/libgit2/libgit2/include/git2) endif() diff --git a/src/git/CMakeLists.txt b/src/git/CMakeLists.txt index 2ae3cd049..1416df857 100644 --- a/src/git/CMakeLists.txt +++ b/src/git/CMakeLists.txt @@ -27,17 +27,9 @@ add_library( TagRef.cpp Tree.cpp) -target_link_libraries( - git - $ - $ # util of libgit2 - gittyupUtil - ${LIBGIT2_DEPENDENCY_OBJECTS} - ${LIBGIT2_SYSTEM_LIBS} - Qt5::Core - Qt5::Network) - -# needed also by the plugin target so it must be public -target_include_directories(git PUBLIC ${LIBGIT2_INCLUDES}) +# we need both libgit2package and libgit2 otherwise we can't find the header +# files +target_link_libraries(git libgit2package libgit2 gittyupUtil Qt5::Core + Qt5::Network) set_target_properties(git PROPERTIES AUTOMOC ON) diff --git a/src/git/Filter.cpp b/src/git/Filter.cpp index 6166b7b37..a0937e0c8 100644 --- a/src/git/Filter.cpp +++ b/src/git/Filter.cpp @@ -12,10 +12,8 @@ #include "Config.h" #include "git2/errors.h" #include "git2/filter.h" -#include "str.h" #include "git2/repository.h" #include "git2/sys/filter.h" -#include "git2_util.h" #include #include @@ -81,7 +79,7 @@ struct Stream { const git_filter_source *filter_source; }; -static void stream_free(git_writestream *stream) { git__free(stream); } +static void stream_free(git_writestream *stream) { free(stream); } static int stream_close(git_writestream *s) { struct Stream *stream = (struct Stream *)s; @@ -103,7 +101,7 @@ static int stream_init(git_writestream **out, git_filter *self, void **payload, const git_filter_source *src, git_writestream *next) { struct Stream *stream = - static_cast(git__calloc(1, sizeof(struct Stream))); + static_cast(calloc(1, sizeof(struct Stream))); if (!stream) return -1; diff --git a/test/dep/zip b/test/dep/zip index 2652bd2bc..fefb8d6ac 160000 --- a/test/dep/zip +++ b/test/dep/zip @@ -1 +1 @@ -Subproject commit 2652bd2bce8573990894cd068e6d62ffb8057676 +Subproject commit fefb8d6acc78b5f63d5a78b86a4900e694bd2862