Remove enable-pkgconfig cmake option

This commit is contained in:
derselbst 2021-10-17 18:31:07 +02:00
parent 90da8af70f
commit bb3bc6da26

View file

@ -89,7 +89,6 @@ option ( enable-wasapi "compile Windows WASAPI support (if it is available)" on
option ( enable-waveout "compile Windows WaveOut support (if it is available)" on ) option ( enable-waveout "compile Windows WaveOut support (if it is available)" on )
option ( enable-winmidi "compile Windows MIDI support (if it is available)" on ) option ( enable-winmidi "compile Windows MIDI support (if it is available)" on )
option ( enable-sdl2 "compile SDL2 audio support (if it is available)" on ) option ( enable-sdl2 "compile SDL2 audio support (if it is available)" 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 )
option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on ) option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on )
@ -480,226 +479,196 @@ if ( ASTYLE )
) )
endif(ASTYLE) endif(ASTYLE)
if(NOT enable-pkgconfig) find_package ( PkgConfig REQUIRED )
FIND_LIBRARY( GLIB_LIB NAMES glib glib-2.0 PATH GLIB_LIBRARY_DIR ) # Mandatory libraries: glib and gthread
FIND_LIBRARY( GTHREAD_LIB NAMES gthread gthread-2.0 PATH GTHREAD_LIBRARY_DIR ) pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 IMPORTED_TARGET )
FIND_PATH( GLIBH_DIR glib.h PATH GLIB_INCLUDE_DIR ) list( APPEND PC_REQUIRES_PRIV "glib-2.0" "gthread-2.0")
FIND_PATH( GLIBCONF_DIR glibconfig.h PATH GLIBCONF_INCLUDE_DIR )
IF( GLIB_LIB MATCHES "GLIB_LIB-NOTFOUND" OR if ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
GTHREAD_LIB MATCHES "GTHREAD_LIB-NOTFOUND" OR message ( WARNING "Your version of glib is very old. This may cause problems with fluidsynth's sample cache on Windows. Consider updating to glib 2.26 or newer!" )
GLIBH_DIR MATCHES "GLIBH_DIR-NOTFOUND" OR endif ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
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} ) include ( PkgConfigHelpers ) # has unset_pkg_config()
SET( GLIB_LIBRARIES ${GLIB_LIB} ${GTHREAD_LIB} )
message( STATUS "GLIB_INCLUDE_DIRS: " ${GLIB_INCLUDE_DIRS} ) # Optional features
message( STATUS "GLIB_LIBRARIES: " ${GLIB_LIBRARIES} ) unset ( LIBSNDFILE_SUPPORT CACHE )
unset ( LIBSNDFILE_HASVORBIS CACHE )
unset ( ALSA_SUPPORT CACHE ) if ( enable-libsndfile )
if ( enable-alsa ) pkg_check_modules ( LIBSNDFILE sndfile>=1.0.0 IMPORTED_TARGET )
find_package( ALSA 0.9.1 ) # imported target ALSA::ALSA since CMake 3.12 set ( LIBSNDFILE_SUPPORT ${LIBSNDFILE_FOUND} )
set ( ALSA_SUPPORT ${ALSA_FOUND} ) if ( LIBSNDFILE_SUPPORT )
endif() #[[ cmake_print_variables (
LIBSNDFILE_STATIC_LIBRARIES
else(NOT enable-pkgconfig) LIBSNDFILE_STATIC_LINK_LIBRARIES
LIBSNDFILE_STATIC_LDFLAGS
find_package ( PkgConfig REQUIRED ) LIBSNDFILE_STATIC_LDFLAGS_OTHER ) ]]
list( APPEND PC_REQUIRES_PRIV "sndfile")
# Mandatory libraries: glib and gthread if ( LIBSNDFILE_STATIC_LIBRARIES MATCHES "vorbis" OR
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 IMPORTED_TARGET ) LIBSNDFILE_STATIC_LDFLAGS MATCHES "vorbis" OR
list( APPEND PC_REQUIRES_PRIV "glib-2.0" "gthread-2.0") LIBSNDFILE_STATIC_LDFLAGS_OTHER MATCHES "vorbis" )
set ( LIBSNDFILE_HASVORBIS 1 )
if ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" ) else ()
message ( WARNING "Your version of glib is very old. This may cause problems with fluidsynth's sample cache on Windows. Consider updating to glib 2.26 or newer!" ) message ( NOTICE "Seems like libsndfile was compiled without OGG/Vorbis support." )
endif ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
include ( PkgConfigHelpers ) # has unset_pkg_config()
# Optional features
unset ( LIBSNDFILE_SUPPORT CACHE )
unset ( LIBSNDFILE_HASVORBIS CACHE )
if ( enable-libsndfile )
pkg_check_modules ( LIBSNDFILE sndfile>=1.0.0 IMPORTED_TARGET )
set ( LIBSNDFILE_SUPPORT ${LIBSNDFILE_FOUND} )
if ( LIBSNDFILE_SUPPORT )
#[[ cmake_print_variables (
LIBSNDFILE_STATIC_LIBRARIES
LIBSNDFILE_STATIC_LINK_LIBRARIES
LIBSNDFILE_STATIC_LDFLAGS
LIBSNDFILE_STATIC_LDFLAGS_OTHER ) ]]
list( APPEND PC_REQUIRES_PRIV "sndfile")
if ( LIBSNDFILE_STATIC_LIBRARIES MATCHES "vorbis" OR
LIBSNDFILE_STATIC_LDFLAGS MATCHES "vorbis" OR
LIBSNDFILE_STATIC_LDFLAGS_OTHER MATCHES "vorbis" )
set ( LIBSNDFILE_HASVORBIS 1 )
else ()
message ( NOTICE "Seems like libsndfile was compiled without OGG/Vorbis support." )
endif ()
#[[ cmake_print_properties( TARGETS PkgConfig::LIBSNDFILE
PROPERTIES
INTERFACE_COMPILE_OPTIONS
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_OPTIONS
INTERFACE_LINK_LIBRARIES ) ]]
sanitize_target_dirs(PkgConfig::LIBSNDFILE)
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 IMPORTED_TARGET )
set ( PULSE_SUPPORT ${PULSE_FOUND} )
if ( PULSE_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "libpulse-simple")
endif ( PULSE_SUPPORT )
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 IMPORTED_TARGET )
set ( ALSA_SUPPORT ${ALSA_FOUND} )
if ( ALSA_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "alsa")
endif ( ALSA_SUPPORT )
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 IMPORTED_TARGET )
set ( PORTAUDIO_SUPPORT ${PORTAUDIO_FOUND} )
if ( PORTAUDIO_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "portaudio-2.0")
endif ()
else ( enable-portaudio )
unset_pkg_config ( PORTAUDIO )
endif ( enable-portaudio )
unset ( JACK_SUPPORT CACHE )
if ( enable-jack )
pkg_check_modules ( JACK jack IMPORTED_TARGET )
set ( JACK_SUPPORT ${JACK_FOUND} )
if (JACK_SUPPORT)
sanitize_target_dirs(PkgConfig::JACK)
list( APPEND PC_REQUIRES_PRIV "jack")
endif()
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 IMPORTED_TARGET )
if ( LASH_FOUND )
set ( LASH_SUPPORT 1 )
add_definitions ( -DHAVE_LASH )
sanitize_target_dirs(PkgConfig::LASH)
list( APPEND PC_REQUIRES_PRIV "lash-1.0")
endif ( LASH_FOUND )
else ( enable-lash )
unset_pkg_config ( LASH )
remove_definitions( -DHAVE_LASH )
endif ( enable-lash )
unset ( SYSTEMD_SUPPORT CACHE )
if ( enable-systemd )
pkg_check_modules ( SYSTEMD libsystemd IMPORTED_TARGET )
set ( SYSTEMD_SUPPORT ${SYSTEMD_FOUND} )
if ( SYSTEMD_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "libsystemd")
endif ( SYSTEMD_SUPPORT )
else ( enable-systemd )
unset_pkg_config ( SYSTEMD )
endif ( enable-systemd )
unset ( DBUS_SUPPORT CACHE )
if ( enable-dbus )
pkg_check_modules ( DBUS dbus-1>=1.0.0 IMPORTED_TARGET )
set ( DBUS_SUPPORT ${DBUS_FOUND} )
if ( DBUS_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "dbus-1")
endif () endif ()
else ( enable-dbus ) #[[ cmake_print_properties( TARGETS PkgConfig::LIBSNDFILE
unset_pkg_config ( DBUS ) PROPERTIES
endif ( enable-dbus ) INTERFACE_COMPILE_OPTIONS
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_OPTIONS
INTERFACE_LINK_LIBRARIES ) ]]
sanitize_target_dirs(PkgConfig::LIBSNDFILE)
endif ( LIBSNDFILE_SUPPORT )
else ( enable-libsndfile )
unset_pkg_config ( LIBSNDFILE )
unset_pkg_config ( LIBSNDFILE_VORBIS )
endif ( enable-libsndfile )
unset ( LADSPA_SUPPORT CACHE ) unset ( PULSE_SUPPORT CACHE )
if ( enable-ladspa ) if ( enable-pulseaudio )
check_include_file ( ladspa.h LADSPA_SUPPORT ) pkg_check_modules ( PULSE libpulse-simple>=0.9.8 IMPORTED_TARGET )
if ( LADSPA_SUPPORT ) set ( PULSE_SUPPORT ${PULSE_FOUND} )
pkg_check_modules ( GMODULE REQUIRED gmodule-2.0>=2.6.5 IMPORTED_TARGET ) if ( PULSE_SUPPORT )
set ( LADSPA 1 ) list( APPEND PC_REQUIRES_PRIV "libpulse-simple")
list( APPEND PC_REQUIRES_PRIV "gmodule-2.0") endif ( PULSE_SUPPORT )
endif ( LADSPA_SUPPORT ) else ( enable-pulseaudio )
endif ( enable-ladspa ) unset_pkg_config ( PULSE )
endif ( enable-pulseaudio )
unset ( LIBINSTPATCH_SUPPORT CACHE ) unset ( ALSA_SUPPORT CACHE )
if ( enable-libinstpatch ) if ( enable-alsa )
pkg_check_modules ( LIBINSTPATCH libinstpatch-1.0>=1.1.0 IMPORTED_TARGET ) pkg_check_modules ( ALSA alsa>=0.9.1 IMPORTED_TARGET )
set ( LIBINSTPATCH_SUPPORT ${LIBINSTPATCH_FOUND} ) set ( ALSA_SUPPORT ${ALSA_FOUND} )
if ( LIBINSTPATCH_SUPPORT ) if ( ALSA_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "libinstpatch-1.0") list( APPEND PC_REQUIRES_PRIV "alsa")
#[[ cmake_print_properties( TARGETS PkgConfig::LIBINSTPATCH endif ( ALSA_SUPPORT )
PROPERTIES else ( enable-alsa )
INTERFACE_COMPILE_OPTIONS unset_pkg_config ( ALSA )
INTERFACE_INCLUDE_DIRECTORIES endif ( enable-alsa )
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_OPTIONS
INTERFACE_LINK_LIBRARIES ) ]]
sanitize_target_dirs(PkgConfig::LIBINSTPATCH)
endif (LIBINSTPATCH_SUPPORT )
endif ( enable-libinstpatch )
unset ( SDL2_SUPPORT CACHE ) unset ( PORTAUDIO_SUPPORT CACHE )
if ( enable-sdl2 ) if ( enable-portaudio )
pkg_check_modules ( SDL2 sdl2 IMPORTED_TARGET ) pkg_check_modules ( PORTAUDIO portaudio-2.0>=19 IMPORTED_TARGET )
set ( SDL2_SUPPORT ${SDL2_FOUND} ) set ( PORTAUDIO_SUPPORT ${PORTAUDIO_FOUND} )
if ( SDL2_SUPPORT ) if ( PORTAUDIO_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "sdl2") list( APPEND PC_REQUIRES_PRIV "portaudio-2.0")
endif ( SDL2_SUPPORT ) endif ()
else ( enable-sdl2 ) else ( enable-portaudio )
unset_pkg_config ( SDL2 ) unset_pkg_config ( PORTAUDIO )
endif ( enable-sdl2 ) endif ( enable-portaudio )
unset ( OBOE_SUPPORT CACHE ) unset ( JACK_SUPPORT CACHE )
if ( enable-oboe ) if ( enable-jack )
pkg_check_modules ( OBOE oboe-1.0 IMPORTED_TARGET ) pkg_check_modules ( JACK jack IMPORTED_TARGET )
if ( OBOE_FOUND ) set ( JACK_SUPPORT ${JACK_FOUND} )
set(CMAKE_CXX_STANDARD 14) if (JACK_SUPPORT)
set(CMAKE_CXX_STANDARD_REQUIRED ON) sanitize_target_dirs(PkgConfig::JACK)
set ( OBOE_SUPPORT 1 ) list( APPEND PC_REQUIRES_PRIV "jack")
list( APPEND PC_REQUIRES_PRIV "oboe-1.0") endif()
endif ( OBOE_FOUND ) else ( enable-jack )
endif ( enable-oboe ) unset_pkg_config ( JACK )
endif ( enable-jack )
unset ( WITH_READLINE CACHE ) unset ( LASH_SUPPORT CACHE )
unset ( READLINE_LIBS CACHE ) if ( enable-lash )
if ( enable-readline ) pkg_check_modules ( LASH lash-1.0>=0.3 IMPORTED_TARGET )
pkg_check_modules ( READLINE readline QUIET IMPORTED_TARGET ) if ( LASH_FOUND )
if ( READLINE_FOUND ) set ( LASH_SUPPORT 1 )
list( APPEND PC_REQUIRES_PRIV "readline") add_definitions ( -DHAVE_LASH )
else ( READLINE_FOUND ) sanitize_target_dirs(PkgConfig::LASH)
find_package ( READLINE ) list( APPEND PC_REQUIRES_PRIV "lash-1.0")
set ( READLINE_FOUND ${HAVE_READLINE} ) endif ( LASH_FOUND )
endif ( READLINE_FOUND ) else ( enable-lash )
if ( READLINE_FOUND ) unset_pkg_config ( LASH )
set ( WITH_READLINE 1 ) remove_definitions( -DHAVE_LASH )
set ( READLINE_LIBS ${READLINE_LIBRARIES} ) endif ( enable-lash )
endif ( READLINE_FOUND )
endif ( enable-readline )
endif(NOT enable-pkgconfig) unset ( SYSTEMD_SUPPORT CACHE )
if ( enable-systemd )
pkg_check_modules ( SYSTEMD libsystemd IMPORTED_TARGET )
set ( SYSTEMD_SUPPORT ${SYSTEMD_FOUND} )
if ( SYSTEMD_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "libsystemd")
endif ( SYSTEMD_SUPPORT )
else ( enable-systemd )
unset_pkg_config ( SYSTEMD )
endif ( enable-systemd )
unset ( DBUS_SUPPORT CACHE )
if ( enable-dbus )
pkg_check_modules ( DBUS dbus-1>=1.0.0 IMPORTED_TARGET )
set ( DBUS_SUPPORT ${DBUS_FOUND} )
if ( DBUS_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "dbus-1")
endif ()
else ( enable-dbus )
unset_pkg_config ( DBUS )
endif ( enable-dbus )
unset ( LADSPA_SUPPORT CACHE )
if ( enable-ladspa )
check_include_file ( ladspa.h LADSPA_SUPPORT )
if ( LADSPA_SUPPORT )
pkg_check_modules ( GMODULE REQUIRED gmodule-2.0>=2.6.5 IMPORTED_TARGET )
set ( LADSPA 1 )
list( APPEND PC_REQUIRES_PRIV "gmodule-2.0")
endif ( LADSPA_SUPPORT )
endif ( enable-ladspa )
unset ( LIBINSTPATCH_SUPPORT CACHE )
if ( enable-libinstpatch )
pkg_check_modules ( LIBINSTPATCH libinstpatch-1.0>=1.1.0 IMPORTED_TARGET )
set ( LIBINSTPATCH_SUPPORT ${LIBINSTPATCH_FOUND} )
if ( LIBINSTPATCH_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "libinstpatch-1.0")
#[[ cmake_print_properties( TARGETS PkgConfig::LIBINSTPATCH
PROPERTIES
INTERFACE_COMPILE_OPTIONS
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_OPTIONS
INTERFACE_LINK_LIBRARIES ) ]]
sanitize_target_dirs(PkgConfig::LIBINSTPATCH)
endif (LIBINSTPATCH_SUPPORT )
endif ( enable-libinstpatch )
unset ( SDL2_SUPPORT CACHE )
if ( enable-sdl2 )
pkg_check_modules ( SDL2 sdl2 IMPORTED_TARGET )
set ( SDL2_SUPPORT ${SDL2_FOUND} )
if ( SDL2_SUPPORT )
list( APPEND PC_REQUIRES_PRIV "sdl2")
endif ( SDL2_SUPPORT )
else ( enable-sdl2 )
unset_pkg_config ( SDL2 )
endif ( enable-sdl2 )
unset ( OBOE_SUPPORT CACHE )
if ( enable-oboe )
pkg_check_modules ( OBOE oboe-1.0 IMPORTED_TARGET )
if ( OBOE_FOUND )
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set ( OBOE_SUPPORT 1 )
list( APPEND PC_REQUIRES_PRIV "oboe-1.0")
endif ( OBOE_FOUND )
endif ( enable-oboe )
unset ( WITH_READLINE CACHE )
unset ( READLINE_LIBS CACHE )
if ( enable-readline )
pkg_check_modules ( READLINE readline QUIET IMPORTED_TARGET )
if ( READLINE_FOUND )
list( APPEND PC_REQUIRES_PRIV "readline")
else ( READLINE_FOUND )
find_package ( READLINE )
set ( READLINE_FOUND ${HAVE_READLINE} )
endif ( READLINE_FOUND )
if ( READLINE_FOUND )
set ( WITH_READLINE 1 )
set ( READLINE_LIBS ${READLINE_LIBRARIES} )
endif ( READLINE_FOUND )
endif ( enable-readline )
unset ( AUFILE_SUPPORT CACHE ) unset ( AUFILE_SUPPORT CACHE )
if ( enable-aufile ) if ( enable-aufile )