2016-07-26 08:41:17 +00:00
|
|
|
cmake_minimum_required (VERSION 3.1.3)
|
2014-07-31 12:07:39 +00:00
|
|
|
|
2017-04-06 05:15:43 +00:00
|
|
|
project(libsndfile VERSION 1.0.29)
|
2014-07-12 08:00:51 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# Variables
|
|
|
|
#
|
2014-10-28 10:00:02 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
set (CMAKE_C_STANDARD 99)
|
|
|
|
set (CMAKE_C_STANDARD_REQUIRED TRUE)
|
2017-04-13 06:11:02 +00:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
|
|
|
set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
|
|
|
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
|
|
|
set (CPACK_PACKAGE_VERSION_STAGE "pre1")
|
|
|
|
set (CPACK_PACKAGE_VERSION_FULL "${PROJECT_VERSION}${CPACK_PACKAGE_VERSION_STAGE}")
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# System-wide includes
|
|
|
|
#
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
include (GNUInstallDirs)
|
|
|
|
include (FeatureSummary)
|
2017-04-13 06:11:02 +00:00
|
|
|
include (CMakeDependentOption)
|
|
|
|
if (ENABLE_CPACK)
|
|
|
|
set (CPACK_PACKAGE_VENDOR "Erik de Castro Lopo")
|
|
|
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "A library for reading and writing audio files")
|
|
|
|
set(SNDFILE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
|
|
|
|
if (SNDFILE_SYSTEM_NAME MATCHES "Windows")
|
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set (SNDFILE_SYSTEM_NAME win64)
|
|
|
|
else ()
|
|
|
|
set (SNDFILE_SYSTEM_NAME win32)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_FULL}-${SNDFILE_SYSTEM_NAME})
|
|
|
|
include (CPack)
|
|
|
|
endif (ENABLE_CPACK)
|
|
|
|
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# Options
|
|
|
|
#
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
option (BUILD_STATIC_LIBS "Build static libraries" ON)
|
|
|
|
option (BUILD_SHARED_LIBS "Build shared libraries" ON)
|
2017-04-09 12:31:46 +00:00
|
|
|
option (BUILD_PROGRAMS "Build programs" ON)
|
2017-04-13 06:11:02 +00:00
|
|
|
option (BUILD_EXAMPLES "Build examples" ON)
|
|
|
|
option (BUILD_TESTING "Build tests" ON)
|
|
|
|
option (ENABLE_CPACK "Enable CPack support" ON)
|
2016-07-26 08:41:17 +00:00
|
|
|
option (DISABLE_EXTERNAL_LIBS "Disable use of FLAC, Ogg and Vorbis" OFF)
|
|
|
|
option (ENABLE_EXPERIMENTAL "Enable experimental code" OFF)
|
|
|
|
option (DISABLE_CPU_CLIP "Disable tricky cpu specific clipper" OFF)
|
2017-04-13 06:11:02 +00:00
|
|
|
option (ENABLE_BOW_DOCS "Enable black-on-white html docs" OFF)
|
|
|
|
if (MSVC OR MINGW)
|
|
|
|
option (ENABLE_STATIC_RUNTIME "Enable static runtime" OFF)
|
|
|
|
endif (MSVC OR MINGW)
|
|
|
|
option (ENABLE_PACKAGE_CONFIG "Generate and install package config file" ON)
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
if ((NOT BUILD_STATIC_LIBS) AND (NOT BUILD_SHARED_LIBS))
|
|
|
|
message ("
|
|
|
|
Both options BUILD_STATIC_LIBS and BUILD_SHARED_LIBS are manually set to OFF. To prevent configuration error
|
|
|
|
BUILD_STATIC_LIBS is now set to ON.\n")
|
|
|
|
set (BUILD_STATIC_LIBS ON)
|
|
|
|
endif ()
|
2016-07-02 01:47:31 +00:00
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
if ((NOT BUILD_STATIC_LIBS) AND ENABLE_TESTING)
|
|
|
|
set (BUILD_TESTING OFF)
|
|
|
|
message ("Build testing required static libraries. To prevent build errors BUILD_TESTING disabled.")
|
|
|
|
endif ()
|
|
|
|
|
2017-04-09 23:06:16 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# Setup definitions
|
|
|
|
#
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
include(${CMAKE_MODULE_PATH}/SndFileChecks.cmake)
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
cmake_dependent_option (BUILD_REGTEST "Build regtest" ON "HAVE_SQLITE3" OFF)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
add_feature_info(BUILD_STATIC_LIBS BUILD_STATIC_LIBS "build static libraries")
|
|
|
|
add_feature_info(BUILD_SHARED_LIBS BUILD_SHARED_LIBS "build shared libraries")
|
|
|
|
add_feature_info(DISABLE_EXTERNAL_LIBS DISABLE_EXTERNAL_LIBS "disable use of FLAC, Ogg and Vorbis")
|
|
|
|
add_feature_info(ENABLE_EXPERIMENTAL ENABLE_EXPERIMENTAL "enable experimental code")
|
|
|
|
add_feature_info(BUILD_TESTING BUILD_TESTING "build tests")
|
2017-04-13 06:11:02 +00:00
|
|
|
add_feature_info(BUILD_REGTEST BUILD_REGTEST "build regtest")
|
|
|
|
add_feature_info(ENABLE_CPACK ENABLE_CPACK "enable CPack support")
|
2016-07-26 08:41:17 +00:00
|
|
|
add_feature_info(DISABLE_CPU_CLIP DISABLE_CPU_CLIP "Disable tricky cpu specific clipper")
|
2017-04-13 06:11:02 +00:00
|
|
|
add_feature_info(ENABLE_BOW_DOCS ENABLE_BOW_DOCS "enable black-on-white html docs")
|
|
|
|
add_feature_info(ENABLE_PACKAGE_CONFIG ENABLE_PACKAGE_CONFIG "generate and install package config file")
|
|
|
|
|
|
|
|
if (MSVC OR MINGW)
|
|
|
|
add_feature_info(ENABLE_STATIC_RUNTIME ENABLE_STATIC_RUNTIME "Enable static runtime")
|
|
|
|
endif (MSVC OR MINGW)
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
set_package_properties(Ogg PROPERTIES TYPE RECOMMENDED
|
|
|
|
URL "www.xiph.org/ogg/"
|
|
|
|
DESCRIPTION "library for manipulating ogg bitstreams"
|
|
|
|
PURPOSE "Required to enable Vorbis, Speex and Opus support")
|
|
|
|
set_package_properties(Vorbis PROPERTIES TYPE RECOMMENDED
|
|
|
|
URL "www.vorbis.com/"
|
|
|
|
DESCRIPTION "open source lossy audio codec"
|
|
|
|
PURPOSE "Enables Vorbis support")
|
|
|
|
set_package_properties(FLAC PROPERTIES TYPE RECOMMENDED
|
|
|
|
URL "www.xiph.org/flac/"
|
|
|
|
DESCRIPTION "Free Lossless Audio Codec Library"
|
|
|
|
PURPOSE "Enables FLAC support")
|
|
|
|
set_package_properties(Speex PROPERTIES TYPE OPTIONAL
|
|
|
|
URL "www.speex.org/"
|
|
|
|
DESCRIPTION "an audio codec tuned for speech"
|
|
|
|
PURPOSE "Enables experemental Speex support")
|
2017-04-13 06:11:02 +00:00
|
|
|
set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL
|
|
|
|
URL "www.sqlite.org/"
|
|
|
|
DESCRIPTION "light weight SQL database engine."
|
|
|
|
PURPOSE "Enables regtest")
|
2017-05-24 06:16:54 +00:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set_package_properties(PythonInterp PROPERTIES TYPE REQUIRED
|
|
|
|
URL "www.python.org/"
|
|
|
|
DESCRIPTION "Python is a widely used high-level programming language."
|
|
|
|
PURPOSE "Required to build shared libraries")
|
|
|
|
endif()
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
feature_summary (WHAT ALL)
|
2016-07-02 23:12:54 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# Setup configuration
|
|
|
|
#
|
2016-07-02 23:12:54 +00:00
|
|
|
|
2017-04-09 23:06:16 +00:00
|
|
|
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h")
|
|
|
|
configure_file (src/config.h.cmake src/config.h)
|
|
|
|
|
|
|
|
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/sndfile.h")
|
|
|
|
configure_file (src/sndfile.h.in src/sndfile.h)
|
2016-07-02 23:12:54 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
set (PC_PREFIX ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set (PC_EXEC_PREFIX "\$\{prefix\}")
|
|
|
|
set (PC_LIBDIR "\$\{prefix\}/${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
set (PC_INCLUDEDIR "\$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}")
|
|
|
|
set (PC_VERSION ${PROJECT_VERSION})
|
|
|
|
if (EXTERNAL_XIPH_LIBS)
|
|
|
|
set (PC_PRIVATE_LIBS "-lFLAC -lvorbisenc")
|
|
|
|
endif ()
|
2017-04-09 23:06:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/sndfile.pc")
|
|
|
|
configure_file (sndfile.pc.cmake.in sndfile.pc @ONLY)
|
2014-07-29 05:33:18 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# libsndfile
|
|
|
|
#
|
2014-07-12 08:00:51 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
# Public libsndfile headers
|
|
|
|
set (include_HEADERS src/sndfile.hh)
|
2017-04-09 23:06:16 +00:00
|
|
|
set (nodist_include_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/src/sndfile.h")
|
2014-07-12 08:35:41 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
# Private libsndfile headers
|
|
|
|
set (noinst_HEADERS
|
|
|
|
src/common.h
|
|
|
|
src/sfconfig.h
|
|
|
|
src/sfendian.h
|
|
|
|
src/wavlike.h
|
|
|
|
src/sf_unistd.h
|
|
|
|
src/ogg.h
|
|
|
|
src/chanmap.h)
|
2014-07-12 08:35:41 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
# Common libsndfile sources
|
|
|
|
set (COMMON
|
|
|
|
src/common.c
|
|
|
|
src/file_io.c
|
|
|
|
src/command.c
|
|
|
|
src/pcm.c
|
|
|
|
src/ulaw.c
|
|
|
|
src/alaw.c
|
|
|
|
src/float32.c
|
|
|
|
src/double64.c
|
|
|
|
src/ima_adpcm.c
|
|
|
|
src/ms_adpcm.c
|
|
|
|
src/gsm610.c
|
|
|
|
src/dwvw.c
|
|
|
|
src/vox_adpcm.c
|
|
|
|
src/interleave.c
|
|
|
|
src/strings.c
|
|
|
|
src/dither.c
|
|
|
|
src/cart.c
|
|
|
|
src/broadcast.c
|
|
|
|
src/audio_detect.c
|
|
|
|
src/ima_oki_adpcm.c
|
|
|
|
src/ima_oki_adpcm.h
|
|
|
|
src/alac.c
|
|
|
|
src/chunk.c
|
|
|
|
src/ogg.c
|
|
|
|
src/chanmap.c
|
|
|
|
src/id3.c)
|
|
|
|
if (WIN32)
|
|
|
|
list (APPEND COMMON src/windows.c)
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
list (APPEND COMMON src/version-metadata.rc)
|
|
|
|
endif (BUILD_SHARED_LIBS)
|
|
|
|
endif (WIN32)
|
2014-07-12 16:37:10 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
# File specific libsndfile sources
|
|
|
|
set (FILESPECIFIC
|
|
|
|
src/sndfile.c
|
2014-07-12 08:00:51 +00:00
|
|
|
src/aiff.c
|
|
|
|
src/au.c
|
|
|
|
src/avr.c
|
2014-07-12 16:37:10 +00:00
|
|
|
src/caf.c
|
2014-07-12 08:00:51 +00:00
|
|
|
src/dwd.c
|
|
|
|
src/flac.c
|
|
|
|
src/g72x.c
|
|
|
|
src/htk.c
|
|
|
|
src/ircam.c
|
|
|
|
src/macos.c
|
|
|
|
src/mat4.c
|
|
|
|
src/mat5.c
|
|
|
|
src/nist.c
|
|
|
|
src/paf.c
|
|
|
|
src/pvf.c
|
|
|
|
src/raw.c
|
|
|
|
src/rx2.c
|
|
|
|
src/sd2.c
|
|
|
|
src/sds.c
|
|
|
|
src/svx.c
|
|
|
|
src/txw.c
|
|
|
|
src/voc.c
|
2016-07-26 08:41:17 +00:00
|
|
|
src/wve.c
|
2014-07-12 08:00:51 +00:00
|
|
|
src/w64.c
|
2016-02-07 03:57:31 +00:00
|
|
|
src/wavlike.c
|
2016-07-26 08:41:17 +00:00
|
|
|
src/wav.c
|
2014-07-12 08:00:51 +00:00
|
|
|
src/xi.c
|
2016-07-26 08:41:17 +00:00
|
|
|
src/mpc2k.c
|
|
|
|
src/rf64.c
|
|
|
|
src/ogg_vorbis.c
|
|
|
|
src/ogg_speex.c
|
|
|
|
src/ogg_pcm.c
|
2017-05-19 21:15:24 +00:00
|
|
|
src/ogg_opus.c
|
|
|
|
src/nms_adpcm.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# GSM610 sources
|
|
|
|
set (libgsm_SOURCES
|
|
|
|
src/GSM610/config.h
|
|
|
|
src/GSM610/gsm.h
|
|
|
|
src/GSM610/gsm610_priv.h
|
|
|
|
src/GSM610/add.c
|
|
|
|
src/GSM610/code.c
|
|
|
|
src/GSM610/decode.c
|
|
|
|
src/GSM610/gsm_create.c
|
|
|
|
src/GSM610/gsm_decode.c
|
|
|
|
src/GSM610/gsm_destroy.c
|
|
|
|
src/GSM610/gsm_encode.c
|
|
|
|
src/GSM610/gsm_option.c
|
|
|
|
src/GSM610/long_term.c
|
|
|
|
src/GSM610/lpc.c
|
|
|
|
src/GSM610/preprocess.c
|
|
|
|
src/GSM610/rpe.c
|
|
|
|
src/GSM610/short_term.c
|
|
|
|
src/GSM610/table.c)
|
|
|
|
source_group ("GSM610" FILES ${libgsm_SOURCES})
|
|
|
|
|
|
|
|
# G72x sources
|
|
|
|
set (libg72x_SOURCES
|
|
|
|
src/G72x/g72x.h
|
|
|
|
src/G72x/g72x_priv.h
|
|
|
|
src/G72x/g721.c
|
|
|
|
src/G72x/g723_16.c
|
|
|
|
src/G72x/g723_24.c
|
|
|
|
src/G72x/g723_40.c
|
|
|
|
src/G72x/g72x.c)
|
|
|
|
source_group ("G72x" FILES ${libg72x_SOURCES})
|
|
|
|
|
|
|
|
# ALAC sources
|
|
|
|
set (libalac_SOURCES
|
|
|
|
src/ALAC/ALACAudioTypes.h
|
|
|
|
src/ALAC/ALACBitUtilities.h
|
|
|
|
src/ALAC/EndianPortable.h
|
|
|
|
src/ALAC/aglib.h
|
|
|
|
src/ALAC/dplib.h
|
|
|
|
src/ALAC/matrixlib.h
|
|
|
|
src/ALAC/alac_codec.h
|
|
|
|
src/ALAC/shift.h
|
|
|
|
src/ALAC/ALACBitUtilities.c
|
|
|
|
src/ALAC/ag_dec.c
|
|
|
|
src/ALAC/ag_enc.c
|
|
|
|
src/ALAC/dp_dec.c
|
|
|
|
src/ALAC/dp_enc.c
|
|
|
|
src/ALAC/matrix_dec.c
|
|
|
|
src/ALAC/matrix_enc.c
|
|
|
|
src/ALAC/alac_decoder.c
|
|
|
|
src/ALAC/alac_encoder.c)
|
|
|
|
source_group ("ALAC" FILES ${libalac_SOURCES})
|
|
|
|
|
|
|
|
# Headers to be installed on target machine
|
|
|
|
set (libsndfile_PUBLIC_HEADERS ${include_HEADERS} ${nodist_include_HEADERS})
|
|
|
|
set (libsndfile_SOURCES ${COMMON} ${FILESPECIFIC} ${noinst_HEADERS}
|
|
|
|
${libgsm_SOURCES} ${libg72x_SOURCES} ${libalac_SOURCES}
|
|
|
|
${libsndfile_PUBLIC_HEADERS})
|
|
|
|
|
|
|
|
#
|
|
|
|
# libsndfile static library
|
|
|
|
#
|
|
|
|
|
|
|
|
if (BUILD_STATIC_LIBS)
|
|
|
|
set (SNDFILE_STATIC_TARGET sndfile-static)
|
|
|
|
add_library (${SNDFILE_STATIC_TARGET} STATIC ${libsndfile_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_include_directories(${SNDFILE_STATIC_TARGET}
|
|
|
|
PUBLIC
|
2017-04-25 11:58:46 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
|
2017-04-13 06:11:02 +00:00
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
2017-04-25 11:58:46 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (LIBM_REQUIRED)
|
|
|
|
target_link_libraries (${SNDFILE_STATIC_TARGET} PUBLIC ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
if (NOT DISABLE_EXTERNAL_LIBS)
|
|
|
|
target_link_libraries (${SNDFILE_STATIC_TARGET} PUBLIC ${EXTERNAL_XIPH_LIBS})
|
|
|
|
target_include_directories (${SNDFILE_STATIC_TARGET} PRIVATE
|
|
|
|
${OGG_INCLUDE_DIRS}
|
|
|
|
${VORBIS_INCLUDE_DIRS}
|
|
|
|
${FLAC_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions (${SNDFILE_STATIC_TARGET} PRIVATE ${FLAC_DEFINITIONS})
|
|
|
|
if (ENABLE_EXPERIMENTAL)
|
|
|
|
target_link_libraries (${SNDFILE_STATIC_TARGET} PUBLIC ${SPEEX_LIBRARIES})
|
|
|
|
target_include_directories (${SNDFILE_STATIC_TARGET} PRIVATE
|
|
|
|
${SPEEX_INCLUDE_DIRS})
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
if (WIN32)
|
|
|
|
set_target_properties (${SNDFILE_STATIC_TARGET} PROPERTIES PREFIX "lib")
|
|
|
|
endif ()
|
|
|
|
# Remove "-static" from output name
|
|
|
|
set_target_properties (${SNDFILE_STATIC_TARGET} PROPERTIES OUTPUT_NAME "sndfile")
|
2017-04-29 04:25:08 +00:00
|
|
|
set_target_properties (${SNDFILE_STATIC_TARGET} PROPERTIES
|
|
|
|
PUBLIC_HEADER "${libsndfile_PUBLIC_HEADERS}")
|
2016-07-26 08:41:17 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
set (SNDFILE_SHARED_TARGET sndfile-shared)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
2017-04-26 07:20:44 +00:00
|
|
|
set (VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR})
|
|
|
|
set (PACKAGE_NAME ${CPACK_PACKAGE_NAME})
|
|
|
|
set (GEN_TOOL cmake)
|
2017-04-29 04:25:08 +00:00
|
|
|
|
|
|
|
set (WIN_RC_VERSION "${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH}")
|
|
|
|
set (CLEAN_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
|
|
|
set (PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
2017-04-26 07:20:44 +00:00
|
|
|
|
2017-04-09 23:06:16 +00:00
|
|
|
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/version-metadata.rc")
|
2017-04-29 04:25:08 +00:00
|
|
|
configure_file(src/version-metadata.rc.in src/version-metadata.rc @ONLY)
|
2017-04-09 23:06:16 +00:00
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
list (APPEND libsndfile_SOURCES
|
2017-05-24 06:16:54 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/version-metadata.rc)
|
2016-07-26 08:41:17 +00:00
|
|
|
endif (WIN32)
|
|
|
|
|
|
|
|
add_library(${SNDFILE_SHARED_TARGET} SHARED ${libsndfile_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_include_directories(${SNDFILE_SHARED_TARGET}
|
|
|
|
PUBLIC
|
2017-04-25 11:58:46 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
|
2017-04-13 06:11:02 +00:00
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>
|
2017-04-25 11:58:46 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
if (LIBM_REQUIRED)
|
|
|
|
target_link_libraries (${SNDFILE_SHARED_TARGET} PRIVATE ${M_LIBRARY})
|
|
|
|
endif (LIBM_REQUIRED)
|
|
|
|
|
|
|
|
if (NOT DISABLE_EXTERNAL_LIBS)
|
|
|
|
target_link_libraries (${SNDFILE_SHARED_TARGET} PRIVATE ${EXTERNAL_XIPH_LIBS})
|
|
|
|
target_include_directories (${SNDFILE_SHARED_TARGET} PRIVATE
|
|
|
|
${OGG_INCLUDE_DIRS}
|
|
|
|
${VORBIS_INCLUDE_DIRS}
|
|
|
|
${FLAC_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions (${SNDFILE_SHARED_TARGET} PRIVATE ${FLAC_DEFINITIONS})
|
|
|
|
if (ENABLE_EXPERIMENTAL)
|
|
|
|
target_link_libraries (${SNDFILE_SHARED_TARGET} PRIVATE ${SPEEX_LIBRARIES})
|
|
|
|
target_include_directories (${SNDFILE_SHARED_TARGET} PRIVATE
|
|
|
|
${SPEEX_INCLUDE_DIRS})
|
|
|
|
endif (ENABLE_EXPERIMENTAL)
|
|
|
|
endif (NOT DISABLE_EXTERNAL_LIBS)
|
|
|
|
|
|
|
|
set_target_properties (${SNDFILE_SHARED_TARGET} PROPERTIES
|
|
|
|
PUBLIC_HEADER "${libsndfile_PUBLIC_HEADERS}"
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
2017-05-24 06:16:54 +00:00
|
|
|
VERSION ${PROJECT_VERSION})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES
|
2017-04-29 04:25:08 +00:00
|
|
|
ARCHIVE_OUTPUT_NAME "libsndfile-${PROJECT_VERSION_MAJOR}"
|
2016-07-26 08:41:17 +00:00
|
|
|
PREFIX "lib"
|
|
|
|
OUTPUT_NAME "sndfile-${PROJECT_VERSION_MAJOR}")
|
2017-05-24 06:16:54 +00:00
|
|
|
else ()
|
|
|
|
set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES
|
|
|
|
OUTPUT_NAME "sndfile")
|
2016-07-26 08:41:17 +00:00
|
|
|
endif (WIN32)
|
|
|
|
|
2017-05-24 06:16:54 +00:00
|
|
|
# Symbol files generation
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set(SYMBOL_FILENAME "libsndfile-${PROJECT_VERSION_MAJOR}.def")
|
|
|
|
set(SYMBOL_OS "win32")
|
|
|
|
elseif((CMAKE_SYSTEM_NAME MATCHES "Darwin") OR (CMAKE_SYSTEM_NAME MATCHES "Rhapsody"))
|
|
|
|
set(SYMBOL_FILENAME "Symbols.darwin")
|
|
|
|
set(SYMBOL_OS "darwin")
|
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "OS2")
|
|
|
|
set(SYMBOL_FILENAME "Symbols.os2")
|
|
|
|
set(SYMBOL_OS "os2")
|
|
|
|
elseif(UNIX)
|
|
|
|
set(SYMBOL_FILENAME "Symbols.gnu-binutils")
|
|
|
|
set(SYMBOL_OS "linux")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (DEFINED SYMBOL_OS)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/create_symbols_file.py ${SYMBOL_OS} ${PROJECT_VERSION_MAJOR} > ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
|
|
|
|
COMMENT "Generating ${SYMBOL_FILENAME}...")
|
|
|
|
|
|
|
|
add_custom_target(GENFILES DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME})
|
|
|
|
if (SYMBOL_OS MATCHES "win32")
|
|
|
|
target_sources(${SNDFILE_SHARED_TARGET}
|
|
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME})
|
|
|
|
elseif(SYMBOL_OS MATCHES "darwin")
|
|
|
|
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
|
|
|
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
|
|
|
elseif(SYMBOL_OS MATCHES "os")
|
|
|
|
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
|
|
|
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,-export-symbols ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
|
|
|
elseif(UNIX)
|
|
|
|
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
|
|
|
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
endif (BUILD_SHARED_LIBS)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Programs
|
|
|
|
#
|
|
|
|
|
|
|
|
# Select libsndfile version to link
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set (SNDFILE_TARGET ${SNDFILE_SHARED_TARGET})
|
|
|
|
else (NOT BUILD_SHARED_LIBS)
|
|
|
|
set (SNDFILE_TARGET ${SNDFILE_STATIC_TARGET})
|
|
|
|
endif (BUILD_SHARED_LIBS)
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
if (BUILD_PROGRAMS)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
# sndfile-info
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_info_SOURCES
|
|
|
|
programs/sndfile-info.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-info ${sndfile_info_SOURCES})
|
|
|
|
target_link_libraries(sndfile-info PUBLIC ${SNDFILE_TARGET})
|
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(sndfile-info PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-play
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
if (NOT BEOS)
|
|
|
|
set (sndfile_play_SOURCES
|
|
|
|
programs/sndfile-play.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
else ()
|
|
|
|
set (sndfile_play_SOURCES
|
|
|
|
programs/sndfile-play-beos.cpp)
|
|
|
|
endif ()
|
2017-04-09 11:49:37 +00:00
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
add_executable (sndfile-play ${sndfile_play_SOURCES})
|
|
|
|
target_link_libraries(sndfile-play PUBLIC ${SNDFILE_TARGET})
|
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries(sndfile-play PRIVATE Winmm.lib)
|
|
|
|
# Maybe ALSA & Sndio are present in BeOS. They are not required
|
|
|
|
# so skip them anyway.
|
|
|
|
elseif ((NOT BEOS) AND ALSA_FOUND)
|
|
|
|
target_include_directories (sndfile-play PRIVATE ${ALSA_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sndfile-play PRIVATE ${ALSA_LIBRARIES})
|
|
|
|
elseif ((NOT BEOS) AND Sndio_FOUND)
|
|
|
|
target_include_directories (sndfile-play PRIVATE ${Sndio_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sndfile-play PRIVATE ${Sndio_LIBRARIES})
|
|
|
|
endif ()
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-convert
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_convert_SOURCES
|
|
|
|
programs/sndfile-convert.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-convert ${sndfile_convert_SOURCES})
|
|
|
|
target_link_libraries(sndfile-convert PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-cmp
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_cmp_SOURCES
|
|
|
|
programs/sndfile-cmp.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-cmp ${sndfile_cmp_SOURCES})
|
|
|
|
target_link_libraries(sndfile-cmp PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-metadata-set
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_metadata_set_SOURCES
|
|
|
|
programs/sndfile-metadata-set.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-metadata-set ${sndfile_metadata_set_SOURCES})
|
|
|
|
target_link_libraries(sndfile-metadata-set PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-metadata-get
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_metadata_get_SOURCES
|
|
|
|
programs/sndfile-metadata-get.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-metadata-get ${sndfile_metadata_get_SOURCES})
|
|
|
|
target_link_libraries(sndfile-metadata-get PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-interleave
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_interleave_SOURCES
|
|
|
|
programs/sndfile-interleave.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-interleave ${sndfile_interleave_SOURCES})
|
|
|
|
target_link_libraries(sndfile-interleave PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-deinterleave
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_deinterleave_SOURCES
|
|
|
|
programs/sndfile-deinterleave.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-deinterleave ${sndfile_deinterleave_SOURCES})
|
|
|
|
target_link_libraries(sndfile-deinterleave PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-concat
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_concat_SOURCES
|
|
|
|
programs/sndfile-concat.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-concat ${sndfile_concat_SOURCES})
|
|
|
|
target_link_libraries(sndfile-concat PUBLIC ${SNDFILE_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
# sndfile-salvage
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
set (sndfile_salvage_SOURCES
|
|
|
|
programs/sndfile-salvage.c
|
|
|
|
programs/common.c
|
|
|
|
programs/common.h)
|
|
|
|
add_executable (sndfile-salvage ${sndfile_salvage_SOURCES})
|
|
|
|
target_link_libraries(sndfile-salvage PUBLIC ${SNDFILE_TARGET})
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
set (SNDFILE_PROGRAM_TARGETS
|
2017-04-09 12:31:46 +00:00
|
|
|
sndfile-info
|
|
|
|
sndfile-play
|
|
|
|
sndfile-convert
|
|
|
|
sndfile-cmp
|
|
|
|
sndfile-metadata-set
|
|
|
|
sndfile-metadata-get
|
|
|
|
sndfile-interleave
|
|
|
|
sndfile-deinterleave
|
|
|
|
sndfile-concat
|
|
|
|
sndfile-salvage)
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
set_target_properties(${SNDFILE_PROGRAM_TARGETS} PROPERTIES FOLDER Programs)
|
|
|
|
|
2017-04-09 12:31:46 +00:00
|
|
|
endif (BUILD_PROGRAMS)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
#
|
|
|
|
|
|
|
|
if (BUILD_EXAMPLES)
|
|
|
|
|
|
|
|
# sndfile-to-text
|
|
|
|
|
|
|
|
set (sndfile-to-text_SOURCES examples/sndfile-to-text.c)
|
|
|
|
add_executable (sndfile-to-text ${sndfile-to-text_SOURCES})
|
|
|
|
target_link_libraries(sndfile-to-text PUBLIC ${SNDFILE_TARGET})
|
|
|
|
|
|
|
|
# sndfile-loopify
|
|
|
|
|
|
|
|
set (sndfile_loopify_SOURCES examples/sndfile-loopify.c)
|
|
|
|
add_executable (sndfile-loopify ${sndfile_loopify_SOURCES})
|
|
|
|
target_link_libraries(sndfile-loopify PUBLIC ${SNDFILE_TARGET})
|
|
|
|
|
|
|
|
# make_sine
|
|
|
|
|
|
|
|
set (make_sine_SOURCES examples/make_sine.c)
|
|
|
|
add_executable (make_sine ${make_sine_SOURCES})
|
|
|
|
target_link_libraries(make_sine PUBLIC ${SNDFILE_TARGET})
|
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(make_sine PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# sfprocess
|
|
|
|
|
|
|
|
set (sfprocess_SOURCES examples/sfprocess.c)
|
|
|
|
add_executable (sfprocess ${sfprocess_SOURCES})
|
|
|
|
target_link_libraries(sfprocess PUBLIC ${SNDFILE_TARGET})
|
|
|
|
|
|
|
|
# list_formats
|
|
|
|
|
|
|
|
set (list_formats_SOURCES examples/list_formats.c)
|
|
|
|
add_executable (list_formats ${list_formats_SOURCES})
|
|
|
|
target_link_libraries(list_formats PUBLIC ${SNDFILE_TARGET})
|
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(make_sine PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# sndfilehandle
|
|
|
|
|
|
|
|
set (sndfilehandle_SOURCES examples/sndfilehandle.cc)
|
|
|
|
add_executable (sndfilehandle ${sndfilehandle_SOURCES})
|
|
|
|
target_link_libraries(sndfilehandle PUBLIC ${SNDFILE_TARGET})
|
|
|
|
|
|
|
|
set (SNDFILE_EXAMPLE_TARGETS
|
|
|
|
sndfile-to-text
|
|
|
|
sndfile-loopify
|
|
|
|
make_sine
|
|
|
|
sfprocess
|
|
|
|
list_formats
|
|
|
|
sndfilehandle)
|
|
|
|
|
|
|
|
set_target_properties(${SNDFILE_EXAMPLE_TARGETS} PROPERTIES FOLDER Examples)
|
|
|
|
|
|
|
|
|
|
|
|
endif (BUILD_EXAMPLES)
|
|
|
|
|
|
|
|
#
|
|
|
|
# sndfile-regtest
|
|
|
|
#
|
|
|
|
|
|
|
|
if (BUILD_REGTEST)
|
|
|
|
|
|
|
|
set (sndfile_regtest_SOURCES
|
|
|
|
regtest/sndfile-regtest.c
|
|
|
|
regtest/database.c
|
|
|
|
regtest/checksum.c)
|
|
|
|
add_executable (sndfile-regtest ${sndfile_regtest_SOURCES})
|
|
|
|
target_include_directories(sndfile-regtest PRIVATE . ${SQLITE3_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sndfile-regtest PUBLIC ${SNDFILE_TARGET} ${SQLITE3_LIBRARIES})
|
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(sndfile-regtest PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
endif (BUILD_REGTEST)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
#
|
|
|
|
# Installation
|
|
|
|
#
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
if (ENABLE_PACKAGE_CONFIG)
|
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
set(CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/libsndfile)
|
|
|
|
elseif(WIN32)
|
|
|
|
set(CMAKE_INSTALL_PACKAGEDIR cmake)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
install (TARGETS ${SNDFILE_STATIC_TARGET} ${SNDFILE_SHARED_TARGET} ${SNDFILE_PROGRAM_TARGETS}
|
|
|
|
EXPORT LibSndFileTargets
|
2016-07-26 08:41:17 +00:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2017-04-13 06:11:02 +00:00
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2016-07-26 08:41:17 +00:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2017-04-13 06:11:02 +00:00
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
|
|
|
|
include (CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
write_basic_package_version_file (LibSndFileConfigVersion.cmake COMPATIBILITY SameMajorVersion)
|
|
|
|
configure_package_config_file (
|
2017-04-25 11:58:46 +00:00
|
|
|
cmake/LibSndFileConfig.cmake.in
|
2017-04-13 06:11:02 +00:00
|
|
|
LibSndFileConfig.cmake
|
|
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
|
|
|
|
|
|
|
|
install(EXPORT LibSndFileTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
|
|
|
|
install(FILES
|
2017-04-25 11:58:46 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfig.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfigVersion.cmake
|
2017-04-13 06:11:02 +00:00
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_PACKAGEDIR})
|
|
|
|
|
|
|
|
elseif (NOT ENABLE_PACKAGE_CONFIG)
|
|
|
|
|
|
|
|
install (TARGETS ${SNDFILE_STATIC_TARGET} ${SNDFILE_SHARED_TARGET} ${sdnfile_PROGRAMS}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2016-07-26 08:41:17 +00:00
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
endif (ENABLE_PACKAGE_CONFIG)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
if (Unix)
|
|
|
|
set (man_MANS
|
|
|
|
man/sndfile-info.1
|
|
|
|
man/sndfile-play.1
|
|
|
|
man/sndfile-convert.1
|
|
|
|
man/sndfile-cmp.1
|
|
|
|
man/sndfile-metadata-get.1
|
|
|
|
#man/sndfile-metadata-set.1
|
|
|
|
man/sndfile-concat.1
|
|
|
|
man/sndfile-interleave.1
|
|
|
|
#man/sndfile-deinterleave.1
|
|
|
|
man/sndfile-salvage.1)
|
|
|
|
install (FILES ${man_MANS} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 PATTERN "*.1")
|
|
|
|
endif ()
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
if (ENABLE_BOW_DOCS)
|
|
|
|
set (HTML_BGCOLOUR "white")
|
|
|
|
set (HTML_FGCOLOUR "black")
|
|
|
|
elseif (NOT ENABLE_BOW_DOCS)
|
|
|
|
set (HTML_BGCOLOUR "black")
|
|
|
|
set (HTML_FGCOLOUR "white")
|
|
|
|
endif ()
|
2017-04-09 23:06:16 +00:00
|
|
|
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/doc/libsndfile.css")
|
|
|
|
configure_file (doc/libsndfile.css.in doc/libsndfile.css)
|
2016-07-26 08:41:17 +00:00
|
|
|
set (html_DATA
|
|
|
|
doc/index.html
|
|
|
|
doc/libsndfile.jpg
|
2017-04-09 23:06:16 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/doc/libsndfile.css"
|
2016-07-26 08:41:17 +00:00
|
|
|
doc/print.css
|
|
|
|
doc/api.html
|
|
|
|
doc/command.html
|
|
|
|
doc/bugs.html
|
|
|
|
doc/sndfile_info.html
|
|
|
|
doc/new_file_type.HOWTO
|
|
|
|
doc/win32.html
|
|
|
|
doc/FAQ.html
|
|
|
|
doc/lists.html
|
|
|
|
doc/embedded_files.html
|
|
|
|
doc/octave.html
|
|
|
|
doc/tutorial.html)
|
2017-04-09 09:02:51 +00:00
|
|
|
install (FILES ${html_DATA} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
2016-07-26 08:41:17 +00:00
|
|
|
|
2017-04-09 23:06:16 +00:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Testing
|
|
|
|
#
|
|
|
|
|
|
|
|
if (BUILD_TESTING)
|
2017-04-13 06:11:02 +00:00
|
|
|
include (CTest)
|
2017-04-10 13:46:31 +00:00
|
|
|
include(${CMAKE_MODULE_PATH}/CMakeAutoGen.cmake)
|
2017-04-13 06:11:02 +00:00
|
|
|
|
|
|
|
enable_testing ()
|
2017-04-10 13:46:31 +00:00
|
|
|
|
|
|
|
# generate tests sources from autogen templates
|
|
|
|
lsf_autogen(tests benchmark c)
|
|
|
|
lsf_autogen(tests floating_point_test c)
|
|
|
|
lsf_autogen(tests header_test c)
|
|
|
|
lsf_autogen(tests pcm_test c)
|
|
|
|
lsf_autogen(tests pipe_test c)
|
|
|
|
lsf_autogen(tests rdwr_test c)
|
|
|
|
lsf_autogen(tests scale_clip_test c)
|
|
|
|
lsf_autogen(tests utils c h)
|
|
|
|
lsf_autogen(tests write_read_test c)
|
|
|
|
lsf_autogen(src test_endswap c)
|
|
|
|
|
|
|
|
# utils static library
|
|
|
|
add_library(test_utils STATIC tests/utils.c)
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries(test_utils PUBLIC ${SNDFILE_STATIC_TARGET})
|
2017-04-25 11:58:46 +00:00
|
|
|
target_include_directories(test_utils PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/tests")
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
### test_main
|
|
|
|
|
|
|
|
set (test_main_SOURCES
|
|
|
|
src/test_main.c
|
|
|
|
src/test_main.h
|
|
|
|
src/test_conversions.c
|
|
|
|
src/test_float.c
|
|
|
|
src/test_endswap.c
|
|
|
|
src/test_audio_detect.c
|
|
|
|
src/test_log_printf.c
|
|
|
|
src/test_file_io.c
|
|
|
|
src/test_ima_oki_adpcm.c
|
|
|
|
src/test_strncpy_crlf.c
|
|
|
|
src/test_broadcast_var.c
|
|
|
|
src/test_cart_var.c
|
2017-05-19 21:15:24 +00:00
|
|
|
src/test_binheader_writef.c
|
|
|
|
src/test_nms_adpcm.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
add_executable (test_main ${test_main_SOURCES})
|
|
|
|
target_link_libraries (test_main ${SNDFILE_STATIC_TARGET})
|
2017-04-13 06:11:02 +00:00
|
|
|
if (MSVC)
|
|
|
|
target_compile_definitions (test_main PRIVATE _USE_MATH_DEFINES)
|
|
|
|
endif (MSVC)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_test (test_main test_main)
|
|
|
|
|
|
|
|
### sfversion_test
|
|
|
|
|
|
|
|
set (sfversion_SOURCES tests/sfversion.c)
|
|
|
|
add_executable (sfversion ${sfversion_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (sfversion ${SNDFILE_STATIC_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
add_test (sfversion sfversion)
|
|
|
|
set_tests_properties (sfversion PROPERTIES
|
2017-04-13 06:11:02 +00:00
|
|
|
PASS_REGULAR_EXPRESSION "libsndfile-${CPACK_PACKAGE_VERSION_FULL}")
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
### error_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (error_test_SOURCES tests/error_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (error_test ${error_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (error_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(error_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (error_test error_test)
|
|
|
|
|
|
|
|
### ulaw_test
|
2017-04-10 13:46:31 +00:00
|
|
|
set (ulaw_test_SOURCES tests/ulaw_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (ulaw_test ${ulaw_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (ulaw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(ulaw_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (ulaw_test ulaw_test)
|
|
|
|
|
|
|
|
### alaw_test
|
2017-04-10 13:46:31 +00:00
|
|
|
set (alaw_test_SOURCES tests/alaw_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (alaw_test ${alaw_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (alaw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(alaw_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (alaw_test alaw_test)
|
|
|
|
|
|
|
|
### dwvw_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (dwvw_test_SOURCES tests/dwvw_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (dwvw_test ${dwvw_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (dwvw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(dwvw_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (dwvw_test dwvw_test)
|
|
|
|
|
|
|
|
### command_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (command_test_SOURCES tests/command_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (command_test ${command_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (command_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(command_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (command_test command_test all)
|
|
|
|
|
|
|
|
### floating_point_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (floating_point_test_SOURCES tests/dft_cmp.c tests/floating_point_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (floating_point_test ${floating_point_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (floating_point_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2017-04-09 23:06:16 +00:00
|
|
|
target_include_directories(floating_point_test PRIVATE tests)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(floating_point_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (floating_point_test floating_point_test)
|
|
|
|
|
|
|
|
### checksum_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (checksum_test_SOURCES tests/checksum_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (checksum_test ${checksum_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (checksum_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(checksum_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (checksum_test checksum_test)
|
|
|
|
|
|
|
|
### scale_clip_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (scale_clip_test_SOURCES tests/scale_clip_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (scale_clip_test ${scale_clip_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (scale_clip_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(scale_clip_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (scale_clip_test scale_clip_test)
|
|
|
|
|
|
|
|
### headerless_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (headerless_test_SOURCES tests/headerless_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (headerless_test ${headerless_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (headerless_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(headerless_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (headerless_test headerless_test)
|
|
|
|
|
|
|
|
### rdwr_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (rdwr_test_SOURCES tests/rdwr_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (rdwr_test ${rdwr_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (rdwr_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(rdwr_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (rdwr_test rdwr_test)
|
|
|
|
|
|
|
|
### locale_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (locale_test_SOURCES tests/locale_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (locale_test ${locale_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (locale_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(locale_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (locale_test locale_test)
|
|
|
|
|
|
|
|
### win32_ordinal_test
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
if (WIN32 AND BUILD_SHARED_LIBS)
|
|
|
|
set (win32_ordinal_test_SOURCES tests/win32_ordinal_test.c)
|
|
|
|
add_executable (win32_ordinal_test ${win32_ordinal_test_SOURCES})
|
|
|
|
target_link_libraries (win32_ordinal_test PRIVATE ${SNDFILE_SHARED_TARGET} test_utils)
|
|
|
|
add_test (win32_ordinal_test win32_ordinal_test)
|
|
|
|
endif ()
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
### cpp_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (cpp_test_SOURCES tests/cpp_test.cc)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (cpp_test ${cpp_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (cpp_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(cpp_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (cpp_test cpp_test)
|
|
|
|
|
|
|
|
### external_libs_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (external_libs_test_SOURCES tests/external_libs_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (external_libs_test ${external_libs_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (external_libs_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(external_libs_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (external_libs_test external_libs_test)
|
|
|
|
|
|
|
|
### format_check_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (format_check_test_SOURCES tests/format_check_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (format_check_test ${format_check_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (format_check_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(format_check_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (format_check_test format_check_test)
|
|
|
|
|
|
|
|
### channel_test
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (channel_test_SOURCES tests/channel_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (channel_test ${channel_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (channel_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(channel_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (channel_test channel_test)
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
### pcm_test
|
|
|
|
|
|
|
|
set (pcm_test_SOURCES tests/pcm_test.c)
|
|
|
|
add_executable (pcm_test ${pcm_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (pcm_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2017-04-10 13:46:31 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(pcm_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (pcm_test pcm_test)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
### common test executables
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (write_read_test_SOURCES tests/generate.c tests/write_read_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (write_read_test ${write_read_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (write_read_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2017-04-09 23:06:16 +00:00
|
|
|
target_include_directories(write_read_test PRIVATE tests)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(write_read_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (lossy_comp_test_SOURCES tests/lossy_comp_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (lossy_comp_test ${lossy_comp_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (lossy_comp_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(lossy_comp_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (peak_chunk_test_SOURCES tests/peak_chunk_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (peak_chunk_test ${peak_chunk_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (peak_chunk_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(peak_chunk_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (header_test_SOURCES tests/header_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (header_test ${header_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (header_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(header_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (misc_test_SOURCES tests/misc_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (misc_test ${misc_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (misc_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(misc_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (string_test_SOURCES tests/string_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (string_test ${string_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (string_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(string_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (multi_file_test_SOURCES tests/multi_file_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (multi_file_test ${multi_file_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (multi_file_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(multi_file_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (aiff_rw_test_SOURCES tests/aiff_rw_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (aiff_rw_test ${aiff_rw_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (aiff_rw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(aiff_rw_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (chunk_test_SOURCES tests/chunk_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (chunk_test ${chunk_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (chunk_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(chunk_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (long_read_write_test_SOURCES tests/long_read_write_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (long_read_write_test ${long_read_write_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (long_read_write_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(long_read_write_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (raw_test_SOURCES tests/raw_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (raw_test ${raw_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (raw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(raw_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (compression_size_test_SOURCES tests/compression_size_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (compression_size_test ${compression_size_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (compression_size_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(compression_size_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (ogg_test_SOURCES tests/ogg_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (ogg_test ${ogg_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (ogg_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(ogg_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (stdin_test_SOURCES tests/stdin_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (stdin_test ${stdin_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (stdin_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(stdin_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
2017-09-03 08:33:06 +00:00
|
|
|
set_target_properties(stdin_test
|
|
|
|
PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "tests")
|
2016-07-26 08:41:17 +00:00
|
|
|
|
|
|
|
set (stdout_test_SOURCES tests/stdout_test.c)
|
|
|
|
add_executable (stdout_test ${stdout_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (stdout_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(stdout_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
2017-09-03 08:33:06 +00:00
|
|
|
set_target_properties(stdout_test
|
|
|
|
PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "tests")
|
2016-07-26 08:41:17 +00:00
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (stdio_test_SOURCES tests/stdio_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (stdio_test ${stdio_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (stdio_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(stdio_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (pipe_test_SOURCES tests/pipe_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (pipe_test ${pipe_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (pipe_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(pipe_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
2017-04-10 13:46:31 +00:00
|
|
|
set (virtual_io_test_SOURCES tests/virtual_io_test.c)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_executable (virtual_io_test ${virtual_io_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (virtual_io_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils)
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(virtual_io_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
### g72x_test
|
|
|
|
|
|
|
|
set (g72x_test_SOURCES src/G72x/g72x_test.c ${libg72x_SOURCES})
|
|
|
|
add_executable (g72x_test ${g72x_test_SOURCES})
|
2017-04-13 06:11:02 +00:00
|
|
|
target_link_libraries (g72x_test PRIVATE ${SNDFILE_STATIC_TARGET})
|
2016-07-26 08:41:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND LIBM_REQUIRED)
|
|
|
|
target_link_libraries(g72x_test PRIVATE ${M_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
add_test (g72x_test g72x_test all)
|
|
|
|
|
|
|
|
### aiff-tests
|
|
|
|
|
|
|
|
add_test (write_read_test_aiff write_read_test aiff)
|
|
|
|
add_test (lossy_comp_test_aiff_ulaw lossy_comp_test aiff_ulaw)
|
|
|
|
add_test (lossy_comp_test_aiff_alaw lossy_comp_test aiff_alaw)
|
|
|
|
add_test (lossy_comp_test_aiff_gsm610 lossy_comp_test aiff_gsm610)
|
|
|
|
add_test (peak_chunk_test_aiff peak_chunk_test aiff)
|
|
|
|
add_test (header_test_aiff header_test aiff)
|
|
|
|
add_test (misc_test_aiff misc_test aiff)
|
|
|
|
add_test (string_test_aiff string_test aiff)
|
|
|
|
add_test (multi_file_test_aiff multi_file_test aiff)
|
|
|
|
add_test (aiff_rw_test aiff_rw_test)
|
|
|
|
|
|
|
|
### au-tests
|
|
|
|
|
|
|
|
add_test (write_read_test_au write_read_test au)
|
|
|
|
add_test (lossy_comp_test_au_ulaw lossy_comp_test au_ulaw)
|
|
|
|
add_test (lossy_comp_test_au_alaw lossy_comp_test au_alaw)
|
|
|
|
add_test (lossy_comp_test_au_g721 lossy_comp_test au_g721)
|
|
|
|
add_test (lossy_comp_test_au_g723 lossy_comp_test au_g723)
|
|
|
|
add_test (header_test_au header_test au)
|
|
|
|
add_test (misc_test_au misc_test au)
|
|
|
|
add_test (multi_file_test_au multi_file_test au)
|
|
|
|
|
|
|
|
### caf-tests
|
|
|
|
|
|
|
|
add_test (write_read_test_caf write_read_test caf)
|
|
|
|
add_test (lossy_comp_test_caf_ulaw lossy_comp_test caf_ulaw)
|
|
|
|
add_test (lossy_comp_test_caf_alaw lossy_comp_test caf_alaw)
|
|
|
|
add_test (header_test_caf header_test caf)
|
|
|
|
add_test (peak_chunk_test_caf peak_chunk_test caf)
|
|
|
|
add_test (misc_test_caf misc_test caf)
|
|
|
|
add_test (chunk_test_caf chunk_test caf)
|
|
|
|
add_test (string_test_caf string_test caf)
|
|
|
|
add_test (long_read_write_test_alac long_read_write_test alac)
|
|
|
|
|
|
|
|
# wav-tests
|
|
|
|
add_test (write_read_test_wav write_read_test wav)
|
|
|
|
add_test (lossy_comp_test_wav_pcm lossy_comp_test wav_pcm)
|
|
|
|
add_test (lossy_comp_test_wav_ima lossy_comp_test wav_ima)
|
|
|
|
add_test (lossy_comp_test_wav_msadpcm lossy_comp_test wav_msadpcm)
|
|
|
|
add_test (lossy_comp_test_wav_ulaw lossy_comp_test wav_ulaw)
|
|
|
|
add_test (lossy_comp_test_wav_alaw lossy_comp_test wav_alaw)
|
|
|
|
add_test (lossy_comp_test_wav_gsm610 lossy_comp_test wav_gsm610)
|
|
|
|
add_test (lossy_comp_test_wav_g721 lossy_comp_test wav_g721)
|
2018-03-10 10:46:51 +00:00
|
|
|
add_test (lossy_comp_test_wav_nmsadpcm lossy_comp_test wav_nmsadpcm)
|
2016-07-26 08:41:17 +00:00
|
|
|
add_test (peak_chunk_test_wav peak_chunk_test wav)
|
|
|
|
add_test (header_test_wav header_test wav)
|
|
|
|
add_test (misc_test_wav misc_test wav)
|
|
|
|
add_test (string_test_wav string_test wav)
|
|
|
|
add_test (multi_file_test_wav multi_file_test wav)
|
|
|
|
add_test (chunk_test_wav chunk_test wav)
|
|
|
|
|
|
|
|
### w64-tests
|
|
|
|
|
|
|
|
add_test (write_read_test_w64 write_read_test w64)
|
|
|
|
add_test (lossy_comp_test_w64_ima lossy_comp_test w64_ima)
|
|
|
|
add_test (lossy_comp_test_w64_msadpcm lossy_comp_test w64_msadpcm)
|
|
|
|
add_test (lossy_comp_test_w64_ulaw lossy_comp_test w64_ulaw)
|
|
|
|
add_test (lossy_comp_test_w64_alaw lossy_comp_test w64_alaw)
|
|
|
|
add_test (lossy_comp_test_w64_gsm610 lossy_comp_test w64_gsm610)
|
|
|
|
add_test (header_test_w64 header_test w64)
|
|
|
|
add_test (misc_test_w64 misc_test w64)
|
|
|
|
|
|
|
|
### rf64-tests
|
|
|
|
|
|
|
|
add_test (write_read_test_rf64 write_read_test rf64)
|
|
|
|
add_test (header_test_rf64 header_test rf64)
|
|
|
|
add_test (misc_test_rf64 misc_test rf64)
|
|
|
|
add_test (string_test_rf64 string_test rf64)
|
|
|
|
add_test (peak_chunk_test_rf64 peak_chunk_test rf64)
|
|
|
|
add_test (chunk_test_rf64 chunk_test rf64)
|
|
|
|
|
|
|
|
### raw-tests
|
|
|
|
add_test (write_read_test_raw write_read_test raw)
|
|
|
|
add_test (lossy_comp_test_raw_ulaw lossy_comp_test raw_ulaw)
|
|
|
|
add_test (lossy_comp_test_raw_alaw lossy_comp_test raw_alaw)
|
|
|
|
add_test (lossy_comp_test_raw_gsm610 lossy_comp_test raw_gsm610)
|
|
|
|
add_test (lossy_comp_test_vox_adpcm lossy_comp_test vox_adpcm)
|
|
|
|
add_test (raw_test raw_test)
|
|
|
|
|
|
|
|
### paf-tests
|
|
|
|
add_test (write_read_test_paf write_read_test paf)
|
|
|
|
add_test (header_test_paf header_test paf)
|
|
|
|
add_test (misc_test_paf misc_test paf)
|
|
|
|
|
|
|
|
### svx-tests
|
|
|
|
add_test (write_read_test_svx write_read_test svx)
|
|
|
|
add_test (header_test_svx header_test svx)
|
|
|
|
add_test (misc_test_svx misc_test svx)
|
|
|
|
|
|
|
|
### nist-tests
|
|
|
|
add_test (write_read_test_nist write_read_test nist)
|
|
|
|
add_test (lossy_comp_test_nist_ulaw lossy_comp_test nist_ulaw)
|
|
|
|
add_test (lossy_comp_test_nist_alaw lossy_comp_test nist_alaw)
|
|
|
|
add_test (header_test_nist header_test nist)
|
|
|
|
add_test (misc_test_nist misc_test nist)
|
|
|
|
|
|
|
|
### ircam-tests
|
|
|
|
add_test (write_read_test_ircam write_read_test ircam)
|
|
|
|
add_test (lossy_comp_test_ircam_ulaw lossy_comp_test ircam_ulaw)
|
|
|
|
add_test (lossy_comp_test_ircam_alaw lossy_comp_test ircam_alaw)
|
|
|
|
add_test (header_test_ircam header_test ircam)
|
|
|
|
add_test (misc_test_ircam misc_test ircam)
|
|
|
|
|
|
|
|
### voc-tests
|
|
|
|
add_test (write_read_test_voc write_read_test voc)
|
|
|
|
add_test (lossy_comp_test_voc_ulaw lossy_comp_test voc_ulaw)
|
|
|
|
add_test (lossy_comp_test_voc_alaw lossy_comp_test voc_alaw)
|
|
|
|
add_test (header_test_voc header_test voc)
|
|
|
|
add_test (misc_test_voc misc_test voc)
|
|
|
|
|
|
|
|
### mat4-tests
|
|
|
|
add_test (write_read_test_mat4 write_read_test mat4)
|
|
|
|
add_test (header_test_mat4 header_test mat4)
|
|
|
|
add_test (misc_test_mat4 misc_test mat4)
|
|
|
|
|
|
|
|
### mat5-tests
|
|
|
|
add_test (write_read_test_mat5 write_read_test mat5)
|
|
|
|
add_test (header_test_mat5 header_test mat5)
|
|
|
|
add_test (misc_test_mat5 misc_test mat5)
|
|
|
|
|
|
|
|
### pvf-tests
|
|
|
|
add_test (write_read_test_pvf write_read_test pvf)
|
|
|
|
add_test (header_test_pvf header_test pvf)
|
|
|
|
add_test (misc_test_pvf misc_test pvf)
|
|
|
|
|
|
|
|
### xi-tests
|
|
|
|
add_test (lossy_comp_test_xi_dpcm lossy_comp_test xi_dpcm)
|
|
|
|
|
|
|
|
### htk-tests
|
|
|
|
add_test (write_read_test_htk write_read_test htk)
|
|
|
|
add_test (header_test_htk header_test htk)
|
|
|
|
add_test (misc_test_htk misc_test htk)
|
|
|
|
|
|
|
|
### avr-tests
|
|
|
|
add_test (write_read_test_avr write_read_test avr)
|
|
|
|
add_test (header_test_avr header_test avr)
|
|
|
|
add_test (misc_test_avr misc_test avr)
|
|
|
|
|
|
|
|
### sds-tests
|
|
|
|
add_test (write_read_test_sds write_read_test sds)
|
|
|
|
add_test (header_test_sds header_test sds)
|
|
|
|
add_test (misc_test_sds misc_test sds)
|
|
|
|
|
|
|
|
# sd2-tests
|
|
|
|
add_test (write_read_test_sd2 write_read_test sd2)
|
|
|
|
|
|
|
|
### wve-tests
|
|
|
|
add_test (lossy_comp_test_wve lossy_comp_test wve)
|
|
|
|
|
|
|
|
### mpc2k-tests
|
|
|
|
add_test (write_read_test_mpc2k write_read_test mpc2k)
|
|
|
|
add_test (header_test_mpc2k header_test mpc2k)
|
|
|
|
add_test (misc_test_mpc2k misc_test mpc2k)
|
|
|
|
|
|
|
|
### flac-tests
|
|
|
|
add_test (write_read_test_flac write_read_test flac)
|
|
|
|
add_test (compression_size_test_flac compression_size_test flac)
|
|
|
|
add_test (string_test_flac string_test flac)
|
|
|
|
|
|
|
|
### vorbis-tests
|
|
|
|
add_test (ogg_test ogg_test)
|
|
|
|
add_test (compression_size_test_vorbis compression_size_test vorbis)
|
|
|
|
add_test (lossy_comp_test_ogg_vorbis lossy_comp_test ogg_vorbis)
|
|
|
|
add_test (string_test_ogg string_test ogg)
|
|
|
|
add_test (misc_test_ogg misc_test ogg)
|
|
|
|
|
|
|
|
### io-tests
|
|
|
|
add_test (stdio_test stdio_test)
|
|
|
|
add_test (pipe_test pipe_test)
|
|
|
|
add_test (virtual_io_test virtual_io_test)
|
|
|
|
|
2017-04-13 06:11:02 +00:00
|
|
|
set (SNDFILE_TEST_TARGETS
|
|
|
|
test_utils
|
|
|
|
test_main
|
|
|
|
sfversion
|
|
|
|
error_test
|
|
|
|
ulaw_test
|
|
|
|
alaw_test
|
|
|
|
dwvw_test
|
|
|
|
command_test
|
|
|
|
floating_point_test
|
|
|
|
checksum_test
|
|
|
|
scale_clip_test
|
|
|
|
headerless_test
|
|
|
|
rdwr_test
|
|
|
|
locale_test
|
|
|
|
cpp_test
|
|
|
|
external_libs_test
|
|
|
|
format_check_test
|
|
|
|
channel_test
|
|
|
|
pcm_test
|
|
|
|
write_read_test
|
|
|
|
lossy_comp_test
|
|
|
|
peak_chunk_test
|
|
|
|
header_test
|
|
|
|
misc_test
|
|
|
|
string_test
|
|
|
|
multi_file_test
|
|
|
|
aiff_rw_test
|
|
|
|
chunk_test
|
|
|
|
long_read_write_test
|
|
|
|
raw_test
|
|
|
|
compression_size_test
|
|
|
|
ogg_test
|
|
|
|
stdin_test
|
|
|
|
stdout_test
|
|
|
|
stdio_test
|
|
|
|
pipe_test
|
|
|
|
virtual_io_test
|
|
|
|
g72x_test)
|
|
|
|
|
|
|
|
if (WIN32 AND BUILD_SHARED_LIBS)
|
|
|
|
list (APPEND SNDFILE_TEST_TARGETS win32_ordinal_test)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set_target_properties(${SNDFILE_TEST_TARGETS} PROPERTIES FOLDER Tests)
|
|
|
|
|
2016-07-26 08:41:17 +00:00
|
|
|
endif (BUILD_TESTING)
|