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

Fix MSVC VST compilation #4421

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
884601f
Use CMake GenerateExportHeader
lukas-w Nov 24, 2017
74d4b2f
CMake: Fix MSVC architecture detection
lukas-w Nov 26, 2017
81a0ec3
MSVC: Port RemoteVstPlugin
lukas-w Nov 26, 2017
c41d59b
RemoteVstPlugin: Debug LoadLibrary failure
lukas-w Nov 26, 2017
2b1b3d3
MSVC: Fix VST build
lukas-w Nov 26, 2017
b416036
VST: Fix main entry calling convention
lukas-w Nov 26, 2017
9c35487
Linux compile fixes
lukas-w Nov 26, 2017
c3d0dc5
Fix Linux VST compilation
lukas-w Nov 26, 2017
e95a587
MSVC: Fix VST arch detection
lukas-w Nov 26, 2017
e644202
MSVC: Fix RemoteVstPlugin module path
lukas-w Nov 26, 2017
8fce500
VST build fixes
lukas-w Nov 27, 2017
f702738
CMake quoting fixes
lukas-w Nov 27, 2017
5b9579d
MinGW fixes
lukas-w Nov 28, 2017
9a9580a
Fix export errors with MinGW
lukas-w Nov 28, 2017
a0bd296
Mingw64 compilation fixes
lukas-w Nov 28, 2017
39d83ee
More export fixes
lukas-w Nov 28, 2017
be0c02f
Fix 64bit VSTs on Linux by fixing callback calling convention
lukas-w Jan 14, 2018
5744c2a
CMake: Fix Clang detection
lukas-w May 9, 2018
3beac2c
MSVC fixes (#4352)
May 22, 2018
9db8cbf
Enable 64bit VSTs on Linux
lukas-w Jun 7, 2018
cd35ec2
MSVC VST compilation fixes
lukas-w Jun 11, 2018
225e902
AudioSdl: Add support for full SDL2 with float samples and recording
Reflexe Nov 7, 2017
aa2c867
AudioSDL -> SDL2: Fix a crash from calling a SDL1 function instead of
Reflexe Dec 21, 2017
3d98b0a
Fix cherry-pick
lukas-w Jun 11, 2018
ad4c4f0
AudioSdl: Use NULL for device names in order to get the default device.
lukas-w Jun 11, 2018
00fda3f
Fix AppImage VST
lukas-w Jun 11, 2018
4d5eb7f
CircleCI: Display Appimage log when failing
lukas-w Jun 11, 2018
0349b97
Fix AppImage 64bit RemoteVstPlugin libwine discovery
lukas-w Jun 11, 2018
af57300
VstPlugin: Fix define naming conflict with MinGW
lukas-w Jun 11, 2018
57fdaed
winegcc_wrapper: Remove misleading usage hint
lukas-w Jun 16, 2018
40a1e36
RemotePlugin: Revert unnecessary invalidate() changes
lukas-w Jun 24, 2018
642703e
Whitespace fix
lukas-w Jun 24, 2018
66c2047
CircleCI: Make sure build fails when AppImage building does
lukas-w Jun 25, 2018
65ccaff
RemoteVstPlugin: Fix confusing variable names
lukas-w Jun 25, 2018
d04965a
Merge branch 'master' into msvc/vst
lukas-w Jul 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
command: |
cd build
make install
make appimage
make appimage || cat appimage.log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this mark the build as successful if AppImage creation is failed? I think it's fine if desired though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps make appimage || cat appimage.log && false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps make appimage || cat appimage.log && false

I think there should be a pair of parenthesis: make appimage || (cat appimage.log && false)
See also: https://unix.stackexchange.com/questions/88850/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhysSong tested, confirmed...

ls -al || (echo hello && false)
echo $?
# returns 0
ls -al || echo hello && false
echo $?
# returns 1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if appimage creation fails, it will fail one line later in cp ./lmms-*.AppImage /tmp/artifacts/. I'll still add the && false to make sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if appimage creation fails, it will fail one line later in cp ./lmms-*.AppImage /tmp/artifacts/.

True, I just missed that.

cp ./lmms-*.AppImage /tmp/artifacts/
- store_artifacts:
path: /tmp/artifacts/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "src/3rdparty/weakjack/weakjack"]
path = src/3rdparty/weakjack/weakjack
url = https://github.com/x42/weakjack.git
[submodule "src/3rdparty/mingw-std-threads"]
path = src/3rdparty/mingw-std-threads
url = https://github.com/meganz/mingw-std-threads.git
35 changes: 26 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ INCLUDE(CheckSubmodules)
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFiles)
INCLUDE(FindPkgConfig)
INCLUDE(GenerateExportHeader)

STRING(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE)

Expand Down Expand Up @@ -46,7 +47,6 @@ ENDIF()
INCLUDE(VersionInfo)
INCLUDE(DetectMachine)


OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON)
OPTION(WANT_CALF "Include CALF LADSPA plugins" ON)
OPTION(WANT_CAPS "Include C* Audio Plugin Suite (LADSPA plugins)" ON)
Expand Down Expand Up @@ -165,9 +165,14 @@ FIND_PACKAGE(Qt5Test)
SET(QT_QTTEST_LIBRARY Qt5::Test)

# check for libsndfile
PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.18)
IF(NOT SNDFILE_FOUND)
MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!")
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.18)
IF(NOT SNDFILE_FOUND)
MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!")
ENDIF()
ELSE()
FIND_PACKAGE(LibSndFile 1.0.18 REQUIRED)
SET(SNDFILE_LIBRARIES sndfile-shared)
ENDIF()
# check if we can use SF_SET_COMPRESSION_LEVEL
IF(NOT SNDFILE_VERSION VERSION_LESS 1.0.26)
Expand Down Expand Up @@ -393,8 +398,13 @@ ENDIF(WANT_JACK)


# check for FFTW3F-library
PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0)

IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0)
ELSE()
#currently find_package for fftw is broken in vcpkg. Replace this when fixed
FIND_PATH(FFTW3F_INCLUDE_DIRS fftw3.h)
FIND_LIBRARY(FFTW3F_LIBRARIES fftw3f)
ENDIF()

# check for FLTK
FIND_PACKAGE(FLTK)
Expand Down Expand Up @@ -476,10 +486,16 @@ ELSE()
ENDIF(WANT_DEBUG_FPE)

# check for libsamplerate
PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8)
ELSE()
#TODO no cmake config support. Can we check the version some other way?
FIND_FILE(SAMPLERATE_INCLUDE_DIRS samplerate.h)
FIND_LIBRARY(SAMPLERATE_LIBRARIES libsamplerate-0)
ENDIF()

# set compiler flags
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang")
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
Expand Down Expand Up @@ -539,7 +555,7 @@ ENDIF()
# we somehow have to make LMMS-binary depend on MOC-files
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h")

IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang")
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
ELSE(WIN32)
Expand Down Expand Up @@ -699,4 +715,5 @@ MESSAGE(
"-----------------------------------------------------------------\n"
"\n\n")

SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BIN_DIR}")
INCLUDE(InstallRequiredSystemLibraries)
2 changes: 1 addition & 1 deletion cmake/build_win32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ fi
CMAKE_OPTS="-DCMAKE_PREFIX_PATH=$MINGW $CMAKE_OPTS"

# shellcheck disable=SC2086
cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" -DCMAKE_MODULE_PATH="$DIR/../cmake/modules/" $CMAKE_OPTS
cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" $CMAKE_OPTS
24 changes: 16 additions & 8 deletions cmake/linux/package_linux.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,32 @@ EOL

chmod +x "${APPDIR}usr/bin/lmms"

# Per https://github.com/probonopd/linuxdeployqt/issues/129
# Per https://github.com/probonopd/linuxdeployqt/issues/129
unset LD_LIBRARY_PATH

# Ensure linuxdeployqt can find shared objects
export LD_LIBRARY_PATH="${APPDIR}usr/lib/lmms/":$LD_LIBRARY_PATH

# Handle wine linking
if [ -d "@WINE_LIBRARY_FIX@" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@WINE_LIBRARY_FIX@:@WINE_LIBRARY_FIX@wine/
if [ -d "@WINE_32_LIBRARY_DIR@" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/wine/:@WINE_32_LIBRARY_DIR@:@WINE_32_LIBRARY_DIR@wine/
fi
if [ -d "@WINE_64_LIBRARY_DIR@" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/wine/:@WINE_64_LIBRARY_DIR@:@WINE_64_LIBRARY_DIR@wine/
fi

# Move executables so linuxdeployqt can find them
ZYNLIB="${APPDIR}usr/lib/lmms/RemoteZynAddSubFx"
VSTLIB="${APPDIR}usr/lib/lmms/RemoteVstPlugin.exe.so"
VSTLIB32="${APPDIR}usr/lib/lmms/RemoteVstPlugin32.exe.so"
VSTLIB64="${APPDIR}usr/lib/lmms/RemoteVstPlugin64.exe.so"

ZYNBIN="${APPDIR}usr/bin/RemoteZynAddSubFx"
VSTBIN="${APPDIR}usr/bin/RemoteVstPlugin.exe.so"
VSTBIN32="${APPDIR}usr/bin/RemoteVstPlugin32.exe.so"
VSTBIN64="${APPDIR}usr/bin/RemoteVstPlugin64.exe.so"

mv "$ZYNLIB" "$ZYNBIN"
mv "$VSTLIB" "$VSTBIN"
mv "$VSTLIB32" "$VSTBIN32"
mv "$VSTLIB64" "$VSTBIN64"

# Patch the desktop file
sed -i 's/.*Exec=.*/Exec=lmms.real/' "$DESKTOPFILE"
Expand All @@ -156,7 +162,8 @@ for file in "${APPDIR}usr/lib/lmms/"*.so; do
executables="${executables} -executable=$thisfile"
done
executables="${executables} -executable=${ZYNBIN}"
executables="${executables} -executable=${VSTBIN}"
executables="${executables} -executable=${VSTBIN32}"
executables="${executables} -executable=${VSTBIN64}"
executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/imp_1199.so"
executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/imbeq_1197.so"
executables="${executables} -executable=${APPDIR}usr/lib/lmms/ladspa/pitch_scale_1193.so"
Expand All @@ -171,7 +178,8 @@ success "Bundled and relinked dependencies"

# Link to original location so lmms can find them
ln -sr "$ZYNBIN" "$ZYNLIB"
ln -sr "$VSTBIN" "$VSTLIB"
ln -sr "$VSTBIN32" "$VSTLIB32"
ln -sr "$VSTBIN64" "$VSTLIB64"

# Remove wine library conflict
rm -f "${APPDIR}/usr/lib/libwine.so.1"
Expand Down
63 changes: 63 additions & 0 deletions cmake/linux/winegcc_wrapper.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/sh
# Wrapper script for winegcc to remove .exe file ending automatically
# appended by winebuild.
# Usage: winegcc <args ...>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your usage says winegcc. I'm sure this was intentional, but more accurately...

# Usage: winegcc_wrapper <args ...>

# --- OR ---
# Usage:
#    CONFIGURE_FILE("path/to/winegcc_wrapper.in winegcc_wrapper @ONLY)
#    SET(WINEGCC "path/to/winegcc_wrapper")
#    winegcc <args ...>

Probably nitpicking, but didn't know if it was a typo or intentional. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't intentional, I don't even know why I wrote this in the first place. :) Although your version is definitely better, I think I'll replace it with a note to FindWine.cmake since it's not supposed to be used outside of that context anyway.


set -e

args="$@"

# Find output name, link mode and architecture
while [ $# -gt 0 ]; do
key="$1"

case $key in
-o)
output=$2
shift
;;
-c)
no_link=true
;;
-m32)
win32=true
;;
*)

;;
esac

shift
done

if [ -z "$output" ]; then
# If -c is used without specifying an output name, GCC defaults to "a.out".
if [ "$no_link" != true ]; then
output="a.out"
no_move=true
fi
fi

# Some Wine distributions can't find their own headers. WINE_INCLUDE_DIR provided
# by FindWine.cmake
extra_args="-I@WINE_INCLUDE_DIR@"

# Apply -m32 library fix if necessary
if [ "$win32" = true ] && [ "$no_link" != true ]; then
extra_args="$extra_args @WINE_32_FLAGS@"
fi

# Run winegcc
export WINEBUILD=@WINE_BUILD@
@WINE_CXX@ $extra_args $args

if [ "$no_move" = true ] || [ "$no_link" = true ]; then
exit 0
fi

if [ ! -e "$output.exe" ]; then
echo "Fatal error in winegcc wrapper: No output file \"$output.exe\" found."
exit 1
fi

mv $output.exe $output
25 changes: 18 additions & 7 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
INCLUDE(GenQrc)

MACRO(BUILD_PLUGIN PLUGIN_NAME)
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN})
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "LINK;EXPORT_BASE_NAME" "MOCFILES;EMBEDDED_RESOURCES;UICFILES" ${ARGN})
SET(PLUGIN_SOURCES ${PLUGIN_UNPARSED_ARGUMENTS})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include)
Expand Down Expand Up @@ -50,19 +50,19 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
SET(QT_LIBRARIES "${QT_OVERRIDE_LIBRARIES}")
ENDIF()

IF ("${PLUGIN_LINK}" STREQUAL "SHARED")
ADD_LIBRARY(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT})
ELSE ()
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT})
ENDIF ()
IF (NOT PLUGIN_LINK)
SET(PLUGIN_LINK "MODULE")
ENDIF()

ADD_LIBRARY(${PLUGIN_NAME} ${PLUGIN_LINK} ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT})

TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml)

IF(LMMS_BUILD_WIN32)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} lmms)
ENDIF(LMMS_BUILD_WIN32)

INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}")
INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION "${PLUGIN_DIR}")

IF(LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader ${CMAKE_BINARY_DIR}/lmms")
Expand All @@ -74,5 +74,16 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
ENDIF()

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${RCC_OUT} ${plugin_MOC_out}")

IF(NOT PLUGIN_EXPORT_BASE_NAME)
SET(PLUGIN_EXPORT_BASE_NAME "PLUGIN")
ENDIF()

GENERATE_EXPORT_HEADER(${PLUGIN_NAME}
BASE_NAME ${PLUGIN_EXPORT_BASE_NAME}
)
TARGET_INCLUDE_DIRECTORIES(${PLUGIN_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
ENDMACRO(BUILD_PLUGIN)

33 changes: 33 additions & 0 deletions cmake/modules/CheckCXXPreprocessor.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

macro(CHECK_CXX_PREPROCESSOR VAR DIRECTIVE)
string(RANDOM DEFINED_KEY)
string(RANDOM UNDEFINED_KEY)

set(TMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/CxxTmp/src.cpp")
SET(SRC "
#if ${DIRECTIVE}
#error ${DEFINED_KEY}
#else
#error ${UNDEFINED_KEY}
#endif
")
file(WRITE ${TMP_FILENAME} "${SRC}")
try_compile(RESULT_VAR
${CMAKE_CURRENT_BINARY_DIR}
${TMP_FILENAME}
OUTPUT_VARIABLE OUTPUT_VAR
)

if(OUTPUT_VAR MATCHES ${DEFINED_KEY})
set(${VAR} ON)
elseif(OUTPUT_VAR MATCHES ${UNDEFINED_KEY})
set(${VAR} OFF)
else()
message(FATAL_ERROR "Can't determine if \"${DIRECTIVE}\" is true.")
endif()
endmacro()


macro(CHECK_CXX_DEFINE VAR DEFINE)
CHECK_CXX_PREPROCESSOR(${VAR} "defined(${DEFINE})")
endmacro()
4 changes: 2 additions & 2 deletions cmake/modules/DetectMachine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ MESSAGE("PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
SET(LMMS_HOST_X86 FALSE)
SET(LMMS_HOST_X86_64 FALSE)

IF(MSVC)
STRING(REGEX MATCH "86_64|amd64|AMD64" WIN64 "${CMAKE_SYSTEM_PROCESSOR}")
IF(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(WIN64 ON)
ENDIF()

IF(WIN32)
Expand Down
28 changes: 23 additions & 5 deletions cmake/modules/FindWine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@

LIST(APPEND CMAKE_PREFIX_PATH /opt/wine-stable /opt/wine-devel /opt/wine-staging /usr/lib/wine/)

FIND_PATH(WINE_INCLUDE_DIR windows/windows.h PATH_SUFFIXES wine wine/wine)
FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine)

FIND_PATH(WINE_INCLUDE_DIR wine/exception.h PATH_SUFFIXES wine)
FIND_PROGRAM(WINE_CXX
NAMES wineg++ winegcc winegcc64 winegcc32 winegcc-stable
PATHS /usr/lib/wine)
FIND_PROGRAM(WINE_BUILD NAMES winebuild)

SET(_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})

FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine)

SET(CMAKE_LIBRARY_ARCHITECTURE ${_ARCHITECTURE})

SET(WINE_INCLUDE_DIRS ${WINE_INCLUDE_DIR} )
SET(WINE_LIBRARIES ${WINE_LIBRARY} )
Expand All @@ -24,6 +31,10 @@ STRING(REPLACE " " ";" WINEBUILD_FLAGS "${WINEBUILD_OUTPUT}")

FOREACH(FLAG ${WINEBUILD_FLAGS})
IF("${FLAG}" MATCHES "libwinecrt0.a.*")
STRING(REGEX REPLACE "/wine/libwinecrt0.a.*" "" FLAG "${FLAG}")

SET(WINE_64_LIBRARY_DIR "${FLAG}/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unusual, but it is possible to use 32-bit WINE toolchain wine32-tools on 64-bit Debian/Ubuntu. In that case, 64-bit VST compilation needs the inverse replacing(32-bit toolchain uses 32-bit libraries, even if -m64 is specified).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that something we have supported before and that this PR breaks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that something we have supported

It's an issue when building 64-bit VST on Linux, so no.


# Debian systems
STRING(REPLACE "/lib/x86_64-" "/lib/i386-" FLAG "${FLAG}")
# Fedora systems
Expand All @@ -33,12 +44,19 @@ FOREACH(FLAG ${WINEBUILD_FLAGS})
# WineHQ (/opt/wine-stable, /opt/wine-devel, /opt/wine-staging)
STRING(REPLACE "/lib64/wine/" "/lib/wine/" FLAG "${FLAG}")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic doesn't work anymore because we drop /wine/ before it and causes #4501.
Some possible solutions:

  • Use a regular expression to match trailing lib64
  • Remove /wine/libwinecrt0.a.* after replacing
  • Always replace lib64 with lib if it doesn't break other platforms

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down. Fixed with 515fefa.

STRING(REGEX REPLACE "/wine/libwinecrt0.a.*" "" WINE_LIBRARY_FIX "${FLAG}")
SET(WINE_LIBRARY_FIX "${WINE_LIBRARY_FIX}/")
SET(WINE_32_LIBRARY_DIR "${FLAG}/")
ENDIF()
ENDFOREACH()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Wine DEFAULT_MSG WINE_CXX WINE_LIBRARIES WINE_INCLUDE_DIRS)

mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY)
mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY WINE_CXX WINE_BUILD)

IF(WINE_32_LIBRARY_DIR)
SET(WINE_32_FLAGS "-L${WINE_32_LIBRARY_DIR}wine/ -L${WINE_32_LIBRARY_DIR}")
ENDIF()

# Create winegcc wrapper
configure_file(${CMAKE_CURRENT_LIST_DIR}/../linux/winegcc_wrapper.in winegcc_wrapper @ONLY)
SET(WINEGCC "${CMAKE_CURRENT_BINARY_DIR}/winegcc_wrapper")
6 changes: 5 additions & 1 deletion cmake/nsis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/nsis_branding.bmp")
IF(MSVC)
STRING(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
ENDIF(MSVC)
SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lmms.ico")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME}.exe" PARENT_SCOPE)
SET(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME_UCASE} ${VERSION}" PARENT_SCOPE)
Expand All @@ -8,7 +11,8 @@ SET(CPACK_NSIS_CONTACT "${PROJECT_EMAIL}" PARENT_SCOPE)
SET(CPACK_PACKAGE_EXECUTABLES "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE)
SET(CPACK_NSIS_MENU_LINKS "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE)
SET(CPACK_NSIS_DEFINES "
!include ${CMAKE_SOURCE_DIR}/cmake/nsis/FileAssociation.nsh
!addincludedir ${CMAKE_SOURCE_DIR}/cmake/nsis
!include FileAssociation.nsh
!include LogicLib.nsh
!include WinVer.nsh")
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}-win32")
Expand Down
Loading