From 405738f66f28dcb1e192fb8f3d60b0a54e1d891b Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Sat, 24 Jun 2023 11:58:56 +0900 Subject: [PATCH] Fix STK rawwave installation in Windows builds (#6705) * Fix STK rawwave path detection and installation * Use the CMake logic for rawwave installation on Win and Mac --- cmake/apple/install_apple.sh.in | 5 ----- cmake/install/CMakeLists.txt | 10 ++++++++++ cmake/modules/FindSTK.cmake | 7 +++++++ cmake/nsis/CMakeLists.txt | 6 ------ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index e1921b1a503..df930071270 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -6,9 +6,6 @@ set -e -# STK rawwaves directory -STK_RAWWAVE=$(brew --prefix stk)/share/stk/rawwaves - # Place to create ".app" bundle APP="@CMAKE_BINARY_DIR@/@PROJECT_NAME_UCASE@.app" @@ -29,11 +26,9 @@ command cp "@CMAKE_BINARY_DIR@/Info.plist" "@CMAKE_INSTALL_PREFIX@/" mkdir -p "$APP/Contents/MacOS" mkdir -p "$APP/Contents/Frameworks" mkdir -p "$APP/Contents/Resources" -mkdir -p "$APP/Contents/share/stk/rawwaves" cd "@CMAKE_INSTALL_PREFIX@" cp -R ./* "$APP/Contents" cp "@CMAKE_SOURCE_DIR@/cmake/apple/"*.icns "$APP/Contents/Resources/" -cp "$STK_RAWWAVE"/*.raw "$APP/Contents/share/stk/rawwaves" > /dev/null 2>&1 # Make all libraries writable for macdeployqt cd "$APP" diff --git a/cmake/install/CMakeLists.txt b/cmake/install/CMakeLists.txt index cd4100c9bf7..5ee731d16b8 100644 --- a/cmake/install/CMakeLists.txt +++ b/cmake/install/CMakeLists.txt @@ -36,6 +36,16 @@ IF(LMMS_BUILD_WIN32 OR LMMS_INSTALL_DEPENDENCIES) ) ENDIF() +# Install STK rawwaves +if(LMMS_HAVE_STK AND (LMMS_BUILD_WIN32 OR LMMS_BUILD_APPLE)) + if(STK_RAWWAVE_ROOT) + file(GLOB RAWWAVES "${STK_RAWWAVE_ROOT}/*.raw") + install(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves") + else() + message(WARNING "Can't find STK rawwave root!") + endif() +endif() + IF(LMMS_BUILD_APPLE) INSTALL(CODE "EXECUTE_PROCESS(COMMAND chmod u+x ${CMAKE_BINARY_DIR}/install_apple.sh)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_BINARY_DIR}/install_apple.sh)") diff --git a/cmake/modules/FindSTK.cmake b/cmake/modules/FindSTK.cmake index 80ed0da42f8..0718f5039a3 100644 --- a/cmake/modules/FindSTK.cmake +++ b/cmake/modules/FindSTK.cmake @@ -26,6 +26,13 @@ else() endif() endif() +# find STK rawwave path +find_path(STK_RAWWAVE_ROOT + NAMES silence.raw sinewave.raw + HINTS "${STK_INCLUDE_DIR}/.." + PATH_SUFFIXES share/stk/rawwaves share/libstk/rawwaves +) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(STK REQUIRED_VARS STK_LIBRARY STK_INCLUDE_DIR diff --git a/cmake/nsis/CMakeLists.txt b/cmake/nsis/CMakeLists.txt index 9dca3495dc7..ee1bd45c305 100644 --- a/cmake/nsis/CMakeLists.txt +++ b/cmake/nsis/CMakeLists.txt @@ -73,12 +73,6 @@ SET(CPACK_NSIS_MUI_ICON "${CPACK_NSIS_MUI_ICON}" PARENT_SCOPE) CONFIGURE_FILE("lmms.rc.in" "${CMAKE_BINARY_DIR}/lmms.rc") CONFIGURE_FILE("zynaddsubfx.rc.in" "${CMAKE_BINARY_DIR}/plugins/ZynAddSubFx/zynaddsubfx.rc") -IF(LMMS_HAVE_STK) - FILE(GLOB RAWWAVES "${MINGW_PREFIX}/share/stk/rawwaves/*.raw") - LIST(SORT RAWWAVES) - INSTALL(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves") -ENDIF() - INSTALL(FILES "lmms.exe.manifest" DESTINATION .) INSTALL(FILES "lmms.VisualElementsManifest.xml" DESTINATION .) INSTALL(DIRECTORY "assets" DESTINATION .)