mirror of
https://github.com/audacity/libmad.git
synced 2025-12-11 19:56:54 -06:00
Adds a CMake build support
detect_fpm is added to detect FPM mode during the compile time
This commit is contained in:
parent
c40aa4e2e3
commit
a1920b5096
76
CMakeLists.txt
Normal file
76
CMakeLists.txt
Normal file
@ -0,0 +1,76 @@
|
||||
cmake_minimum_required( VERSION 3.15 )
|
||||
|
||||
project( libmad )
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
set( TARGET libmad )
|
||||
|
||||
cmake_dependent_option( BUILD_SHARED "Build a shared library" Off "NOT WIN32" Off)
|
||||
option( OPT_ACCURACY "Favour accuracy" On)
|
||||
option( OPT_SPEED "Favour speed" Off)
|
||||
option( OPT_SSO "Enable a fast subband synthesis approximation optimization" Off)
|
||||
|
||||
if( BUILD_SHARED )
|
||||
add_library( ${TARGET} SHARED )
|
||||
else()
|
||||
add_library( ${TARGET} STATIC )
|
||||
endif()
|
||||
|
||||
set(EXPORTED_HEADERS
|
||||
detect_fpm.h
|
||||
version.h
|
||||
fixed.h
|
||||
bit.h
|
||||
timer.h
|
||||
stream.h
|
||||
frame.h
|
||||
synth.h
|
||||
decoder.h
|
||||
)
|
||||
|
||||
target_sources( ${TARGET}
|
||||
PRIVATE
|
||||
bit.c
|
||||
decoder.c
|
||||
fixed.c
|
||||
frame.c
|
||||
huffman.c
|
||||
layer12.c
|
||||
layer3.c
|
||||
stream.c
|
||||
synth.c
|
||||
timer.c
|
||||
version.c
|
||||
)
|
||||
|
||||
target_include_directories( ${TARGET} PRIVATE . "${CMAKE_BINARY_DIR}/include" )
|
||||
|
||||
target_compile_definitions( ${TARGET}
|
||||
PRIVATE
|
||||
HAVE_CONFIG_H
|
||||
OPT_ACCURACY
|
||||
${FPM}
|
||||
)
|
||||
|
||||
target_compile_options( ${TARGET}
|
||||
PRIVATE
|
||||
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:-Wall>
|
||||
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:-fPIC>
|
||||
)
|
||||
|
||||
set (MAD_H "${CMAKE_BINARY_DIR}/include/mad.h")
|
||||
|
||||
configure_file( config.h.in "${CMAKE_BINARY_DIR}/include/config.h" )
|
||||
configure_file( mad.h.in "${MAD_H}" )
|
||||
|
||||
foreach( header ${EXPORTED_HEADERS} )
|
||||
file( READ ${header} HEADER_DATA )
|
||||
file( APPEND ${MAD_H} "// #include \"${header}\"\n\n${HEADER_DATA}\n" )
|
||||
endforeach()
|
||||
|
||||
file( APPEND ${MAD_H} "#endif\n" )
|
||||
|
||||
|
||||
install(TARGETS ${TARGET})
|
||||
install(FILES ${MAD_H} DESTINATION TYPE INCLUDE)
|
||||
181
config.h.in
181
config.h.in
@ -7,183 +7,106 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id: acconfig.h,v 1.2 2001-10-21 22:26:32 dmazzoni Exp $
|
||||
*/
|
||||
|
||||
# ifndef LIBMAD_CONFIG_H
|
||||
# define LIBMAD_CONFIG_H
|
||||
# define LIBMAD_CONFIG_H 1
|
||||
|
||||
#include "detect_fpm.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Definitions selected automatically by `configure' *
|
||||
*****************************************************************************/
|
||||
|
||||
/* Define to optimize for speed over accuracy. */
|
||||
#undef OPT_SPEED
|
||||
|
||||
#cmakedefine OPT_SPEED 1
|
||||
/* Define to optimize for accuracy over speed. */
|
||||
#undef OPT_ACCURACY
|
||||
|
||||
#cmakedefine OPT_ACCURACY 1
|
||||
/* Define to enable a fast subband synthesis approximation optimization. */
|
||||
#undef OPT_SSO
|
||||
|
||||
#cmakedefine OPT_SSO 1
|
||||
/* Define to influence a strict interpretation of the ISO/IEC standards,
|
||||
even if this is in opposition with best accepted practices. */
|
||||
#undef OPT_STRICT
|
||||
|
||||
#cmakedefine OPT_STRICT 1
|
||||
/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
|
||||
#undef HAVE_MADD_ASM
|
||||
|
||||
#cmakedefine HAVE_MADD_ASM 1
|
||||
/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
|
||||
#undef HAVE_MADD16_ASM
|
||||
|
||||
#cmakedefine HAVE_MADD16_ASM 1
|
||||
/* Define to enable diagnostic debugging support. */
|
||||
#undef DEBUG
|
||||
|
||||
#cmakedefine DEBUG 1
|
||||
/* Define to disable debugging assertions. */
|
||||
#undef NDEBUG
|
||||
|
||||
#cmakedefine NDEBUG 1
|
||||
/* Define to enable experimental code. */
|
||||
#undef EXPERIMENTAL
|
||||
|
||||
|
||||
#cmakedefine EXPERIMENTAL 1
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define to enable diagnostic debugging support. */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define to enable experimental code. */
|
||||
#undef EXPERIMENTAL
|
||||
|
||||
#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#undef HAVE_ASSERT_H
|
||||
|
||||
#cmakedefine HAVE_ASSERT_H 1
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
#cmakedefine HAVE_DLFCN_H 1
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
#cmakedefine HAVE_ERRNO_H 1
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
#cmakedefine HAVE_FCNTL 1
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
#cmakedefine HAVE_FCNTL_H 1
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
#cmakedefine HAVE_FORK 1
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
|
||||
#undef HAVE_MADD16_ASM
|
||||
|
||||
/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
|
||||
#undef HAVE_MADD_ASM
|
||||
|
||||
#cmakedefine HAVE_LIMITS_H 1
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
#cmakedefine HAVE_MEMORY_H 1
|
||||
/* Define to 1 if you have the `pipe' function. */
|
||||
#undef HAVE_PIPE
|
||||
|
||||
#cmakedefine HAVE_PIPE 1
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
#cmakedefine HAVE_SYS_WAIT_H 1
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
/* Define to 1 if you have the `waitpid' function. */
|
||||
#undef HAVE_WAITPID
|
||||
|
||||
#cmakedefine HAVE_WAITPID 1
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to disable debugging assertions. */
|
||||
#undef NDEBUG
|
||||
|
||||
/* Define to optimize for accuracy over speed. */
|
||||
#undef OPT_ACCURACY
|
||||
|
||||
/* Define to optimize for speed over accuracy. */
|
||||
#undef OPT_SPEED
|
||||
|
||||
/* Define to enable a fast subband synthesis approximation optimization. */
|
||||
#undef OPT_SSO
|
||||
|
||||
#cmakedefine LT_OBJDIR "@LT_OBJDIR@"
|
||||
/* Define to influence a strict interpretation of the ISO/IEC standards, even
|
||||
if this is in opposition with best accepted practices. */
|
||||
#undef OPT_STRICT
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
#cmakedefine PACKAGE "@PACKAGES"
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
#cmakedefine PACKAGE_URL "@PACKAGE_URL@"
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
#cmakedefine VERSION "@VERSION@"
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
@ -192,23 +115,19 @@
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
#cmakedefine const @const@
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#cmakedefine inline @const@
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#cmakedefine pid_t @pid_t@
|
||||
/* End of automatically configured definitions */
|
||||
|
||||
#endif
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
/*****************************************************************************
|
||||
* End of automatically configured definitions *
|
||||
*****************************************************************************/
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
43
detect_fpm.h
Normal file
43
detect_fpm.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* detect_fpm.h. */
|
||||
/*
|
||||
* libmad - MPEG audio decoder library
|
||||
* Copyright (C) 2000-2001 Robert Leslie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* $Id: acconfig.h,v 1.2 2001-10-21 22:26:32 dmazzoni Exp $
|
||||
*/
|
||||
|
||||
#ifndef _DETECT_FPM_H_
|
||||
#define _DETECT_FPM_H_
|
||||
|
||||
#if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__arm64__) || defined(__aarch64__) || defined(__ppc64__) || defined(__mips64)
|
||||
# define FPM_64BIT
|
||||
#elif defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL)
|
||||
# define FPM_INTEL
|
||||
#elif defined(arm) || defined(__arm__) || defined(ARM) || defined(_ARM_)
|
||||
# define FPM_ARM
|
||||
#elif defined(__PPC__) || defined(__powerpc__) || defined(__powerpc) || defined(___M_PPC)
|
||||
# define FPM_PPC
|
||||
#elif (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)
|
||||
# define FPM_MIPS
|
||||
#else
|
||||
# define FPM_DEFAULT
|
||||
#endif
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
/* The case is that some of the CMake generators won't the propper int size detection */
|
||||
/* This will fail horribly on 16 bit CPUs */
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
#endif
|
||||
23
mad.h.in
Normal file
23
mad.h.in
Normal file
@ -0,0 +1,23 @@
|
||||
/* mad.h.in. */
|
||||
/*
|
||||
* libmad - MPEG audio decoder library
|
||||
* Copyright (C) 2000-2001 Robert Leslie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* $Id: acconfig.h,v 1.2 2001-10-21 22:26:32 dmazzoni Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MAD_H_
|
||||
#define _MAD_H_
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user