Make the libssh linking optional

Due to bugs in libgit2, we force linking with libssh2 to add
git-over-ssh support. On android we currency don't want libssh2 due to
its dependency chain, so this makes the libssh2 force linking opt-out.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2015-07-09 00:42:11 +02:00 committed by Dirk Hohndel
parent a558f09f8d
commit 1f112c7738
2 changed files with 13 additions and 8 deletions

View file

@ -16,6 +16,7 @@ option(NO_DOCS "disable the docs" OFF)
option(NO_PRINTING "disable the printing support" ON) option(NO_PRINTING "disable the printing support" ON)
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF) option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
option(USE_LIBGIT23_API "allow building with libgit2 master" OFF) option(USE_LIBGIT23_API "allow building with libgit2 master" OFF)
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF) option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
option(FBSUPPORT "allow posting to Facebook" ON) option(FBSUPPORT "allow posting to Facebook" ON)
@ -54,15 +55,18 @@ if(LIBGIT2_FROM_PKGCONFIG)
if(USE_LIBGIT23_API) if(USE_LIBGIT23_API)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API")
if(FORCE_LIBSSH)
pkg_config_library(LIBSSH2 libssh2 REQUIRED) pkg_config_library(LIBSSH2 libssh2 REQUIRED)
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES}) set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES})
endif() endif()
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) if(USE_LIBGIT23_API)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API")
if(FORCE_LIBSSH)
find_package(Libssh2 QUIET CONFIG) find_package(Libssh2 QUIET CONFIG)
if ("${LIBSSH2_VERSION}" STRGREATER "1.6.1") if ("${LIBSSH2_VERSION}" STRGREATER "1.6.1")
set(LIBSSH2_LIBRARIES Libssh2::libssh2) set(LIBSSH2_LIBRARIES Libssh2::libssh2)
@ -70,6 +74,7 @@ else()
if(!LIBSSH2_FOUND OR "${LIBSSH2_FOUND}" STREQUAL "") if(!LIBSSH2_FOUND OR "${LIBSSH2_FOUND}" STREQUAL "")
pkg_config_library(LIBSSH2 libssh2 REQUIRED) pkg_config_library(LIBSSH2 libssh2 REQUIRED)
endif() endif()
endif()
find_package(libcurl QUIET) find_package(libcurl QUIET)
if(!LIBCURL_FOUND OR "${LIBCURL_FOUND}" STREQUAL "") if(!LIBCURL_FOUND OR "${LIBCURL_FOUND}" STREQUAL "")
pkg_config_library(LIBCURL libcurl REQUIRED) pkg_config_library(LIBCURL libcurl REQUIRED)

View file

@ -158,7 +158,7 @@ fi
mkdir -p subsurface-build-$ARCH mkdir -p subsurface-build-$ARCH
cd subsurface-build-$ARCH cd subsurface-build-$ARCH
cmake -DCMAKE_SYSTEM_NAME=Android -DLIBDC_FROM_PKGCONFIG=ON -DLIBGIT2_FROM_PKGCONFIG=ON -DUSE_LIBGIT23_API=ON -DNO_MARBLE=ON -DNO_PRINTING=ON -DNO_USERMANUAL=ON -DCMAKE_PREFIX_PATH:UNINITIALIZED=${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake $SUBSURFACE_SOURCE cmake -DCMAKE_SYSTEM_NAME=Android -DFORCE_LIBSSH=OFF -DLIBDC_FROM_PKGCONFIG=ON -DLIBGIT2_FROM_PKGCONFIG=ON -DUSE_LIBGIT23_API=ON -DNO_MARBLE=ON -DNO_PRINTING=ON -DNO_USERMANUAL=ON -DCMAKE_PREFIX_PATH:UNINITIALIZED=${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake $SUBSURFACE_SOURCE
make make
#make install INSTALL_ROOT=android_build #make install INSTALL_ROOT=android_build
# bug in androiddeployqt? why is it looking for something with the builddir in it? # bug in androiddeployqt? why is it looking for something with the builddir in it?