Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
let cmake find WinMidi and DSound
rather than hardcoding support; addresses #232
  • Loading branch information
derselbst committed Nov 8, 2017
1 parent a13cf15 commit 74ea46c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
19 changes: 16 additions & 3 deletions CMakeLists.txt
Expand Up @@ -162,15 +162,28 @@ endif ( CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
# Windows
unset ( WINDOWS_SUPPORT CACHE )
unset ( WINDOWS_LIBS CACHE )
unset ( DSOUND_SUPPORT CACHE )
unset ( WINMIDI_SUPPORT CACHE )
unset ( MINGW32 CACHE )
if ( WIN32 )
include ( CheckIncludeFiles )
check_include_file ( windows.h HAVE_WINDOWS_H )
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
check_include_file ( io.h HAVE_IO_H )
set ( WINDOWS_LIBS "ws2_32" )

check_include_file ( dsound.h HAVE_DSOUND_H )
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
set ( WINDOWS_LIBS "dsound;winmm;ws2_32" )
if(HAVE_DSOUND_H)
set ( WINDOWS_LIBS "${WINDOWS_LIBS};dsound" )
set ( DSOUND_SUPPORT ${HAVE_DSOUND_H} )
endif(HAVE_DSOUND_H)

check_include_files ( mmsystem.h HAVE_MMSYSTEM_H )
if(HAVE_MMSYSTEM_H)
set ( WINDOWS_LIBS "${WINDOWS_LIBS};winmm" )
set ( WINMIDI_SUPPORT ${HAVE_MMSYSTEM_H} )
endif(HAVE_MMSYSTEM_H)

set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
set ( CMAKE_DEBUG_POSTFIX "_debug" )
Expand Down
12 changes: 12 additions & 0 deletions cmake_admin/report.cmake
Expand Up @@ -73,6 +73,18 @@ else ( WINDOWS_SUPPORT )
message ( "Windows: no" )
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 )
message ( "LADSPA support: yes" )
else ( LADSPA_SUPPORT )
Expand Down
10 changes: 9 additions & 1 deletion src/CMakeLists.txt
Expand Up @@ -76,9 +76,17 @@ if ( PORTAUDIO_SUPPORT )
endif ( PORTAUDIO_SUPPORT )

if ( WINDOWS_SUPPORT )
set ( fluid_windows_SOURCES fluid_dll.c drivers/fluid_dsound.c drivers/fluid_winmidi.c )
set ( fluid_windows_SOURCES fluid_dll.c )
endif ( WINDOWS_SUPPORT )

if ( DSOUND_SUPPORT )
set ( fluid_windows_SOURCES "${fluid_windows_SOURCES} drivers/fluid_dsound.c" )
endif ( DSOUND_SUPPORT )

if ( WINMIDI_SUPPORT )
set ( fluid_windows_SOURCES "${fluid_windows_SOURCES} drivers/fluid_winmidi.c" )
endif ( WINMIDI_SUPPORT )

if ( OSS_SUPPORT )
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
endif ( OSS_SUPPORT )
Expand Down
6 changes: 6 additions & 0 deletions src/config.cmake
Expand Up @@ -25,6 +25,9 @@
/* Soundfont to load automatically in some use cases */
#cmakedefine DEFAULT_SOUNDFONT "@DEFAULT_SOUNDFONT@"

/* Define to enable dsound driver */
#cmakedefine DSOUND_SUPPORT @DSOUND_SUPPORT@

/* Define to enable FPE checks */
#cmakedefine FPE_CHECK @FPE_CHECK@

Expand Down Expand Up @@ -193,6 +196,9 @@
/* Version number of package */
#cmakedefine VERSION @FLUIDSYNTH_VERSION@

/* Define to enable WinMidi driver */
#cmakedefine WINMIDI_SUPPORT @WINMIDI_SUPPORT@

/* Define to do all DSP in single floating point precision */
#cmakedefine WITH_FLOAT @WITH_FLOAT@

Expand Down
2 changes: 0 additions & 2 deletions src/utils/fluidsynth_priv.h
Expand Up @@ -139,8 +139,6 @@ typedef guint64 uint64_t;
/* MinGW32 special defines */
#ifdef MINGW32

#define DSOUND_SUPPORT 1
#define WINMIDI_SUPPORT 1
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
Expand Down

0 comments on commit 74ea46c

Please sign in to comment.