From 72d7c3d3a93d75e6d4bc91172806c45fedc2d451 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 8 Aug 2018 12:02:42 +0200 Subject: [PATCH] libsndfile: Add feature to make additional libraries optional (#3528) * libsndfile: Add feature to make additional libraries optional * [libsndfile] Make external-libs a default feature * [libsndfile] Fix typo --- ports/libsndfile/CONTROL | 6 +++++- ports/libsndfile/portfile.cmake | 27 +++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/ports/libsndfile/CONTROL b/ports/libsndfile/CONTROL index f870d97afb..d448f694ce 100644 --- a/ports/libsndfile/CONTROL +++ b/ports/libsndfile/CONTROL @@ -1,4 +1,8 @@ Source: libsndfile -Version: 1.0.29-6830c42-3 +Version: 1.0.29-6830c42-5 Description: Library to read, write and manipulate many soundfile types. Authored by Eric de Castro Lopo +Default-Features: external-libs + +Feature: external-libs +Description: Support OGG and FLAC audio files Build-Depends: libogg, libflac, libvorbis diff --git a/ports/libsndfile/portfile.cmake b/ports/libsndfile/portfile.cmake index e217a96717..1ba590fd7e 100644 --- a/ports/libsndfile/portfile.cmake +++ b/ports/libsndfile/portfile.cmake @@ -6,35 +6,26 @@ vcpkg_from_github( REF 6830c421899e32f8d413a903a21a9b6cf384d369 SHA512 b13c5d7bc27218eff8a8c4ce89a964b4920b1d3946e4843e60be965d77ec205845750a82bf654a7c2c772bf3a24f6ff5706881b24ff12115f2525c8134b6d0b9 HEAD_REF master -) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/uwp-createfile-getfilesize.patch" "${CMAKE_CURRENT_LIST_DIR}/uwp-createfile-getfilesize-addendum.patch" ) -if (VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(CRT_LIB_STATIC 0) -elseif (VCPKG_CRT_LINKAGE STREQUAL "static") - set(CRT_LIB_STATIC 1) -endif() - -if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(BUILD_STATIC 1) - set(BUILD_DYNAMIC 0) -elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - set(BUILD_STATIC 0) - set(BUILD_DYNAMIC 1) -endif() +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" CRT_LIB_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) option(BUILD_EXECUTABLES "Build sndfile tools and install to folder tools" OFF) +if("external-libs" IN_LIST FEATURES) + set(SNDFILE_WITHOUT_EXTERNAL_LIBS OFF) +else() + set(SNDFILE_WITHOUT_EXTERNAL_LIBS ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS -DBUILD_EXAMPLES=0 -DBUILD_REGTEST=0 -DBUILD_TESTING=0 -DENABLE_STATIC_RUNTIME=${CRT_LIB_STATIC} -DBUILD_STATIC_LIBS=${BUILD_STATIC} + OPTIONS -DBUILD_EXAMPLES=0 -DBUILD_REGTEST=0 -DBUILD_TESTING=0 -DENABLE_STATIC_RUNTIME=${CRT_LIB_STATIC} -DBUILD_STATIC_LIBS=${BUILD_STATIC} -DDISABLE_EXTERNAL_LIBS=${SNDFILE_WITHOUT_EXTERNAL_LIBS} OPTIONS_RELEASE -DBUILD_PROGRAMS=${BUILD_EXECUTABLES} # Setting ENABLE_PACKAGE_CONFIG=0 has no effect OPTIONS_DEBUG -DBUILD_PROGRAMS=0