opusfile: Add feature for disabling the openssl dependency (#3527)

* opusfile: Add feature for disabling the openssl dependency

* [opusfile] Rename feature openssl -> opusurl to better describe this library's interface
This commit is contained in:
Gabriel 2018-08-08 12:04:44 +02:00 committed by Robert Schumacher
parent 72d7c3d3a9
commit ad2bcd9dad
3 changed files with 33 additions and 14 deletions

View File

@ -10,8 +10,6 @@ find_library(OGG_LIBRARY ogg)
find_path(OPUS_INCLUDE_DIR opus.h PATH_SUFFIXES opus)
find_library(OPUS_LIBRARY opus)
find_package(OpenSSL MODULE REQUIRED)
add_library(opusfile
src/info.c
src/internal.c
@ -21,19 +19,28 @@ add_library(opusfile
target_include_directories(opusfile PRIVATE include PUBLIC ${OGG_INCLUDE_DIR} ${OPUS_INCLUDE_DIR})
target_link_libraries(opusfile PRIVATE ${OGG_LIBRARY} ${OPUS_LIBRARY})
add_library(opusurl
src/http.c
src/wincerts.c)
target_compile_definitions(opusurl PRIVATE OP_ENABLE_HTTP)
target_include_directories(opusurl PRIVATE include)
target_link_libraries(opusurl PRIVATE opusfile OpenSSL::SSL ws2_32.lib crypt32.lib)
install(TARGETS opusfile opusurl
install(TARGETS opusfile
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if(BUILD_OPUSURL)
find_package(OpenSSL MODULE REQUIRED)
add_library(opusurl
src/http.c
src/wincerts.c)
target_compile_definitions(opusurl PRIVATE OP_ENABLE_HTTP)
target_include_directories(opusurl PRIVATE include)
target_link_libraries(opusurl PRIVATE opusfile OpenSSL::SSL ws2_32.lib crypt32.lib)
install(TARGETS opusurl
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
if(NOT OPUSFILE_SKIP_HEADERS)
install(FILES include/opusfile.h
DESTINATION include/opus)

View File

@ -1,4 +1,8 @@
Source: opusfile
Version: 0.9-1
Version: 0.9-3
Description: Stand-alone decoder library for .opus streams
Build-Depends: libogg, opus, openssl
Build-Depends: libogg, opus
Feature: opusurl
Description: Support decoding of http(s) streams
Build-Depends: openssl

View File

@ -12,8 +12,16 @@ vcpkg_from_github(
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
if("opusurl" IN_LIST FEATURES)
set(BUILD_OPUSURL ON)
else()
set(BUILD_OPUSURL OFF)
endif()
vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
PREFER_NINJA
OPTIONS
-DBUILD_OPUSURL=${BUILD_OPUSURL}
OPTIONS_DEBUG
-DOPUSFILE_SKIP_HEADERS=ON)