diff --git a/CMakeLists.txt b/CMakeLists.txt index e8e16011..3af34052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,6 +333,10 @@ if ( WIN32 ) if ( MINGW ) set ( MINGW32 1 ) add_compile_options ( -mms-bitfields ) + # mman-win32 + if ( HAVE_SYS_MMAN_H ) + set ( WINDOWS_LIBS "${WINDOWS_LIBS};mman" ) + endif () endif ( MINGW ) else ( WIN32 ) # Check PThreads, but not in Windows @@ -514,6 +518,7 @@ else(NOT enable-pkgconfig) # Mandatory libraries: glib and gthread pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 ) + 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!" ) @@ -528,6 +533,7 @@ else(NOT enable-pkgconfig) pkg_check_modules ( LIBSNDFILE sndfile>=1.0.0 ) set ( LIBSNDFILE_SUPPORT ${LIBSNDFILE_FOUND} ) if ( LIBSNDFILE_SUPPORT ) + list( APPEND PC_REQUIRES_PRIV "sndfile") message (DEBUG "LIBSNDFILE_STATIC_LIBRARIES: ${LIBSNDFILE_STATIC_LIBRARIES}") message (DEBUG "LIBSNDFILE_STATIC_LINK_LIBRARIES: ${LIBSNDFILE_STATIC_LINK_LIBRARIES}") message (DEBUG "LIBSNDFILE_STATIC_LDFLAGS: ${LIBSNDFILE_STATIC_LDFLAGS}") @@ -549,6 +555,9 @@ else(NOT enable-pkgconfig) if ( enable-pulseaudio ) pkg_check_modules ( PULSE libpulse-simple>=0.9.8 ) 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 ) @@ -557,6 +566,9 @@ else(NOT enable-pkgconfig) if ( enable-alsa ) pkg_check_modules ( ALSA alsa>=0.9.1 ) 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 ) @@ -565,6 +577,9 @@ else(NOT enable-pkgconfig) if ( enable-portaudio ) pkg_check_modules ( PORTAUDIO portaudio-2.0>=19 ) 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 ) @@ -573,6 +588,9 @@ else(NOT enable-pkgconfig) if ( enable-jack ) pkg_check_modules ( JACK jack ) set ( JACK_SUPPORT ${JACK_FOUND} ) + if ( JACK_SUPPORT ) + list( APPEND PC_REQUIRES_PRIV "jack") + endif () else ( enable-jack ) unset_pkg_config ( JACK ) endif ( enable-jack ) @@ -583,6 +601,7 @@ else(NOT enable-pkgconfig) if ( LASH_FOUND ) set ( LASH_SUPPORT 1 ) add_definitions ( -DHAVE_LASH ) + list( APPEND PC_REQUIRES_PRIV "lash-1.0") endif ( LASH_FOUND ) else ( enable-lash ) unset_pkg_config ( LASH ) @@ -593,6 +612,9 @@ else(NOT enable-pkgconfig) if ( enable-systemd ) pkg_check_modules ( SYSTEMD libsystemd ) 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 ) @@ -601,6 +623,9 @@ else(NOT enable-pkgconfig) if ( enable-dbus ) pkg_check_modules ( DBUS dbus-1>=1.0.0 ) 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 ) @@ -611,6 +636,7 @@ else(NOT enable-pkgconfig) if ( LADSPA_SUPPORT ) pkg_check_modules ( GMODULE REQUIRED gmodule-2.0>=2.6.5 ) set ( LADSPA 1 ) + list( APPEND PC_REQUIRES_PRIV "gmodule-2.0") endif ( LADSPA_SUPPORT ) endif ( enable-ladspa ) @@ -618,25 +644,30 @@ else(NOT enable-pkgconfig) if ( enable-libinstpatch ) pkg_check_modules ( LIBINSTPATCH libinstpatch-1.0>=1.1.0 ) set ( LIBINSTPATCH_SUPPORT ${LIBINSTPATCH_FOUND} ) + if ( LIBINSTPATCH_SUPPORT ) + list( APPEND PC_REQUIRES_PRIV "libinstpatch-1.0") + endif (LIBINSTPATCH_SUPPORT ) endif ( enable-libinstpatch ) unset ( SDL2_SUPPORT CACHE ) if ( enable-sdl2 ) pkg_check_modules ( SDL2 sdl2 ) 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 ) - unset ( OBOE_LIBS CACHE ) if ( enable-oboe ) pkg_check_modules ( OBOE oboe-1.0 ) if ( OBOE_FOUND ) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set ( OBOE_SUPPORT 1 ) - set ( OBOE_LIBS ${OBOE_LIBRARIES} ) + list( APPEND PC_REQUIRES_PRIV "oboe-1.0") endif ( OBOE_FOUND ) endif ( enable-oboe ) @@ -644,10 +675,12 @@ else(NOT enable-pkgconfig) unset ( READLINE_LIBS CACHE ) if ( enable-readline ) pkg_check_modules ( READLINE readline ) - if ( NOT READLINE_FOUND ) + if ( READLINE_FOUND ) + list( APPEND PC_REQUIRES_PRIV "readline") + else ( READLINE_FOUND ) find_package ( READLINE ) set ( READLINE_FOUND ${HAVE_READLINE} ) - endif ( NOT READLINE_FOUND ) + endif ( READLINE_FOUND ) if ( READLINE_FOUND ) set ( WITH_READLINE 1 ) set ( READLINE_LIBS ${READLINE_LIBRARIES} ) @@ -852,6 +885,8 @@ else () message ( DEPRECATION "Your version of CMake is old. A complete pkg-config file can not created. Get cmake 3.13.3 or newer." ) endif ( CMAKE_VERSION VERSION_EQUAL "3.12.0" OR CMAKE_VERSION VERSION_GREATER "3.12.0" ) +list ( JOIN PC_REQUIRES_PRIV " " PC_REQUIRES_PRIV_JOINED ) + configure_file ( fluidsynth.pc.in ${CMAKE_BINARY_DIR}/fluidsynth.pc IMMEDIATE @ONLY ) install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc diff --git a/fluidsynth.pc.in b/fluidsynth.pc.in index f66d5dd3..ecacb6f7 100644 --- a/fluidsynth.pc.in +++ b/fluidsynth.pc.in @@ -6,6 +6,7 @@ includedir=@includedir@ Name: FluidSynth Description: Software SoundFont synth Version: @VERSION@ +Requires.private: @PC_REQUIRES_PRIV_JOINED@ Libs: -L${libdir} -lfluidsynth Libs.private: @LIBS_PRIVATE_JOINED@ @LIBS_PRIVATE_WITH_PATH_JOINED@ Cflags: -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e913cb21..4f3ef86a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -366,7 +366,7 @@ target_link_libraries ( libfluidsynth ${WINDOWS_LIBS} ${MidiShare_LIBS} ${OpenSLES_LIBS} - ${OBOE_LIBS} + ${OBOE_LIBRARIES} ${LIBFLUID_LIBS} ${LIBINSTPATCH_LIBRARIES} )