1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Manage libsndfile dependency with Conan

This commit is contained in:
Dmitry Vedenko
2021-08-09 14:03:42 +03:00
parent 305ac32ad0
commit 50cf64f93f
7 changed files with 369 additions and 24 deletions

View File

@@ -5,7 +5,7 @@ add_conan_lib(
PKG_CONFIG "zlib >= 1.2.11"
INTERFACE_NAME ZLIB::ZLIB
OPTION_NAME zlib
CONAN_OPTIONS
CONAN_OPTIONS
zlib:shared=True
)
@@ -14,7 +14,7 @@ add_conan_lib(
expat/2.2.9@audacity/stable
REQUIRED
PKG_CONFIG "expat >= 2.1.0"
CONAN_OPTIONS
CONAN_OPTIONS
expat:shared=True
)
@@ -49,15 +49,15 @@ if (${_OPT}use_expat STREQUAL "system")
set(wx_expat "sys")
endif()
add_conan_lib(
wxWidgets
wxwidgets/3.1.3.1-audacity
REQUIRED
add_conan_lib(
wxWidgets
wxwidgets/3.1.3.1-audacity
REQUIRED
ALWAYS_ALLOW_CONAN_FALLBACK
OPTION_NAME wxwidgets
FIND_PACKAGE_OPTIONS COMPONENTS adv base core html qa xml net
INTERFACE_NAME wxwidgets::wxwidgets
CONAN_OPTIONS
CONAN_OPTIONS
wxwidgets:shared=True
wxwidgets:zlib=${wx_zlib}
wxwidgets:expat=${wx_expat}
@@ -78,7 +78,7 @@ add_conan_lib(
wxwidgets:protocol=False
# Building with SIMD requires a huge number of build dependencies
# Probably this will be enabled in the future
libjpeg-turbo:SIMD=False
libjpeg-turbo:SIMD=False
)
add_conan_lib(
@@ -106,6 +106,51 @@ add_conan_lib(
PKG_CONFIG "mad >= 0.15.0b" # Ubuntu has broken PC file
)
add_conan_lib(
Ogg
ogg/1.3.4
OPTION_NAME libogg
ALLOW_FIND_PACKAGE
CONAN_OPTIONS
ogg:shared=True
)
add_conan_lib(
FLAC
flac/1.3.3
OPTION_NAME libflac
ALLOW_FIND_PACKAGE
CONAN_OPTIONS
flac:shared=True
)
add_conan_lib(
Opus
opus/1.3.1
OPTION_NAME libopus
ALLOW_FIND_PACKAGE
CONAN_OPTIONS
opus:shared=True
)
add_conan_lib(
Vorbis
vorbis/1.3.7
OPTION_NAME libvorbis
ALLOW_FIND_PACKAGE
CONAN_OPTIONS
vorbis:shared=True
)
add_conan_lib(
SndFile
libsndfile/1.0.31
OPTION_NAME libsndfile
ALLOW_FIND_PACKAGE
CONAN_OPTIONS
libsndfile:shared=True
)
add_conan_lib(
PortAudio
portaudio/19.7.0
@@ -118,15 +163,14 @@ add_conan_lib(
portaudio:with_wdmks=False
)
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set( curl_ssl "darwinssl" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set( curl_ssl "schannel")
else()
set ( curl_ssl "openssl" )
endif ()
if( ${_OPT}has_networking )
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set( curl_ssl "darwinssl" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set( curl_ssl "schannel")
else()
set ( curl_ssl "openssl" )
endif ()
add_conan_lib(
ThreadPool
@@ -174,7 +218,6 @@ set_conan_vars_to_parent()
# Required libraries
#
# directory option symbol req chk version
addlib( libsndfile sndfile SNDFILE YES YES "sndfile >= 1.0.28" )
addlib( sqlite sqlite SQLITE YES YES "sqlite3 >= 3.31.1" )
# Optional libraries
@@ -182,9 +225,6 @@ addlib( sqlite sqlite SQLITE YES YES "sqlite3 >= 3.31.
# directory option symbol req chk version
addlib( ffmpeg ffmpeg FFMPEG NO NO "libavcodec >= 51.53" "libavformat >= 52.12" "libavutil >= 52.66" )
addlib( libvamp vamp VAMP NO YES "vamp >= 2.5" "vamp-hostsdk >= 2.5" )
addlib( libogg ogg LIBOGG NO YES "ogg >= 1.3.1" )
addlib( libvorbis vorbis LIBVORBIS NO YES "vorbis >= 1.3.3" "vorbisenc >= 1.3.3" "vorbisfile >= 1.3.3" )
addlib( libflac flac LIBFLAC NO YES "flac >= 1.3.1" "flac++ >= 1.3.1" )
addlib( lv2 lv2 LV2 NO YES "lilv-0 >= 0.24.6" "lv2 >= 1.16.0" "serd-0 >= 0.30.2" "sord-0 >= 0.16.4" "sratom-0 >= 0.6.4" "suil-0 >= 0.10.6" )
addlib( portmidi midi MIDI NO YES "PortMidi" )

View File

@@ -0,0 +1,68 @@
#[[
A module to look for FLAC
]]
if( NOT FLAC_FOUND )
include( FindPackageHandleStandardArgs )
find_package( Ogg QUIET )
find_package( PkgConfig QUIET )
pkg_check_modules( PC_FLAC QUIET flac >= 1.3.1 )
find_path( FLAC_INCLUDE_DIR FLAC/stream_decoder.h
HINTS
${PC_FLAC_INCLUDE_DIRS}
${FLAC_ROOT}
)
find_library( FLAC_LIBRARIES
NAMES
FLAC
FLAC_static
HINTS
${PC_FLAC_LIBRARY_DIRS}
${FLAC_ROOT}
)
find_path( FLACPP_INCLUDE_DIR FLAC++/decoder.h
HINTS
${PC_FLAC_INCLUDE_DIRS}
${FLAC_ROOT}
)
find_library( FLACPP_LIBRARIES
NAMES
FLAC++
FLAC++_static
HINTS
${PC_FLAC_LIBRARY_DIRS}
${FLAC_ROOT}
)
find_package_handle_standard_args( FLAC DEFAULT_MSG Ogg_FOUND FLAC_INCLUDE_DIR FLAC_LIBRARIES )
if( FLAC_FOUND )
if( NOT TARGET FLAC::FLAC )
add_library( FLAC::FLAC INTERFACE IMPORTED GLOBAL )
target_include_directories( FLAC::FLAC INTERFACE ${FLAC_INCLUDE_DIR} )
target_link_libraries( FLAC::FLAC INTERFACE ${FLAC_LIBRARIES} Ogg::ogg )
endif()
if( NOT TARGET FLAC::FLAC++ )
add_library( FLAC::FLAC++ INTERFACE IMPORTED GLOBAL )
target_include_directories( FLAC::FLAC++ INTERFACE ${FLACPP_INCLUDE_DIR} )
target_link_libraries( FLAC::FLAC++ INTERFACE ${FLACPP_LIBRARIES} FLAC::FLAC)
endif()
mark_as_advanced(
FLAC_FOUND
FLAC_INCLUDE_DIR
FLAC_LIBRARIES
FLACPP_INCLUDE_DIR
FLACPP_LIBRARIES
)
endif()
endif()

View File

@@ -0,0 +1,42 @@
#[[
A module to look for Ogg
]]
if( NOT Ogg_FOUND )
include( FindPackageHandleStandardArgs )
find_package( PkgConfig QUIET)
pkg_check_modules( PC_Ogg QUIET ogg >= 1.3.1 )
find_path( Ogg_INCLUDE_DIR ogg/ogg.h
HINTS
${PC_Ogg_INCLUDE_DIRS}
${OGG_ROOT}
)
find_library( Ogg_LIBRARIES
NAMES
ogg
ogg_static
HINTS
${PC_Ogg_LIBRARY_DIRS}
${OGG_ROOT}
)
find_package_handle_standard_args( Ogg DEFAULT_MSG Ogg_INCLUDE_DIR Ogg_LIBRARIES )
if( Ogg_FOUND )
if( NOT TARGET Ogg::ogg )
add_library( Ogg::ogg INTERFACE IMPORTED GLOBAL )
target_include_directories( Ogg::ogg INTERFACE ${Ogg_INCLUDE_DIR} )
target_link_libraries( Ogg::ogg INTERFACE ${Ogg_LIBRARIES} )
endif()
mark_as_advanced(
Ogg_FOUND
Ogg_INCLUDE_DIR
Ogg_LIBRARIES
)
endif()
endif()

View File

@@ -0,0 +1,44 @@
#[[
A module to look for Opus
]]
if( NOT Opus_FOUND )
include( FindPackageHandleStandardArgs)
find_package( Ogg QUIET )
find_package( PkgConfig QUIET )
pkg_check_modules( PC_Opus QUIET opus >= 1.3 )
find_path( Opus_INCLUDE_DIR opus/opus.h
HINTS
${PC_Opus_INCLUDE_DIRS}
${OPUS_ROOT}
)
find_library( Opus_LIBRARIES
NAMES
opus
opus_static
HINTS
${PC_Opus_LIBRARY_DIRS}
${OPUS_ROOT}
)
find_package_handle_standard_args( Opus DEFAULT_MSG Ogg_FOUND Opus_INCLUDE_DIR Opus_LIBRARIES )
if( Opus_FOUND )
if( NOT TARGET Opus::opus )
add_library( Opus::opus INTERFACE IMPORTED GLOBAL )
target_include_directories( Opus::opus INTERFACE ${Opus_INCLUDE_DIR} )
target_link_libraries( Opus::opus INTERFACE ${Opus_LIBRARIES} Ogg::ogg )
endif()
mark_as_advanced(
Opus_FOUND
Opus_INCLUDE_DIR
Opus_LIBRARIES
)
endif()
endif()

View File

@@ -0,0 +1,42 @@
#[[
A module to look for SndFile
]]
if( NOT SndFile_FOUND )
include( FindPackageHandleStandardArgs )
find_package( PkgConfig QUIET)
pkg_check_modules( PC_SndFile QUIET sndfile )
find_path( SndFile_INCLUDE_DIR sndfile.h
HINTS
${PC_SndFile_INCLUDE_DIRS}
${OGG_ROOT}
)
find_library( SndFile_LIBRARIES
NAMES
sndfile
sndfile_static
HINTS
${PC_SndFile_LIBRARY_DIRS}
${OGG_ROOT}
)
find_package_handle_standard_args( SndFile DEFAULT_MSG SndFile_INCLUDE_DIR SndFile_LIBRARIES )
if( SndFile_FOUND )
if( NOT TARGET SndFile::sndfile )
add_library( SndFile::sndfile INTERFACE IMPORTED GLOBAL )
target_include_directories( SndFile::sndfile INTERFACE ${SndFile_INCLUDE_DIR} )
target_link_libraries( SndFile::sndfile INTERFACE ${SndFile_LIBRARIES} )
endif()
mark_as_advanced(
SndFile_FOUND
SndFile_INCLUDE_DIR
SndFile_LIBRARIES
)
endif()
endif()

View File

@@ -0,0 +1,105 @@
#[[
A module to look for Vorbis
]]
if( NOT Vorbis_FOUND )
include( FindPackageHandleStandardArgs )
find_package( Ogg QUIET )
find_package( PkgConfig QUIET )
pkg_check_modules( PC_Vorbis_Vorbis QUIET vorbis >= 1.3 )
pkg_check_modules( PC_Vorbis_VorbisEnc QUIET vorbisenc >= 1.3 )
pkg_check_modules( PC_Vorbis_VorbisFile QUIET vorbisfile >= 1.3 )
find_path( Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
HINTS
${PC_Vorbis_Vorbis_INCLUDE_DIRS}
${VORBIS_ROOT}
)
find_library( Vorbis_Vorbis_LIBRARIES
NAMES
vorbis
vorbis_static
HINTS
${PC_Vorbis_Vorbis_LIBRARY_DIRS}
${VORBIS_ROOT}
)
find_path( Vorbis_VorbisEnc_INCLUDE_DIR vorbis/vorbisenc.h
HINTS
${PC_Vorbis_VorbisEnc_INCLUDE_DIRS}
${VORBIS_ROOT}
)
find_library( Vorbis_VorbisEnc_LIBRARIES
NAMES
vorbisenc
vorbisenc_static
HINTS
${PC_Vorbis_VorbisEnc_LIBRARY_DIRS}
${VORBIS_ROOT}
)
find_path( Vorbis_VorbisFile_INCLUDE_DIR vorbis/vorbisfile.h
HINTS
${PC_Vorbis_VorbisFile_INCLUDE_DIRS}
${VORBIS_ROOT}
)
find_library( Vorbis_VorbisFile_LIBRARIES
NAMES
vorbisfile
vorbisfile_static
HINTS
${PC_Vorbis_VorbisFile_LIBRARY_DIRS}
${VORBIS_ROOT}
)
find_package_handle_standard_args(
Vorbis
DEFAULT_MSG
Ogg_FOUND
Vorbis_Vorbis_INCLUDE_DIR
Vorbis_Vorbis_LIBRARIES
Vorbis_VorbisEnc_INCLUDE_DIR
Vorbis_VorbisEnc_LIBRARIES
Vorbis_VorbisFile_INCLUDE_DIR
Vorbis_VorbisFile_LIBRARIES
)
if( Vorbis_FOUND )
if( NOT TARGET Vorbis::vorbis )
add_library( Vorbis::vorbis INTERFACE IMPORTED GLOBAL )
target_include_directories( Vorbis::vorbis INTERFACE ${Vorbis_Vorbis_INCLUDE_DIR} )
target_link_libraries( Vorbis::vorbis INTERFACE ${Vorbis_Vorbis_LIBRARIES} Ogg::ogg )
endif()
if( NOT TARGET Vorbis::vorbisenc )
add_library( Vorbis::vorbisenc INTERFACE IMPORTED GLOBAL )
target_include_directories( Vorbis::vorbisenc INTERFACE ${Vorbis_VorbisEnc_INCLUDE_DIR} )
target_link_libraries( Vorbis::vorbisenc INTERFACE ${Vorbis_VorbisEnc_LIBRARIES} Vorbis::vorbis )
endif()
if( NOT TARGET Vorbis::vorbisfile )
add_library( Vorbis::vorbisfile INTERFACE IMPORTED GLOBAL )
target_include_directories( Vorbis::vorbisfile INTERFACE ${Vorbis_VorbisFile_INCLUDE_DIR} )
target_link_libraries( Vorbis::vorbisfile INTERFACE ${Vorbis_VorbisFile_LIBRARIES} Vorbis::vorbis )
endif()
mark_as_advanced(
Vorbis_FOUND
Vorbis_Vorbis_INCLUDE_DIR
Vorbis_Vorbis_LIBRARIES
Vorbis_VorbisEnc_INCLUDE_DIR
Vorbis_VorbisEnc_LIBRARIES
Vorbis_VorbisFile_INCLUDE_DIR
Vorbis_VorbisFile_LIBRARIES
)
endif()
endif()

View File

@@ -1060,16 +1060,20 @@ list( APPEND LIBRARIES
wxwidgets::wxwidgets
expat::expat
libmp3lame::libmp3lame
libsndfile
SndFile::sndfile
PortAudio::PortAudio
sqlite
$<$<BOOL:${${_OPT}has_crashreports}>:crashreports>
$<$<BOOL:${USE_FFMPEG}>:ffmpeg>
$<$<BOOL:${USE_LIBID3TAG}>:libid3tag::libid3tag>
$<$<BOOL:${USE_LIBFLAC}>:libflac>
$<$<BOOL:${USE_LIBFLAC}>:FLAC::FLAC>
$<$<BOOL:${USE_LIBFLAC}>:FLAC::FLAC++>
$<$<BOOL:${USE_LIBMAD}>:libmad::libmad>
$<$<BOOL:${USE_LIBOGG}>:libogg>
$<$<BOOL:${USE_LIBVORBIS}>:libvorbis>
$<$<BOOL:${USE_LIBOGG}>:Ogg::ogg>
$<$<BOOL:${USE_LIBVORBIS}>:Vorbis::vorbis>
$<$<BOOL:${USE_LIBVORBIS}>:Vorbis::vorbisfile>
$<$<BOOL:${USE_LIBVORBIS}>:Vorbis::vorbisenc>
$<$<BOOL:${USE_LIBOPUS}>:Opus::opus>
$<$<BOOL:${USE_LIBTWOLAME}>:twolame>
$<$<BOOL:${USE_LV2}>:lv2>
$<$<BOOL:${USE_MIDI}>:portmidi>