More CMake polishing

* Add win32_ordinal_test to test suite
* Add examples targets
* Add sndfile-regtest target
* Improve compatibility with MSVC
* Check direct.h header
* Add define to enable math constants
* Don't use CTest if tests are disabled
* Make packaging configurable
* Suppress annoying MSVC warnings
* Add ENABLE_BOW_DOCS option
* Add ENABLE_STATIC_RUNTIME option
* Add package config support
* Tune large files support messages
* Don't build tests when static libs disabled
* Use VS solution folders feature
* Fix option value set twice
* Rename sndfile target to sndfile-shared
* Mark M_LIBRARY variable as advanced
* Fix config packages installation directory
* Rename ENABLE_PACKAGING option for clarity
* CPack fixes
* Add CMake modules to Makefile.am
* Update documentation

Closes: https://github.com/erikd/libsndfile/issues/71
This commit is contained in:
evpobr 2017-04-13 11:11:02 +05:00 committed by Erik de Castro Lopo
parent 560cefe607
commit 9ebb96ca72
9 changed files with 492 additions and 78 deletions

View File

@ -6,21 +6,39 @@ project(libsndfile VERSION 1.0.29)
# Variables
#
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 "${PROJECT_VERSION}pre1")
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 (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}")
#
# System-wide includes
#
include (GNUInstallDirs)
include (CPack)
include (CTest)
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)
#
# Options
@ -29,9 +47,17 @@ include (FeatureSummary)
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 ("
@ -40,6 +66,11 @@ if ((NOT BUILD_STATIC_LIBS) AND (NOT BUILD_SHARED_LIBS))
set (BUILD_STATIC_LIBS ON)
endif ()
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 ()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
#
@ -48,12 +79,22 @@ 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")
if (MSVC OR MINGW)
add_feature_info(ENABLE_STATIC_RUNTIME ENABLE_STATIC_RUNTIME "Enable static runtime")
endif (MSVC OR MINGW)
set_package_properties(Ogg PROPERTIES TYPE RECOMMENDED
URL "www.xiph.org/ogg/"
@ -71,6 +112,10 @@ 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
URL "www.sqlite.org/"
DESCRIPTION "light weight SQL database engine."
PURPOSE "Enables regtest")
feature_summary (WHAT ALL)
@ -253,7 +298,11 @@ set (libsndfile_SOURCES ${COMMON} ${FILESPECIFIC} ${noinst_HEADERS}
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 ${CMAKE_BINARY_DIR}/src)
target_include_directories(${SNDFILE_STATIC_TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
if (LIBM_REQUIRED)
target_link_libraries (${SNDFILE_STATIC_TARGET} PUBLIC ${M_LIBRARY})
endif ()
@ -275,12 +324,11 @@ if (BUILD_STATIC_LIBS)
endif ()
# Remove "-static" from output name
set_target_properties (${SNDFILE_STATIC_TARGET} PROPERTIES OUTPUT_NAME "sndfile")
target_include_directories (${SNDFILE_STATIC_TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif ()
if (BUILD_SHARED_LIBS)
set (SNDFILE_SHARED_TARGET sndfile)
set (SNDFILE_SHARED_TARGET sndfile-shared)
if (WIN32)
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/version-metadata.rc")
@ -295,7 +343,11 @@ if (BUILD_SHARED_LIBS)
endif (WIN32)
add_library(${SNDFILE_SHARED_TARGET} SHARED ${libsndfile_SOURCES})
target_include_directories(${SNDFILE_SHARED_TARGET} PUBLIC ${CMAKE_BINARY_DIR}/src)
target_include_directories(${SNDFILE_SHARED_TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
if (LIBM_REQUIRED)
target_link_libraries (${SNDFILE_SHARED_TARGET} PRIVATE ${M_LIBRARY})
@ -315,9 +367,6 @@ if (BUILD_SHARED_LIBS)
endif (ENABLE_EXPERIMENTAL)
endif (NOT DISABLE_EXTERNAL_LIBS)
target_include_directories (${SNDFILE_SHARED_TARGET}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set_target_properties (${SNDFILE_SHARED_TARGET} PROPERTIES
DEFINE_SYMBOL SNDFILE_EXPORTS
PUBLIC_HEADER "${libsndfile_PUBLIC_HEADERS}"
@ -456,7 +505,7 @@ if (BUILD_PROGRAMS)
add_executable (sndfile-salvage ${sndfile_salvage_SOURCES})
target_link_libraries(sndfile-salvage PUBLIC ${SNDFILE_TARGET})
set (sdnfile_PROGRAMS
set (SNDFILE_PROGRAM_TARGETS
sndfile-info
sndfile-play
sndfile-convert
@ -468,19 +517,136 @@ if (BUILD_PROGRAMS)
sndfile-concat
sndfile-salvage)
set_target_properties(${SNDFILE_PROGRAM_TARGETS} PROPERTIES FOLDER Programs)
endif (BUILD_PROGRAMS)
#
# 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)
#
# Installation
#
install (TARGETS ${SNDFILE_STATIC_TARGET} ${SNDFILE_SHARED_TARGET} ${sdnfile_PROGRAMS}
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
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
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_SOURCE_DIR}/cmake/LibSndFileConfig.cmake.in
LibSndFileConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
install(EXPORT LibSndFileTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
install(FILES
${CMAKE_BINARY_DIR}/LibSndFileConfig.cmake
${CMAKE_BINARY_DIR}/LibSndFileConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_PACKAGEDIR})
elseif (NOT ENABLE_PACKAGE_CONFIG)
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})
endif (ENABLE_PACKAGE_CONFIG)
if (Unix)
set (man_MANS
man/sndfile-info.1
@ -496,9 +662,13 @@ if (Unix)
install (FILES ${man_MANS} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 PATTERN "*.1")
endif ()
#TODO: ENABLE_BOW_DOCS option
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 ()
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/doc/libsndfile.css")
configure_file (doc/libsndfile.css.in doc/libsndfile.css)
set (html_DATA
@ -526,13 +696,11 @@ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION ${CMAKE_INSTAL
#
if (BUILD_TESTING)
# Create src and tests directory in CMAKE_BINARY_DIR to put generated sources in
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/src")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
include (CTest)
include(${CMAKE_MODULE_PATH}/CMakeAutoGen.cmake)
enable_testing ()
# generate tests sources from autogen templates
lsf_autogen(tests benchmark c)
lsf_autogen(tests floating_point_test c)
@ -543,12 +711,11 @@ if (BUILD_TESTING)
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_TARGET})
target_link_libraries(test_utils PUBLIC ${SNDFILE_STATIC_TARGET})
target_include_directories(test_utils PUBLIC "${CMAKE_BINARY_DIR}/tests")
### test_main
@ -570,22 +737,25 @@ if (BUILD_TESTING)
add_executable (test_main ${test_main_SOURCES})
target_link_libraries (test_main ${SNDFILE_STATIC_TARGET})
if (MSVC)
target_compile_definitions (test_main PRIVATE _USE_MATH_DEFINES)
endif (MSVC)
add_test (test_main test_main)
### sfversion_test
set (sfversion_SOURCES tests/sfversion.c)
add_executable (sfversion ${sfversion_SOURCES})
target_link_libraries (sfversion ${SNDFILE_TARGET})
target_link_libraries (sfversion ${SNDFILE_STATIC_TARGET})
add_test (sfversion sfversion)
set_tests_properties (sfversion PROPERTIES
PASS_REGULAR_EXPRESSION "libsndfile-${CPACK_PACKAGE_VERSION}")
PASS_REGULAR_EXPRESSION "libsndfile-${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_TARGET} test_utils)
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 ()
@ -594,7 +764,7 @@ if (BUILD_TESTING)
### ulaw_test
set (ulaw_test_SOURCES tests/ulaw_test.c)
add_executable (ulaw_test ${ulaw_test_SOURCES})
target_link_libraries (ulaw_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -603,7 +773,7 @@ if (BUILD_TESTING)
### alaw_test
set (alaw_test_SOURCES tests/alaw_test.c)
add_executable (alaw_test ${alaw_test_SOURCES})
target_link_libraries (alaw_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -613,7 +783,7 @@ if (BUILD_TESTING)
set (dwvw_test_SOURCES tests/dwvw_test.c)
add_executable (dwvw_test ${dwvw_test_SOURCES})
target_link_libraries (dwvw_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -623,7 +793,7 @@ if (BUILD_TESTING)
set (command_test_SOURCES tests/command_test.c)
add_executable (command_test ${command_test_SOURCES})
target_link_libraries (command_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -633,7 +803,7 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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})
@ -644,7 +814,7 @@ if (BUILD_TESTING)
set (checksum_test_SOURCES tests/checksum_test.c)
add_executable (checksum_test ${checksum_test_SOURCES})
target_link_libraries (checksum_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -654,7 +824,7 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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 ()
@ -664,7 +834,7 @@ if (BUILD_TESTING)
set (headerless_test_SOURCES tests/headerless_test.c)
add_executable (headerless_test ${headerless_test_SOURCES})
target_link_libraries (headerless_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -674,7 +844,7 @@ if (BUILD_TESTING)
set (rdwr_test_SOURCES tests/rdwr_test.c)
add_executable (rdwr_test ${rdwr_test_SOURCES})
target_link_libraries (rdwr_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -684,7 +854,7 @@ if (BUILD_TESTING)
set (locale_test_SOURCES tests/locale_test.c)
add_executable (locale_test ${locale_test_SOURCES})
target_link_libraries (locale_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -692,13 +862,18 @@ if (BUILD_TESTING)
### win32_ordinal_test
# TODO
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 ()
### cpp_test
set (cpp_test_SOURCES tests/cpp_test.cc)
add_executable (cpp_test ${cpp_test_SOURCES})
target_link_libraries (cpp_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -708,7 +883,7 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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 ()
@ -718,7 +893,7 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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 ()
@ -728,7 +903,7 @@ if (BUILD_TESTING)
set (channel_test_SOURCES tests/channel_test.c)
add_executable (channel_test ${channel_test_SOURCES})
target_link_libraries (channel_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -738,7 +913,7 @@ if (BUILD_TESTING)
set (pcm_test_SOURCES tests/pcm_test.c)
add_executable (pcm_test ${pcm_test_SOURCES})
target_link_libraries (pcm_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
@ -748,7 +923,7 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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})
@ -756,119 +931,119 @@ if (BUILD_TESTING)
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_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
set (header_test_SOURCES tests/header_test.c)
add_executable (header_test ${header_test_SOURCES})
target_link_libraries (header_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
set (misc_test_SOURCES tests/misc_test.c)
add_executable (misc_test ${misc_test_SOURCES})
target_link_libraries (misc_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
set (string_test_SOURCES tests/string_test.c)
add_executable (string_test ${string_test_SOURCES})
target_link_libraries (string_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
set (chunk_test_SOURCES tests/chunk_test.c)
add_executable (chunk_test ${chunk_test_SOURCES})
target_link_libraries (chunk_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
set (raw_test_SOURCES tests/raw_test.c)
add_executable (raw_test ${raw_test_SOURCES})
target_link_libraries (raw_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
set (ogg_test_SOURCES tests/ogg_test.c)
add_executable (ogg_test ${ogg_test_SOURCES})
target_link_libraries (ogg_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
set (stdin_test_SOURCES tests/stdin_test.c)
add_executable (stdin_test ${stdin_test_SOURCES})
target_link_libraries (stdin_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 (stdout_test_SOURCES tests/stdout_test.c)
add_executable (stdout_test ${stdout_test_SOURCES})
target_link_libraries (stdout_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 (stdio_test_SOURCES tests/stdio_test.c)
add_executable (stdio_test ${stdio_test_SOURCES})
target_link_libraries (stdio_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
set (pipe_test_SOURCES tests/pipe_test.c)
add_executable (pipe_test ${pipe_test_SOURCES})
target_link_libraries (pipe_test PRIVATE ${SNDFILE_TARGET} test_utils)
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 ()
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_TARGET} test_utils)
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 ()
@ -877,7 +1052,7 @@ if (BUILD_TESTING)
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_TARGET})
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 ()
@ -1055,4 +1230,50 @@ if (BUILD_TESTING)
add_test (pipe_test pipe_test)
add_test (virtual_io_test virtual_io_test)
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)
endif (BUILD_TESTING)

View File

@ -20,10 +20,13 @@ EXTRA_DIST = libsndfile.spec.in sndfile.pc.in Scripts/android-configure.sh \
Scripts/linux-to-win-cross-configure.sh Scripts/build-test-tarball.mk.in \
CMakeLists.txt $(cmake_files) sndfile.pc.cmake.in
cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake cmake/FindOgg.cmake \
cmake/FindSndio.cmake cmake/FindSpeex.cmake cmake/FindVorbis.cmake \
cmake/SndFileChecks.cmake cmake/TestInline.c.in cmake/TestInline.cmake \
cmake/TestLargeFiles.cmake
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/SndFileChecks.cmake cmake/TestInline.cmake \
cmake/TestLargeFiles.cmake cmake/LibSndFileConfig.cmake.in \
cmake/TestInline.c.in
CLEANFILES = *~

11
README
View File

@ -39,6 +39,9 @@ Since libsndfile optionally links against libFLAC, libogg and libvorbis, you
will need to install appropriate versions of these libraries before running
configure as above.
You can use CMake now to build under Linux, also under Windows and MacOS, see
README.md for details. CMake toolchain is usable, but still exterimental.
UNIX
----
@ -47,11 +50,13 @@ Compile as for Linux.
Win32/Win64
-----------
The default Windows compilers are nowhere near compliant with the 1999 ISO
C Standard and hence not able to compile libsndfile.
Please use the libsndfile binaries available on the libsndfile web site.
Official Windows binaries are compiled with Autotools and MinGW, but you can use
CMake to generate solution for Visual Studio. Details are described in
README.md.
It is still recommended to use the libsndfile binaries available on the
libsndfile web site.
MacOSX
------

108
README.md
View File

@ -43,14 +43,112 @@ as simple as:
## The CMake build system.
The CMake build system is still experimental and probably only works on linux
because it still relies on GNU autotools for bootstrapping. Using it as simple
as:
Although Autotools is the primary and recommended build toolchain, experimental
CMake meta build generator is also available. The build process with CMake takes
place in two stages. First, standard build files are created from configuration
scripts. Then the platform's native build tools are used for the actual
building. CMake can produce Microsoft Visual Studio project and solution files,
Unix Makefiles, Xcode projects and [many more](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
$ Scripts/cmake-build.sh
### Requirements
I would be happy to accept patches to make the CMake build system more portable.
1. C99-compliant compiler toolchain (tested with GCC, Clang and Visual
Studio 2015)
2. CMake 3.1.3 or newer
There are some recommended packages to enable all features of libsndfile:
1. Ogg, Vorbis and FLAC libraries and headers to enable these formats support
2. ALSA development package under Linux to build sndfile-play utility
3. Sndio development package under BSD to build sndfile-play utility
### Building from command line
CMake can handle out-of-place builds, enabling several builds from
the same source tree, and cross-compilation. The ability to build a directory
tree outside the source tree is a key feature, ensuring that if a build
directory is removed, the source files remain unaffected.
mkdir CMakeBuild
cd CMakeBuild
Then run `cmake` command with directory where CMakeLists.txt script is located
as argument (relative paths are supported):
cmake ..
This command will configure and write build script or solution to CMakeBuild
directory. CMake is smart enough to create Unix makefiles under Linux or Visual
Studio solution if you have Visual Studio installed, but you can configure
[generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
with `-G` command line parameter:
cmake .. -G"Unix Makefiles"
The build procedure depends on the selected generator. With "Unix Makefiles" you
can type:
make & make install
With "Visual Studio" and some other generators you can open solution or project
from `CMakeBuild` directory and build using IDE.
Finally, you can use unified command:
cmake --build .
CMake also provides Qt-based cross platform GUI, cmake-gui. Using it is trivial
and does not require detailed explanations.
### Configuring CMake
You can pass additional options with `/D<parameter>=<value>` when you run
`cmake` command. Some useful system options:
* `CMAKE_C_FLAGS` - additional C compiler flags
* `CMAKE_BUILD_TYPE` - configuration type, `DEBUG`, `RELEASE`, `RELWITHDEBINFO`
or `MINSIZEREL`. `DEBUG` is default
* `CMAKE_INSTALL_PREFIX` - build install location, the same as `--prefix` option
of `configure` script
Useful libsndfile options:
* `BUILD_SHARED_LIBS` - build shared library (DLL under Windows)
* `BUILD_STATIC_LIBS` - build static library
* `BUILD_PROGRAMS` - build libsndfile's utilities from `programs/` directory
* `BUILD_EXAMPLES` - build examples
* `BUILD_TESTING` - build tests. Then you can run tests with `ctest` command
* `DISABLE_EXTERNAL_LIBS` - disable Ogg, Vorbis and FLAC support
* `DISABLE_CPU_CLIP` - disable tricky cpu specific clipper. Don't touch it if
you are not sure.
* `ENABLE_BOW_DOCS` - enable black-on-white documentation theme
* `ENABLE_EXPERIMENTAL` - enable experimental code. Don't use it if you are
not sure
* `ENABLE_CPACK` - enable [CPack](https://cmake.org/cmake/help/latest/module/CPack.html) support
* `ENABLE_PACKAGE_CONFIG` - Generate and install [package config file](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages).
* `ENABLE_STATIC_RUNTIME` - enable static runtime, useful for Windows
### Notes for Windows users
First advice - set `ENABLE_STATIC_RUNTIME` to ON. This will remove dependencies
on runtime DLLs.
Second advice is about Ogg, Vorbis and FLAC support. Searching external
libraries under Windows is a little bit tricky. The best wayis to use
[Vcpkg](https://github.com/Microsoft/vcpkg). You need to install static libogg,
libvorbis and libflac libraries:
vcpkg install libogg:x64-windows-static libvorbis:x64-windows-static
libflac:x64-windows-static libogg:x86-windows-static
libvorbis:x86-windows-static libflac:x86-windows-static
Then and add this parameter to cmake command line:
-DCMAKE_TOOLCHAIN_FILE=<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake
You also need to set `VCPKG_TARGET_TRIPLET` because you use static libraries:
-DVCPKG_TARGET_TRIPLET=x64-windows-static
## Submitting Patches.

29
cmake/FindSQLite3.cmake Normal file
View File

@ -0,0 +1,29 @@
# - Find SQLITE3
# Find the native SQLITE3 includes and libraries
#
# SQLITE3_INCLUDE_DIRS - where to find sqlite.h, etc.
# SQLITE3_LIBRARIES - List of libraries when using SQLITE3.
# SQLITE3_FOUND - True if SQLITE3 found.
if(SQLITE3_INCLUDE_DIR)
# Already in cache, be silent
set(SQLITE3_FIND_QUIETLY TRUE)
endif(SQLITE3_INCLUDE_DIR)
find_package (PkgConfig QUIET)
pkg_check_modules(PC_SQLITE3 QUIET sqlite3)
find_path(SQLITE3_INCLUDE_DIR sqlite3.h HINTS ${PC_SQLITE3_INCLUDEDIR} ${PC_SQLITE3_INCLUDE_DIRS} ${SQLITE3_ROOT})
find_library (SQLITE3_LIBRARY NAMES sqlite3 HINTS ${PC_SQLITE3_LIBDIR} ${PC_SQLITE3_LIBRARY_DIRS} ${SQLITE3_ROOT} PATH_SUFFIXES lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SQLITE3 DEFAULT_MSG SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
if (SQLITE3_FOUND)
set (SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
set (SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
endif (SQLITE3_FOUND)
mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)

View File

@ -0,0 +1,3 @@
@PACKAGE_INIT@
include (${CMAKE_CURRENT_LIST_DIR}/LibSndFileTargets.cmake)

View File

@ -51,8 +51,14 @@ if (ENABLE_EXPERIMENTAL)
find_package (Speex)
endif ()
find_package (SQLite3)
if (SQLITE3_FOUND)
set (HAVE_SQLITE3 1)
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)
@ -113,6 +119,7 @@ if (M_LIBRARY)
unset (M_LIBRARY)
endif ()
endif ()
mark_as_advanced (M_LIBRARY)
check_library_exists (sqlite3 sqlite3_close "" HAVE_SQLITE3)
@ -190,3 +197,45 @@ test_inline ()
if (NOT DISABLE_CPU_CLIP)
clip_mode ()
endif ()
if (MSVC)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif (MSVC)
if (ENABLE_STATIC_RUNTIME)
if (MSVC)
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)
endif (MSVC)
if (MINGW)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
endif (MINGW)
elseif (NOT ENABLE_STATIC_RUNTIME)
if (MSVC)
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)
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)

View File

@ -101,6 +101,9 @@ if (NOT DEFINED ${VARIABLE})
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)

View File

@ -34,6 +34,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine01 HAVE_DLFCN_H
/* Define to 1 if you have the <direct.h> header file. */
#cmakedefine HAVE_DIRECT_H
/* Define to 1 if you have the <endian.h> header file. */
#cmakedefine01 HAVE_ENDIAN_H
@ -197,7 +200,7 @@
#define PACKAGE_NAME "@CPACK_PACKAGE_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION@"
#define PACKAGE_STRING "@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION_FULL@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@CPACK_PACKAGE_NAME@"
@ -206,7 +209,7 @@
#define PACKAGE_URL "@PACKAGE_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@CPACK_PACKAGE_VERSION@"
#define PACKAGE_VERSION "@CPACK_PACKAGE_VERSION_FULL@"
/* Set to maximum allowed value of sf_count_t type. */
#define SF_COUNT_MAX @SF_COUNT_MAX@