Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Sf2 Player, Mallets, PortAudio, and Lame with MSVC #6507

Merged
merged 14 commits into from
Sep 19, 2022
Merged
Prev Previous commit
Next Next commit
Enable building Mallets with MSVC
The rawwaves directory is not yet installed; a more general fix is
required to handle MinGW too.
DomClark committed Sep 6, 2022
commit a529a1de3902b1aea454b6b3c5fb2aa9df8c6441
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -223,7 +223,8 @@ jobs:
- name: Install dependencies
run: |
vcpkg install --triplet ${{ matrix.arch }}-windows --recurse `
fftw3 fluidsynth[sndfile] libsamplerate libsndfile lilv lv2 sdl2
fftw3 fluidsynth[sndfile] libsamplerate libsndfile libstk lilv lv2 `
sdl2
- name: Set up build environment
uses: ilammy/msvc-dev-cmd@d8610e2b41c6d0f0c3b4c46dad8df0fd826c68e1
with:
32 changes: 23 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -202,6 +202,27 @@ CHECK_CXX_SOURCE_COMPILES(
LMMS_HAVE_SF_COMPLEVEL
)

# Search for a target in a package using config mode first, then fall back to
# module mode. This allows us to use the package's own CMake configuration files
# if available.
# We use this macro instead of the CMAKE_FIND_PACKAGE_PREFER_CONFIG variable
# since some packages on some systems provide a config file that doesn't create
# a target, and some packages have unusual config file names.
macro(find_target_prefer_config PACKAGE_NAME TARGET_NAME)
if("${ARGC}" GREATER 2)
# Handle optional third argument specifying a config name different from
# the module name
find_package("${ARGV2}" CONFIG QUIET)
set("${PACKAGE_NAME}_FOUND" "${${ARGV2}_FOUND}")
else()
find_package("${PACKAGE_NAME}" CONFIG QUIET)
endif()
if(NOT TARGET "${TARGET_NAME}")
unset("${PACKAGE_NAME}_FOUND")
find_package("${PACKAGE_NAME}" MODULE)
endif()
endmacro()

IF(WANT_LV2)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(LV2 lv2)
@@ -300,14 +321,7 @@ IF(WANT_SDL)
# Don't look for SDL2main
SET(SDL2_BUILDING_LIBRARY TRUE)

# Search for SDL2 using config mode first, then fall back to module mode.
# This allows us to use SDL2's own CMake configuration files if available.
FIND_PACKAGE(SDL2 CONFIG QUIET)
IF(NOT TARGET SDL2::SDL2)
UNSET(SDL2_FOUND)
FIND_PACKAGE(SDL2 MODULE)
ENDIF()

find_target_prefer_config(SDL2 SDL2::SDL2)
IF(SDL2_FOUND)
SET(LMMS_HAVE_SDL TRUE)
SET(LMMS_HAVE_SDL2 TRUE)
@@ -343,7 +357,7 @@ ENDIF()

# check for Stk
IF(WANT_STK)
FIND_PACKAGE(STK)
find_target_prefer_config(STK unofficial::libstk::libstk unofficial-libstk)
IF(STK_FOUND)
SET(LMMS_HAVE_STK TRUE)
SET(STATUS_STK "OK")
37 changes: 20 additions & 17 deletions cmake/modules/FindSTK.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
FIND_PATH(STK_INCLUDE_DIR Stk.h /usr/include/stk /usr/local/include/stk ${CMAKE_INSTALL_PREFIX}/include/stk ${CMAKE_FIND_ROOT_PATH}/include/stk)
find_path(STK_INCLUDE_DIR
NAMES stk/Stk.h
PATH /usr/include/stk /usr/local/include/stk "${CMAKE_INSTALL_PREFIX}/include/stk" "${CMAKE_FIND_ROOT_PATH}/include/stk"
)

FIND_LIBRARY(STK_LIBRARY NAMES stk PATH /usr/lib /usr/local/lib ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_FIND_ROOT_PATH}/lib)
find_library(STK_LIBRARY
NAMES stk
PATH /usr/lib /usr/local/lib "${CMAKE_INSTALL_PREFIX}/lib" "${CMAKE_FIND_ROOT_PATH}/lib"
)

IF (STK_INCLUDE_DIR AND STK_LIBRARY)
SET(STK_FOUND TRUE)
ENDIF (STK_INCLUDE_DIR AND STK_LIBRARY)


IF (STK_FOUND)
IF (NOT STK_FIND_QUIETLY)
MESSAGE(STATUS "Found STK: ${STK_LIBRARY}")
SET(HAVE_STK TRUE)
ENDIF (NOT STK_FIND_QUIETLY)
ELSE (STK_FOUND)
IF (STK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find STK")
ENDIF (STK_FIND_REQUIRED)
ENDIF (STK_FOUND)
if(STK_INCLUDE_DIR AND STK_LIBRARY)
# Yes, this target name is hideous, but it matches that provided by vcpkg
add_library(unofficial::libstk::libstk UNKNOWN IMPORTED)
set_target_properties(unofficial::libstk::libstk PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${STK_INCLUDE_DIR}"
IMPORTED_LOCATION "${STK_LIBRARY}"
)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(STK
REQUIRED_VARS STK_LIBRARY STK_INCLUDE_DIR
)
12 changes: 7 additions & 5 deletions plugins/Stk/Mallets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES("${STK_INCLUDE_DIR}")
LINK_LIBRARIES(${STK_LIBRARY})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
BUILD_PLUGIN(malletsstk Mallets.cpp Mallets.h MOCFILES Mallets.h EMBEDDED_RESOURCES artwork.png logo.png)
include(BuildPlugin)
build_plugin(malletsstk
Mallets.cpp Mallets.h
MOCFILES Mallets.h
EMBEDDED_RESOURCES artwork.png logo.png
)
target_link_libraries(malletsstk unofficial::libstk::libstk)
6 changes: 3 additions & 3 deletions plugins/Stk/Mallets/Mallets.cpp
Original file line number Diff line number Diff line change
@@ -30,9 +30,9 @@
#include <QDomElement>
#include <QMessageBox>

#include "BandedWG.h"
#include "ModalBar.h"
#include "TubeBell.h"
#include <stk/BandedWG.h>
#include <stk/ModalBar.h>
#include <stk/TubeBell.h>

#include "AudioEngine.h"
#include "ConfigManager.h"
2 changes: 1 addition & 1 deletion plugins/Stk/Mallets/Mallets.h
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
#ifndef _MALLET_H
#define _MALLET_H

#include "Instrmnt.h"
#include <stk/Instrmnt.h>

#include "ComboBox.h"
#include "Instrument.h"