From 6710ff3fc69f308e6ce68e9a7ad5d1459b3ffc5e Mon Sep 17 00:00:00 2001 From: evpobr Date: Sun, 19 Aug 2018 08:56:17 +0500 Subject: [PATCH] CMake: updates & fixes --- .gitignore | 30 +- .travis.yml | 2 +- CMakeLists.txt | 1174 +++++++++++++++---------------- Makefile.am | 9 +- cmake/FindFLAC.cmake | 52 +- cmake/FindOgg.cmake | 55 +- cmake/FindSQLite3.cmake | 49 +- cmake/FindSndio.cmake | 66 +- cmake/FindSpeex.cmake | 54 +- cmake/FindVorbis.cmake | 83 ++- cmake/FindVorbisEnc.cmake | 64 ++ cmake/LibSndFileConfig.cmake.in | 3 - cmake/SndFileChecks.cmake | 268 ++++--- cmake/TestLargeFiles.cmake | 161 +++-- sndfile.pc.cmake.in | 12 - src/config.h.cmake | 8 +- src/create_symbols_file.py | 1 - src/version-metadata.rc.in | 1 - 18 files changed, 1122 insertions(+), 970 deletions(-) create mode 100644 cmake/FindVorbisEnc.cmake delete mode 100644 cmake/LibSndFileConfig.cmake.in delete mode 100644 sndfile.pc.cmake.in diff --git a/.gitignore b/.gitignore index 09c6ea1a..5b71b579 100644 --- a/.gitignore +++ b/.gitignore @@ -6,15 +6,6 @@ *.au *.bin *.caf -/*.cmake -/src/*.cmake -/src/ALAC/*.cmake -/src/G72x/*.cmake -/src/GSM610/*.cmake -/tests/*.cmake -/programs/*.cmake -!src/config.h.cmake -!*.in.cmake *.dll *.exe *.flac @@ -40,11 +31,6 @@ .deps .dirstamp .libs -Build/ -CMake/config.h.in -CMakeFiles -CMakeCache.txt -build-aux Hack Hack/sndfile-fuzzbomb INSTALL @@ -139,3 +125,19 @@ Release/ bin/ obj/ octave-workspace + +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +CMakeSettings.json + +/*[Bb]uild*/ + +/.vscode/ +/.vs/ diff --git a/.travis.yml b/.travis.yml index d841309a..635a7de2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ install: - true script: - - mkdir cmake-build && (cd cmake-build && cmake .. -DCMAKE_BUILD_TYPE=Release && make VERBOSE=1 && ctest -V) + - mkdir cmake-build && (cd cmake-build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Wall -Wextra" && make VERBOSE=1 && ctest -V) - pwd - ./autogen.sh - ./configure --enable-werror && make clean all check && make distcheck diff --git a/CMakeLists.txt b/CMakeLists.txt index 10ee8630..493cd643 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ set (CMAKE_C_STANDARD 99) set (CMAKE_C_STANDARD_REQUIRED TRUE) set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set (CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set (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}) @@ -24,54 +24,28 @@ set (CPACK_PACKAGE_VERSION_FULL "${PROJECT_VERSION}${CPACK_PACKAGE_VERSION_STAGE include (GNUInstallDirs) include (FeatureSummary) 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) - +include (CTest) # # Options # -option (BUILD_STATIC_LIBS "Build static libraries" ON) -option (BUILD_SHARED_LIBS "Build shared libraries" ON) -option (BUILD_PROGRAMS "Build programs" ON) -option (BUILD_EXAMPLES "Build examples" ON) -option (BUILD_TESTING "Build tests" ON) -option (ENABLE_CPACK "Enable CPack support" ON) -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) -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) - -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 () - -if ((NOT BUILD_STATIC_LIBS) AND BUILD_TESTING) +option (BUILD_SHARED_LIBS "Build shared libraries" OFF) +if (BUILD_SHARED_LIBS AND BUILD_TESTING) set (BUILD_TESTING OFF) message ("Build testing required static libraries. To prevent build errors BUILD_TESTING disabled.") endif () +option (BUILD_PROGRAMS "Build programs" ON) +option (BUILD_EXAMPLES "Build examples" ON) +option (ENABLE_CPACK "Enable CPack support" ON) +option (ENABLE_EXPERIMENTAL "Enable experimental code" OFF) +option (ENABLE_BOW_DOCS "Enable black-on-white html docs" OFF) +if (MSVC OR MINGW) + option (ENABLE_STATIC_RUNTIME "Enable static runtime" OFF) +endif () +option (ENABLE_PACKAGE_CONFIG "Generate and install package config file" ON) -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # # Setup definitions @@ -79,48 +53,73 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") include(${CMAKE_MODULE_PATH}/SndFileChecks.cmake) -cmake_dependent_option (BUILD_REGTEST "Build regtest" ON "HAVE_SQLITE3" OFF) -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") -add_feature_info(BUILD_REGTEST BUILD_REGTEST "build regtest") -add_feature_info(ENABLE_CPACK ENABLE_CPACK "enable CPack support") -add_feature_info(DISABLE_CPU_CLIP DISABLE_CPU_CLIP "Disable tricky cpu specific clipper") -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") +cmake_dependent_option (BUILD_REGTEST "Build regtest" ON "SQLITE3_FOUND" OFF) +cmake_dependent_option (ENABLE_EXTERNAL_LIBS "Enable FLAC and Vorbis codecs" ON "VORBISENC_FOUND;FLAC_FOUND" OFF) +cmake_dependent_option (ENABLE_CPU_CLIP "Enable tricky cpu specific clipper" ON "CPU_CLIPS_POSITIVE;CPU_CLIPS_NEGATIVE" OFF) +if (NOT ENABLE_CPU_CLIP) + set (CPU_CLIPS_POSITIVE FALSE) + set (CPU_CLIPS_NEGATIVE FALSE) +endif () + +set (HAVE_EXTERNAL_XIPH_LIBS ${ENABLE_EXTERNAL_LIBS}) +set (HAVE_SQLITE3 ${BUILD_REGTEST}) +set (HAVE_ALSA_ASOUNDLIB_H ${ALSA_FOUND}) +set (HAVE_SNDIO_H ${SNDIO_FOUND}) + +set (ENABLE_EXPERIMENTAL_CODE ${ENABLE_EXPERIMENTAL}) +set (HAVE_SPEEX ${ENABLE_EXPERIMENTAL}) + +add_feature_info (BUILD_SHARED_LIBS BUILD_SHARED_LIBS "build shared libraries") +add_feature_info (ENABLE_EXTERNAL_LIBS ENABLE_EXTERNAL_LIBS "enable FLAC and Vorbis codecs") +add_feature_info (ENABLE_EXPERIMENTAL ENABLE_EXPERIMENTAL "enable experimental code") +add_feature_info (BUILD_TESTING BUILD_TESTING "build tests") +add_feature_info (BUILD_REGTEST BUILD_REGTEST "build regtest") +add_feature_info (ENABLE_CPACK ENABLE_CPACK "enable CPack support") +add_feature_info (ENABLE_CPU_CLIP ENABLE_CPU_CLIP "Enable tricky cpu specific clipper") +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) + add_feature_info (ENABLE_STATIC_RUNTIME ENABLE_STATIC_RUNTIME "Enable static runtime") +endif () -set_package_properties(Ogg PROPERTIES TYPE RECOMMENDED +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 + PURPOSE "Required to enable Vorbis, Speex and Opus support" + ) +set_package_properties (VorbisEnc PROPERTIES + TYPE RECOMMENDED URL "www.vorbis.com/" DESCRIPTION "open source lossy audio codec" - PURPOSE "Enables Vorbis support") -set_package_properties(FLAC PROPERTIES TYPE RECOMMENDED + 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") + 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") -set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL + PURPOSE "Enables experemental Speex support" + ) +set_package_properties (SQLite3 PROPERTIES + TYPE OPTIONAL URL "www.sqlite.org/" DESCRIPTION "light weight SQL database engine." - PURPOSE "Enables regtest") -if(BUILD_SHARED_LIBS) - set_package_properties(PythonInterp PROPERTIES TYPE REQUIRED + PURPOSE "Enables regtest" + ) +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") + PURPOSE "Required to build shared libraries" + ) endif() feature_summary (WHAT ALL) @@ -129,45 +128,39 @@ feature_summary (WHAT ALL) # Setup configuration # -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) -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}) +set (prefix ${CMAKE_INSTALL_PREFIX}) +set (exec_prefix "\$\{prefix\}") +set (libdir "\$\{prefix\}/${CMAKE_INSTALL_LIBDIR}") +set (includedir "\$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}") +set (VERSION ${PROJECT_VERSION}) if (EXTERNAL_XIPH_LIBS) set (PC_PRIVATE_LIBS "-lFLAC -lvorbisenc") endif () - - -file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/sndfile.pc") -configure_file (sndfile.pc.cmake.in sndfile.pc @ONLY) +configure_file (sndfile.pc.in sndfile.pc @ONLY) # # libsndfile # # Public libsndfile headers -set (include_HEADERS src/sndfile.hh) -set (nodist_include_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/src/sndfile.h") +set (sndfile_HDRS + src/sndfile.hh + ${CMAKE_CURRENT_BINARY_DIR}/src/sndfile.h + ) -# Private libsndfile headers -set (noinst_HEADERS - src/common.h +# +# libsndfile static library +# + +add_library (sndfile src/sfconfig.h src/sfendian.h - src/wavlike.h src/sf_unistd.h - src/ogg.h - src/chanmap.h) - -# Common libsndfile sources -set (COMMON + src/common.h src/common.c src/file_io.c src/command.c @@ -191,18 +184,13 @@ set (COMMON src/ima_oki_adpcm.h src/alac.c src/chunk.c + src/ogg.h src/ogg.c + src/chanmap.h 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) - -# File specific libsndfile sources -set (FILESPECIFIC + src/id3.c + $<$:src/windows.c> + $<$,$>:src/version-metadata.rc> src/sndfile.c src/aiff.c src/au.c @@ -228,6 +216,7 @@ set (FILESPECIFIC src/voc.c src/wve.c src/w64.c + src/wavlike.h src/wavlike.c src/wav.c src/xi.c @@ -237,10 +226,7 @@ set (FILESPECIFIC src/ogg_speex.c src/ogg_pcm.c src/ogg_opus.c - src/nms_adpcm.c) - -# GSM610 sources -set (libgsm_SOURCES + src/nms_adpcm.c src/GSM610/config.h src/GSM610/gsm.h src/GSM610/gsm610_priv.h @@ -257,22 +243,14 @@ set (libgsm_SOURCES 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/GSM610/table.c 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/G72x/g72x.c src/ALAC/ALACAudioTypes.h src/ALAC/ALACBitUtilities.h src/ALAC/EndianPortable.h @@ -289,277 +267,205 @@ set (libalac_SOURCES 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}) + src/ALAC/alac_encoder.c + ${sndfile_HDRS} + ${CMAKE_CURRENT_BINARY_DIR}/src/config.h + ) -# 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}) - target_include_directories(${SNDFILE_STATIC_TARGET} - PUBLIC - $ - $ - $) - 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") - set_target_properties (${SNDFILE_STATIC_TARGET} PROPERTIES - PUBLIC_HEADER "${libsndfile_PUBLIC_HEADERS}") -endif () +target_include_directories(sndfile + PUBLIC + $ + $ + $ + ) +target_link_libraries (sndfile + PRIVATE + $<$:m> + $<$:Vorbis::VorbisEnc> + $<$:FLAC::FLAC> + $<$,$,$>:Speex::Speex> + ) +set_target_properties (sndfile PROPERTIES + PUBLIC_HEADER "${sndfile_HDRS}" + ) if (BUILD_SHARED_LIBS) - set (SNDFILE_SHARED_TARGET sndfile-shared) - if (WIN32) set (VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}) - set (PACKAGE_NAME ${CPACK_PACKAGE_NAME}) set (GEN_TOOL cmake) 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}) - file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/version-metadata.rc") - configure_file(src/version-metadata.rc.in src/version-metadata.rc @ONLY) + configure_file (src/version-metadata.rc.in src/version-metadata.rc @ONLY) + endif () - list (APPEND libsndfile_SOURCES - ${CMAKE_CURRENT_BINARY_DIR}/src/version-metadata.rc) - endif (WIN32) - - add_library(${SNDFILE_SHARED_TARGET} SHARED ${libsndfile_SOURCES}) - target_include_directories(${SNDFILE_SHARED_TARGET} - PUBLIC - $ - $ - $) - - 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}" + set_target_properties (sndfile PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} - VERSION ${PROJECT_VERSION}) - - if (WIN32) - set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES - ARCHIVE_OUTPUT_NAME "libsndfile-${PROJECT_VERSION_MAJOR}" - PREFIX "lib" - OUTPUT_NAME "sndfile-${PROJECT_VERSION_MAJOR}") - else () - set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES - OUTPUT_NAME "sndfile") - endif (WIN32) + VERSION ${PROJECT_VERSION} + ) # 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() + set (SYMBOL_FILENAME "sndfile.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( + 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}...") + COMMENT "Generating ${SYMBOL_FILENAME}..." + ) - add_custom_target(GENFILES DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/src/${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}") + target_sources (sndfile + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME} + ) + elseif (SYMBOL_OS MATCHES "darwin") + add_dependencies (sndfile GENFILES) + set_property (TARGET sndfile 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 GENFILES) + set_property (TARGET sndfile APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,-export-symbols ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}" + ) + elseif (UNIX) + add_dependencies (sndfile GENFILES) + set_property (TARGET sndfile APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}" + ) endif() endif() -endif (BUILD_SHARED_LIBS) +endif () # # 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) - if (BUILD_PROGRAMS) # sndfile-info - set (sndfile_info_SOURCES + add_executable (sndfile-info 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 () + programs/common.h + ) + target_link_libraries (sndfile-info + PRIVATE + sndfile + $<$:m> + ) # sndfile-play - 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 () - - add_executable (sndfile-play ${sndfile_play_SOURCES}) - target_link_libraries(sndfile-play PUBLIC ${SNDFILE_TARGET}) + add_executable (sndfile-play + $<$>:programs/sndfile-play.c> + $<$>:programs/common.c> + $<$>:programs/sndfile-play.c> + $<$:programs/sndfile-play-beos.cpp> + ) + target_link_libraries (sndfile-play PRIVATE sndfile) if (WIN32) target_link_libraries(sndfile-play PRIVATE winmm) # 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}) + target_link_libraries (sndfile-play PRIVATE ${ALSA_LIBRARIES}) + elseif ((NOT BEOS) AND SNDIO_FOUND) + target_link_libraries (sndfile-play PRIVATE Sndio::Sndio) endif () # sndfile-convert - set (sndfile_convert_SOURCES + add_executable (sndfile-convert 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}) + programs/common.h + ) + target_link_libraries (sndfile-convert PRIVATE sndfile) # sndfile-cmp - set (sndfile_cmp_SOURCES + add_executable (sndfile-cmp 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}) + programs/common.h + ) + target_link_libraries (sndfile-cmp PRIVATE sndfile) # sndfile-metadata-set - set (sndfile_metadata_set_SOURCES + add_executable (sndfile-metadata-set 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}) + programs/common.h + ) + target_link_libraries (sndfile-metadata-set PRIVATE sndfile) # sndfile-metadata-get - set (sndfile_metadata_get_SOURCES + add_executable (sndfile-metadata-get 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}) + programs/common.h + ) + target_link_libraries (sndfile-metadata-get PRIVATE sndfile) # sndfile-interleave - set (sndfile_interleave_SOURCES + add_executable (sndfile-interleave 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}) + programs/common.h + ) + target_link_libraries (sndfile-interleave PRIVATE sndfile) # sndfile-deinterleave - set (sndfile_deinterleave_SOURCES + add_executable (sndfile-deinterleave 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}) + programs/common.h + ) + target_link_libraries (sndfile-deinterleave PRIVATE sndfile) # sndfile-concat - set (sndfile_concat_SOURCES + add_executable (sndfile-concat 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}) + programs/common.h + ) + target_link_libraries (sndfile-concat PRIVATE sndfile) # sndfile-salvage - set (sndfile_salvage_SOURCES + add_executable (sndfile-salvage 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}) + programs/common.h + ) + target_link_libraries (sndfile-salvage PRIVATE sndfile) set (SNDFILE_PROGRAM_TARGETS sndfile-info @@ -571,11 +477,12 @@ if (BUILD_PROGRAMS) sndfile-interleave sndfile-deinterleave sndfile-concat - sndfile-salvage) + sndfile-salvage + ) set_target_properties(${SNDFILE_PROGRAM_TARGETS} PROPERTIES FOLDER Programs) -endif (BUILD_PROGRAMS) +endif () # # Examples @@ -585,45 +492,45 @@ 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}) + add_executable (sndfile-to-text examples/sndfile-to-text.c) + target_link_libraries (sndfile-to-text PRIVATE sndfile) # 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}) + add_executable (sndfile-loopify examples/sndfile-loopify.c) + target_link_libraries (sndfile-loopify PRIVATE sndfile) # 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 () + add_executable (make_sine examples/make_sine.c) + target_link_libraries (make_sine + PRIVATE + sndfile + $<$:m> + ) # sfprocess - set (sfprocess_SOURCES examples/sfprocess.c) - add_executable (sfprocess ${sfprocess_SOURCES}) - target_link_libraries(sfprocess PUBLIC ${SNDFILE_TARGET}) + add_executable (sfprocess examples/sfprocess.c) + target_link_libraries (sfprocess + PRIVATE + sndfile + $<$:m> + ) # 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 () + add_executable (list_formats examples/list_formats.c) + target_link_libraries (list_formats + PRIVATE + sndfile + $<$:m> + ) # sndfilehandle - set (sndfilehandle_SOURCES examples/sndfilehandle.cc) - add_executable (sndfilehandle ${sndfilehandle_SOURCES}) - target_link_libraries(sndfilehandle PUBLIC ${SNDFILE_TARGET}) + add_executable (sndfilehandle examples/sndfilehandle.cc) + target_link_libraries (sndfilehandle PUBLIC sndfile) set (SNDFILE_EXAMPLE_TARGETS sndfile-to-text @@ -631,12 +538,13 @@ if (BUILD_EXAMPLES) make_sine sfprocess list_formats - sndfilehandle) + sndfilehandle + ) set_target_properties(${SNDFILE_EXAMPLE_TARGETS} PROPERTIES FOLDER Examples) -endif (BUILD_EXAMPLES) +endif () # # sndfile-regtest @@ -644,19 +552,19 @@ endif (BUILD_EXAMPLES) if (BUILD_REGTEST) - set (sndfile_regtest_SOURCES + add_executable (sndfile-regtest 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 () + regtest/checksum.c + ) + target_link_libraries(sndfile-regtest + PRIVATE + sndfile + SQLite3::SQLite3 + $<$:m> + ) - -endif (BUILD_REGTEST) +endif () # # Installation @@ -665,43 +573,42 @@ endif (BUILD_REGTEST) if (ENABLE_PACKAGE_CONFIG) if (UNIX) - set(CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/libsndfile) + set (CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/SndFile) elseif(WIN32) - set(CMAKE_INSTALL_PACKAGEDIR cmake) + set (CMAKE_INSTALL_PACKAGEDIR cmake) endif() - install (TARGETS ${SNDFILE_STATIC_TARGET} ${SNDFILE_SHARED_TARGET} ${SNDFILE_PROGRAM_TARGETS} - EXPORT LibSndFileTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install (TARGETS sndfile ${SNDFILE_PROGRAM_TARGETS} + EXPORT SndFileConfig + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) include (CMakePackageConfigHelpers) - write_basic_package_version_file (LibSndFileConfigVersion.cmake COMPATIBILITY SameMajorVersion) - configure_package_config_file ( - cmake/LibSndFileConfig.cmake.in - LibSndFileConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) + write_basic_package_version_file (SndFileConfigVersion.cmake COMPATIBILITY SameMajorVersion) - install(EXPORT LibSndFileTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfigVersion.cmake - DESTINATION - ${CMAKE_INSTALL_PACKAGEDIR}) + install(EXPORT SndFileConfig + NAMESPACE SndFile:: + DESTINATION ${CMAKE_INSTALL_PACKAGEDIR} + ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/SndFileConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_PACKAGEDIR} + ) -elseif (NOT ENABLE_PACKAGE_CONFIG) +else () -install (TARGETS ${SNDFILE_STATIC_TARGET} ${SNDFILE_SHARED_TARGET} ${sdnfile_PROGRAMS} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install (TARGETS sndfile ${sdnfile_PROGRAMS} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -endif (ENABLE_PACKAGE_CONFIG) +endif () if (Unix) set (man_MANS @@ -714,18 +621,18 @@ if (Unix) man/sndfile-concat.1 man/sndfile-interleave.1 #man/sndfile-deinterleave.1 - man/sndfile-salvage.1) + man/sndfile-salvage.1 + ) install (FILES ${man_MANS} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 PATTERN "*.1") endif () if (ENABLE_BOW_DOCS) set (HTML_BGCOLOUR "white") set (HTML_FGCOLOUR "black") -elseif (NOT ENABLE_BOW_DOCS) +else () set (HTML_BGCOLOUR "black") set (HTML_FGCOLOUR "white") endif () -file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/doc/libsndfile.css") configure_file (doc/libsndfile.css.in doc/libsndfile.css) set (html_DATA doc/index.html @@ -742,7 +649,8 @@ set (html_DATA doc/lists.html doc/embedded_files.html doc/octave.html - doc/tutorial.html) + doc/tutorial.html + ) install (FILES ${html_DATA} DESTINATION ${CMAKE_INSTALL_DOCDIR}) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) @@ -752,31 +660,31 @@ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION ${CMAKE_INSTAL # if (BUILD_TESTING) - include (CTest) - include(${CMAKE_MODULE_PATH}/CMakeAutoGen.cmake) - + enable_testing () + include (${CMAKE_MODULE_PATH}/CMakeAutoGen.cmake) + # 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) + 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) - target_link_libraries(test_utils PUBLIC ${SNDFILE_STATIC_TARGET}) + target_link_libraries(test_utils PRIVATE sndfile) target_include_directories(test_utils PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/tests") ### test_main - set (test_main_SOURCES + add_executable (test_main src/test_main.c src/test_main.h src/test_conversions.c @@ -790,335 +698,370 @@ if (BUILD_TESTING) src/test_broadcast_var.c src/test_cart_var.c src/test_binheader_writef.c - src/test_nms_adpcm.c) - - add_executable (test_main ${test_main_SOURCES}) - target_link_libraries (test_main ${SNDFILE_STATIC_TARGET}) + src/test_nms_adpcm.c + ) + target_link_libraries (test_main PRIVATE sndfile) if (MSVC) target_compile_definitions (test_main PRIVATE _USE_MATH_DEFINES) - endif (MSVC) + endif () add_test (test_main test_main) ### sfversion_test - set (sfversion_SOURCES tests/sfversion.c) - add_executable (sfversion ${sfversion_SOURCES}) - target_link_libraries (sfversion ${SNDFILE_STATIC_TARGET}) + add_executable (sfversion tests/sfversion.c) + target_link_libraries (sfversion sndfile) add_test (sfversion sfversion) set_tests_properties (sfversion PROPERTIES - PASS_REGULAR_EXPRESSION "libsndfile-${CPACK_PACKAGE_VERSION_FULL}") + PASS_REGULAR_EXPRESSION "${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_FULL}" + ) ### error_test - set (error_test_SOURCES tests/error_test.c) - add_executable (error_test ${error_test_SOURCES}) - target_link_libraries (error_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(error_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (error_test tests/error_test.c) + target_link_libraries (error_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (error_test error_test) ### ulaw_test - set (ulaw_test_SOURCES tests/ulaw_test.c) - add_executable (ulaw_test ${ulaw_test_SOURCES}) - target_link_libraries (ulaw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(ulaw_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (ulaw_test tests/ulaw_test.c) + target_link_libraries (ulaw_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (ulaw_test ulaw_test) ### alaw_test - set (alaw_test_SOURCES tests/alaw_test.c) - add_executable (alaw_test ${alaw_test_SOURCES}) - target_link_libraries (alaw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(alaw_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (alaw_test tests/alaw_test.c) + target_link_libraries (alaw_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (alaw_test alaw_test) ### dwvw_test - set (dwvw_test_SOURCES tests/dwvw_test.c) - add_executable (dwvw_test ${dwvw_test_SOURCES}) - target_link_libraries (dwvw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(dwvw_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (dwvw_test tests/dwvw_test.c) + target_link_libraries (dwvw_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (dwvw_test dwvw_test) ### command_test - set (command_test_SOURCES tests/command_test.c) - add_executable (command_test ${command_test_SOURCES}) - target_link_libraries (command_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(command_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (command_test tests/command_test.c) + target_link_libraries (command_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (command_test command_test all) ### floating_point_test - set (floating_point_test_SOURCES tests/dft_cmp.c tests/floating_point_test.c) - add_executable (floating_point_test ${floating_point_test_SOURCES}) - target_link_libraries (floating_point_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - target_include_directories(floating_point_test PRIVATE tests) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(floating_point_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (floating_point_test + tests/dft_cmp.c + tests/floating_point_test.c + ) + target_link_libraries (floating_point_test + PRIVATE + sndfile + test_utils + $<$:m> + ) + target_include_directories (floating_point_test PRIVATE tests) add_test (floating_point_test floating_point_test) ### checksum_test - set (checksum_test_SOURCES tests/checksum_test.c) - add_executable (checksum_test ${checksum_test_SOURCES}) - target_link_libraries (checksum_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(checksum_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (checksum_test tests/checksum_test.c) + target_link_libraries (checksum_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (checksum_test checksum_test) ### scale_clip_test - set (scale_clip_test_SOURCES tests/scale_clip_test.c) - add_executable (scale_clip_test ${scale_clip_test_SOURCES}) - target_link_libraries (scale_clip_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(scale_clip_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (scale_clip_test tests/scale_clip_test.c) + target_link_libraries (scale_clip_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (scale_clip_test scale_clip_test) ### headerless_test - set (headerless_test_SOURCES tests/headerless_test.c) - add_executable (headerless_test ${headerless_test_SOURCES}) - target_link_libraries (headerless_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(headerless_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (headerless_test tests/headerless_test.c) + target_link_libraries (headerless_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (headerless_test headerless_test) ### rdwr_test - set (rdwr_test_SOURCES tests/rdwr_test.c) - add_executable (rdwr_test ${rdwr_test_SOURCES}) - target_link_libraries (rdwr_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(rdwr_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (rdwr_test tests/rdwr_test.c) + target_link_libraries (rdwr_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (rdwr_test rdwr_test) ### locale_test - set (locale_test_SOURCES tests/locale_test.c) - add_executable (locale_test ${locale_test_SOURCES}) - target_link_libraries (locale_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(locale_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (locale_test tests/locale_test.c) + target_link_libraries (locale_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (locale_test locale_test) ### win32_ordinal_test - 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 () +# Disabled because we cannot test with shared sndfile library +# if (WIN32 AND BUILD_SHARED_LIBS) +# add_executable (win32_ordinal_test tests/win32_ordinal_test.c) +# target_link_libraries (win32_ordinal_test PRIVATE sndfile test_utils) +# add_test (win32_ordinal_test win32_ordinal_test) +# endif () ### cpp_test - set (cpp_test_SOURCES tests/cpp_test.cc) - add_executable (cpp_test ${cpp_test_SOURCES}) - target_link_libraries (cpp_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(cpp_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (cpp_test tests/cpp_test.cc) + target_link_libraries (cpp_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (cpp_test cpp_test) ### external_libs_test - set (external_libs_test_SOURCES tests/external_libs_test.c) - add_executable (external_libs_test ${external_libs_test_SOURCES}) - target_link_libraries (external_libs_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(external_libs_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (external_libs_test tests/external_libs_test.c) + target_link_libraries (external_libs_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (external_libs_test external_libs_test) ### format_check_test - set (format_check_test_SOURCES tests/format_check_test.c) - add_executable (format_check_test ${format_check_test_SOURCES}) - target_link_libraries (format_check_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(format_check_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (format_check_test tests/format_check_test.c) + target_link_libraries (format_check_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (format_check_test format_check_test) ### channel_test - set (channel_test_SOURCES tests/channel_test.c) - add_executable (channel_test ${channel_test_SOURCES}) - target_link_libraries (channel_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(channel_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (channel_test tests/channel_test.c) + target_link_libraries (channel_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (channel_test channel_test) ### pcm_test - set (pcm_test_SOURCES tests/pcm_test.c) - add_executable (pcm_test ${pcm_test_SOURCES}) - target_link_libraries (pcm_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(pcm_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (pcm_test tests/pcm_test.c) + target_link_libraries (pcm_test + PRIVATE + sndfile + test_utils + $<$:m> + ) add_test (pcm_test pcm_test) ### common test executables - set (write_read_test_SOURCES tests/generate.c tests/write_read_test.c) - add_executable (write_read_test ${write_read_test_SOURCES}) - target_link_libraries (write_read_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - target_include_directories(write_read_test PRIVATE tests) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(write_read_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (write_read_test + tests/generate.c + tests/write_read_test.c + ) + target_link_libraries (write_read_test + PRIVATE + sndfile + test_utils + $<$:m> + ) + target_include_directories (write_read_test PRIVATE tests) - set (lossy_comp_test_SOURCES tests/lossy_comp_test.c) - add_executable (lossy_comp_test ${lossy_comp_test_SOURCES}) - target_link_libraries (lossy_comp_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(lossy_comp_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (lossy_comp_test tests/lossy_comp_test.c) + target_link_libraries (lossy_comp_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (peak_chunk_test_SOURCES tests/peak_chunk_test.c) - add_executable (peak_chunk_test ${peak_chunk_test_SOURCES}) - target_link_libraries (peak_chunk_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(peak_chunk_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (peak_chunk_test tests/peak_chunk_test.c) + target_link_libraries (peak_chunk_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (header_test_SOURCES tests/header_test.c) - add_executable (header_test ${header_test_SOURCES}) - target_link_libraries (header_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(header_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (header_test tests/header_test.c) + target_link_libraries (header_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (misc_test_SOURCES tests/misc_test.c) - add_executable (misc_test ${misc_test_SOURCES}) - target_link_libraries (misc_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(misc_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (misc_test tests/misc_test.c) + target_link_libraries (misc_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (string_test_SOURCES tests/string_test.c) - add_executable (string_test ${string_test_SOURCES}) - target_link_libraries (string_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(string_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (string_test tests/string_test.c) + target_link_libraries (string_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (multi_file_test_SOURCES tests/multi_file_test.c) - add_executable (multi_file_test ${multi_file_test_SOURCES}) - target_link_libraries (multi_file_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(multi_file_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (multi_file_test tests/multi_file_test.c) + target_link_libraries (multi_file_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (aiff_rw_test_SOURCES tests/aiff_rw_test.c) - add_executable (aiff_rw_test ${aiff_rw_test_SOURCES}) - target_link_libraries (aiff_rw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(aiff_rw_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (aiff_rw_test tests/aiff_rw_test.c) + target_link_libraries (aiff_rw_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (chunk_test_SOURCES tests/chunk_test.c) - add_executable (chunk_test ${chunk_test_SOURCES}) - target_link_libraries (chunk_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(chunk_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (chunk_test tests/chunk_test.c) + target_link_libraries (chunk_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (long_read_write_test_SOURCES tests/long_read_write_test.c) - add_executable (long_read_write_test ${long_read_write_test_SOURCES}) - target_link_libraries (long_read_write_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(long_read_write_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (long_read_write_test tests/long_read_write_test.c) + target_link_libraries (long_read_write_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (raw_test_SOURCES tests/raw_test.c) - add_executable (raw_test ${raw_test_SOURCES}) - target_link_libraries (raw_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(raw_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (raw_test tests/raw_test.c) + target_link_libraries (raw_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (compression_size_test_SOURCES tests/compression_size_test.c) - add_executable (compression_size_test ${compression_size_test_SOURCES}) - target_link_libraries (compression_size_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(compression_size_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (compression_size_test tests/compression_size_test.c) + target_link_libraries (compression_size_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (ogg_test_SOURCES tests/ogg_test.c) - add_executable (ogg_test ${ogg_test_SOURCES}) - target_link_libraries (ogg_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(ogg_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (ogg_test tests/ogg_test.c) + target_link_libraries (ogg_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (stdin_test_SOURCES tests/stdin_test.c) - add_executable (stdin_test ${stdin_test_SOURCES}) - target_link_libraries (stdin_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(stdin_test PRIVATE ${M_LIBRARY}) - endif () - set_target_properties(stdin_test - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "tests") + add_executable (stdin_test tests/stdin_test.c) + target_link_libraries (stdin_test + PRIVATE + sndfile + test_utils + $<$:m> + ) + set_target_properties (stdin_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "tests") - set (stdout_test_SOURCES tests/stdout_test.c) - add_executable (stdout_test ${stdout_test_SOURCES}) - target_link_libraries (stdout_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(stdout_test PRIVATE ${M_LIBRARY}) - endif () - set_target_properties(stdout_test - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "tests") + add_executable (stdout_test tests/stdout_test.c) + target_link_libraries (stdout_test + PRIVATE + sndfile + test_utils + $<$:m> + ) + set_target_properties (stdout_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "tests") - set (stdio_test_SOURCES tests/stdio_test.c) - add_executable (stdio_test ${stdio_test_SOURCES}) - target_link_libraries (stdio_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(stdio_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (stdio_test tests/stdio_test.c) + target_link_libraries (stdio_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (pipe_test_SOURCES tests/pipe_test.c) - add_executable (pipe_test ${pipe_test_SOURCES}) - target_link_libraries (pipe_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(pipe_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (pipe_test tests/pipe_test.c) + target_link_libraries (pipe_test + PRIVATE + sndfile + test_utils + $<$:m> + ) - set (virtual_io_test_SOURCES tests/virtual_io_test.c) - add_executable (virtual_io_test ${virtual_io_test_SOURCES}) - target_link_libraries (virtual_io_test PRIVATE ${SNDFILE_STATIC_TARGET} test_utils) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(virtual_io_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (virtual_io_test tests/virtual_io_test.c) + target_link_libraries (virtual_io_test + PRIVATE + sndfile + test_utils + $<$:m> + ) ### g72x_test - set (g72x_test_SOURCES src/G72x/g72x_test.c ${libg72x_SOURCES}) - add_executable (g72x_test ${g72x_test_SOURCES}) - target_link_libraries (g72x_test PRIVATE ${SNDFILE_STATIC_TARGET}) - if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) - target_link_libraries(g72x_test PRIVATE ${M_LIBRARY}) - endif () + add_executable (g72x_test src/G72x/g72x_test.c) + target_link_libraries (g72x_test + PRIVATE + sndfile + $<$:m> + ) add_test (g72x_test g72x_test all) ### aiff-tests @@ -1332,12 +1275,13 @@ if (BUILD_TESTING) stdio_test pipe_test virtual_io_test - g72x_test) + g72x_test + ) - if (WIN32 AND BUILD_SHARED_LIBS) - list (APPEND SNDFILE_TEST_TARGETS win32_ordinal_test) - endif () +# if (WIN32 AND BUILD_SHARED_LIBS) +# list (APPEND SNDFILE_TEST_TARGETS win32_ordinal_test) +# endif () set_target_properties(${SNDFILE_TEST_TARGETS} PROPERTIES FOLDER Tests) -endif (BUILD_TESTING) +endif () diff --git a/Makefile.am b/Makefile.am index 0e284e33..2744aef3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,15 +14,14 @@ endif EXTRA_DIST = libsndfile.spec.in sndfile.pc.in Scripts/android-configure.sh \ Scripts/linux-to-win-cross-configure.sh \ - CMakeLists.txt $(cmake_files) sndfile.pc.cmake.in Win32 + CMakeLists.txt $(cmake_files) Win32 cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake \ cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \ - cmake/FindFLAC.cmake cmake/FindOgg.cmake cmake/FindSndio.cmake \ - cmake/FindSpeex.cmake cmake/FindSQLite3.cmake cmake/FindVorbis.cmake \ + cmake/FindOgg.cmake cmake/FindVorbis.cmake cmake/FindSndio.cmake \ + cmake/FindSpeex.cmake cmake/FindSQLite3.cmake cmake/FindVorbisEnc.cmake \ cmake/SndFileChecks.cmake cmake/TestInline.cmake \ - cmake/TestLargeFiles.cmake cmake/LibSndFileConfig.cmake.in \ - cmake/TestInline.c.in + cmake/TestLargeFiles.cmake cmake/TestInline.c.in pkgconfig_DATA = sndfile.pc diff --git a/cmake/FindFLAC.cmake b/cmake/FindFLAC.cmake index b1ccf0f0..601e5665 100644 --- a/cmake/FindFLAC.cmake +++ b/cmake/FindFLAC.cmake @@ -9,31 +9,50 @@ if (FLAC_INCLUDE_DIR) # Already in cache, be silent set (FLAC_FIND_QUIETLY TRUE) -endif (FLAC_INCLUDE_DIR) +endif () find_package (Ogg QUIET) find_package (PkgConfig QUIET) pkg_check_modules(PC_FLAC QUIET flac) +set(FLAC_VERSION ${PC_FLAC_VERSION}) + find_path (FLAC_INCLUDE_DIR FLAC/stream_decoder.h - HINTS ${PC_FLAC_INCLUDEDIR} ${PC_FLAC_INCLUDE_DIRS} ${FLAC_ROOT} - PATH_SUFFIXES include) + HINTS + ${PC_FLAC_INCLUDEDIR} + ${PC_FLAC_INCLUDE_DIRS} + ${FLAC_ROOT} + ) # MSVC built libraries can name them *_static, which is good as it # distinguishes import libraries from static libraries with the same extension. -find_library (FLAC_LIBRARY NAMES FLAC libFLAC libFLAC_dynamic libFLAC_static - HINTS ${PC_FLAC_LIBDIR} ${PC_FLAC_LIBRARY_DIRS} ${FLAC_ROOT} - PATH_SUFFIXES lib) +find_library (FLAC_LIBRARY + NAMES + FLAC + libFLAC + libFLAC_dynamic + libFLAC_static + HINTS + ${PC_FLAC_LIBDIR} + ${PC_FLAC_LIBRARY_DIRS} + ${FLAC_ROOT} + ) # Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if # all listed variables are TRUE. include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (FLAC DEFAULT_MSG - FLAC_INCLUDE_DIR FLAC_LIBRARY) +find_package_handle_standard_args (FLAC + REQUIRED_VARS + FLAC_LIBRARY + FLAC_INCLUDE_DIR + OGG_FOUND + VERSION_VAR + FLAC_VERSION + ) if (FLAC_FOUND) - set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR} ${OGG_INCLUDE_DIRS}) + set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR}) set (FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARIES}) if (WIN32) set (FLAC_LIBRARIES ${FLAC_LIBRARIES} wsock32) @@ -41,7 +60,18 @@ if (FLAC_FOUND) if (FLAC_LIBRARY_FILENAME MATCHES "libFLAC_static") set (FLAC_DEFINITIONS -DFLAC__NO_DLL) endif () - endif (WIN32) -endif (FLAC_FOUND) + endif () + if (NOT TARGET FLAC::FLAC) + add_library(FLAC::FLAC UNKNOWN IMPORTED) + set_target_properties(FLAC::FLAC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}" + IMPORTED_LOCATION "${FLAC_LIBRARY}" + INTERFACE_LINK_LIBRARIES + Ogg::Ogg + $<$:wsock32> + INTERFACE_COMPILE_DEFINITIONS ${FLAC_DEFINITIONS} + ) + endif () +endif () mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY) diff --git a/cmake/FindOgg.cmake b/cmake/FindOgg.cmake index a710518d..1e9c72d7 100644 --- a/cmake/FindOgg.cmake +++ b/cmake/FindOgg.cmake @@ -3,28 +3,59 @@ # # OGG_INCLUDE_DIRS - where to find ogg.h, etc. # OGG_LIBRARIES - List of libraries when using ogg. -# Ogg_FOUND - True if ogg found. +# OGG_FOUND - True if ogg found. -if(OGG_INCLUDE_DIR) - # Already in cache, be silent - set(OGG_FIND_QUIETLY TRUE) -endif(OGG_INCLUDE_DIR) +if (OGG_INCLUDE_DIR) + # Already in cache, be silent + set(OGG_FIND_QUIETLY TRUE) +endif () find_package (PkgConfig QUIET) -pkg_check_modules(PC_OGG QUIET ogg) +pkg_check_modules (PC_OGG QUIET ogg) -find_path(OGG_INCLUDE_DIR ogg/ogg.h HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS} ${OGG_ROOT} PATH_SUFFIXES include) +set (OGG_VERSION ${PC_OGG_VERSION}) + +find_path (OGG_INCLUDE_DIR ogg/ogg.h + HINTS + ${PC_OGG_INCLUDEDIR} + ${PC_OGG_INCLUDE_DIRS} + ${OGG_ROOT} + ) # MSVC built ogg may be named ogg_static. # The provided project files name the library with the lib prefix. -find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static HINTS ${PC_OGG_LIBDIR} ${PC_OGG_LIBRARY_DIRS} ${OGG_ROOT} PATH_SUFFIXES lib) +find_library (OGG_LIBRARY + NAMES + ogg + ogg_static + libogg + libogg_static + HINTS + ${PC_OGG_LIBDIR} + ${PC_OGG_LIBRARY_DIRS} + ${OGG_ROOT} + ) # Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND # to TRUE if all listed variables are TRUE. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY) +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (Ogg + REQUIRED_VARS + OGG_LIBRARY + OGG_INCLUDE_DIR + VERSION_VAR + OGG_VERSION + ) if (OGG_FOUND) set (OGG_LIBRARIES ${OGG_LIBRARY}) set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) -endif (OGG_FOUND) + + if(NOT TARGET Ogg::Ogg) + add_library(Ogg::Ogg UNKNOWN IMPORTED) + set_target_properties(Ogg::Ogg PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}" + IMPORTED_LOCATION "${OGG_LIBRARIES}" + ) + endif () +endif () -mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY) +mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY) diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake index 250441ee..b5c0b571 100644 --- a/cmake/FindSQLite3.cmake +++ b/cmake/FindSQLite3.cmake @@ -5,25 +5,52 @@ # SQLITE3_LIBRARIES - List of libraries when using SQLITE3. # SQLITE3_FOUND - True if SQLITE3 found. -if(SQLITE3_INCLUDE_DIR) +if (SQLITE3_INCLUDE_DIR) # Already in cache, be silent - set(SQLITE3_FIND_QUIETLY TRUE) -endif(SQLITE3_INCLUDE_DIR) + set (SQLITE3_FIND_QUIETLY TRUE) +endif () find_package (PkgConfig QUIET) -pkg_check_modules(PC_SQLITE3 QUIET sqlite3) +pkg_check_modules (PC_SQLITE3 QUIET sqlite3) -find_path(SQLITE3_INCLUDE_DIR sqlite3.h HINTS ${PC_SQLITE3_INCLUDEDIR} ${PC_SQLITE3_INCLUDE_DIRS} ${SQLITE3_ROOT}) +set (SQLITE3_VERSION ${PC_SQLITE3_VERSION}) -find_library (SQLITE3_LIBRARY NAMES sqlite3 HINTS ${PC_SQLITE3_LIBDIR} ${PC_SQLITE3_LIBRARY_DIRS} ${SQLITE3_ROOT} PATH_SUFFIXES lib) +find_path (SQLITE3_INCLUDE_DIR sqlite3.h + HINTS + ${PC_SQLITE3_INCLUDEDIR} + ${PC_SQLITE3_INCLUDE_DIRS} + ${SQLITE3_ROOT} + ) -include(FindPackageHandleStandardArgs) +find_library (SQLITE3_LIBRARY + NAMES + sqlite3 + HINTS + ${PC_SQLITE3_LIBDIR} + ${PC_SQLITE3_LIBRARY_DIRS} + ${SQLITE3_ROOT} + ) -find_package_handle_standard_args(SQLITE3 DEFAULT_MSG SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY) +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (SQLITE3 + REQUIRED_VARS + SQLITE3_LIBRARY + SQLITE3_INCLUDE_DIR + VERSION_VAR + SQLITE3_VERSION + ) if (SQLITE3_FOUND) set (SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR}) - set (SQLITE3_LIBRARIES ${SQLITE3_LIBRARY}) -endif (SQLITE3_FOUND) + set (SQLITE3_LIBRARIES ${SQLITE3_LIBRARY}) + if (NOT TARGET SQLite3::SQLite3) + add_library (SQLite3::SQLite3 UNKNOWN IMPORTED) + set_target_properties (SQLite3::SQLite3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIRS}" + IMPORTED_LOCATION "${SQLITE3_LIBRARIES}" + ) + endif () +endif () -mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY) +mark_as_advanced (SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY) diff --git a/cmake/FindSndio.cmake b/cmake/FindSndio.cmake index 6aece463..6b9b4098 100644 --- a/cmake/FindSndio.cmake +++ b/cmake/FindSndio.cmake @@ -1,7 +1,7 @@ # - Find SoundIO (sndio) includes and libraries # -# Sndio_FOUND - True if SNDIO_INCLUDE_DIR & SNDIO_LIBRARY are -# found +# SNDIO_FOUND - True if SNDIO_INCLUDE_DIR & SNDIO_LIBRARY are +# found # SNDIO_LIBRARIES - Set when SNDIO_LIBRARY is found # SNDIO_INCLUDE_DIRS - Set when SNDIO_INCLUDE_DIR is found # @@ -9,25 +9,53 @@ # SNDIO_LIBRARY - the sndio library # -find_path(SNDIO_INCLUDE_DIR - NAMES sndio.h - DOC "The SoundIO include directory" -) +if (SNDIO_INCLUDE_DIR) + # Already in cache, be silent + set (SNDIO_FIND_QUIETLY TRUE) +endif () -find_library(SNDIO_LIBRARY - NAMES sndio - DOC "The SoundIO library" -) +find_package (PkgConfig QUIET) +pkg_check_modules (PC_SNDIO QUIET sndio) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sndio - REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIR -) +set (SNDIO_VERSION ${PC_SNDIO_VERSION}) -if(Sndio_FOUND) - set(SNDIO_LIBRARIES ${SNDIO_LIBRARY}) - set(SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR}) +find_path (SNDIO_INCLUDE_DIR + NAMES + sndio.h + HINTS + ${PC_SNDIO_INCLUDEDIR} + ${PC_SNDIO_INCLUDE_DIRS} + ${SNDIO_ROOT} + ) + +find_library (SNDIO_LIBRARY + NAMES + sndio + HINTS + ${PC_SNDIO_LIBDIR} + ${PC_SNDIO_LIBRARY_DIRS} + ${SNDIO_ROOT} + ) + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (Sndio + REQUIRED_VARS + SNDIO_LIBRARY + SNDIO_INCLUDE_DIR + VERSION_VAR + SNDIO_VERSION + ) + +if (SNDIO_FOUND) + set (SNDIO_LIBRARIES ${SNDIO_LIBRARY}) + set (SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR}) + if (NOT TARGET Sndio::Sndio) + add_library (Sndio::Sndio UNKNOWN IMPORTED) + set_target_properties (Sndio::Sndio PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIRS}" + IMPORTED_LOCATION "${SNDIO_LIBRARIES}" + ) + endif() endif() -mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY) - +mark_as_advanced (SNDIO_INCLUDE_DIR SNDIO_LIBRARY) diff --git a/cmake/FindSpeex.cmake b/cmake/FindSpeex.cmake index 1620d9fd..c28fe60c 100644 --- a/cmake/FindSpeex.cmake +++ b/cmake/FindSpeex.cmake @@ -1,25 +1,55 @@ # - Find Speex # Find the native Speex includes and libraries # -# SPEEX_INCLUDE_DIRS - where to find speex.h, etc. -# SPEEX_LIBRARIES - List of libraries when using Speex. -# Speex_FOUND - True if Speex found. +# SPEEX_INCLUDE_DIRS - where to find speex.h, etc. +# SPEEX_LIBRARIES - List of libraries when using Speex. +# SPEEX_FOUND - True if Speex found. if (SPEEX_INCLUDE_DIR) set (SPEEX_FIND_QUIETLY TRUE) endif () find_package (PkgConfig QUIET) -pkg_check_modules(PC_SPEEX QUIET speex) +pkg_check_modules (PC_SPEEX QUIET speex) -find_path (SPEEX_INCLUDE_DIR speex/speex.h HINTS ${PC_SPEEX_INCLUDEDIR} ${PC_SPEEX_INCLUDE_DIRS} ${SPEEX_ROOT} PATH_SUFFIXES include) -find_library (SPEEX_LIBRARY NAMES speex HINTS ${PC_SPEEX_LIBDIR} ${PC_SPEEX_LIBRARY_DIRS} ${SPEEX_ROOT} PATH_SUFFIXES lib) +set (SPEEX_VERSION ${PC_SPEEX_VERSION}) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Speex DEFAULT_MSG SPEEX_INCLUDE_DIR SPEEX_LIBRARY) +find_path (SPEEX_INCLUDE_DIR speex/speex.h + HINTS + ${PC_SPEEX_INCLUDEDIR} + ${PC_SPEEX_INCLUDE_DIRS} + ${SPEEX_ROOT} + ) +find_library (SPEEX_LIBRARY + NAMES + speex + libspeex + HINTS + ${PC_SPEEX_LIBDIR} + ${PC_SPEEX_LIBRARY_DIRS} + ${SPEEX_ROOT} + ) + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (Speex + REQUIRED_VARS + SPEEX_LIBRARY + SPEEX_INCLUDE_DIR + VERSION_VAR + SPEEX_VERSION + ) + +if (SPEEX_FOUND) + set (SPEEX_LIBRARIES ${SPEEX_LIBRARY}) + set (SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR}) + + if (NOT TARGET Speex::Speex) + add_library (Speex::Speex UNKNOWN IMPORTED) + set_target_properties (Speex::Speex PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIRS}" + IMPORTED_LOCATION "${SPEEX_LIBRARIES}" + ) + endif () +endif () mark_as_advanced (SPEEX_INCLUDE_DIR SPEEX_LIBRARY) - -set(SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR}) -set(SPEEX_LIBRARIES ${SPEEX_LIBRARY}) - diff --git a/cmake/FindVorbis.cmake b/cmake/FindVorbis.cmake index 2ba2de5d..d76c76d8 100644 --- a/cmake/FindVorbis.cmake +++ b/cmake/FindVorbis.cmake @@ -1,49 +1,64 @@ -# - Find vorbis -# Find the native vorbis includes and libraries +# - Find vorbisenc +# Find the native vorbisenc includes and libraries # # VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc. -# VORBIS_LIBRARIES - List of libraries when using vorbis(file). -# Vorbis_FOUND - True if vorbis found. +# VORBIS_LIBRARIES - List of libraries when using vorbis. +# VORBIS_FOUND - True if vorbis found. -if(VORBIS_INCLUDE_DIR) +if (VORBIS_INCLUDE_DIR) # Already in cache, be silent - set(VORBIS_FIND_QUIETLY TRUE) -endif(VORBIS_INCLUDE_DIR) + set (VORBIS_FIND_QUIETLY TRUE) +endif () find_package (Ogg QUIET) find_package (PkgConfig QUIET) -pkg_check_modules(PC_VORBIS QUIET vorbis) -pkg_check_modules(PC_VORBISFILE QUIET vorbisfile) -pkg_check_modules(PC_VORBISENC QUIET vorbisenc) +pkg_check_modules (PC_VORBIS QUIET vorbis) -find_path(VORBIS_INCLUDE_DIR vorbis/codec.h vorbis/vorbisfile.h vorbis/vorbisfile.h - HINTS ${PC_VORBIS_INCLUDEDIR} ${PC_VORBIS_INCLUDE_DIRS} ${VORBIS_ROOT} - PATH_SUFFIXES include) -# MSVC built vorbis may be named vorbis_static -# The provided project files name the library with the lib prefix. -find_library(VORBIS_LIBRARY - NAMES vorbis vorbis_static libvorbis libvorbis_static - HINTS ${PC_VORBIS_LIBDIR} ${PC_VORBIS_LIBRARY_DIRS} ${VORBIS_ROOT} - PATH_SUFFIXES lib) -find_library(VORBISFILE_LIBRARY - NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static - HINTS ${PC_VORBISFILE_LIBDIR} ${PC_VORBISFILE_LIBRARY_DIRS} ${VORBIS_ROOT} - PATH_SUFFIXES lib) -find_library(VORBISENC_LIBRARY - NAMES vorbisenc vorbisenc_static libvorbisenc libvorbisenc_static - HINTS ${PC_VORBISENC_LIBDIR} ${PC_VORBISENC_LIBRARY_DIRS} ${VORBIS_ROOT} - PATH_SUFFIXES lib) +set (VORBIS_VERSION ${PC_VORBIS_VERSION}) + +find_path (VORBIS_INCLUDE_DIR vorbis/codec.h + HINTS + ${PC_VORBIS_INCLUDEDIR} + ${PC_VORBIS_INCLUDE_DIRS} + ${VORBIS_ROOT} + ) + +find_library (VORBIS_LIBRARY + NAMES + vorbis + vorbis_static + libvorbis + libvorbis_static + HINTS + ${PC_VORBIS_LIBDIR} + ${PC_VORBIS_LIBRARY_DIRS} + ${VORBIS_ROOT} + ) # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND # to TRUE if all listed variables are TRUE. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vorbis DEFAULT_MSG VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (Vorbis + REQUIRED_VARS + VORBIS_LIBRARY + VORBIS_INCLUDE_DIR + OGG_FOUND + VERSION_VAR + VORBIS_VERSION + ) if (VORBIS_FOUND) - set (VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIRS}) - set (VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${VORBISENC_LIBRARY} - ${OGG_LIBRARIES}) -endif (VORBIS_FOUND) + set (VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR}) + set (VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES}) + if (NOT TARGET Vorbis::Vorbis) + add_library (Vorbis::Vorbis UNKNOWN IMPORTED) + set_target_properties (Vorbis::Vorbis PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}" + IMPORTED_LOCATION "${VORBIS_LIBRARY}" + INTERFACE_LINK_LIBRARIES Ogg::Ogg + ) + endif () +endif () -mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) +mark_as_advanced (VORBIS_INCLUDE_DIR VORBIS_LIBRARY) diff --git a/cmake/FindVorbisEnc.cmake b/cmake/FindVorbisEnc.cmake new file mode 100644 index 00000000..87240d12 --- /dev/null +++ b/cmake/FindVorbisEnc.cmake @@ -0,0 +1,64 @@ +# - Find vorbisenc +# Find the native vorbisenc includes and libraries +# +# VORBISENC_INCLUDE_DIRS - where to find vorbisenc.h, etc. +# VORBISENC_LIBRARIES - List of libraries when using vorbisenc. +# VORBISENC_FOUND - True if vorbisenc found. + +if (VORBISENC_INCLUDE_DIR) + # Already in cache, be silent + set (VORBISENC_FIND_QUIETLY TRUE) +endif () + +find_package (Vorbis QUIET) + +find_package (PkgConfig QUIET) +pkg_check_modules (PC_VORBISENC QUIET vorbisenc) + +set (VORBISENC_VERSION ${PC_VORBISENC_VERSION}) + +find_path (VORBISENC_INCLUDE_DIR vorbis/vorbisenc.h + HINTS + ${PC_VORBISENC_INCLUDEDIR} + ${PC_VORBISENC_INCLUDE_DIRS} + ${VORBISENC_ROOT} + ) + +find_library (VORBISENC_LIBRARY + NAMES + vorbisenc + vorbisenc_static + libvorbisenc + libvorbisenc_static + HINTS + ${PC_VORBISENC_LIBDIR} + ${PC_VORBISENC_LIBRARY_DIRS} + ${VORBISENC_ROOT} + ) + +# Handle the QUIETLY and REQUIRED arguments and set VORBISENC_FOUND +# to TRUE if all listed variables are TRUE. +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (VorbisEnc + REQUIRED_VARS + VORBISENC_LIBRARY + VORBISENC_INCLUDE_DIR + VORBIS_FOUND + VERSION_VAR + VORBISENC_VERSION + ) + +if (VORBISENC_FOUND) + set (VORBISENC_INCLUDE_DIRS ${VORBISENC_INCLUDE_DIR}) + set (VORBISENC_LIBRARIES ${VORBISENC_LIBRARY} ${VORBIS_LIBRARIES}) + if (NOT TARGET Vorbis::VorbisEnc) + add_library (Vorbis::VorbisEnc UNKNOWN IMPORTED) + set_target_properties (Vorbis::VorbisEnc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${VORBISENC_INCLUDE_DIR}" + IMPORTED_LOCATION "${VORBISENC_LIBRARY}" + INTERFACE_LINK_LIBRARIES Vorbis::Vorbis + ) + endif () +endif () + +mark_as_advanced (VORBISENC_INCLUDE_DIR VORBISENC_LIBRARY) diff --git a/cmake/LibSndFileConfig.cmake.in b/cmake/LibSndFileConfig.cmake.in deleted file mode 100644 index 824f1bbf..00000000 --- a/cmake/LibSndFileConfig.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -@PACKAGE_INIT@ - -include (${CMAKE_CURRENT_LIST_DIR}/LibSndFileTargets.cmake) diff --git a/cmake/SndFileChecks.cmake b/cmake/SndFileChecks.cmake index d1f72cc0..47482646 100644 --- a/cmake/SndFileChecks.cmake +++ b/cmake/SndFileChecks.cmake @@ -9,7 +9,7 @@ include (TestInline) include (ClipMode) include(TestLargeFiles) -test_large_files(_LARGEFILES) +test_large_files (_LARGEFILES) if (LARGE_FILES_DEFINITIONS) add_definitions(${LARGE_FILES_DEFINITIONS}) @@ -17,75 +17,72 @@ endif () if (WIN32) set(TYPEOF_SF_COUNT_T __int64) -else (UNIX) +else () set(TYPEOF_SF_COUNT_T int64_t) endif () -set(SF_COUNT_MAX 0x7fffffffffffffffll) +set (SF_COUNT_MAX 0x7fffffffffffffffll) if (NOT WIN32) find_package (ALSA) - if (ALSA_FOUND) - set (HAVE_ALSA_ASOUNDLIB_H TRUE) - else () - find_package (Sndio) - set (HAVE_SNDIO_H ${SNDIO_FOUND}) - endif (ALSA_FOUND) + find_package (Sndio) endif () -if (NOT DISABLE_EXTERNAL_LIBS) -find_package (Ogg) -find_package (Vorbis) +find_package (VorbisEnc) find_package (FLAC) -if (OGG_FOUND AND VORBIS_FOUND AND FLAC_FOUND) - set (HAVE_EXTERNAL_XIPH_LIBS 1) - set (EXTERNAL_XIPH_LIBS - ${OGG_LIBRARIES} - ${VORBIS_LIBRARIES} - ${FLAC_LIBRARIES}) +if (VORBIS_FOUND AND FLAC_FOUND) + set (HAVE_EXTERNAL_XIPH_LIBS 1) else () - set (DISABLE_EXTERNAL_LIBS ON) -endif () -endif () - -if (ENABLE_EXPERIMENTAL) - find_package (Speex) + set (HAVE_EXTERNAL_XIPH_LIBS 0) endif () +find_package (Speex) find_package (SQLite3) -if (SQLITE3_FOUND) - set (HAVE_SQLITE3 1) + +check_include_file (byteswap.h HAVE_BYTESWAP_H) +check_include_file (dlfcn.h HAVE_DLFCN_H) +check_include_file (direct.h HAVE_DIRECT_H) +check_include_file (endian.h HAVE_ENDIAN_H) +check_include_file (inttypes.h HAVE_INTTYPES_H) +check_include_file (io.h HAVE_IO_H) +check_include_file (stdint.h HAVE_STDINT_H) +check_include_file (sys/time.h HAVE_SYS_TIME_H) +check_include_file (sys/types.h HAVE_SYS_TYPES_H) +check_include_file (unistd.h HAVE_UNISTD_H) + +# Never checked +# check_include_file (stdlib.h HAVE_STDLIB_H) +# check_include_file (string.h HAVE_STRING_H) +# check_include_file (strings.h HAVE_STRINGS_H) +# check_include_file (sys/stat.h HAVE_SYS_STAT_H) +# check_include_file (memory.h HAVE_MEMORY_H) + +if (BUILD_TESTING) + check_include_file (locale.h HAVE_LOCALE_H) + check_include_file (sys/wait.h HAVE_SYS_WAIT_H) endif () -check_include_file(byteswap.h HAVE_BYTESWAP_H) -check_include_file(dlfcn.h HAVE_DLFCN_H) -check_include_file(direct.h HAVE_DIRECT_H) -check_include_file(endian.h HAVE_ENDIAN_H) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(locale.h HAVE_LOCALE_H) -check_include_file(memory.h HAVE_MEMORY_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stdlib.h HAVE_STDLIB_H) -check_include_file(string.h HAVE_STRING_H) -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(sys/wait.h HAVE_SYS_WAIT_H) -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(io.h HAVE_IO_H) -check_type_size(int64_t SIZEOF_INT64_T) -check_type_size(double SIZEOF_DOUBLE) -check_type_size(float SIZEOF_FLOAT) -check_type_size(int SIZEOF_INT) -check_type_size(loff_t SIZEOF_LOFF_T) -check_type_size(long SIZEOF_LONG) -check_type_size(long\ long SIZEOF_LONG_LONG) -check_type_size(offt64_t SIZEOF_OFF64_T) -check_type_size(short SIZEOF_SHORT) -check_type_size(size_t SIZEOF_SIZE_T) -check_type_size(ssize_t SIZEOF_SSIZE_T) -check_type_size(void* SIZEOF_VOIDP) -check_type_size(wchar_t SIZEOF_WCHAR_T) +check_type_size (int64_t SIZEOF_INT64_T) +check_type_size (long SIZEOF_LONG) +check_type_size (long\ long SIZEOF_LONG_LONG) +check_type_size (ssize_t SIZEOF_SSIZE_T) +check_type_size (wchar_t SIZEOF_WCHAR_T) + +# Never used +# check_type_size (loff_t SIZEOF_LOFF_T) +# check_type_size (offt64_t SIZEOF_OFF64_T) + +# Never checked +# check_type_size (size_t SIZEOF_SIZE_T) + +# Used in configre.ac +# check_type_size (double SIZEOF_DOUBLE) +# check_type_size (float SIZEOF_FLOAT) +# check_type_size (int SIZEOF_INT) +# check_type_size (short SIZEOF_SHORT) + +if (ENABLE_TESTING) + check_type_size (void* SIZEOF_VOIDP) +endif() if ((SIZEOF_OFF_T EQUAL 8) OR (SIZEOF_LOFF_T EQUAL 8) OR (SIZEOF_OFF64_T EQUAL 8)) set (TYPEOF_SF_COUNT_T "int64_t") @@ -96,7 +93,7 @@ else () set (TYPEOF_SF_COUNT_T "__int64") set (SF_COUNT_MAX "0x7FFFFFFFFFFFFFFFLL") set (SIZEOF_SF_COUNT_T 8) - else (NOT WIN32) + else () message ("") message ("*** The configure process has determined that this system is capable") message ("*** of Large File Support but has not been able to find a type which") @@ -104,64 +101,69 @@ else () message ("*** Please contact the author to help resolve this problem.") message ("") message (FATAL_ERROR "Bad file offset type.") - endif (WIN32) -endif () - -check_type_size(${TYPEOF_SF_COUNT_T} SIZEOF_SF_COUNT_T) - -find_library (M_LIBRARY m) -if (M_LIBRARY) - # Check if he need to link 'm' for math functions - check_library_exists (m floor "" LIBM_REQUIRED) - if (LIBM_REQUIRED) - list (APPEND CMAKE_REQUIRED_LIBRARIES ${M_LIBRARY}) - else () - unset (M_LIBRARY) endif () endif () -mark_as_advanced (M_LIBRARY) + +check_type_size (${TYPEOF_SF_COUNT_T} SIZEOF_SF_COUNT_T) + +if (NOT WIN32) + check_library_exists (m floor "" LIBM_REQUIRED) + if (LIBM_REQUIRED) + list (APPEND CMAKE_REQUIRED_LIBRARIES m) + endif () +endif () check_library_exists (sqlite3 sqlite3_close "" HAVE_SQLITE3) -check_function_exists(calloc HAVE_CALLOC) -check_function_exists(free HAVE_FREE) -check_function_exists(fstat HAVE_FSTAT) -check_function_exists(fstat64 HAVE_FSTAT64) -check_function_exists(fsync HAVE_FSYNC) -check_function_exists(ftruncate HAVE_FTRUNCATE) -check_function_exists(getpagesize HAVE_GETPAGESIZE) -check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) -check_function_exists(gmtime HAVE_GMTIME) -check_function_exists(gmtime_r HAVE_GMTIME_R) -check_function_exists(localtime HAVE_LOCALTIME) -check_function_exists(localtime_r HAVE_LOCALTIME_R) -check_function_exists(lseek HAVE_LSEEK) -check_function_exists(lseek64 HAVE_LSEEK64) -check_function_exists(malloc HAVE_MALLOC) -check_function_exists(mmap HAVE_MMAP) -check_function_exists(open HAVE_OPEN) -check_function_exists(pipe HAVE_PIPE) -check_function_exists(read HAVE_READ) -check_function_exists(realloc HAVE_REALLOC) -check_function_exists(setlocale HAVE_SETLOCALE) -check_function_exists(snprintf HAVE_SNPRINTF) -check_function_exists(vsnprintf HAVE_VSNPRINTF) -check_function_exists(waitpid HAVE_WAITPID) -check_function_exists(write HAVE_WRITE) -check_function_exists(ceil HAVE_CEIL) -check_function_exists(floor HAVE_FLOOR) -check_function_exists(fmod HAVE_FMOD) -check_function_exists(lrint HAVE_LRINT) -check_function_exists(lrintf HAVE_LRINTF) -check_function_exists(lround HAVE_LROUND) +check_function_exists (fstat HAVE_FSTAT) +check_function_exists (fstat64 HAVE_FSTAT64) +check_function_exists (gettimeofday HAVE_GETTIMEOFDAY) +check_function_exists (gmtime HAVE_GMTIME) +check_function_exists (gmtime_r HAVE_GMTIME_R) +check_function_exists (localtime HAVE_LOCALTIME) +check_function_exists (localtime_r HAVE_LOCALTIME_R) +check_function_exists (lseek HAVE_LSEEK) +check_function_exists (open HAVE_OPEN) +check_function_exists (read HAVE_READ) +check_function_exists (write HAVE_WRITE) +check_function_exists (lrint HAVE_LRINT) +check_function_exists (lrintf HAVE_LRINTF) + +if (NOT WIN32) + check_function_exists (ftruncate HAVE_FTRUNCATE) + check_function_exists (fsync HAVE_FSYNC) +endif () + +if (BUILD_TESTING) + check_function_exists (pipe HAVE_PIPE) + check_function_exists (setlocale HAVE_SETLOCALE) + check_function_exists (waitpid HAVE_WAITPID) +endif () + +# Never checked +# check_function_exists (calloc HAVE_CALLOC) +# check_function_exists (free HAVE_FREE) +# check_function_exists (getpagesize HAVE_GETPAGESIZE) +# check_function_exists (malloc HAVE_MALLOC) +# check_function_exists (realloc HAVE_REALLOC) +# check_function_exists (snprintf HAVE_SNPRINTF) +# check_function_exists (vsnprintf HAVE_VSNPRINTF) +# check_function_exists (floor HAVE_FLOOR) +# check_function_exists (fmod HAVE_FMOD) + +# Never used +# check_function_exists (mmap HAVE_MMAP) +# check_function_exists (ceil HAVE_CEIL) +# check_function_exists (lround HAVE_LROUND) +# check_function_exists (lseek64 HAVE_LSEEK64) + check_symbol_exists (S_IRGRP sys/stat.h HAVE_DECL_S_IRGRP) -test_big_endian(WORDS_BIGENDIAN) +test_big_endian (WORDS_BIGENDIAN) if (WORDS_BIGENDIAN) - set (WORDS_BIGENDIAN 1) set (CPU_IS_BIG_ENDIAN 1) -else (${LITTLE_ENDIAN}) +else () set (CPU_IS_LITTLE_ENDIAN 1) endif () @@ -171,12 +173,12 @@ if (WIN32) if (BUILD_SHARED_LIBS) set (WIN32_TARGET_DLL 1) endif () -if (MINGW) - set (__USE_MINGW_ANSI_STDIO 1) -endif (MINGW) -endif (WIN32) + if (MINGW) + set (__USE_MINGW_ANSI_STDIO 1) + endif () +endif () -if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") +if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") set (OS_IS_OPENBSD 1) endif () @@ -185,18 +187,8 @@ if (CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang")) set (COMPILER_IS_GCC 1) endif () -if (COMPILER_IS_GCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") -endif () - -if (ENABLE_EXPERIMENTAL) - set (ENABLE_EXPERIMENTAL_CODE 1) -endif () - test_inline () -if (NOT DISABLE_CPU_CLIP) - clip_mode () -endif () +clip_mode () if (MSVC) add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) @@ -204,15 +196,16 @@ endif (MSVC) if (ENABLE_STATIC_RUNTIME) if (MSVC) - foreach(flag_var + foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + ) + if (${flag_var} MATCHES "/MD") + string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif () + endforeach (flag_var) endif (MSVC) if (MINGW) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc") @@ -222,24 +215,25 @@ if (ENABLE_STATIC_RUNTIME) endif (MINGW) elseif (NOT ENABLE_STATIC_RUNTIME) if (MSVC) - foreach(flag_var + foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MT") - string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MT") - endforeach(flag_var) - endif (MSVC) + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + ) + if (${flag_var} MATCHES "/MT") + string (REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") + endif (${flag_var} MATCHES "/MT") + endforeach (flag_var) + endif () if (MINGW) set (CMAKE_C_FLAGS "") set (CMAKE_CXX_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - endif (MINGW) -endif (ENABLE_STATIC_RUNTIME) + endif () +endif ( ) if (BUILD_SHARED_LIBS) - find_package(PythonInterp REQUIRED) + find_package (PythonInterp REQUIRED) endif() diff --git a/cmake/TestLargeFiles.cmake b/cmake/TestLargeFiles.cmake index 7b8a751f..075407b4 100644 --- a/cmake/TestLargeFiles.cmake +++ b/cmake/TestLargeFiles.cmake @@ -12,56 +12,23 @@ if (NOT DEFINED ${VARIABLE}) message (STATUS "") message (STATUS "Checking large files support...") - message (STATUS "") - check_include_file(sys/types.h HAVE_SYS_TYPES_H) - check_include_file(stdint.h HAVE_STDINT_H) - check_include_file(stddef.h HAVE_STDDEF_H) - message (STATUS "") - - message (STATUS "Checking size of off_t without any definitions:") - check_type_size (off_t SIZEOF_OFF_T) - message (STATUS "Checking of off_t without any definitions: ${SIZEOF_OFF_T}") - if (SIZEOF_OFF_T EQUAL 8) - set (LARGE_FILES_DEFINITIONS "" CACHE INTERNAL "64-bit off_t required definitions") - set (FILE64 TRUE) + if (WIN32) + set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE) + message (STATUS "") + message (STATUS "Result of checking large files support: supported with WinAPI") else () - unset (HAVE_SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T_CODE CACHE) - cmake_pop_check_state() - set (FILE64 FALSE) - endif () - if (NOT FILE64) - set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_FILE_OFFSET_BITS=64) message (STATUS "") - message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64:") - check_type_size (off_t SIZEOF_OFF_T) - message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64: ${SIZEOF_OFF_T}") - if (SIZEOF_OFF_T EQUAL 8) - set (_FILE_OFFSET_BITS 64 CACHE INTERNAL "") - set (_FILE_OFFSET_BITS_CODE "#define _FILE_OFFSET_BITS 64" CACHE INTERNAL "") - set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_FILE_OFFSET_BITS=64" CACHE INTERNAL "64-bit off_t required definitions") - set (FILE64 TRUE) - else () - set (_FILE_OFFSET_BITS_CODE "" CACHE INTERNAL "") - unset (HAVE_SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T_CODE CACHE) - cmake_pop_check_state() - set (FILE64 FALSE) - endif () - endif () + check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(stdint.h HAVE_STDINT_H) + check_include_file(stddef.h HAVE_STDDEF_H) + message (STATUS "") - if (NOT FILE64) - set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGE_FILES) - message (STATUS "") - message (STATUS "Checking size of off_t with _LARGE_FILES:") + message (STATUS "Checking size of off_t without any definitions:") check_type_size (off_t SIZEOF_OFF_T) - message (STATUS "Checking size of off_t with _LARGE_FILES: ${SIZEOF_OFF_T}") + message (STATUS "Checking of off_t without any definitions: ${SIZEOF_OFF_T}") if (SIZEOF_OFF_T EQUAL 8) - set (_LARGE_FILES 1 CACHE INTERNAL "") - set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGE_FILES" CACHE INTERNAL "64-bit off_t required definitions") + set (LARGE_FILES_DEFINITIONS "" CACHE INTERNAL "64-bit off_t required definitions") set (FILE64 TRUE) else () unset (HAVE_SIZEOF_OFF_T CACHE) @@ -70,46 +37,84 @@ if (NOT DEFINED ${VARIABLE}) cmake_pop_check_state() set (FILE64 FALSE) endif () - endif () - if (NOT FILE64) - set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGEFILE_SOURCE) - unset (HAVE_SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T CACHE) - unset (SIZEOF_OFF_T_CODE CACHE) + if (NOT FILE64) + set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_FILE_OFFSET_BITS=64) + message (STATUS "") + message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64:") + check_type_size (off_t SIZEOF_OFF_T) + message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64: ${SIZEOF_OFF_T}") + if (SIZEOF_OFF_T EQUAL 8) + set (_FILE_OFFSET_BITS 64 CACHE INTERNAL "") + set (_FILE_OFFSET_BITS_CODE "#define _FILE_OFFSET_BITS 64" CACHE INTERNAL "") + set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_FILE_OFFSET_BITS=64" CACHE INTERNAL "64-bit off_t required definitions") + set (FILE64 TRUE) + else () + set (_FILE_OFFSET_BITS_CODE "" CACHE INTERNAL "") + unset (HAVE_SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T_CODE CACHE) + cmake_pop_check_state() + set (FILE64 FALSE) + endif () + endif () + + if (NOT FILE64) + set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGE_FILES) + message (STATUS "") + message (STATUS "Checking size of off_t with _LARGE_FILES:") + check_type_size (off_t SIZEOF_OFF_T) + message (STATUS "Checking size of off_t with _LARGE_FILES: ${SIZEOF_OFF_T}") + if (SIZEOF_OFF_T EQUAL 8) + set (_LARGE_FILES 1 CACHE INTERNAL "") + set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGE_FILES" CACHE INTERNAL "64-bit off_t required definitions") + set (FILE64 TRUE) + else () + unset (HAVE_SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T_CODE CACHE) + cmake_pop_check_state() + set (FILE64 FALSE) + endif () + endif () + + if (NOT FILE64) + set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGEFILE_SOURCE) + unset (HAVE_SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T CACHE) + unset (SIZEOF_OFF_T_CODE CACHE) + message (STATUS "") + message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE:") + check_type_size (off_t SIZEOF_OFF_T) + message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE: ${SIZEOF_OFF_T}") + if (SIZEOF_OFF_T EQUAL 8) + set (_LARGEFILE_SOURCE 1 CACHE INTERNAL "") + set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGEFILE_SOURCE" CACHE INTERNAL "64-bit off_t required definitions") + set (FILE64 TRUE) + else () + cmake_pop_check_state() + set (FILE64 FALSE) + endif () + endif () + message (STATUS "") - message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE:") - check_type_size (off_t SIZEOF_OFF_T) - message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE: ${SIZEOF_OFF_T}") - if (SIZEOF_OFF_T EQUAL 8) - set (_LARGEFILE_SOURCE 1 CACHE INTERNAL "") - set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGEFILE_SOURCE" CACHE INTERNAL "64-bit off_t required definitions") - set (FILE64 TRUE) + if (FILE64) + set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE) + if (NOT SIZEOF_OFF_T_REQURED_DEFINITIONS) + message (STATUS "Result of checking large files support: supported") + else () + message (STATUS "Result of checking large files support: supported with ${LARGE_FILES_DEFINITIONS}") + message (STATUS "Add LARGE_FILES_DEFINITIONS to your compiler definitions or configure with _FILE_OFFSET_BITS,") + message (STATUS "_FILE_OFFSET_BITS_CODE, _LARGE_FILES and _LARGEFILE_SOURCE variables.") + endif () else () - cmake_pop_check_state() - set (FILE64 FALSE) + message ("Result of checking large files support: not supported") + set (${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE) endif () - endif () + message ("") + message ("") - message (STATUS "") - if (FILE64) - set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE) - if (NOT SIZEOF_OFF_T_REQURED_DEFINITIONS) - message (STATUS "Result of checking large files support: supported") - else () - message (STATUS "Result of checking large files support: supported with ${LARGE_FILES_DEFINITIONS}") - message (STATUS "Add LARGE_FILES_DEFINITIONS to your compiler definitions or configure with _FILE_OFFSET_BITS,") - message (STATUS "_FILE_OFFSET_BITS_CODE, _LARGE_FILES and _LARGEFILE_SOURCE variables.") - endif () - elseif (WIN32) - set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE) - message (STATUS "Result of checking large files support: supported with WinAPI") - else () - message ("Result of checking large files support: not supported") - set (${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE) endif () - message ("") - message ("") endif (NOT DEFINED ${VARIABLE}) diff --git a/sndfile.pc.cmake.in b/sndfile.pc.cmake.in deleted file mode 100644 index 7e873299..00000000 --- a/sndfile.pc.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@PC_PREFIX@ -exec_prefix=@PC_EXEC_PREFIX@ -libdir=@PC_LIBDIR@ -includedir=@PC_INCLUDEDIR@ - -Name: sndfile -Description: A library for reading and writing audio files -Requires: -Version: @PC_VERSION@ -Libs: -L${libdir} -lsndfile -Libs.private: @PC_PRIVATE_LIBS@ -Cflags: -I${includedir} diff --git a/src/config.h.cmake b/src/config.h.cmake index 7884a417..63eb2989 100644 --- a/src/config.h.cmake +++ b/src/config.h.cmake @@ -191,19 +191,19 @@ #cmakedefine01 OS_IS_WIN32 /* Name of package */ -#define PACKAGE "@CPACK_PACKAGE_NAME@" +#define PACKAGE "@PROJECT_NAME@" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" /* Define to the full name of this package. */ -#define PACKAGE_NAME "@CPACK_PACKAGE_NAME@" +#define PACKAGE_NAME "@PROJECT_NAME@" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION_FULL@" +#define PACKAGE_STRING "@PROJECT_NAME@ @CPACK_PACKAGE_VERSION_FULL@" /* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@CPACK_PACKAGE_NAME@" +#define PACKAGE_TARNAME "@PROJECT_NAME@" /* Define to the home page for this package. */ #define PACKAGE_URL "@PACKAGE_URL@" diff --git a/src/create_symbols_file.py b/src/create_symbols_file.py index 28503f3b..82717466 100644 --- a/src/create_symbols_file.py +++ b/src/create_symbols_file.py @@ -110,7 +110,6 @@ def darwin_symbols (progname, version): def win32_symbols (progname, version, name): print ("; Auto-generated by %s\n" %progname) - print ("LIBRARY %s-%s.dll" % (name, re.sub ("\..*", "", version))) print ("EXPORTS\n") for name, ordinal in ALL_SYMBOLS: print ("%-20s @%s" % (name, ordinal)) diff --git a/src/version-metadata.rc.in b/src/version-metadata.rc.in index ed79b22a..a672e4bb 100644 --- a/src/version-metadata.rc.in +++ b/src/version-metadata.rc.in @@ -19,7 +19,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS VALUE "Full Version", "@PACKAGE_VERSION@" VALUE "InternalName", "libsndfile" VALUE "LegalCopyright", "Copyright (C) 1999-2012, Licensed LGPL" - VALUE "OriginalFilename", "libsndfile-1.dll" VALUE "ProductName", "libsndfile-1 DLL" VALUE "ProductVersion", "@CLEAN_VERSION@.0\0" VALUE "Language", "Language Neutral"