mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
Merge PR #595: CMake: use find_package() and link Cedar to Ncurses
This commit is contained in:
commit
af45ab0b86
@ -48,6 +48,7 @@ before_install:
|
|||||||
- bash .ci/build-openssl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
|
- bash .ci/build-openssl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- export OPENSSL_ROOT_DIR=${OPENSSL_INSTALL_DIR}
|
||||||
- export LD_LIBRARY_PATH="${HOME}/opt/lib:${LD_LIBRARY_PATH:-}"
|
- export LD_LIBRARY_PATH="${HOME}/opt/lib:${LD_LIBRARY_PATH:-}"
|
||||||
- export CFLAGS="-I${HOME}/opt/include"
|
- export CFLAGS="-I${HOME}/opt/include"
|
||||||
- export LDFLAGS="-L${HOME}/opt/lib"
|
- export LDFLAGS="-L${HOME}/opt/lib"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.4.3)
|
||||||
|
|
||||||
project(SoftEtherVPN LANGUAGES C)
|
project(SoftEtherVPN LANGUAGES C)
|
||||||
|
|
||||||
|
8
configure
vendored
8
configure
vendored
@ -25,6 +25,14 @@ if [ ! -z ${CMAKE_INSTALL_PREFIX+x} ]; then
|
|||||||
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
|
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z ${OPENSSL_ROOT_DIR} ]; then
|
||||||
|
unameOut="$(uname -s)"
|
||||||
|
if [ "$unameOut" = "Darwin" ]; then
|
||||||
|
echo "Environment variable OPENSSL_ROOT_DIR not set, using default Homebrew path: /usr/local/opt/openssl/"
|
||||||
|
export OPENSSL_ROOT_DIR="/usr/local/opt/openssl/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
(cd tmp && cmake ${CMAKE_FLAGS} .. || exit 1)
|
(cd tmp && cmake ${CMAKE_FLAGS} .. || exit 1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +63,6 @@ if(UNIX)
|
|||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
add_definitions(-DUNIX_MACOS -DBRIDGE_PCAP)
|
add_definitions(-DUNIX_MACOS -DBRIDGE_PCAP)
|
||||||
include_directories(SYSTEM /usr/local/opt/openssl/include)
|
|
||||||
link_directories(SYSTEM /usr/local/opt/openssl/lib)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@ set_target_properties(cedar
|
|||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_library(LIB_READLINE readline)
|
||||||
|
find_package(Curses REQUIRED)
|
||||||
|
|
||||||
|
target_link_libraries(cedar ${LIB_READLINE} ${CURSES_LIBRARIES})
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
target_link_libraries(cedar pcap)
|
target_link_libraries(cedar pcap)
|
||||||
endif()
|
endif()
|
||||||
|
@ -12,26 +12,14 @@ set_target_properties(mayaqua
|
|||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(OpenSSL REQUIRED)
|
||||||
find_library(LIB_READLINE readline)
|
find_package(Threads REQUIRED)
|
||||||
find_library(LIB_NCURSES ncurses)
|
find_package(ZLIB REQUIRED)
|
||||||
find_library(LIB_Z z)
|
|
||||||
|
|
||||||
# In some cases libiconv is not included in libc
|
# In some cases libiconv is not included in libc
|
||||||
find_library(LIB_ICONV iconv)
|
find_library(LIB_ICONV iconv)
|
||||||
|
|
||||||
# This is required in order to link to the correct OpenSSL library
|
target_link_libraries(mayaqua OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
|
||||||
find_library(LIB_SSL
|
|
||||||
NAMES ssl
|
|
||||||
HINTS "/usr/local/opt/openssl/lib"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(LIB_CRYPTO
|
|
||||||
NAMES crypto
|
|
||||||
HINTS "/usr/local/opt/openssl/lib"
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(mayaqua ${CMAKE_THREAD_LIBS_INIT} ${LIB_SSL} ${LIB_CRYPTO} ${LIB_READLINE} ${LIB_NCURSES} ${LIB_Z})
|
|
||||||
|
|
||||||
if(LIB_ICONV)
|
if(LIB_ICONV)
|
||||||
target_link_libraries(mayaqua ${LIB_ICONV})
|
target_link_libraries(mayaqua ${LIB_ICONV})
|
||||||
|
Loading…
Reference in New Issue
Block a user