mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add USE_LIBGIT23_API as cmake option
Just as we would expect, the libgit2 developers of course once again broke their API. In order to compile against current master we need to remap those APIs once again. Simply call cmake with -DUSE_LIBGIT23_API Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8af85fbc04
commit
95664af53b
3 changed files with 26 additions and 0 deletions
|
@ -12,6 +12,7 @@ option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
||||||
option(NO_MARBLE "disable the marble widget" OFF)
|
option(NO_MARBLE "disable the marble widget" OFF)
|
||||||
option(NO_TESTS "disable the tests" OFF)
|
option(NO_TESTS "disable the tests" OFF)
|
||||||
option(NO_DOCS "disable the docs" OFF)
|
option(NO_DOCS "disable the docs" OFF)
|
||||||
|
option(USE_LIBGIT23_API "allow building with libgit2 master" OFF)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
|
set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
|
||||||
include_directories(. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
include_directories(. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
||||||
|
@ -35,9 +36,18 @@ pkg_config_library(LIBUSB libusb-1.0 QUIET)
|
||||||
if(LIBGIT2_FROM_PKGCONFIG)
|
if(LIBGIT2_FROM_PKGCONFIG)
|
||||||
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
||||||
set(LIBGIT2_LIBRARIES "")
|
set(LIBGIT2_LIBRARIES "")
|
||||||
|
if(USE_LIBGIT23_API)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
|
||||||
|
pkg_config_library(LIBSSH2 libssh2 REQUIRED)
|
||||||
|
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES})
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
find_package(LIBGIT2 REQUIRED)
|
find_package(LIBGIT2 REQUIRED)
|
||||||
include_directories(${LIBGIT2_INCLUDE_DIR})
|
include_directories(${LIBGIT2_INCLUDE_DIR})
|
||||||
|
if(USE_LIBGIT23_API)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
|
||||||
|
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -lssh2)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LIBDC_FROM_PKGCONFIG)
|
if(LIBDC_FROM_PKGCONFIG)
|
||||||
|
|
|
@ -26,6 +26,13 @@
|
||||||
#define git_remote_fetch(remote, refspecs, signature, reflog) git_remote_fetch(remote, signature, reflog)
|
#define git_remote_fetch(remote, refspecs, signature, reflog) git_remote_fetch(remote, signature, reflog)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* api break introduced in libgit2 master after 0.22 - let's guess this is the v0.23 API
|
||||||
|
*/
|
||||||
|
#if USE_LIBGIT23_API
|
||||||
|
#define git_branch_create(out, repo, branch_name, target, force, signature, log_message) \
|
||||||
|
git_branch_create(out, repo, branch_name, target, force)
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *get_local_dir(const char *remote, const char *branch)
|
static char *get_local_dir(const char *remote, const char *branch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,15 @@
|
||||||
#else
|
#else
|
||||||
#define git_treebuilder_write(id, repo, bld) git_treebuilder_write(id, bld)
|
#define git_treebuilder_write(id, repo, bld) git_treebuilder_write(id, bld)
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* api break introduced in libgit2 master after 0.22 - let's guess this is the v0.23 API
|
||||||
|
*/
|
||||||
|
#if USE_LIBGIT23_API
|
||||||
|
#define git_branch_create(out, repo, branch_name, target, force, signature, log_message) \
|
||||||
|
git_branch_create(out, repo, branch_name, target, force)
|
||||||
|
#define git_reference_set_target(out, ref, id, author, log_message) \
|
||||||
|
git_reference_set_target(out, ref, id, log_message)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VA_BUF(b, fmt) do { va_list args; va_start(args, fmt); put_vformat(b, fmt, args); va_end(args); } while (0)
|
#define VA_BUF(b, fmt) do { va_list args; va_start(args, fmt); put_vformat(b, fmt, args); va_end(args); } while (0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue