2016-07-26 08:41:17 +00:00
cmake_minimum_required ( VERSION 3.1.3 )
2014-07-31 12:07:39 +00:00
2017-04-06 05:15:43 +00:00
project ( libsndfile VERSION 1.0.29 )
2014-07-12 08:00:51 +00:00
2016-07-26 08:41:17 +00:00
#
# Variables
#
2014-10-28 10:00:02 +00:00
2016-07-26 08:41:17 +00:00
set ( CMAKE_C_STANDARD 99 )
set ( CMAKE_C_STANDARD_REQUIRED TRUE )
2017-04-13 06:11:02 +00:00
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
2018-08-19 03:56:17 +00:00
set ( PACKAGE_NAME ${ PROJECT_NAME } )
2017-04-13 06:11:02 +00:00
set ( CPACK_PACKAGE_VERSION_MAJOR ${ PROJECT_VERSION_MAJOR } )
set ( CPACK_PACKAGE_VERSION_MINOR ${ PROJECT_VERSION_MINOR } )
set ( CPACK_PACKAGE_VERSION_PATCH ${ PROJECT_VERSION_PATCH } )
set ( CPACK_PACKAGE_VERSION_STAGE "pre1" )
set ( CPACK_PACKAGE_VERSION_FULL "${PROJECT_VERSION}${CPACK_PACKAGE_VERSION_STAGE}" )
2016-07-02 01:47:31 +00:00
2016-07-26 08:41:17 +00:00
#
# System-wide includes
#
2016-07-02 01:47:31 +00:00
2016-07-26 08:41:17 +00:00
include ( GNUInstallDirs )
include ( FeatureSummary )
2017-04-13 06:11:02 +00:00
include ( CMakeDependentOption )
2018-08-19 03:56:17 +00:00
include ( CTest )
2016-07-02 01:47:31 +00:00
2016-07-26 08:41:17 +00:00
#
# Options
#
2016-07-02 01:47:31 +00:00
2018-08-19 03:56:17 +00:00
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 ( )
2017-04-09 12:31:46 +00:00
option ( BUILD_PROGRAMS "Build programs" ON )
2017-04-13 06:11:02 +00:00
option ( BUILD_EXAMPLES "Build examples" ON )
option ( ENABLE_CPACK "Enable CPack support" ON )
2016-07-26 08:41:17 +00:00
option ( ENABLE_EXPERIMENTAL "Enable experimental code" OFF )
2017-04-13 06:11:02 +00:00
option ( ENABLE_BOW_DOCS "Enable black-on-white html docs" OFF )
if ( MSVC OR MINGW )
option ( ENABLE_STATIC_RUNTIME "Enable static runtime" OFF )
endif ( )
2018-08-19 03:56:17 +00:00
option ( ENABLE_PACKAGE_CONFIG "Generate and install package config file" ON )
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
2014-07-29 05:33:18 +00:00
2016-07-26 08:41:17 +00:00
#
# Setup definitions
#
2014-07-29 05:33:18 +00:00
2018-08-25 20:03:09 +00:00
include ( SndFileChecks )
2014-07-29 05:33:18 +00:00
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
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 ( )
2018-08-20 05:47:26 +00:00
cmake_dependent_option ( ENABLE_COMPATIBLE_LIBSNDFILE_NAME "Set DLL name to libsndfile-1.dll (canonical name), sndfile.dll otherwise" OFF "WIN32;NOT MINGW;BUILD_SHARED_LIBS" OFF )
2018-08-19 03:56:17 +00:00
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" )
2018-08-20 03:03:50 +00:00
if ( WIN32 AND ( NOT MINGW ) AND BUILD_SHARED_LIBS )
add_feature_info ( ENABLE_COMPATIBLE_LIBSNDFILE_NAME ENABLE_COMPATIBLE_LIBSNDFILE_NAME "Set DLL name to libsndfile-1.dll (canonical name), sndfile.dll otherwise" )
endif ( )
2017-04-13 06:11:02 +00:00
if ( MSVC OR MINGW )
2018-08-19 03:56:17 +00:00
add_feature_info ( ENABLE_STATIC_RUNTIME ENABLE_STATIC_RUNTIME "Enable static runtime" )
endif ( )
2014-07-29 05:33:18 +00:00
2018-08-19 03:56:17 +00:00
set_package_properties ( Ogg PROPERTIES
T Y P E R E C O M M E N D E D
2016-07-26 08:41:17 +00:00
U R L " w w w . x i p h . o r g / o g g / "
D E S C R I P T I O N " l i b r a r y f o r m a n i p u l a t i n g o g g b i t s t r e a m s "
2018-08-19 03:56:17 +00:00
P U R P O S E " R e q u i r e d t o e n a b l e V o r b i s , S p e e x a n d O p u s s u p p o r t "
)
set_package_properties ( VorbisEnc PROPERTIES
T Y P E R E C O M M E N D E D
2016-07-26 08:41:17 +00:00
U R L " w w w . v o r b i s . c o m / "
D E S C R I P T I O N " o p e n s o u r c e l o s s y a u d i o c o d e c "
2018-08-19 03:56:17 +00:00
P U R P O S E " E n a b l e s V o r b i s s u p p o r t "
)
set_package_properties ( FLAC PROPERTIES
T Y P E R E C O M M E N D E D
2016-07-26 08:41:17 +00:00
U R L " w w w . x i p h . o r g / f l a c / "
D E S C R I P T I O N " F r e e L o s s l e s s A u d i o C o d e c L i b r a r y "
2018-08-19 03:56:17 +00:00
P U R P O S E " E n a b l e s F L A C s u p p o r t "
)
2016-07-26 08:41:17 +00:00
set_package_properties ( Speex PROPERTIES TYPE OPTIONAL
U R L " w w w . s p e e x . o r g / "
D E S C R I P T I O N " a n a u d i o c o d e c t u n e d f o r s p e e c h "
2018-08-19 03:56:17 +00:00
P U R P O S E " E n a b l e s e x p e r e m e n t a l S p e e x s u p p o r t "
)
set_package_properties ( SQLite3 PROPERTIES
T Y P E O P T I O N A L
2017-04-13 06:11:02 +00:00
U R L " w w w . s q l i t e . o r g / "
D E S C R I P T I O N " l i g h t w e i g h t S Q L d a t a b a s e e n g i n e . "
2018-08-19 03:56:17 +00:00
P U R P O S E " E n a b l e s r e g t e s t "
)
if ( BUILD_SHARED_LIBS )
set_package_properties ( PythonInterp PROPERTIES
T Y P E R E Q U I R E D
2017-05-24 06:16:54 +00:00
U R L " w w w . p y t h o n . o r g / "
D E S C R I P T I O N " P y t h o n i s a w i d e l y u s e d h i g h - l e v e l p r o g r a m m i n g l a n g u a g e . "
2018-08-19 03:56:17 +00:00
P U R P O S E " R e q u i r e d t o b u i l d s h a r e d l i b r a r i e s "
)
2017-05-24 06:16:54 +00:00
endif ( )
2014-07-29 05:33:18 +00:00
2016-07-26 08:41:17 +00:00
feature_summary ( WHAT ALL )
2016-07-02 23:12:54 +00:00
2016-07-26 08:41:17 +00:00
#
# Setup configuration
#
2016-07-02 23:12:54 +00:00
2017-04-09 23:06:16 +00:00
configure_file ( src/config.h.cmake src/config.h )
configure_file ( src/sndfile.h.in src/sndfile.h )
2016-07-02 23:12:54 +00:00
2018-08-19 03:56:17 +00:00
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 } )
2016-07-26 08:41:17 +00:00
if ( EXTERNAL_XIPH_LIBS )
set ( PC_PRIVATE_LIBS "-lFLAC -lvorbisenc" )
endif ( )
2018-08-19 03:56:17 +00:00
configure_file ( sndfile.pc.in sndfile.pc @ONLY )
2014-07-29 05:33:18 +00:00
2016-07-26 08:41:17 +00:00
#
# libsndfile
#
2014-07-12 08:00:51 +00:00
2016-07-26 08:41:17 +00:00
# Public libsndfile headers
2018-08-19 03:56:17 +00:00
set ( sndfile_HDRS
s r c / s n d f i l e . h h
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / s n d f i l e . h
)
2014-07-12 08:35:41 +00:00
2018-08-19 03:56:17 +00:00
#
# libsndfile static library
#
add_library ( sndfile
2016-07-26 08:41:17 +00:00
s r c / s f c o n f i g . h
s r c / s f e n d i a n . h
s r c / s f _ u n i s t d . h
2018-08-19 03:56:17 +00:00
s r c / c o m m o n . h
2016-07-26 08:41:17 +00:00
s r c / c o m m o n . c
s r c / f i l e _ i o . c
s r c / c o m m a n d . c
s r c / p c m . c
s r c / u l a w . c
s r c / a l a w . c
s r c / f l o a t 3 2 . c
s r c / d o u b l e 6 4 . c
s r c / i m a _ a d p c m . c
s r c / m s _ a d p c m . c
s r c / g s m 6 1 0 . c
s r c / d w v w . c
s r c / v o x _ a d p c m . c
s r c / i n t e r l e a v e . c
s r c / s t r i n g s . c
s r c / d i t h e r . c
s r c / c a r t . c
s r c / b r o a d c a s t . c
s r c / a u d i o _ d e t e c t . c
s r c / i m a _ o k i _ a d p c m . c
s r c / i m a _ o k i _ a d p c m . h
s r c / a l a c . c
s r c / c h u n k . c
2018-08-19 03:56:17 +00:00
s r c / o g g . h
2016-07-26 08:41:17 +00:00
s r c / o g g . c
2018-08-19 03:56:17 +00:00
s r c / c h a n m a p . h
2016-07-26 08:41:17 +00:00
s r c / c h a n m a p . c
2018-08-19 03:56:17 +00:00
s r c / i d 3 . c
$ < $ < B O O L : $ { WIN32 } > : s r c / w i n d o w s . c >
$ < $ < A N D : $ < B O O L : $ { WIN32 } > , $ < B O O L : $ { WIN32 } > > : s r c / v e r s i o n - m e t a d a t a . r c >
2016-07-26 08:41:17 +00:00
s r c / s n d f i l e . c
2014-07-12 08:00:51 +00:00
s r c / a i f f . c
s r c / a u . c
s r c / a v r . c
2014-07-12 16:37:10 +00:00
s r c / c a f . c
2014-07-12 08:00:51 +00:00
s r c / d w d . c
s r c / f l a c . c
s r c / g 7 2 x . c
s r c / h t k . c
s r c / i r c a m . c
s r c / m a c o s . c
s r c / m a t 4 . c
s r c / m a t 5 . c
s r c / n i s t . c
s r c / p a f . c
s r c / p v f . c
s r c / r a w . c
s r c / r x 2 . c
s r c / s d 2 . c
s r c / s d s . c
s r c / s v x . c
s r c / t x w . c
s r c / v o c . c
2016-07-26 08:41:17 +00:00
s r c / w v e . c
2014-07-12 08:00:51 +00:00
s r c / w 6 4 . c
2018-08-19 03:56:17 +00:00
s r c / w a v l i k e . h
2016-02-07 03:57:31 +00:00
s r c / w a v l i k e . c
2016-07-26 08:41:17 +00:00
s r c / w a v . c
2014-07-12 08:00:51 +00:00
s r c / x i . c
2016-07-26 08:41:17 +00:00
s r c / m p c 2 k . c
s r c / r f 6 4 . c
s r c / o g g _ v o r b i s . c
s r c / o g g _ s p e e x . c
s r c / o g g _ p c m . c
2017-05-19 21:15:24 +00:00
s r c / o g g _ o p u s . c
2018-08-19 03:56:17 +00:00
s r c / n m s _ a d p c m . c
2016-07-26 08:41:17 +00:00
s r c / G S M 6 1 0 / c o n f i g . h
s r c / G S M 6 1 0 / g s m . h
s r c / G S M 6 1 0 / g s m 6 1 0 _ p r i v . h
s r c / G S M 6 1 0 / a d d . c
s r c / G S M 6 1 0 / c o d e . c
s r c / G S M 6 1 0 / d e c o d e . c
s r c / G S M 6 1 0 / g s m _ c r e a t e . c
s r c / G S M 6 1 0 / g s m _ d e c o d e . c
s r c / G S M 6 1 0 / g s m _ d e s t r o y . c
s r c / G S M 6 1 0 / g s m _ e n c o d e . c
s r c / G S M 6 1 0 / g s m _ o p t i o n . c
s r c / G S M 6 1 0 / l o n g _ t e r m . c
s r c / G S M 6 1 0 / l p c . c
s r c / G S M 6 1 0 / p r e p r o c e s s . c
s r c / G S M 6 1 0 / r p e . c
s r c / G S M 6 1 0 / s h o r t _ t e r m . c
2018-08-19 03:56:17 +00:00
s r c / G S M 6 1 0 / t a b l e . c
2016-07-26 08:41:17 +00:00
s r c / G 7 2 x / g 7 2 x . h
s r c / G 7 2 x / g 7 2 x _ p r i v . h
s r c / G 7 2 x / g 7 2 1 . c
s r c / G 7 2 x / g 7 2 3 _ 1 6 . c
s r c / G 7 2 x / g 7 2 3 _ 2 4 . c
s r c / G 7 2 x / g 7 2 3 _ 4 0 . c
2018-08-19 03:56:17 +00:00
s r c / G 7 2 x / g 7 2 x . c
2016-07-26 08:41:17 +00:00
s r c / A L A C / A L A C A u d i o T y p e s . h
s r c / A L A C / A L A C B i t U t i l i t i e s . h
s r c / A L A C / E n d i a n P o r t a b l e . h
s r c / A L A C / a g l i b . h
s r c / A L A C / d p l i b . h
s r c / A L A C / m a t r i x l i b . h
s r c / A L A C / a l a c _ c o d e c . h
s r c / A L A C / s h i f t . h
s r c / A L A C / A L A C B i t U t i l i t i e s . c
s r c / A L A C / a g _ d e c . c
s r c / A L A C / a g _ e n c . c
s r c / A L A C / d p _ d e c . c
s r c / A L A C / d p _ e n c . c
s r c / A L A C / m a t r i x _ d e c . c
s r c / A L A C / m a t r i x _ e n c . c
s r c / A L A C / a l a c _ d e c o d e r . c
2018-08-19 03:56:17 +00:00
s r c / A L A C / a l a c _ e n c o d e r . c
$ { s n d f i l e _ H D R S }
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / c o n f i g . h
)
target_include_directories ( sndfile
P U B L I C
$ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c >
$ < I N S T A L L _ I N T E R F A C E : $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } >
$ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c >
)
target_link_libraries ( sndfile
P R I V A T E
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
$ < $ < B O O L : $ { H A V E _ E X T E R N A L _ X I P H _ L I B S } > : V o r b i s : : V o r b i s E n c >
$ < $ < B O O L : $ { H A V E _ E X T E R N A L _ X I P H _ L I B S } > : F L A C : : F L A C >
$ < $ < A N D : $ < B O O L : $ { E N A B L E _ E X P E R I M E N T A L } > , $ < B O O L : $ { H A V E _ E X T E R N A L _ X I P H _ L I B S } > , $ < B O O L : $ { H A V E _ S P E E X } > > : S p e e x : : S p e e x >
)
set_target_properties ( sndfile PROPERTIES
2018-08-20 05:47:26 +00:00
P U B L I C _ H E A D E R " $ { s n d f i l e _ H D R S } "
2018-08-19 03:56:17 +00:00
)
2016-07-26 08:41:17 +00:00
2018-08-20 03:03:50 +00:00
if ( ENABLE_COMPATIBLE_LIBSNDFILE_NAME )
set_target_properties ( sndfile PROPERTIES
R U N T I M E _ O U T P U T _ N A M E " l i b s n d f i l e - 1 "
)
endif ( )
2016-07-26 08:41:17 +00:00
if ( BUILD_SHARED_LIBS )
if ( WIN32 )
2017-04-26 07:20:44 +00:00
set ( VERSION_MAJOR ${ CPACK_PACKAGE_VERSION_MAJOR } )
set ( GEN_TOOL cmake )
2017-04-29 04:25:08 +00:00
set ( WIN_RC_VERSION "${CPACK_PACKAGE_VERSION_MAJOR},${CPACK_PACKAGE_VERSION_MINOR},${CPACK_PACKAGE_VERSION_PATCH}" )
set ( CLEAN_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
set ( PACKAGE_VERSION ${ CPACK_PACKAGE_VERSION } )
2017-04-26 07:20:44 +00:00
2018-08-19 03:56:17 +00:00
configure_file ( src/version-metadata.rc.in src/version-metadata.rc @ONLY )
endif ( )
2016-07-26 08:41:17 +00:00
2018-08-19 03:56:17 +00:00
set_target_properties ( sndfile PROPERTIES
S O V E R S I O N $ { P R O J E C T _ V E R S I O N _ M A J O R }
V E R S I O N $ { P R O J E C T _ V E R S I O N }
)
2016-07-26 08:41:17 +00:00
2017-05-24 06:16:54 +00:00
# Symbol files generation
if ( WIN32 )
2018-08-19 03:56:17 +00:00
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 ( )
2017-05-24 06:16:54 +00:00
if ( DEFINED SYMBOL_OS )
2018-08-19 03:56:17 +00:00
add_custom_command (
2017-05-24 06:16:54 +00:00
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c r e a t e _ s y m b o l s _ f i l e . p y $ { S Y M B O L _ O S } $ { P R O J E C T _ V E R S I O N _ M A J O R } > $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E }
2018-08-19 03:56:17 +00:00
C O M M E N T " G e n e r a t i n g $ { S Y M B O L _ F I L E N A M E } . . . "
)
2017-05-24 06:16:54 +00:00
2018-08-19 03:56:17 +00:00
add_custom_target ( GENFILES DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } /src/ ${ SYMBOL_FILENAME } )
2017-05-24 06:16:54 +00:00
if ( SYMBOL_OS MATCHES "win32" )
2018-08-19 03:56:17 +00:00
target_sources ( sndfile
P R I V A T E
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E }
)
elseif ( SYMBOL_OS MATCHES "darwin" )
add_dependencies ( sndfile GENFILES )
set_property ( TARGET sndfile APPEND_STRING PROPERTY
L I N K _ F L A G S " - W l , - e x p o r t e d _ s y m b o l s _ l i s t - W l , $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E } "
)
elseif ( SYMBOL_OS MATCHES "os" )
add_dependencies ( sndfile GENFILES )
set_property ( TARGET sndfile APPEND_STRING PROPERTY
L I N K _ F L A G S " - W l , - e x p o r t - s y m b o l s $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E } "
)
elseif ( UNIX )
add_dependencies ( sndfile GENFILES )
set_property ( TARGET sndfile APPEND_STRING PROPERTY
L I N K _ F L A G S " - W l , - - v e r s i o n - s c r i p t , $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s r c / $ { S Y M B O L _ F I L E N A M E } "
)
2017-05-24 06:16:54 +00:00
endif ( )
endif ( )
2018-08-19 03:56:17 +00:00
endif ( )
2016-07-26 08:41:17 +00:00
#
# Programs
#
2017-04-09 12:31:46 +00:00
if ( BUILD_PROGRAMS )
2016-07-26 08:41:17 +00:00
# sndfile-info
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-info
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - i n f o . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-info
P R I V A T E
s n d f i l e
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
# sndfile-play
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-play
$ < $ < N O T : $ < B O O L : $ { B E O S } > > : p r o g r a m s / s n d f i l e - p l a y . c >
$ < $ < N O T : $ < B O O L : $ { B E O S } > > : p r o g r a m s / c o m m o n . c >
$ < $ < N O T : $ < B O O L : $ { B E O S } > > : p r o g r a m s / s n d f i l e - p l a y . c >
$ < $ < B O O L : $ { B E O S } > : p r o g r a m s / s n d f i l e - p l a y - b e o s . c p p >
)
target_link_libraries ( sndfile-play PRIVATE sndfile )
2017-04-09 12:31:46 +00:00
if ( WIN32 )
2018-03-17 09:09:52 +00:00
target_link_libraries ( sndfile-play PRIVATE winmm )
2017-04-09 12:31:46 +00:00
# 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 } )
2018-08-19 03:56:17 +00:00
target_link_libraries ( sndfile-play PRIVATE ${ ALSA_LIBRARIES } )
elseif ( ( NOT BEOS ) AND SNDIO_FOUND )
target_link_libraries ( sndfile-play PRIVATE Sndio::Sndio )
2017-04-09 12:31:46 +00:00
endif ( )
2016-07-26 08:41:17 +00:00
# sndfile-convert
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-convert
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - c o n v e r t . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-convert PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-cmp
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-cmp
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - c m p . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-cmp PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-metadata-set
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-metadata-set
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - m e t a d a t a - s e t . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-metadata-set PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-metadata-get
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-metadata-get
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - m e t a d a t a - g e t . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-metadata-get PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-interleave
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-interleave
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - i n t e r l e a v e . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-interleave PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-deinterleave
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-deinterleave
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - d e i n t e r l e a v e . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-deinterleave PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-concat
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-concat
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - c o n c a t . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-concat PRIVATE sndfile )
2016-07-26 08:41:17 +00:00
# sndfile-salvage
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-salvage
2017-04-09 12:31:46 +00:00
p r o g r a m s / s n d f i l e - s a l v a g e . c
p r o g r a m s / c o m m o n . c
2018-08-19 03:56:17 +00:00
p r o g r a m s / c o m m o n . h
)
target_link_libraries ( sndfile-salvage PRIVATE sndfile )
2017-04-09 12:31:46 +00:00
2017-04-13 06:11:02 +00:00
set ( SNDFILE_PROGRAM_TARGETS
2017-04-09 12:31:46 +00:00
s n d f i l e - i n f o
s n d f i l e - p l a y
s n d f i l e - c o n v e r t
s n d f i l e - c m p
s n d f i l e - m e t a d a t a - s e t
s n d f i l e - m e t a d a t a - g e t
s n d f i l e - i n t e r l e a v e
s n d f i l e - d e i n t e r l e a v e
s n d f i l e - c o n c a t
2018-08-19 03:56:17 +00:00
s n d f i l e - s a l v a g e
)
2017-04-09 12:31:46 +00:00
2017-04-13 06:11:02 +00:00
set_target_properties ( ${ SNDFILE_PROGRAM_TARGETS } PROPERTIES FOLDER Programs )
2018-08-19 03:56:17 +00:00
endif ( )
2016-07-26 08:41:17 +00:00
2017-04-13 06:11:02 +00:00
#
# Examples
#
if ( BUILD_EXAMPLES )
# sndfile-to-text
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-to-text examples/sndfile-to-text.c )
target_link_libraries ( sndfile-to-text PRIVATE sndfile )
2017-04-13 06:11:02 +00:00
# sndfile-loopify
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-loopify examples/sndfile-loopify.c )
target_link_libraries ( sndfile-loopify PRIVATE sndfile )
2017-04-13 06:11:02 +00:00
# make_sine
2018-08-19 03:56:17 +00:00
add_executable ( make_sine examples/make_sine.c )
target_link_libraries ( make_sine
P R I V A T E
s n d f i l e
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2017-04-13 06:11:02 +00:00
# sfprocess
2018-08-19 03:56:17 +00:00
add_executable ( sfprocess examples/sfprocess.c )
target_link_libraries ( sfprocess
P R I V A T E
s n d f i l e
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2017-04-13 06:11:02 +00:00
# list_formats
2018-08-19 03:56:17 +00:00
add_executable ( list_formats examples/list_formats.c )
target_link_libraries ( list_formats
P R I V A T E
s n d f i l e
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2017-04-13 06:11:02 +00:00
# sndfilehandle
2018-08-19 03:56:17 +00:00
add_executable ( sndfilehandle examples/sndfilehandle.cc )
target_link_libraries ( sndfilehandle PUBLIC sndfile )
2017-04-13 06:11:02 +00:00
set ( SNDFILE_EXAMPLE_TARGETS
s n d f i l e - t o - t e x t
s n d f i l e - l o o p i f y
m a k e _ s i n e
s f p r o c e s s
l i s t _ f o r m a t s
2018-08-19 03:56:17 +00:00
s n d f i l e h a n d l e
)
2017-04-13 06:11:02 +00:00
set_target_properties ( ${ SNDFILE_EXAMPLE_TARGETS } PROPERTIES FOLDER Examples )
2018-08-19 03:56:17 +00:00
endif ( )
2017-04-13 06:11:02 +00:00
#
# sndfile-regtest
#
if ( BUILD_REGTEST )
2018-08-19 03:56:17 +00:00
add_executable ( sndfile-regtest
2017-04-13 06:11:02 +00:00
r e g t e s t / s n d f i l e - r e g t e s t . c
r e g t e s t / d a t a b a s e . c
2018-08-19 03:56:17 +00:00
r e g t e s t / c h e c k s u m . c
)
target_link_libraries ( sndfile-regtest
P R I V A T E
s n d f i l e
S Q L i t e 3 : : S Q L i t e 3
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
endif ( )
2017-04-13 06:11:02 +00:00
2016-07-26 08:41:17 +00:00
#
# Installation
#
2017-04-13 06:11:02 +00:00
if ( ENABLE_PACKAGE_CONFIG )
if ( UNIX )
2018-08-19 03:56:17 +00:00
set ( CMAKE_INSTALL_PACKAGEDIR ${ CMAKE_INSTALL_LIBDIR } /cmake/SndFile )
2017-04-13 06:11:02 +00:00
elseif ( WIN32 )
2018-08-19 03:56:17 +00:00
set ( CMAKE_INSTALL_PACKAGEDIR cmake )
2017-04-13 06:11:02 +00:00
endif ( )
2018-08-19 03:56:17 +00:00
install ( TARGETS sndfile ${ SNDFILE_PROGRAM_TARGETS }
E X P O R T S n d F i l e C o n f i g
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
P U B L I C _ H E A D E R D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ I N C L U D E D I R }
)
2017-04-13 06:11:02 +00:00
include ( CMakePackageConfigHelpers )
2018-08-19 03:56:17 +00:00
write_basic_package_version_file ( SndFileConfigVersion.cmake COMPATIBILITY SameMajorVersion )
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
install ( EXPORT SndFileConfig
N A M E S P A C E S n d F i l e : :
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P A C K A G E D I R }
)
install (
F I L E S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / S n d F i l e C o n f i g V e r s i o n . c m a k e
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P A C K A G E D I R }
)
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
else ( )
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
install ( TARGETS sndfile ${ sdnfile_PROGRAMS }
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
P U B L I C _ H E A D E R D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } )
2016-07-26 08:41:17 +00:00
2018-08-19 03:56:17 +00:00
endif ( )
2017-04-13 06:11:02 +00:00
2016-07-26 08:41:17 +00:00
if ( Unix )
set ( man_MANS
m a n / s n d f i l e - i n f o . 1
m a n / s n d f i l e - p l a y . 1
m a n / s n d f i l e - c o n v e r t . 1
m a n / s n d f i l e - c m p . 1
m a n / s n d f i l e - m e t a d a t a - g e t . 1
#man/sndfile-metadata-set.1
m a n / s n d f i l e - c o n c a t . 1
m a n / s n d f i l e - i n t e r l e a v e . 1
#man/sndfile-deinterleave.1
2018-08-19 03:56:17 +00:00
m a n / s n d f i l e - s a l v a g e . 1
)
2016-07-26 08:41:17 +00:00
install ( FILES ${ man_MANS } DESTINATION ${ CMAKE_INSTALL_MANDIR } /man1 PATTERN "*.1" )
endif ( )
2017-04-13 06:11:02 +00:00
if ( ENABLE_BOW_DOCS )
set ( HTML_BGCOLOUR "white" )
set ( HTML_FGCOLOUR "black" )
2018-08-19 03:56:17 +00:00
else ( )
2017-04-13 06:11:02 +00:00
set ( HTML_BGCOLOUR "black" )
set ( HTML_FGCOLOUR "white" )
endif ( )
2017-04-09 23:06:16 +00:00
configure_file ( doc/libsndfile.css.in doc/libsndfile.css )
2016-07-26 08:41:17 +00:00
set ( html_DATA
d o c / i n d e x . h t m l
d o c / l i b s n d f i l e . j p g
2017-04-09 23:06:16 +00:00
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / d o c / l i b s n d f i l e . c s s "
2016-07-26 08:41:17 +00:00
d o c / p r i n t . c s s
d o c / a p i . h t m l
d o c / c o m m a n d . h t m l
d o c / b u g s . h t m l
d o c / s n d f i l e _ i n f o . h t m l
d o c / n e w _ f i l e _ t y p e . H O W T O
d o c / w i n 3 2 . h t m l
d o c / F A Q . h t m l
d o c / l i s t s . h t m l
d o c / e m b e d d e d _ f i l e s . h t m l
d o c / o c t a v e . h t m l
2018-08-19 03:56:17 +00:00
d o c / t u t o r i a l . h t m l
)
2017-04-09 09:02:51 +00:00
install ( FILES ${ html_DATA } DESTINATION ${ CMAKE_INSTALL_DOCDIR } )
2016-07-26 08:41:17 +00:00
2017-04-09 23:06:16 +00:00
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /sndfile.pc DESTINATION ${ CMAKE_INSTALL_LIBDIR } /pkgconfig )
2016-07-26 08:41:17 +00:00
#
# Testing
#
if ( BUILD_TESTING )
2018-08-19 03:56:17 +00:00
2017-04-13 06:11:02 +00:00
enable_testing ( )
2017-04-10 13:46:31 +00:00
2018-08-25 20:03:09 +00:00
include ( CMakeAutoGen )
2018-08-19 03:56:17 +00:00
2017-04-10 13:46:31 +00:00
# generate tests sources from autogen templates
2018-08-19 03:56:17 +00:00
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 )
2017-04-10 13:46:31 +00:00
# utils static library
add_library ( test_utils STATIC tests/utils.c )
2018-08-19 03:56:17 +00:00
target_link_libraries ( test_utils PRIVATE sndfile )
2017-04-25 11:58:46 +00:00
target_include_directories ( test_utils PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/tests" )
2016-07-26 08:41:17 +00:00
### test_main
2018-08-19 03:56:17 +00:00
add_executable ( test_main
2016-07-26 08:41:17 +00:00
s r c / t e s t _ m a i n . c
s r c / t e s t _ m a i n . h
s r c / t e s t _ c o n v e r s i o n s . c
s r c / t e s t _ f l o a t . c
s r c / t e s t _ e n d s w a p . c
s r c / t e s t _ a u d i o _ d e t e c t . c
s r c / t e s t _ l o g _ p r i n t f . c
s r c / t e s t _ f i l e _ i o . c
s r c / t e s t _ i m a _ o k i _ a d p c m . c
s r c / t e s t _ s t r n c p y _ c r l f . c
s r c / t e s t _ b r o a d c a s t _ v a r . c
s r c / t e s t _ c a r t _ v a r . c
2017-05-19 21:15:24 +00:00
s r c / t e s t _ b i n h e a d e r _ w r i t e f . c
2018-08-19 03:56:17 +00:00
s r c / t e s t _ n m s _ a d p c m . c
)
target_link_libraries ( test_main PRIVATE sndfile )
2017-04-13 06:11:02 +00:00
if ( MSVC )
target_compile_definitions ( test_main PRIVATE _USE_MATH_DEFINES )
2018-08-19 03:56:17 +00:00
endif ( )
2016-07-26 08:41:17 +00:00
add_test ( test_main test_main )
### sfversion_test
2018-08-19 03:56:17 +00:00
add_executable ( sfversion tests/sfversion.c )
target_link_libraries ( sfversion sndfile )
2016-07-26 08:41:17 +00:00
add_test ( sfversion sfversion )
set_tests_properties ( sfversion PROPERTIES
2018-08-19 03:56:17 +00:00
P A S S _ R E G U L A R _ E X P R E S S I O N " $ { P A C K A G E _ N A M E } - $ { C P A C K _ P A C K A G E _ V E R S I O N _ F U L L } "
)
2016-07-26 08:41:17 +00:00
### error_test
2018-08-19 03:56:17 +00:00
add_executable ( error_test tests/error_test.c )
target_link_libraries ( error_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( error_test error_test )
### ulaw_test
2018-08-19 03:56:17 +00:00
add_executable ( ulaw_test tests/ulaw_test.c )
target_link_libraries ( ulaw_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( ulaw_test ulaw_test )
### alaw_test
2018-08-19 03:56:17 +00:00
add_executable ( alaw_test tests/alaw_test.c )
target_link_libraries ( alaw_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( alaw_test alaw_test )
### dwvw_test
2018-08-19 03:56:17 +00:00
add_executable ( dwvw_test tests/dwvw_test.c )
target_link_libraries ( dwvw_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( dwvw_test dwvw_test )
### command_test
2018-08-19 03:56:17 +00:00
add_executable ( command_test tests/command_test.c )
target_link_libraries ( command_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( command_test command_test all )
### floating_point_test
2018-08-19 03:56:17 +00:00
add_executable ( floating_point_test
t e s t s / d f t _ c m p . c
t e s t s / f l o a t i n g _ p o i n t _ t e s t . c
)
target_link_libraries ( floating_point_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
target_include_directories ( floating_point_test PRIVATE tests )
2016-07-26 08:41:17 +00:00
add_test ( floating_point_test floating_point_test )
### checksum_test
2018-08-19 03:56:17 +00:00
add_executable ( checksum_test tests/checksum_test.c )
target_link_libraries ( checksum_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( checksum_test checksum_test )
### scale_clip_test
2018-08-19 03:56:17 +00:00
add_executable ( scale_clip_test tests/scale_clip_test.c )
target_link_libraries ( scale_clip_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( scale_clip_test scale_clip_test )
### headerless_test
2018-08-19 03:56:17 +00:00
add_executable ( headerless_test tests/headerless_test.c )
target_link_libraries ( headerless_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( headerless_test headerless_test )
### rdwr_test
2018-08-19 03:56:17 +00:00
add_executable ( rdwr_test tests/rdwr_test.c )
target_link_libraries ( rdwr_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( rdwr_test rdwr_test )
### locale_test
2018-08-19 03:56:17 +00:00
add_executable ( locale_test tests/locale_test.c )
target_link_libraries ( locale_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( locale_test locale_test )
### win32_ordinal_test
2018-08-19 03:56:17 +00:00
# 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 ()
2016-07-26 08:41:17 +00:00
### cpp_test
2018-08-19 03:56:17 +00:00
add_executable ( cpp_test tests/cpp_test.cc )
target_link_libraries ( cpp_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( cpp_test cpp_test )
### external_libs_test
2018-08-19 03:56:17 +00:00
add_executable ( external_libs_test tests/external_libs_test.c )
target_link_libraries ( external_libs_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( external_libs_test external_libs_test )
### format_check_test
2018-08-19 03:56:17 +00:00
add_executable ( format_check_test tests/format_check_test.c )
target_link_libraries ( format_check_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( format_check_test format_check_test )
### channel_test
2018-08-19 03:56:17 +00:00
add_executable ( channel_test tests/channel_test.c )
target_link_libraries ( channel_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( channel_test channel_test )
2017-04-10 13:46:31 +00:00
### pcm_test
2018-08-19 03:56:17 +00:00
add_executable ( pcm_test tests/pcm_test.c )
target_link_libraries ( pcm_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2017-04-10 13:46:31 +00:00
add_test ( pcm_test pcm_test )
2016-07-26 08:41:17 +00:00
### common test executables
2018-08-19 03:56:17 +00:00
add_executable ( write_read_test
t e s t s / g e n e r a t e . c
t e s t s / w r i t e _ r e a d _ t e s t . c
)
target_link_libraries ( write_read_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
target_include_directories ( write_read_test PRIVATE tests )
add_executable ( lossy_comp_test tests/lossy_comp_test.c )
target_link_libraries ( lossy_comp_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( peak_chunk_test tests/peak_chunk_test.c )
target_link_libraries ( peak_chunk_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( header_test tests/header_test.c )
target_link_libraries ( header_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( misc_test tests/misc_test.c )
target_link_libraries ( misc_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( string_test tests/string_test.c )
target_link_libraries ( string_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( multi_file_test tests/multi_file_test.c )
target_link_libraries ( multi_file_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( aiff_rw_test tests/aiff_rw_test.c )
target_link_libraries ( aiff_rw_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( chunk_test tests/chunk_test.c )
target_link_libraries ( chunk_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( long_read_write_test tests/long_read_write_test.c )
target_link_libraries ( long_read_write_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( raw_test tests/raw_test.c )
target_link_libraries ( raw_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( compression_size_test tests/compression_size_test.c )
target_link_libraries ( compression_size_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( ogg_test tests/ogg_test.c )
target_link_libraries ( ogg_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( stdin_test tests/stdin_test.c )
target_link_libraries ( stdin_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
set_target_properties ( stdin_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "tests" )
add_executable ( stdout_test tests/stdout_test.c )
target_link_libraries ( stdout_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
set_target_properties ( stdout_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "tests" )
add_executable ( stdio_test tests/stdio_test.c )
target_link_libraries ( stdio_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( pipe_test tests/pipe_test.c )
target_link_libraries ( pipe_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
add_executable ( virtual_io_test tests/virtual_io_test.c )
target_link_libraries ( virtual_io_test
P R I V A T E
s n d f i l e
t e s t _ u t i l s
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
### g72x_test
2018-08-19 03:56:17 +00:00
add_executable ( g72x_test src/G72x/g72x_test.c )
target_link_libraries ( g72x_test
P R I V A T E
s n d f i l e
$ < $ < B O O L : $ { L I B M _ R E Q U I R E D } > : m >
)
2016-07-26 08:41:17 +00:00
add_test ( g72x_test g72x_test all )
### aiff-tests
add_test ( write_read_test_aiff write_read_test aiff )
add_test ( lossy_comp_test_aiff_ulaw lossy_comp_test aiff_ulaw )
add_test ( lossy_comp_test_aiff_alaw lossy_comp_test aiff_alaw )
add_test ( lossy_comp_test_aiff_gsm610 lossy_comp_test aiff_gsm610 )
add_test ( peak_chunk_test_aiff peak_chunk_test aiff )
add_test ( header_test_aiff header_test aiff )
add_test ( misc_test_aiff misc_test aiff )
add_test ( string_test_aiff string_test aiff )
add_test ( multi_file_test_aiff multi_file_test aiff )
add_test ( aiff_rw_test aiff_rw_test )
### au-tests
add_test ( write_read_test_au write_read_test au )
add_test ( lossy_comp_test_au_ulaw lossy_comp_test au_ulaw )
add_test ( lossy_comp_test_au_alaw lossy_comp_test au_alaw )
add_test ( lossy_comp_test_au_g721 lossy_comp_test au_g721 )
add_test ( lossy_comp_test_au_g723 lossy_comp_test au_g723 )
add_test ( header_test_au header_test au )
add_test ( misc_test_au misc_test au )
add_test ( multi_file_test_au multi_file_test au )
### caf-tests
add_test ( write_read_test_caf write_read_test caf )
add_test ( lossy_comp_test_caf_ulaw lossy_comp_test caf_ulaw )
add_test ( lossy_comp_test_caf_alaw lossy_comp_test caf_alaw )
add_test ( header_test_caf header_test caf )
add_test ( peak_chunk_test_caf peak_chunk_test caf )
add_test ( misc_test_caf misc_test caf )
add_test ( chunk_test_caf chunk_test caf )
add_test ( string_test_caf string_test caf )
add_test ( long_read_write_test_alac long_read_write_test alac )
# wav-tests
add_test ( write_read_test_wav write_read_test wav )
add_test ( lossy_comp_test_wav_pcm lossy_comp_test wav_pcm )
add_test ( lossy_comp_test_wav_ima lossy_comp_test wav_ima )
add_test ( lossy_comp_test_wav_msadpcm lossy_comp_test wav_msadpcm )
add_test ( lossy_comp_test_wav_ulaw lossy_comp_test wav_ulaw )
add_test ( lossy_comp_test_wav_alaw lossy_comp_test wav_alaw )
add_test ( lossy_comp_test_wav_gsm610 lossy_comp_test wav_gsm610 )
add_test ( lossy_comp_test_wav_g721 lossy_comp_test wav_g721 )
2018-03-10 10:46:51 +00:00
add_test ( lossy_comp_test_wav_nmsadpcm lossy_comp_test wav_nmsadpcm )
2016-07-26 08:41:17 +00:00
add_test ( peak_chunk_test_wav peak_chunk_test wav )
add_test ( header_test_wav header_test wav )
add_test ( misc_test_wav misc_test wav )
add_test ( string_test_wav string_test wav )
add_test ( multi_file_test_wav multi_file_test wav )
add_test ( chunk_test_wav chunk_test wav )
### w64-tests
add_test ( write_read_test_w64 write_read_test w64 )
add_test ( lossy_comp_test_w64_ima lossy_comp_test w64_ima )
add_test ( lossy_comp_test_w64_msadpcm lossy_comp_test w64_msadpcm )
add_test ( lossy_comp_test_w64_ulaw lossy_comp_test w64_ulaw )
add_test ( lossy_comp_test_w64_alaw lossy_comp_test w64_alaw )
add_test ( lossy_comp_test_w64_gsm610 lossy_comp_test w64_gsm610 )
add_test ( header_test_w64 header_test w64 )
add_test ( misc_test_w64 misc_test w64 )
### rf64-tests
add_test ( write_read_test_rf64 write_read_test rf64 )
add_test ( header_test_rf64 header_test rf64 )
add_test ( misc_test_rf64 misc_test rf64 )
add_test ( string_test_rf64 string_test rf64 )
add_test ( peak_chunk_test_rf64 peak_chunk_test rf64 )
add_test ( chunk_test_rf64 chunk_test rf64 )
### raw-tests
add_test ( write_read_test_raw write_read_test raw )
add_test ( lossy_comp_test_raw_ulaw lossy_comp_test raw_ulaw )
add_test ( lossy_comp_test_raw_alaw lossy_comp_test raw_alaw )
add_test ( lossy_comp_test_raw_gsm610 lossy_comp_test raw_gsm610 )
add_test ( lossy_comp_test_vox_adpcm lossy_comp_test vox_adpcm )
add_test ( raw_test raw_test )
### paf-tests
add_test ( write_read_test_paf write_read_test paf )
add_test ( header_test_paf header_test paf )
add_test ( misc_test_paf misc_test paf )
### svx-tests
add_test ( write_read_test_svx write_read_test svx )
add_test ( header_test_svx header_test svx )
add_test ( misc_test_svx misc_test svx )
### nist-tests
add_test ( write_read_test_nist write_read_test nist )
add_test ( lossy_comp_test_nist_ulaw lossy_comp_test nist_ulaw )
add_test ( lossy_comp_test_nist_alaw lossy_comp_test nist_alaw )
add_test ( header_test_nist header_test nist )
add_test ( misc_test_nist misc_test nist )
### ircam-tests
add_test ( write_read_test_ircam write_read_test ircam )
add_test ( lossy_comp_test_ircam_ulaw lossy_comp_test ircam_ulaw )
add_test ( lossy_comp_test_ircam_alaw lossy_comp_test ircam_alaw )
add_test ( header_test_ircam header_test ircam )
add_test ( misc_test_ircam misc_test ircam )
### voc-tests
add_test ( write_read_test_voc write_read_test voc )
add_test ( lossy_comp_test_voc_ulaw lossy_comp_test voc_ulaw )
add_test ( lossy_comp_test_voc_alaw lossy_comp_test voc_alaw )
add_test ( header_test_voc header_test voc )
add_test ( misc_test_voc misc_test voc )
### mat4-tests
add_test ( write_read_test_mat4 write_read_test mat4 )
add_test ( header_test_mat4 header_test mat4 )
add_test ( misc_test_mat4 misc_test mat4 )
### mat5-tests
add_test ( write_read_test_mat5 write_read_test mat5 )
add_test ( header_test_mat5 header_test mat5 )
add_test ( misc_test_mat5 misc_test mat5 )
### pvf-tests
add_test ( write_read_test_pvf write_read_test pvf )
add_test ( header_test_pvf header_test pvf )
add_test ( misc_test_pvf misc_test pvf )
### xi-tests
add_test ( lossy_comp_test_xi_dpcm lossy_comp_test xi_dpcm )
### htk-tests
add_test ( write_read_test_htk write_read_test htk )
add_test ( header_test_htk header_test htk )
add_test ( misc_test_htk misc_test htk )
### avr-tests
add_test ( write_read_test_avr write_read_test avr )
add_test ( header_test_avr header_test avr )
add_test ( misc_test_avr misc_test avr )
### sds-tests
add_test ( write_read_test_sds write_read_test sds )
add_test ( header_test_sds header_test sds )
add_test ( misc_test_sds misc_test sds )
# sd2-tests
add_test ( write_read_test_sd2 write_read_test sd2 )
### wve-tests
add_test ( lossy_comp_test_wve lossy_comp_test wve )
### mpc2k-tests
add_test ( write_read_test_mpc2k write_read_test mpc2k )
add_test ( header_test_mpc2k header_test mpc2k )
add_test ( misc_test_mpc2k misc_test mpc2k )
### flac-tests
add_test ( write_read_test_flac write_read_test flac )
add_test ( compression_size_test_flac compression_size_test flac )
add_test ( string_test_flac string_test flac )
### vorbis-tests
add_test ( ogg_test ogg_test )
add_test ( compression_size_test_vorbis compression_size_test vorbis )
add_test ( lossy_comp_test_ogg_vorbis lossy_comp_test ogg_vorbis )
add_test ( string_test_ogg string_test ogg )
add_test ( misc_test_ogg misc_test ogg )
### io-tests
add_test ( stdio_test stdio_test )
add_test ( pipe_test pipe_test )
add_test ( virtual_io_test virtual_io_test )
2017-04-13 06:11:02 +00:00
set ( SNDFILE_TEST_TARGETS
t e s t _ u t i l s
t e s t _ m a i n
s f v e r s i o n
e r r o r _ t e s t
u l a w _ t e s t
a l a w _ t e s t
d w v w _ t e s t
c o m m a n d _ t e s t
f l o a t i n g _ p o i n t _ t e s t
c h e c k s u m _ t e s t
s c a l e _ c l i p _ t e s t
h e a d e r l e s s _ t e s t
r d w r _ t e s t
l o c a l e _ t e s t
c p p _ t e s t
e x t e r n a l _ l i b s _ t e s t
f o r m a t _ c h e c k _ t e s t
c h a n n e l _ t e s t
p c m _ t e s t
w r i t e _ r e a d _ t e s t
l o s s y _ c o m p _ t e s t
p e a k _ c h u n k _ t e s t
h e a d e r _ t e s t
m i s c _ t e s t
s t r i n g _ t e s t
m u l t i _ f i l e _ t e s t
a i f f _ r w _ t e s t
c h u n k _ t e s t
l o n g _ r e a d _ w r i t e _ t e s t
r a w _ t e s t
c o m p r e s s i o n _ s i z e _ t e s t
o g g _ t e s t
s t d i n _ t e s t
s t d o u t _ t e s t
s t d i o _ t e s t
p i p e _ t e s t
v i r t u a l _ i o _ t e s t
2018-08-19 03:56:17 +00:00
g 7 2 x _ t e s t
)
2017-04-13 06:11:02 +00:00
2018-08-19 03:56:17 +00:00
# if (WIN32 AND BUILD_SHARED_LIBS)
# list (APPEND SNDFILE_TEST_TARGETS win32_ordinal_test)
# endif ()
2017-04-13 06:11:02 +00:00
set_target_properties ( ${ SNDFILE_TEST_TARGETS } PROPERTIES FOLDER Tests )
2018-08-19 03:56:17 +00:00
endif ( )