-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Sf2 Player, Mallets, PortAudio, and Lame with MSVC (#6507)
- Loading branch information
Showing
14 changed files
with
374 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright (c) 2022 Dominic Clark | ||
# | ||
# Redistribution and use is allowed according to the terms of the New BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
|
||
# Return if we already have FluidSynth | ||
if(TARGET fluidsynth) | ||
set(FluidSynth_FOUND 1) | ||
return() | ||
endif() | ||
|
||
# Attempt to find FluidSynth using PkgConfig | ||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(FLUIDSYNTH_PKG fluidsynth) | ||
endif() | ||
|
||
# Find the library and headers using the results from PkgConfig as a guide | ||
find_path(FluidSynth_INCLUDE_DIR | ||
NAMES "fluidsynth.h" | ||
HINTS ${FLUIDSYNTH_PKG_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(FluidSynth_LIBRARY | ||
NAMES "fluidsynth" | ||
HINTS ${FLUIDSYNTH_PKG_LIBRARY_DIRS} | ||
) | ||
|
||
if(FluidSynth_INCLUDE_DIR AND FluidSynth_LIBRARY) | ||
add_library(fluidsynth UNKNOWN IMPORTED) | ||
set_target_properties(fluidsynth PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_DIR}" | ||
) | ||
|
||
if(VCPKG_INSTALLED_DIR) | ||
include(ImportedTargetHelpers) | ||
_get_vcpkg_library_configs(FluidSynth_IMPLIB_RELEASE FluidSynth_IMPLIB_DEBUG "${FluidSynth_LIBRARY}") | ||
else() | ||
set(FluidSynth_IMPLIB_RELEASE "${FluidSynth_LIBRARY}") | ||
endif() | ||
|
||
if(FluidSynth_IMPLIB_DEBUG) | ||
set_target_properties(fluidsynth PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${FluidSynth_IMPLIB_RELEASE}" | ||
IMPORTED_LOCATION_DEBUG "${FluidSynth_IMPLIB_DEBUG}" | ||
) | ||
else() | ||
set_target_properties(fluidsynth PROPERTIES | ||
IMPORTED_LOCATION "${FluidSynth_IMPLIB_RELEASE}" | ||
) | ||
endif() | ||
|
||
if(EXISTS "${FluidSynth_INCLUDE_DIR}/fluidsynth/version.h") | ||
file(STRINGS | ||
"${FluidSynth_INCLUDE_DIR}/fluidsynth/version.h" | ||
_version_string | ||
REGEX "^#[\t ]*define[\t ]+FLUIDSYNTH_VERSION[\t ]+\".*\"" | ||
) | ||
string(REGEX REPLACE | ||
"^.*FLUIDSYNTH_VERSION[\t ]+\"([^\"]*)\".*$" | ||
"\\1" | ||
FluidSynth_VERSION_STRING | ||
"${_version_string}" | ||
) | ||
unset(_version_string) | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(FluidSynth | ||
REQUIRED_VARS FluidSynth_LIBRARY FluidSynth_INCLUDE_DIR | ||
VERSION_VAR FluidSynth_VERSION_STRING | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
# - Try to find LAME | ||
# Once done this will define | ||
# | ||
# LAME_FOUND - system has liblame | ||
# LAME_INCLUDE_DIRS - the liblame include directory | ||
# LAME_LIBRARIES - The liblame libraries | ||
# Lame_FOUND - system has liblame | ||
# Lame_INCLUDE_DIRS - the liblame include directory | ||
# Lame_LIBRARIES - The liblame libraries | ||
# mp3lame::mp3lame - an imported target providing lame | ||
|
||
find_path(LAME_INCLUDE_DIRS lame/lame.h) | ||
find_library(LAME_LIBRARIES mp3lame) | ||
find_package(mp3lame CONFIG QUIET) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Lame DEFAULT_MSG LAME_INCLUDE_DIRS LAME_LIBRARIES) | ||
if(TARGET mp3lame::mp3lame) | ||
# Extract details for find_package_handle_standard_args | ||
get_target_property(Lame_LIBRARIES mp3lame::mp3lame LOCATION) | ||
get_target_property(Lame_INCLUDE_DIRS mp3lame::mp3lame INTERFACE_INCLUDE_DIRECTORIES) | ||
else() | ||
find_path(Lame_INCLUDE_DIRS lame/lame.h) | ||
find_library(Lame_LIBRARIES mp3lame) | ||
|
||
list(APPEND Lame_DEFINITIONS HAVE_LIBMP3LAME=1) | ||
|
||
mark_as_advanced(Lame_INCLUDE_DIRS Lame_LIBRARIES Lame_DEFINITIONS) | ||
|
||
list(APPEND LAME_DEFINITIONS -DHAVE_LIBMP3LAME=1) | ||
if(Lame_LIBRARIES AND Lame_INCLUDE_DIRS) | ||
add_library(mp3lame::mp3lame UNKNOWN IMPORTED) | ||
|
||
mark_as_advanced(LAME_INCLUDE_DIRS LAME_LIBRARIES LAME_DEFINITIONS) | ||
set_target_properties(mp3lame::mp3lame PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${Lame_INCLUDE_DIRS}" | ||
INTERFACE_COMPILE_DEFINITIONS "${Lame_DEFINITIONS}" | ||
IMPORTED_LOCATION "${Lame_LIBRARIES}" | ||
) | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Lame | ||
REQUIRED_VARS Lame_LIBRARIES Lame_INCLUDE_DIRS | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,44 @@ | ||
# - Try to find Portaudio | ||
# Once done this will define | ||
# | ||
# PORTAUDIO_FOUND - system has Portaudio | ||
# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory | ||
# PORTAUDIO_LIBRARIES - Link these to use Portaudio | ||
# PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio | ||
# | ||
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org> | ||
# Copyright (c) 2022 Dominic Clark | ||
# | ||
# Redistribution and use is allowed according to the terms of the New BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
# | ||
|
||
# Try config mode if possible | ||
find_package(portaudio CONFIG QUIET) | ||
|
||
if(TARGET portaudio) | ||
# Extract details for find_package_handle_standard_args | ||
get_target_property(Portaudio_LIBRARY portaudio LOCATION) | ||
get_target_property(Portaudio_INCLUDE_DIR portaudio INTERFACE_INCLUDE_DIRECTORIES) | ||
else() | ||
# Attempt to find PortAudio using PkgConfig, if we have it | ||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(PORTAUDIO_PKG portaudio-2.0) | ||
endif() | ||
|
||
if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) | ||
# in cache already | ||
set(PORTAUDIO_FOUND TRUE) | ||
else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) | ||
include(FindPkgConfig) | ||
pkg_check_modules(PORTAUDIO portaudio-2.0) | ||
if (PORTAUDIO_FOUND) | ||
if (NOT Portaudio_FIND_QUIETLY) | ||
message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}") | ||
endif (NOT Portaudio_FIND_QUIETLY) | ||
else (PORTAUDIO_FOUND) | ||
if (Portaudio_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find Portaudio") | ||
endif (Portaudio_FIND_REQUIRED) | ||
endif (PORTAUDIO_FOUND) | ||
# Find the library and headers using the results from PkgConfig as a guide | ||
find_library(Portaudio_LIBRARY | ||
NAMES "portaudio" | ||
HINTS ${PORTAUDIO_PKG_LIBRARY_DIRS} | ||
) | ||
|
||
# show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view | ||
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) | ||
find_path(Portaudio_INCLUDE_DIR | ||
NAMES "portaudio.h" | ||
HINTS ${PORTAUDIO_PKG_INCLUDE_DIRS} | ||
) | ||
|
||
endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) | ||
# Create an imported target for PortAudio if we succeeded in finding it. | ||
if(Portaudio_LIBRARY AND Portaudio_INCLUDE_DIR) | ||
add_library(portaudio UNKNOWN IMPORTED) | ||
set_target_properties(portaudio PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${Portaudio_INCLUDE_DIR}" | ||
IMPORTED_LOCATION "${Portaudio_LIBRARY}" | ||
) | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Portaudio | ||
REQUIRED_VARS Portaudio_LIBRARY Portaudio_INCLUDE_DIR | ||
) |
Oops, something went wrong.