mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-13 00:04:10 +00:00
Merge pull request #449 from carlo-bramini/win-driver-selection
let cmake find WinMidi and DSound
This commit is contained in:
commit
804cbf91c9
7 changed files with 59 additions and 13 deletions
|
@ -67,6 +67,8 @@ option ( enable-libsndfile "compile libsndfile support (if it is available)" on
|
||||||
option ( enable-midishare "compile MidiShare support (if it is available)" on )
|
option ( enable-midishare "compile MidiShare support (if it is available)" on )
|
||||||
option ( enable-network "enable network support (requires BSD sockets)" on )
|
option ( enable-network "enable network support (requires BSD sockets)" on )
|
||||||
option ( enable-oss "compile OSS support (if it is available)" on )
|
option ( enable-oss "compile OSS support (if it is available)" on )
|
||||||
|
option ( enable-dsound "compile DirectSound support (if it is available)" on )
|
||||||
|
option ( enable-winmidi "compile Windows MIDI support (if it is available)" on )
|
||||||
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
|
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
|
||||||
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
|
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
|
||||||
option ( enable-readline "compile readline lib line editing (if it is available)" on )
|
option ( enable-readline "compile readline lib line editing (if it is available)" on )
|
||||||
|
@ -190,15 +192,34 @@ endif ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE
|
||||||
# Windows
|
# Windows
|
||||||
unset ( WINDOWS_SUPPORT CACHE )
|
unset ( WINDOWS_SUPPORT CACHE )
|
||||||
unset ( WINDOWS_LIBS CACHE )
|
unset ( WINDOWS_LIBS CACHE )
|
||||||
|
unset ( DSOUND_SUPPORT CACHE )
|
||||||
|
unset ( WINMIDI_SUPPORT CACHE )
|
||||||
unset ( MINGW32 CACHE )
|
unset ( MINGW32 CACHE )
|
||||||
if ( WIN32 )
|
if ( WIN32 )
|
||||||
include ( CheckIncludeFiles )
|
include ( CheckIncludeFiles )
|
||||||
|
|
||||||
|
# Check presence of MS include files
|
||||||
check_include_file ( windows.h HAVE_WINDOWS_H )
|
check_include_file ( windows.h HAVE_WINDOWS_H )
|
||||||
check_include_file ( io.h HAVE_IO_H )
|
check_include_file ( io.h HAVE_IO_H )
|
||||||
check_include_file ( dsound.h HAVE_DSOUND_H )
|
check_include_file ( dsound.h HAVE_DSOUND_H )
|
||||||
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
|
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
|
||||||
|
|
||||||
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
|
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
|
||||||
set ( WINDOWS_LIBS "dsound;winmm;ws2_32" )
|
|
||||||
|
if ( enable-network )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};ws2_32" )
|
||||||
|
endif ( enable-network )
|
||||||
|
|
||||||
|
if ( enable-dsound AND HAVE_DSOUND_H )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};dsound" )
|
||||||
|
set ( DSOUND_SUPPORT 1 )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if ( enable-winmidi AND HAVE_MMSYSTEM_H )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};winmm" )
|
||||||
|
set ( WINMIDI_SUPPORT 1 )
|
||||||
|
endif ()
|
||||||
|
|
||||||
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
|
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
|
||||||
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
|
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
|
||||||
if ( MSVC )
|
if ( MSVC )
|
||||||
|
@ -229,7 +250,7 @@ if ( WIN32 )
|
||||||
# MinGW compiler (a Windows GCC port)
|
# MinGW compiler (a Windows GCC port)
|
||||||
if ( MINGW )
|
if ( MINGW )
|
||||||
set ( MINGW32 1 )
|
set ( MINGW32 1 )
|
||||||
add_definitions ( -mms-bitfields )
|
add_compile_options ( -mms-bitfields )
|
||||||
endif ( MINGW )
|
endif ( MINGW )
|
||||||
else ( WIN32 )
|
else ( WIN32 )
|
||||||
# Check PThreads, but not in Windows
|
# Check PThreads, but not in Windows
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "VersionInfo.h"
|
#include "VersionInfo.h"
|
||||||
#include "winres.h"
|
#include "winver.h"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION FILE_VERSION_RESOURCE
|
FILEVERSION FILE_VERSION_RESOURCE
|
||||||
|
|
|
@ -74,6 +74,18 @@ else ( WINDOWS_SUPPORT )
|
||||||
message ( "Windows: no" )
|
message ( "Windows: no" )
|
||||||
endif ( WINDOWS_SUPPORT )
|
endif ( WINDOWS_SUPPORT )
|
||||||
|
|
||||||
|
if ( DSOUND_SUPPORT )
|
||||||
|
message ( "DSound: yes" )
|
||||||
|
else ( DSOUND_SUPPORT )
|
||||||
|
message ( "DSound: no" )
|
||||||
|
endif ( DSOUND_SUPPORT )
|
||||||
|
|
||||||
|
if ( WINMIDI_SUPPORT )
|
||||||
|
message ( "WinMidi support: yes" )
|
||||||
|
else ( WINMIDI_SUPPORT )
|
||||||
|
message ( "WinMidi support: no" )
|
||||||
|
endif ( WINMIDI_SUPPORT )
|
||||||
|
|
||||||
if ( LADSPA_SUPPORT )
|
if ( LADSPA_SUPPORT )
|
||||||
message ( "LADSPA support: yes" )
|
message ( "LADSPA support: yes" )
|
||||||
else ( LADSPA_SUPPORT )
|
else ( LADSPA_SUPPORT )
|
||||||
|
|
|
@ -78,9 +78,13 @@ if ( PORTAUDIO_SUPPORT )
|
||||||
include_directories ( ${PORTAUDIO_INCLUDE_DIRS} )
|
include_directories ( ${PORTAUDIO_INCLUDE_DIRS} )
|
||||||
endif ( PORTAUDIO_SUPPORT )
|
endif ( PORTAUDIO_SUPPORT )
|
||||||
|
|
||||||
if ( WINDOWS_SUPPORT )
|
if ( DSOUND_SUPPORT )
|
||||||
set ( fluid_windows_SOURCES drivers/fluid_dsound.c drivers/fluid_winmidi.c )
|
set ( fluid_dsound_SOURCES drivers/fluid_dsound.c )
|
||||||
endif ( WINDOWS_SUPPORT )
|
endif ( DSOUND_SUPPORT )
|
||||||
|
|
||||||
|
if ( WINMIDI_SUPPORT )
|
||||||
|
set ( fluid_winmidi_SOURCES drivers/fluid_winmidi.c )
|
||||||
|
endif ( WINMIDI_SUPPORT )
|
||||||
|
|
||||||
if ( OSS_SUPPORT )
|
if ( OSS_SUPPORT )
|
||||||
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
|
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
|
||||||
|
@ -212,7 +216,7 @@ configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth/version.h.in
|
||||||
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
|
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
|
||||||
${public_main_HEADER} )
|
${public_main_HEADER} )
|
||||||
|
|
||||||
if ( WIN32 AND NOT MINGW )
|
if ( WIN32 )
|
||||||
include(generate_product_version)
|
include(generate_product_version)
|
||||||
generate_product_version(
|
generate_product_version(
|
||||||
VersionFilesOutputVariable
|
VersionFilesOutputVariable
|
||||||
|
@ -227,7 +231,7 @@ generate_product_version(
|
||||||
ORIGINAL_FILENAME "libfluidsynth.dll"
|
ORIGINAL_FILENAME "libfluidsynth.dll"
|
||||||
FILE_DESCRIPTION "Fluidsynth"
|
FILE_DESCRIPTION "Fluidsynth"
|
||||||
)
|
)
|
||||||
endif ( WIN32 AND NOT MINGW )
|
endif ( WIN32 )
|
||||||
|
|
||||||
add_library ( libfluidsynth-OBJ OBJECT
|
add_library ( libfluidsynth-OBJ OBJECT
|
||||||
${config_SOURCES}
|
${config_SOURCES}
|
||||||
|
@ -243,7 +247,8 @@ add_library ( libfluidsynth-OBJ OBJECT
|
||||||
${fluid_oss_SOURCES}
|
${fluid_oss_SOURCES}
|
||||||
${fluid_portaudio_SOURCES}
|
${fluid_portaudio_SOURCES}
|
||||||
${fluid_pulse_SOURCES}
|
${fluid_pulse_SOURCES}
|
||||||
${fluid_windows_SOURCES}
|
${fluid_dsound_SOURCES}
|
||||||
|
${fluid_winmidi_SOURCES}
|
||||||
${libfluidsynth_SOURCES}
|
${libfluidsynth_SOURCES}
|
||||||
${public_HEADERS}
|
${public_HEADERS}
|
||||||
${public_main_HEADER}
|
${public_main_HEADER}
|
||||||
|
|
|
@ -190,6 +190,12 @@
|
||||||
/* Define to enable PulseAudio driver */
|
/* Define to enable PulseAudio driver */
|
||||||
#cmakedefine PULSE_SUPPORT @PULSE_SUPPORT@
|
#cmakedefine PULSE_SUPPORT @PULSE_SUPPORT@
|
||||||
|
|
||||||
|
/* Define to enable DirectSound driver */
|
||||||
|
#cmakedefine DSOUND_SUPPORT @DSOUND_SUPPORT@
|
||||||
|
|
||||||
|
/* Define to enable Windows MIDI driver */
|
||||||
|
#cmakedefine WINMIDI_SUPPORT @WINMIDI_SUPPORT@
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#cmakedefine STDC_HEADERS @STDC_HEADERS@
|
#cmakedefine STDC_HEADERS @STDC_HEADERS@
|
||||||
|
|
||||||
|
|
|
@ -1330,9 +1330,10 @@ fluid_istream_gets(fluid_istream_t in, char *buf, int len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef NETWORK_SUPPORT
|
||||||
n = recv(in & ~FLUID_SOCKET_FLAG, &c, 1, 0);
|
n = recv(in & ~FLUID_SOCKET_FLAG, &c, 1, 0);
|
||||||
|
|
||||||
if(n == SOCKET_ERROR)
|
if(n == SOCKET_ERROR)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1405,10 +1406,13 @@ fluid_ostream_printf(fluid_ostream_t out, const char *format, ...)
|
||||||
return write(out, buf, FLUID_STRLEN(buf));
|
return write(out, buf, FLUID_STRLEN(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NETWORK_SUPPORT
|
||||||
/* Socket */
|
/* Socket */
|
||||||
retval = send(out & ~FLUID_SOCKET_FLAG, buf, FLUID_STRLEN(buf), 0);
|
retval = send(out & ~FLUID_SOCKET_FLAG, buf, FLUID_STRLEN(buf), 0);
|
||||||
|
|
||||||
return retval != SOCKET_ERROR ? retval : -1;
|
return retval != SOCKET_ERROR ? retval : -1;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,6 @@ typedef guint64 uint64_t;
|
||||||
#include <ws2tcpip.h> /* Provides also socklen_t */
|
#include <ws2tcpip.h> /* Provides also socklen_t */
|
||||||
|
|
||||||
/* WIN32 special defines */
|
/* WIN32 special defines */
|
||||||
#define DSOUND_SUPPORT 1
|
|
||||||
#define WINMIDI_SUPPORT 1
|
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
#define STDOUT_FILENO 1
|
#define STDOUT_FILENO 1
|
||||||
#define STDERR_FILENO 2
|
#define STDERR_FILENO 2
|
||||||
|
|
Loading…
Reference in a new issue