2010-10-31 16:15:32 +00:00
|
|
|
# FluidSynth - A Software Synthesizer
|
2010-03-17 20:14:13 +00:00
|
|
|
#
|
2011-07-21 19:29:18 +00:00
|
|
|
# Copyright (C) 2003-2011 Peter Hanappe and others.
|
2010-03-17 20:14:13 +00:00
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
2017-07-12 15:45:23 +00:00
|
|
|
# modify it under the terms of the GNU Lesser General Public License
|
2017-07-12 15:53:03 +00:00
|
|
|
# as published by the Free Software Foundation; either version 2.1 of
|
2010-03-17 20:14:13 +00:00
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library 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
|
2017-07-12 15:45:23 +00:00
|
|
|
# Lesser General Public License for more details.
|
2010-03-17 20:14:13 +00:00
|
|
|
#
|
2017-07-12 15:54:54 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2010-03-17 20:14:13 +00:00
|
|
|
# License along with this library; if not, write to the Free
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA
|
|
|
|
|
|
|
|
# CMake based build system. Pedro Lopez-Cabanillas <plcl@users.sf.net>
|
|
|
|
|
2017-07-08 18:39:43 +00:00
|
|
|
cmake_minimum_required ( VERSION 3.0.2 )
|
2010-03-17 20:14:13 +00:00
|
|
|
project ( FluidSynth C )
|
|
|
|
set ( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_admin )
|
2017-10-27 17:40:40 +00:00
|
|
|
set ( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# FluidSynth package name
|
|
|
|
set ( PACKAGE "fluidsynth" )
|
|
|
|
|
|
|
|
# FluidSynth package version
|
|
|
|
set ( FLUIDSYNTH_VERSION_MAJOR 1 )
|
|
|
|
set ( FLUIDSYNTH_VERSION_MINOR 1 )
|
2017-10-12 15:14:40 +00:00
|
|
|
set ( FLUIDSYNTH_VERSION_MICRO 8 )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( VERSION "${FLUIDSYNTH_VERSION_MAJOR}.${FLUIDSYNTH_VERSION_MINOR}.${FLUIDSYNTH_VERSION_MICRO}" )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( FLUIDSYNTH_VERSION "\"${VERSION}\"" )
|
|
|
|
|
2010-08-08 12:04:58 +00:00
|
|
|
# libfluidsynth - Library version
|
|
|
|
# *** NOTICE ***
|
|
|
|
# Update library version upon each release (follow these steps in order)
|
|
|
|
# if any source code changes: REVISION++
|
|
|
|
# if any interfaces added/removed/changed: REVISION=0
|
|
|
|
# if any interfaces removed/changed (compatibility broken): CURRENT++
|
|
|
|
# if any interfaces have been added: AGE++
|
|
|
|
# if any interfaces have been removed/changed (compatibility broken): AGE=0
|
|
|
|
# This is not exactly the same algorithm as the libtool one, but the results are the same.
|
2010-10-16 18:27:29 +00:00
|
|
|
set ( LIB_VERSION_CURRENT 1 )
|
2017-09-03 09:19:56 +00:00
|
|
|
set ( LIB_VERSION_AGE 6 )
|
2017-10-12 15:14:40 +00:00
|
|
|
set ( LIB_VERSION_REVISION 1 )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( LIB_VERSION_INFO
|
2010-10-16 18:27:29 +00:00
|
|
|
"${LIB_VERSION_CURRENT}.${LIB_VERSION_AGE}.${LIB_VERSION_REVISION}" )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# Options disabled by default
|
|
|
|
option ( enable-floats "enable type float instead of double for DSP samples" off )
|
|
|
|
option ( enable-profiling "profile the dsp code" off )
|
2010-10-19 21:30:29 +00:00
|
|
|
option ( enable-portaudio "compile PortAudio support" off )
|
2010-03-17 20:14:13 +00:00
|
|
|
option ( enable-trap-on-fpe "enable SIGFPE trap on Floating Point Exceptions" off )
|
|
|
|
option ( enable-fpe-check "enable Floating Point Exception checks and debug messages" off )
|
|
|
|
option ( enable-debug "enable debugging (default=no)" off )
|
|
|
|
|
|
|
|
# Options enabled by default
|
2017-08-28 18:03:42 +00:00
|
|
|
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
|
2010-03-17 20:14:13 +00:00
|
|
|
option ( enable-libsndfile "compile libsndfile support (if it is available)" on )
|
|
|
|
option ( enable-aufile "compile support for sound file output" on )
|
2010-10-31 16:15:32 +00:00
|
|
|
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
|
2010-03-17 20:14:13 +00:00
|
|
|
option ( enable-jack "compile JACK support (if it is available)" on )
|
|
|
|
option ( enable-midishare "compile MidiShare support (if it is available)" on )
|
|
|
|
option ( enable-readline "compile readline lib line editing (if it is available)" on )
|
2010-06-25 11:12:49 +00:00
|
|
|
option ( enable-dbus "compile DBUS support (if it is available)" on )
|
2010-08-11 11:18:53 +00:00
|
|
|
option ( BUILD_SHARED_LIBS "Build a shared object or DLL" on )
|
2017-10-28 12:35:20 +00:00
|
|
|
option ( enable-ladspa "enable LADSPA effect units" on )
|
2014-07-02 06:10:07 +00:00
|
|
|
option ( enable-ipv6 "enable ipv6 support " on )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
2010-10-13 21:57:19 +00:00
|
|
|
# Platform specific options
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "Linux" )
|
|
|
|
option ( enable-ladcca "compile LADCCA support if it is available (deprecated)" off )
|
2010-10-13 21:57:19 +00:00
|
|
|
option ( enable-lash "compile LASH support (if it is available)" on )
|
|
|
|
option ( enable-alsa "compile ALSA support (if it is available)" on )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "Linux" )
|
2010-10-13 21:57:19 +00:00
|
|
|
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "Darwin" )
|
2010-10-13 21:57:19 +00:00
|
|
|
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
|
|
|
|
option ( enable-coremidi "compile CoreMIDI support (if it is available)" on )
|
2010-10-31 16:15:32 +00:00
|
|
|
option ( enable-framework "create a Mac OSX style FluidSynth.framework" on )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "Darwin" )
|
2010-10-13 21:57:19 +00:00
|
|
|
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "OS2" )
|
2010-10-13 21:57:19 +00:00
|
|
|
option ( enable-dart "compile DART support (if it is available)" on )
|
2016-01-18 09:16:37 +00:00
|
|
|
set ( enable-ipv6 off )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "OS2" )
|
2010-10-13 21:57:19 +00:00
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# Initialize the library directory name suffix.
|
|
|
|
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set ( _init_lib_suffix "64" )
|
|
|
|
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set ( _init_lib_suffix "" )
|
|
|
|
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( LIB_SUFFIX ${_init_lib_suffix} CACHE STRING
|
2010-03-17 20:14:13 +00:00
|
|
|
"library directory name suffix (32/64/nothing)" )
|
|
|
|
mark_as_advanced ( LIB_SUFFIX )
|
|
|
|
|
2010-10-16 17:27:47 +00:00
|
|
|
# Default install directory names
|
|
|
|
include ( DefaultDirs )
|
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# Basic C library checks
|
|
|
|
include ( CheckSTDC )
|
|
|
|
include ( CheckIncludeFile )
|
2017-07-07 13:33:43 +00:00
|
|
|
include ( CheckFunctionExists )
|
2010-03-17 20:14:13 +00:00
|
|
|
check_include_file ( string.h HAVE_STRING_H )
|
2010-10-31 16:15:32 +00:00
|
|
|
check_include_file ( stdlib.h HAVE_STDLIB_H )
|
|
|
|
check_include_file ( stdio.h HAVE_STDIO_H )
|
|
|
|
check_include_file ( math.h HAVE_MATH_H )
|
|
|
|
check_include_file ( errno.h HAVE_ERRNO_H )
|
|
|
|
check_include_file ( stdarg.h HAVE_STDARG_H )
|
|
|
|
check_include_file ( unistd.h HAVE_UNISTD_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
check_include_file ( memory.h HAVE_MEMORY_H )
|
2010-10-31 16:15:32 +00:00
|
|
|
check_include_file ( sys/mman.h HAVE_SYS_MMAN_H )
|
|
|
|
check_include_file ( sys/types.h HAVE_SYS_TYPES_H )
|
|
|
|
check_include_file ( sys/time.h HAVE_SYS_TIME_H )
|
|
|
|
check_include_file ( sys/stat.h HAVE_SYS_STAT_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
check_include_file ( sys/ioctl.h HAVE_SYS_IOCTL_H )
|
2010-10-31 16:15:32 +00:00
|
|
|
check_include_file ( fcntl.h HAVE_FCNTL_H )
|
|
|
|
check_include_file ( sys/socket.h HAVE_SYS_SOCKET_H )
|
|
|
|
check_include_file ( netinet/in.h HAVE_NETINET_IN_H )
|
|
|
|
check_include_file ( netinet/tcp.h HAVE_NETINET_TCP_H )
|
|
|
|
check_include_file ( arpa/inet.h HAVE_ARPA_INET_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
check_include_file ( limits.h HAVE_LIMITS_H )
|
2010-10-31 16:15:32 +00:00
|
|
|
check_include_file ( pthread.h HAVE_PTHREAD_H )
|
|
|
|
check_include_file ( signal.h HAVE_SIGNAL_H )
|
2012-03-11 11:49:49 +00:00
|
|
|
check_include_file ( getopt.h HAVE_GETOPT_H )
|
2017-11-04 11:53:44 +00:00
|
|
|
check_include_file ( stdint.h HAVE_STDINT_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
include ( TestInline )
|
2010-07-15 21:02:00 +00:00
|
|
|
include ( TestVLA )
|
2010-03-17 20:14:13 +00:00
|
|
|
include ( TestBigEndian )
|
|
|
|
test_big_endian ( WORDS_BIGENDIAN )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( LIBFLUID_CPPFLAGS CACHE )
|
|
|
|
unset ( LIBFLUID_LIBS CACHE )
|
|
|
|
unset ( FLUID_CPPFLAGS CACHE )
|
|
|
|
unset ( FLUID_LIBS CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# Options for the GNU C compiler only
|
2017-07-08 18:39:43 +00:00
|
|
|
if ( CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
|
2010-11-21 15:12:37 +00:00
|
|
|
if ( NOT APPLE AND NOT OS2 )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( CMAKE_EXE_LINKER_FLAGS
|
2010-03-17 20:14:13 +00:00
|
|
|
"${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed" )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( CMAKE_SHARED_LINKER_FLAGS
|
2010-03-17 20:14:13 +00:00
|
|
|
"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
|
2010-11-21 15:12:37 +00:00
|
|
|
endif ( NOT APPLE AND NOT OS2 )
|
2017-08-10 21:31:59 +00:00
|
|
|
|
2016-01-18 09:17:45 +00:00
|
|
|
if ( OS2 )
|
|
|
|
set ( GNUCC_VISIBILITY_FLAG "" )
|
|
|
|
else ( OS2 )
|
|
|
|
set ( GNUCC_VISIBILITY_FLAG "-fvisibility=hidden" )
|
|
|
|
endif ( OS2 )
|
|
|
|
|
2011-04-09 22:59:31 +00:00
|
|
|
set ( GNUCC_WARNING_FLAGS "-Wall -W -Wpointer-arith -Wbad-function-cast -Wno-cast-qual -Wcast-align -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement" )
|
2017-10-19 19:12:08 +00:00
|
|
|
set ( CMAKE_C_FLAGS_DEBUG "-std=gnu89 -g ${GNUCC_VISIBILITY_FLAG} -DDEBUG ${GNUCC_WARNING_FLAGS} -fsanitize=undefined" )
|
2016-01-18 09:17:45 +00:00
|
|
|
set ( CMAKE_C_FLAGS_RELEASE "-std=gnu89 -O2 -fomit-frame-pointer -finline-functions ${GNUCC_VISIBILITY_FLAG} -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
|
|
|
|
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-std=gnu89 -O2 -g -fomit-frame-pointer -finline-functions ${GNUCC_VISIBILITY_FLAG} -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
|
2017-07-08 18:39:43 +00:00
|
|
|
endif ( CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# Windows
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( WINDOWS_SUPPORT CACHE )
|
|
|
|
unset ( WINDOWS_LIBS CACHE )
|
|
|
|
unset ( MINGW32 CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( WIN32 )
|
2010-04-10 10:45:44 +00:00
|
|
|
include ( CheckIncludeFiles )
|
2010-03-17 20:14:13 +00:00
|
|
|
check_include_file ( windows.h HAVE_WINDOWS_H )
|
|
|
|
check_include_file ( io.h HAVE_IO_H )
|
|
|
|
check_include_file ( dsound.h HAVE_DSOUND_H )
|
2010-04-10 10:45:44 +00:00
|
|
|
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
|
|
|
|
set ( WINDOWS_LIBS "dsound;winmm;ws2_32" )
|
2017-10-01 08:17:22 +00:00
|
|
|
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
|
2010-07-15 17:10:34 +00:00
|
|
|
set ( CMAKE_DEBUG_POSTFIX "_debug" )
|
2010-03-17 20:14:13 +00:00
|
|
|
# MinGW compiler (a Windows GCC port)
|
2010-10-31 16:15:32 +00:00
|
|
|
if ( MINGW )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( MINGW32 1 )
|
|
|
|
add_definitions ( -mms-bitfields )
|
|
|
|
endif ( MINGW )
|
|
|
|
else ( WIN32 )
|
2010-10-31 16:15:32 +00:00
|
|
|
# Check PThreads, but not in Windows
|
2017-07-01 21:53:47 +00:00
|
|
|
find_package ( Threads REQUIRED )
|
|
|
|
set ( HAVE_LIBPTHREAD ${Threads_FOUND} )
|
|
|
|
set ( LIBFLUID_LIBS "m" ${CMAKE_THREAD_LIBS_INIT} )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( WIN32 )
|
|
|
|
|
|
|
|
# IBM OS/2
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( DART_SUPPORT CACHE )
|
2010-10-31 16:15:32 +00:00
|
|
|
unset ( DART_LIBS CACHE )
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( DART_INCLUDE_DIRS CACHE )
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "OS2" )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Zbin-files" )
|
2010-11-21 15:12:37 +00:00
|
|
|
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Zbin-files" )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-dart )
|
2014-03-15 12:20:50 +00:00
|
|
|
check_include_files ( "os2.h;os2me.h" HAVE_DART_H )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( DART_SUPPORT ${HAVE_DART_H} )
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( DART_INCLUDE_DIRS CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( enable-dart )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "OS2" )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# Solaris / SunOS
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "SunOS" )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( FLUID_LIBS "${FLUID_LIBS};nsl;socket" )
|
|
|
|
set ( LIBFLUID_LIBS "${LIBFLUID_LIBS};nsl;socket" )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "SunOS" )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
|
|
|
# Apple Mac OSX
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( COREAUDIO_SUPPORT CACHE )
|
2010-10-31 16:15:32 +00:00
|
|
|
unset ( COREAUDIO_LIBS CACHE )
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( COREMIDI_SUPPORT CACHE )
|
|
|
|
unset ( COREMIDI_LIBS CACHE )
|
2010-10-31 16:15:32 +00:00
|
|
|
unset ( DARWIN CACHE )
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( MACOSX_FRAMEWORK CACHE )
|
2016-01-21 12:25:21 +00:00
|
|
|
if ( CMAKE_SYSTEM MATCHES "Darwin" )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( DARWIN 1 )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( CMAKE_INSTALL_NAME_DIR
|
2010-10-16 17:27:47 +00:00
|
|
|
${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}${LIB_SUFFIX} )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-coreaudio )
|
|
|
|
check_include_file ( CoreAudio/AudioHardware.h COREAUDIO_FOUND )
|
|
|
|
if ( COREAUDIO_FOUND )
|
|
|
|
set ( COREAUDIO_SUPPORT ${COREAUDIO_FOUND} )
|
2010-10-17 18:12:30 +00:00
|
|
|
set ( COREAUDIO_LIBS "-Wl,-framework,CoreAudio,-framework,AudioUnit" )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( COREAUDIO_FOUND )
|
|
|
|
endif ( enable-coreaudio )
|
|
|
|
if ( enable-coremidi )
|
|
|
|
check_include_file ( CoreMIDI/MIDIServices.h COREMIDI_FOUND )
|
|
|
|
if ( COREMIDI_FOUND )
|
|
|
|
set ( COREMIDI_SUPPORT ${COREMIDI_FOUND} )
|
|
|
|
set ( COREMIDI_LIBS "-Wl,-framework,CoreMIDI,-framework,CoreServices" )
|
|
|
|
endif ( COREMIDI_FOUND )
|
|
|
|
endif ( enable-coremidi )
|
2010-10-13 21:57:19 +00:00
|
|
|
if ( enable-framework )
|
|
|
|
set ( MACOSX_FRAMEWORK 1 )
|
|
|
|
endif ( enable-framework )
|
2016-01-21 12:25:21 +00:00
|
|
|
endif ( CMAKE_SYSTEM MATCHES "Darwin" )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
2017-07-07 13:33:43 +00:00
|
|
|
|
|
|
|
unset ( HAVE_INETNTOP CACHE )
|
|
|
|
unset ( IPV6_SUPPORT CACHE )
|
|
|
|
CHECK_FUNCTION_EXISTS ( "inet_ntop" HAVE_INETNTOP )
|
|
|
|
if ( enable-ipv6 )
|
|
|
|
if ( HAVE_INETNTOP )
|
|
|
|
set ( IPV6_SUPPORT 1 )
|
|
|
|
endif ( HAVE_INETNTOP )
|
|
|
|
endif ( enable-ipv6 )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( WITH_FLOAT CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-floats )
|
|
|
|
set ( WITH_FLOAT 1 )
|
|
|
|
endif ( enable-floats )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( WITH_PROFILING CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-profiling )
|
|
|
|
set ( WITH_PROFILING 1 )
|
2010-10-31 16:15:32 +00:00
|
|
|
endif ( enable-profiling )
|
2010-03-17 20:14:13 +00:00
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( HAVE_LIBDL CACHE )
|
|
|
|
unset ( LADSPA_SUPPORT CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-ladspa )
|
|
|
|
check_include_file ( ladspa.h LADSPA_SUPPORT )
|
|
|
|
if ( LADSPA_SUPPORT )
|
2010-09-01 09:24:26 +00:00
|
|
|
set ( LADSPA 1 )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( CMAKE_DL_LIBS )
|
|
|
|
set ( HAVE_LIBDL 1 )
|
|
|
|
set ( LIBFLUID_LIBS "${LIBFLUID_LIBS};${CMAKE_DL_LIBS}" )
|
2010-10-31 16:15:32 +00:00
|
|
|
endif ( CMAKE_DL_LIBS )
|
|
|
|
endif ( LADSPA_SUPPORT )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( enable-ladspa )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( ENABLE_TRAPONFPE CACHE )
|
|
|
|
unset ( TRAP_ON_FPE CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-trap-on-fpe AND NOT APPLE AND NOT WIN32 )
|
|
|
|
set ( ENABLE_TRAPONFPE 1 )
|
|
|
|
set ( TRAP_ON_FPE 1 )
|
|
|
|
endif ( enable-trap-on-fpe AND NOT APPLE AND NOT WIN32 )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( ENABLE_FPECHECK CACHE )
|
2010-10-31 16:15:32 +00:00
|
|
|
unset ( FPE_CHECK CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-fpe-check )
|
|
|
|
set ( ENABLE_FPECHECK 1 )
|
|
|
|
set ( FPE_CHECK 1 )
|
|
|
|
endif ( enable-fpe-check )
|
2010-10-31 16:15:32 +00:00
|
|
|
|
|
|
|
if ( enable-debug )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
|
|
|
"Choose the build type, options: Debug Release RelWithDebInfo" FORCE )
|
|
|
|
endif ( enable-debug )
|
|
|
|
|
2012-08-04 16:58:48 +00:00
|
|
|
if ( NOT CMAKE_BUILD_TYPE )
|
|
|
|
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
|
|
|
"Choose the build type, options: Debug Release RelWithDebInfo" FORCE )
|
|
|
|
endif ( NOT CMAKE_BUILD_TYPE )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( ENABLE_DEBUG CACHE )
|
|
|
|
unset ( DEBUG CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( CMAKE_BUILD_TYPE MATCHES "Debug" )
|
|
|
|
set ( ENABLE_DEBUG 1 )
|
|
|
|
set ( DEBUG 1 )
|
|
|
|
endif ( CMAKE_BUILD_TYPE MATCHES "Debug" )
|
|
|
|
|
2017-08-28 18:03:42 +00:00
|
|
|
|
|
|
|
if(NOT enable-pkgconfig)
|
|
|
|
|
|
|
|
FIND_LIBRARY( GLIB_LIB NAMES glib glib-2.0 PATH GLIB_LIBRARY_DIR NO_DEFAULT_PATH)
|
|
|
|
FIND_LIBRARY( GTHREAD_LIB NAMES gthread gthread-2.0 PATH GTHREAD_LIBRARY_DIR NO_DEFAULT_PATH )
|
2017-11-11 23:53:57 +00:00
|
|
|
FIND_LIBRARY( GMODULE_LIB NAMES gmodule gmodule-2.0 PATH GMODULE_LIBRARY_DIR NO_DEFAULT_PATH )
|
2017-08-28 18:03:42 +00:00
|
|
|
FIND_PATH( GLIBH_DIR glib.h PATH GLIB_INCLUDE_DIR NO_DEFAULT_PATH )
|
|
|
|
FIND_PATH( GLIBCONF_DIR glibconfig.h PATH GLIBCONF_INCLUDE_DIR NO_DEFAULT_PATH )
|
|
|
|
|
|
|
|
IF( GLIB_LIB MATCHES "GLIB_LIB-NOTFOUND" OR
|
|
|
|
GTHREAD_LIB MATCHES "GTHREAD_LIB-NOTFOUND" OR
|
2017-11-11 23:53:57 +00:00
|
|
|
GMODULE_LIB MATCHES "GMODULE_LIB-NOTFOUND" OR
|
2017-08-28 18:03:42 +00:00
|
|
|
GLIBH_DIR MATCHES "GLIBH_DIR-NOTFOUND" OR
|
|
|
|
GLIBCONF_DIR MATCHES "GLIBCONF_DIR-NOTFOUND")
|
|
|
|
message( WARNING "Not sure if I found GLIB, continuing anyway.")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
SET( GLIB_INCLUDE_DIRS ${GLIBH_DIR} ${GLIBCONF_DIR} )
|
2017-11-11 23:53:57 +00:00
|
|
|
SET( GLIB_LIBRARIES ${GLIB_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} )
|
2017-08-28 18:03:42 +00:00
|
|
|
|
|
|
|
message( STATUS "GLIB_INCLUDE_DIRS: " ${GLIB_INCLUDE_DIRS} )
|
|
|
|
message( STATUS "GLIB_LIBRARIES: " ${GLIB_LIBRARIES} )
|
|
|
|
|
|
|
|
else(NOT enable-pkgconfig)
|
|
|
|
|
|
|
|
find_package ( PkgConfig REQUIRED )
|
|
|
|
|
|
|
|
# Mandatory libraries: glib and gthread
|
2017-11-11 23:53:57 +00:00
|
|
|
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 gmodule-2.0>=2.6.5 )
|
2017-08-28 18:03:42 +00:00
|
|
|
|
|
|
|
include ( UnsetPkgConfig )
|
|
|
|
|
|
|
|
# Optional features
|
|
|
|
unset ( LIBSNDFILE_SUPPORT CACHE )
|
|
|
|
unset ( LIBSNDFILE_HASVORBIS CACHE )
|
|
|
|
if ( enable-libsndfile )
|
|
|
|
pkg_check_modules ( LIBSNDFILE sndfile>=1.0.0 )
|
|
|
|
set ( LIBSNDFILE_SUPPORT ${LIBSNDFILE_FOUND} )
|
|
|
|
if ( LIBSNDFILE_SUPPORT )
|
|
|
|
pkg_check_modules ( LIBSNDFILE_VORBIS sndfile>=1.0.18 )
|
|
|
|
set ( LIBSNDFILE_HASVORBIS ${LIBSNDFILE_VORBIS_FOUND} )
|
|
|
|
endif ( LIBSNDFILE_SUPPORT )
|
|
|
|
else ( enable-libsndfile )
|
|
|
|
unset_pkg_config ( LIBSNDFILE )
|
|
|
|
unset_pkg_config ( LIBSNDFILE_VORBIS )
|
|
|
|
endif ( enable-libsndfile )
|
|
|
|
|
|
|
|
unset ( PULSE_SUPPORT CACHE )
|
|
|
|
if ( enable-pulseaudio )
|
|
|
|
pkg_check_modules ( PULSE libpulse-simple>=0.9.8 )
|
|
|
|
set ( PULSE_SUPPORT ${PULSE_FOUND} )
|
|
|
|
else ( enable-pulseaudio )
|
|
|
|
unset_pkg_config ( PULSE )
|
|
|
|
endif ( enable-pulseaudio )
|
|
|
|
|
|
|
|
unset ( ALSA_SUPPORT CACHE )
|
|
|
|
if ( enable-alsa )
|
|
|
|
pkg_check_modules ( ALSA alsa>=0.9.1 )
|
|
|
|
set ( ALSA_SUPPORT ${ALSA_FOUND} )
|
|
|
|
else ( enable-alsa )
|
|
|
|
unset_pkg_config ( ALSA )
|
|
|
|
endif ( enable-alsa )
|
|
|
|
|
|
|
|
unset ( PORTAUDIO_SUPPORT CACHE )
|
|
|
|
if ( enable-portaudio )
|
|
|
|
pkg_check_modules ( PORTAUDIO portaudio-2.0>=19 )
|
|
|
|
set ( PORTAUDIO_SUPPORT ${PORTAUDIO_FOUND} )
|
|
|
|
else ( enable-portaudio )
|
|
|
|
unset_pkg_config ( PORTAUDIO )
|
|
|
|
endif ( enable-portaudio )
|
|
|
|
|
|
|
|
unset ( JACK_SUPPORT CACHE )
|
|
|
|
if ( enable-jack )
|
|
|
|
pkg_check_modules ( JACK jack )
|
|
|
|
set ( JACK_SUPPORT ${JACK_FOUND} )
|
|
|
|
else ( enable-jack )
|
|
|
|
unset_pkg_config ( JACK )
|
|
|
|
endif ( enable-jack )
|
|
|
|
|
|
|
|
unset ( LASH_SUPPORT CACHE )
|
|
|
|
if ( enable-lash )
|
|
|
|
pkg_check_modules ( LASH lash-1.0>=0.3 )
|
|
|
|
if ( LASH_FOUND )
|
|
|
|
set ( LASH_SUPPORT 1 )
|
|
|
|
add_definitions ( -DHAVE_LASH )
|
|
|
|
endif ( LASH_FOUND )
|
|
|
|
else ( enable-lash )
|
|
|
|
unset_pkg_config ( LASH )
|
|
|
|
remove_definitions( -DHAVE_LASH )
|
|
|
|
endif ( enable-lash )
|
|
|
|
|
|
|
|
unset ( DBUS_SUPPORT CACHE )
|
|
|
|
if ( enable-dbus )
|
|
|
|
pkg_check_modules ( DBUS dbus-1>=1.0.0 )
|
|
|
|
set ( DBUS_SUPPORT ${DBUS_FOUND} )
|
|
|
|
else ( enable-dbus )
|
|
|
|
unset_pkg_config ( DBUS )
|
|
|
|
endif ( enable-dbus )
|
|
|
|
|
|
|
|
endif(NOT enable-pkgconfig)
|
2010-03-17 20:14:13 +00:00
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( AUFILE_SUPPORT CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-aufile )
|
|
|
|
set ( AUFILE_SUPPORT 1 )
|
|
|
|
endif ( enable-aufile )
|
|
|
|
|
|
|
|
find_package ( OSS QUIET )
|
|
|
|
set ( OSS_SUPPORT ${OSS_FOUND} )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( MIDISHARE_SUPPORT CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable_midishare )
|
|
|
|
find_package ( MidiShare )
|
|
|
|
set ( MIDISHARE_SUPPORT ${MidiShare_FOUND} )
|
2010-10-16 15:36:06 +00:00
|
|
|
else ( enable_midishare )
|
|
|
|
unset ( MidiShare_LIBS CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( enable_midishare )
|
|
|
|
|
2010-10-16 15:36:06 +00:00
|
|
|
unset ( WITH_READLINE CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
if ( enable-readline )
|
|
|
|
find_package ( Readline )
|
|
|
|
set ( FOUND_READLINE ${HAVE_READLINE} )
|
|
|
|
if ( HAVE_READLINE )
|
2010-08-05 18:01:50 +00:00
|
|
|
set ( WITH_READLINE 1 )
|
2010-03-17 20:14:13 +00:00
|
|
|
set ( READLINE_LIBS ${READLINE_LIBRARIES} )
|
|
|
|
endif ( HAVE_READLINE )
|
2010-10-16 15:36:06 +00:00
|
|
|
else ( enable-readline )
|
|
|
|
unset ( READLINE_LIBS CACHE )
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( enable-readline )
|
|
|
|
|
2014-07-02 06:10:07 +00:00
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# General configuration file
|
2010-10-31 16:15:32 +00:00
|
|
|
configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
|
2010-03-17 20:14:13 +00:00
|
|
|
${CMAKE_BINARY_DIR}/config.h )
|
|
|
|
add_definitions ( -DHAVE_CONFIG_H )
|
|
|
|
|
|
|
|
# Extra configuration file for MS VisualC compiler
|
|
|
|
if ( MSVC )
|
2010-10-31 16:15:32 +00:00
|
|
|
configure_file ( ${CMAKE_SOURCE_DIR}/src/config_win32.cmake
|
2010-03-17 20:14:13 +00:00
|
|
|
${CMAKE_BINARY_DIR}/config_win32.h )
|
|
|
|
endif ( MSVC )
|
|
|
|
|
2010-10-31 16:15:32 +00:00
|
|
|
# Process subdirectories
|
2010-03-17 20:14:13 +00:00
|
|
|
add_subdirectory ( src )
|
|
|
|
add_subdirectory ( include )
|
|
|
|
add_subdirectory ( doc )
|
|
|
|
|
2012-03-11 12:47:52 +00:00
|
|
|
# pkg-config support
|
|
|
|
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
|
|
|
|
set ( exec_prefix "\${prefix}" )
|
|
|
|
set ( libdir "\${exec_prefix}/${LIB_INSTALL_DIR}${LIB_SUFFIX}" )
|
|
|
|
set ( includedir "\${prefix}/${INCLUDE_INSTALL_DIR}" )
|
|
|
|
configure_file ( fluidsynth.pc.in
|
|
|
|
${CMAKE_BINARY_DIR}/fluidsynth.pc IMMEDIATE @ONLY )
|
|
|
|
install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
|
|
|
|
DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX}/pkgconfig )
|
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# Extra targets for Unix build environments
|
|
|
|
if ( UNIX )
|
|
|
|
# RPM spec
|
2010-10-31 16:15:32 +00:00
|
|
|
configure_file ( fluidsynth.spec.in
|
|
|
|
${CMAKE_BINARY_DIR}/fluidsynth.spec IMMEDIATE @ONLY )
|
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# uninstall custom target
|
|
|
|
configure_file ( "${CMAKE_SOURCE_DIR}/cmake_admin/cmake_uninstall.cmake.in"
|
2010-10-16 18:27:29 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
2010-03-17 20:14:13 +00:00
|
|
|
add_custom_target ( uninstall
|
2010-10-16 18:27:29 +00:00
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
2010-10-31 16:15:32 +00:00
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
# tarball custom target
|
|
|
|
add_custom_target ( tarball
|
|
|
|
COMMAND mkdir -p ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND cp -r bindings ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND cp -r cmake_admin ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND cp -r doc ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND cp -r include ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND cp -r src ${PACKAGE}-${VERSION}
|
2017-09-17 15:50:09 +00:00
|
|
|
COMMAND cp AUTHORS ChangeLog CMakeLists.txt LICENSE ${PACKAGE}.* INSTALL NEWS README* THANKS TODO ${PACKAGE}-${VERSION}
|
2010-08-08 12:04:58 +00:00
|
|
|
# COMMAND tar -cj --exclude .svn --exclude Makefile.am -f ${PACKAGE}-${VERSION}.tar.bz2 ${PACKAGE}-${VERSION}
|
|
|
|
# COMMAND tar -cz --exclude .svn --exclude Makefile.am -f ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION}
|
|
|
|
# COMMAND zip -qr ${PACKAGE}-${VERSION}.zip ${PACKAGE}-${VERSION} -x '*.svn*' -x '*Makefile.am'
|
2010-09-01 06:00:27 +00:00
|
|
|
COMMAND tar -cj --exclude .svn -f ${PACKAGE}-${VERSION}.tar.bz2 ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND tar -cz --exclude .svn -f ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION}
|
|
|
|
COMMAND zip -qr ${PACKAGE}-${VERSION}.zip ${PACKAGE}-${VERSION} -x '*.svn*'
|
|
|
|
COMMAND rm -rf ${PACKAGE}-${VERSION}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
2010-03-17 20:14:13 +00:00
|
|
|
endif ( UNIX )
|
|
|
|
|
|
|
|
include ( report )
|
2010-10-14 21:07:17 +00:00
|
|
|
|
2010-10-31 16:15:32 +00:00
|
|
|
# CPack support
|
2010-10-14 21:07:17 +00:00
|
|
|
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "FluidSynth real-time synthesizer" )
|
|
|
|
set ( CPACK_PACKAGE_VENDOR "fluidsynth.org" )
|
2017-09-03 11:34:00 +00:00
|
|
|
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
|
|
|
|
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE" )
|
2010-10-14 21:07:17 +00:00
|
|
|
set ( CPACK_PACKAGE_VERSION_MAJOR ${FLUIDSYNTH_VERSION_MAJOR} )
|
|
|
|
set ( CPACK_PACKAGE_VERSION_MINOR ${FLUIDSYNTH_VERSION_MINOR} )
|
|
|
|
set ( CPACK_PACKAGE_VERSION_PATCH ${FLUIDSYNTH_VERSION_MICRO} )
|
|
|
|
set ( CPACK_PACKAGE_EXECUTABLES "fluidsynth" "FluidSynth CLI" )
|
|
|
|
|
|
|
|
# source packages
|
|
|
|
set ( CPACK_SOURCE_GENERATOR TGZ;TBZ2;ZIP )
|
|
|
|
set ( CPACK_SOURCE_IGNORE_FILES "/.svn/;/build/;~$;.cproject;.project;/.settings/;${CPACK_SOURCE_IGNORE_FILES}" )
|
2010-10-31 16:15:32 +00:00
|
|
|
set ( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" )
|
2010-10-14 21:07:17 +00:00
|
|
|
set ( CPACK_SOURCE_STRIP_FILES OFF )
|
|
|
|
|
|
|
|
# binary packages
|
|
|
|
include ( InstallRequiredSystemLibraries )
|
|
|
|
set ( CPACK_GENERATOR STGZ;TGZ;TBZ2;ZIP )
|
|
|
|
set ( CPACK_PACKAGE_NAME ${PACKAGE} )
|
|
|
|
set ( CPACK_STRIP_FILES ON )
|
|
|
|
|
|
|
|
include ( CPack )
|