Remove enable-pkgconfig cmake option

This commit is contained in:
derselbst 2021-10-17 18:31:07 +02:00
parent 90da8af70f
commit bb3bc6da26
1 changed files with 179 additions and 210 deletions

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-winmidi "compile Windows MIDI 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-readline "compile readline lib line editing (if it is available)" on )
option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on )
@ -480,226 +479,196 @@ if ( ASTYLE )
)
endif(ASTYLE)
if(NOT enable-pkgconfig)
find_package ( PkgConfig REQUIRED )
FIND_LIBRARY( GLIB_LIB NAMES glib glib-2.0 PATH GLIB_LIBRARY_DIR )
FIND_LIBRARY( GTHREAD_LIB NAMES gthread gthread-2.0 PATH GTHREAD_LIBRARY_DIR )
FIND_PATH( GLIBH_DIR glib.h PATH GLIB_INCLUDE_DIR )
FIND_PATH( GLIBCONF_DIR glibconfig.h PATH GLIBCONF_INCLUDE_DIR )
# Mandatory libraries: glib and gthread
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 IMPORTED_TARGET )
list( APPEND PC_REQUIRES_PRIV "glib-2.0" "gthread-2.0")
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()
if ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
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!" )
endif ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
SET( GLIB_INCLUDE_DIRS ${GLIBH_DIR} ${GLIBCONF_DIR} )
SET( GLIB_LIBRARIES ${GLIB_LIB} ${GTHREAD_LIB} )
include ( PkgConfigHelpers ) # has unset_pkg_config()
message( STATUS "GLIB_INCLUDE_DIRS: " ${GLIB_INCLUDE_DIRS} )
message( STATUS "GLIB_LIBRARIES: " ${GLIB_LIBRARIES} )
unset ( ALSA_SUPPORT CACHE )
if ( enable-alsa )
find_package( ALSA 0.9.1 ) # imported target ALSA::ALSA since CMake 3.12
set ( ALSA_SUPPORT ${ALSA_FOUND} )
endif()
else(NOT enable-pkgconfig)
find_package ( PkgConfig REQUIRED )
# Mandatory libraries: glib and gthread
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 IMPORTED_TARGET )
list( APPEND PC_REQUIRES_PRIV "glib-2.0" "gthread-2.0")
if ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
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!" )
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")
# 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 ()
else ( enable-dbus )
unset_pkg_config ( DBUS )
endif ( enable-dbus )
#[[ 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 )
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 )
if ( enable-aufile )