Merge pull request #200 from FluidSynth/msvc

make pkg-config optional
This commit is contained in:
Tom M 2017-09-03 12:45:33 +02:00 committed by GitHub
commit 79fe0a82e5
2 changed files with 125 additions and 94 deletions

View file

@ -58,6 +58,7 @@ option ( enable-fpe-check "enable Floating Point Exception checks and debug mess
option ( enable-debug "enable debugging (default=no)" off )
# Options enabled by default
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
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 )
@ -160,8 +161,8 @@ if ( WIN32 )
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
set ( WINDOWS_LIBS "dsound;winmm;ws2_32" )
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
set ( LIBFLUID_CPPFLAGS "${FLUID_CPPFLAGS} -DFLUIDSYNTH_DLL_EXPORTS" )
set ( CMAKE_DEBUG_POSTFIX "_debug" )
# MinGW compiler (a Windows GCC port)
if ( MINGW )
@ -289,7 +290,29 @@ if ( CMAKE_BUILD_TYPE MATCHES "Debug" )
set ( DEBUG 1 )
endif ( CMAKE_BUILD_TYPE MATCHES "Debug" )
# Mandatory tool: pkg-config
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 )
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
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} )
SET( GLIB_LIBRARIES ${GLIB_LIB} ${GTHREAD_LIB} )
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
@ -312,11 +335,6 @@ else ( enable-libsndfile )
unset_pkg_config ( LIBSNDFILE_VORBIS )
endif ( enable-libsndfile )
unset ( AUFILE_SUPPORT CACHE )
if ( enable-aufile )
set ( AUFILE_SUPPORT 1 )
endif ( enable-aufile )
unset ( PULSE_SUPPORT CACHE )
if ( enable-pulseaudio )
pkg_check_modules ( PULSE libpulse-simple>=0.9.8 )
@ -341,17 +359,6 @@ else ( enable-portaudio )
unset_pkg_config ( PORTAUDIO )
endif ( enable-portaudio )
find_package ( OSS QUIET )
set ( OSS_SUPPORT ${OSS_FOUND} )
unset ( MIDISHARE_SUPPORT CACHE )
if ( enable_midishare )
find_package ( MidiShare )
set ( MIDISHARE_SUPPORT ${MidiShare_FOUND} )
else ( enable_midishare )
unset ( MidiShare_LIBS CACHE )
endif ( enable_midishare )
unset ( JACK_SUPPORT CACHE )
if ( enable-jack )
pkg_check_modules ( JACK jack )
@ -360,18 +367,6 @@ else ( enable-jack )
unset_pkg_config ( JACK )
endif ( enable-jack )
unset ( WITH_READLINE CACHE )
if ( enable-readline )
find_package ( Readline )
set ( FOUND_READLINE ${HAVE_READLINE} )
if ( HAVE_READLINE )
set ( WITH_READLINE 1 )
set ( READLINE_LIBS ${READLINE_LIBRARIES} )
endif ( HAVE_READLINE )
else ( enable-readline )
unset ( READLINE_LIBS CACHE )
endif ( enable-readline )
unset ( LASH_SUPPORT CACHE )
if ( enable-lash )
pkg_check_modules ( LASH lash-1.0>=0.3 )
@ -400,6 +395,37 @@ else ( enable-dbus )
unset_pkg_config ( DBUS )
endif ( enable-dbus )
endif(NOT enable-pkgconfig)
unset ( AUFILE_SUPPORT CACHE )
if ( enable-aufile )
set ( AUFILE_SUPPORT 1 )
endif ( enable-aufile )
find_package ( OSS QUIET )
set ( OSS_SUPPORT ${OSS_FOUND} )
unset ( MIDISHARE_SUPPORT CACHE )
if ( enable_midishare )
find_package ( MidiShare )
set ( MIDISHARE_SUPPORT ${MidiShare_FOUND} )
else ( enable_midishare )
unset ( MidiShare_LIBS CACHE )
endif ( enable_midishare )
unset ( WITH_READLINE CACHE )
if ( enable-readline )
find_package ( Readline )
set ( FOUND_READLINE ${HAVE_READLINE} )
if ( HAVE_READLINE )
set ( WITH_READLINE 1 )
set ( READLINE_LIBS ${READLINE_LIBRARIES} )
endif ( HAVE_READLINE )
else ( enable-readline )
unset ( READLINE_LIBS CACHE )
endif ( enable-readline )
# General configuration file
configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
${CMAKE_BINARY_DIR}/config.h )

View file

@ -19,6 +19,9 @@ FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h"
SET(OSS_FOUND FALSE)
if ( NOT WIN32 )
IF(LINUX_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR})
@ -37,6 +40,8 @@ IF(MACHINE_OSS_INCLUDE_DIR)
SET(HAVE_MACHINE_SOUNDCARD_H 1)
ENDIF()
ENDIF(NOT WIN32)
MARK_AS_ADVANCED (
OSS_FOUND
OSS_INCLUDE_DIR