Skip to content

Commit

Permalink
Fix build (at least on Windows using Clang)
Browse files Browse the repository at this point in the history
  • Loading branch information
exactly-one-kas committed Nov 17, 2022
1 parent b71ad6b commit ed226b4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 38 deletions.
10 changes: 0 additions & 10 deletions dep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 5 additions & 11 deletions dep/libgit2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
16 changes: 4 additions & 12 deletions src/git/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,9 @@ add_library(
TagRef.cpp
Tree.cpp)

target_link_libraries(
git
$<TARGET_OBJECTS:libgit2>
$<TARGET_OBJECTS:util> # 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)
6 changes: 2 additions & 4 deletions src/git/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QMap>
#include <QProcess>

Expand Down Expand Up @@ -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;
Expand All @@ -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<struct Stream *>(git__calloc(1, sizeof(struct Stream)));
static_cast<struct Stream *>(calloc(1, sizeof(struct Stream)));
if (!stream)
return -1;

Expand Down
2 changes: 1 addition & 1 deletion test/dep/zip

0 comments on commit ed226b4

Please sign in to comment.