* Preliminary support for creating in MacOSX a "FluidSynth.framework"

* Platform dependent options scoped to only the relevant platform
* Fixed warning in fluid_synth.c
This commit is contained in:
Pedro Lopez-Cabanillas 2010-10-13 21:57:19 +00:00
parent cb2b88a108
commit 304d6a0875
6 changed files with 93 additions and 36 deletions

View File

@ -54,24 +54,35 @@ option ( enable-ladspa "enable LADSPA effect units" off )
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 )
option ( enable-ladcca "compile LADCCA support if it is available (deprecated)" off )
# Options enabled by default
option ( enable-libsndfile "compile libsndfile support (if it is available)" on )
option ( enable-aufile "compile support for sound file output" on )
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
option ( enable-alsa "compile ALSA support (if it is available)" on )
option ( enable-portaudio "compile PortAudio support (if it is available)" on )
option ( enable-jack "compile JACK support (if it is available)" on )
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
option ( enable-coremidi "compile CoreMIDI support (if it is available)" on )
option ( enable-midishare "compile MidiShare support (if it is available)" on )
option ( enable-dart "compile DART support (if it is available)" on )
option ( enable-readline "compile readline lib line editing (if it is available)" on )
option ( enable-lash "compile LASH support (if it is available)" on )
option ( enable-dbus "compile DBUS support (if it is available)" on )
option ( BUILD_SHARED_LIBS "Build a shared object or DLL" on )
# Platform specific options
if ( ${CMAKE_SYSTEM} MATCHES "Linux" )
option ( enable-ladcca "compile LADCCA support if it is available (deprecated)" off )
option ( enable-lash "compile LASH support (if it is available)" on )
option ( enable-alsa "compile ALSA support (if it is available)" on )
endif ( ${CMAKE_SYSTEM} MATCHES "Linux" )
if ( ${CMAKE_SYSTEM} MATCHES "Darwin" )
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
option ( enable-coremidi "compile CoreMIDI support (if it is available)" on )
option ( enable-framework "create a Mac OSX style FluidSynth.framework" on )
endif ( ${CMAKE_SYSTEM} MATCHES "Darwin" )
if ( ${CMAKE_SYSTEM} MATCHES "os2" )
option ( enable-dart "compile DART support (if it is available)" on )
endif ( ${CMAKE_SYSTEM} MATCHES "os2" )
# Initialize the library directory name suffix.
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( _init_lib_suffix "64" )
@ -182,6 +193,7 @@ set ( COREAUDIO_LIBS )
set ( COREMIDI_SUPPORT )
set ( COREMIDI_LIBS )
set ( DARWIN )
set ( MACOSX_FRAMEWORK )
if ( ${CMAKE_SYSTEM} MATCHES "Darwin" )
set ( DARWIN 1 )
set ( CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
@ -199,6 +211,9 @@ if ( ${CMAKE_SYSTEM} MATCHES "Darwin" )
set ( COREMIDI_LIBS "-Wl,-framework,CoreMIDI,-framework,CoreServices" )
endif ( COREMIDI_FOUND )
endif ( enable-coremidi )
if ( enable-framework )
set ( MACOSX_FRAMEWORK 1 )
endif ( enable-framework )
endif ( ${CMAKE_SYSTEM} MATCHES "Darwin" )
set ( WITH_FLOAT )

View File

@ -19,6 +19,8 @@
# CMake based build system. Pedro Lopez-Cabanillas <plcl@users.sf.net>
add_subdirectory ( fluidsynth )
add_subdirectory ( fluidsynth )
install ( FILES fluidsynth.h DESTINATION include )
IF (NOT MACOSX_FRAMEWORK )
install ( FILES fluidsynth.h DESTINATION include )
ENDIF (NOT MACOSX_FRAMEWORK )

View File

@ -22,7 +22,8 @@
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/version.h )
set ( include_HEADERS
if ( NOT MACOSX_FRAMEWORK )
set ( include_HEADERS
audio.h
event.h
gen.h
@ -39,12 +40,12 @@ set ( include_HEADERS
synth.h
types.h
voice.h
)
install (
FILES
${include_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION
include/fluidsynth
)
)
install (
FILES
${include_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION
include/fluidsynth
)
endif ( NOT MACOSX_FRAMEWORK )

View File

@ -21,7 +21,7 @@
#ifndef _FLUIDSYNTH_SEQBIND_H
#define _FLUIDSYNTH_SEQBIND_H
#include "fluidsynth/seq.h"
#include "seq.h"
#ifdef __cplusplus
extern "C" {

View File

@ -175,6 +175,30 @@ set ( libfluidsynth_SOURCES
bindings/fluid_filerenderer.c
)
set ( public_HEADERS
${CMAKE_SOURCE_DIR}/include/fluidsynth/audio.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/event.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/gen.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/log.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/midi.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/misc.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/mod.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/ramsfont.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/seq.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/seqbind.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/settings.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/sfont.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/shell.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/synth.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/types.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/voice.h
${CMAKE_BINARY_DIR}/include/fluidsynth/version.h
)
set ( public_main_HEADER
${CMAKE_SOURCE_DIR}/include/fluidsynth.h
)
link_directories (
${GLIB_LIBDIR}
${GLIB_LIBRARY_DIRS}
@ -196,6 +220,7 @@ link_directories (
${DBUS_LIBRARY_DIRS}
)
# note: by default this target creates a shared object (or dll). To build a
# static library instead, set the option BUILD_SHARED_LIBS to FALSE.
add_library ( libfluidsynth
@ -213,28 +238,39 @@ add_library ( libfluidsynth
${fluid_pulse_SOURCES}
${fluid_windows_SOURCES}
${libfluidsynth_SOURCES}
${public_HEADERS}
${public_main_HEADER}
)
set_target_properties ( libfluidsynth
PROPERTIES
PREFIX "lib"
OUTPUT_NAME "fluidsynth"
VERSION ${LT_VERSION_INFO}
SOVERSION ${LT_VERSION_CURRENT}
LT_VERSION_CURRENT ${LT_VERSION_CURRENT}
LT_VERSION_AGE ${LT_VERSION_AGE}
LT_VERSION_REVISION ${LT_VERSION_REVISION}
)
if ( LIBFLUID_CPPFLAGS )
if ( MACOSX_FRAMEWORK )
set_property ( SOURCE ${public_HEADERS}
PROPERTY MACOSX_PACKAGE_LOCATION Headers/fluidsynth
)
set_target_properties ( libfluidsynth
PROPERTIES
OUTPUT_NAME "FluidSynth"
FRAMEWORK TRUE
PUBLIC_HEADER "${public_main_HEADER}"
FRAMEWORK_VERSION "${LT_VERSION_CURRENT}"
INSTALL_NAME_DIR "/Library/Frameworks"
VERSION ${LT_VERSION_INFO}
SOVERSION ${LT_VERSION_CURRENT}
)
else ( MACOSX_FRAMEWORK )
set_target_properties ( libfluidsynth
PROPERTIES
PREFIX "lib"
OUTPUT_NAME "fluidsynth"
VERSION ${LT_VERSION_INFO}
SOVERSION ${LT_VERSION_CURRENT}
)
endif ( MACOSX_FRAMEWORK )
if ( LIBFLUID_CPPFLAGS )
set_target_properties ( libfluidsynth
PROPERTIES COMPILE_FLAGS ${LIBFLUID_CPPFLAGS} )
endif ( LIBFLUID_CPPFLAGS )
# this code creates the file libfluidsynth.la
# include ( CreateLibtoolFile )
# create_libtool_file ( libfluidsynth "lib${LIB_SUFFIX}" )
target_link_libraries ( libfluidsynth
${GLIB_LIBRARIES}
${LASH_LIBRARIES}
@ -276,4 +312,5 @@ install ( TARGETS fluidsynth libfluidsynth
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
FRAMEWORK DESTINATION /Library/Frameworks
)

View File

@ -2905,7 +2905,7 @@ fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
fluid_real_t** left_in;
fluid_real_t** right_in;
double time = fluid_utime();
int i, j, num, available, count, bytes;
int i, num, available, count, bytes;
float cpu_load;
if (!synth->eventhandler->is_threadsafe)
@ -2926,6 +2926,7 @@ fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
FLUID_MEMCPY(left[i], left_in[i] + synth->cur, bytes);
FLUID_MEMCPY(right[i], right_in[i] + synth->cur, bytes);
#else //WITH_FLOAT
int j;
for (j = 0; j < num; j++) {
left[i][j] = (float) left_in[i][j + synth->cur];
right[i][j] = (float) right_in[i][j + synth->cur];
@ -2950,6 +2951,7 @@ fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
FLUID_MEMCPY(left[i] + count, left_in[i], bytes);
FLUID_MEMCPY(right[i] + count, right_in[i], bytes);
#else //WITH_FLOAT
int j;
for (j = 0; j < num; j++) {
left[i][j + count] = (float) left_in[i][j];
right[i][j + count] = (float) right_in[i][j];