Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
MSVC VST compilation fixes
  • Loading branch information
lukas-w committed Jun 11, 2018
commit cd35ec2d587ed464d0edd0f17c43cb43fe604955
30 changes: 13 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ ENDIF()
INCLUDE(VersionInfo)
INCLUDE(DetectMachine)

IF(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake$")
SET(USING_VCPKG TRUE)
ENDIF()

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 @@ -169,15 +165,15 @@ FIND_PACKAGE(Qt5Test)
SET(QT_QTTEST_LIBRARY Qt5::Test)

# check for libsndfile
IF(USING_VCPKG)
FIND_PACKAGE(LibSndFile 1.0.18 REQUIRED)
SET(SNDFILE_LIBRARIES sndfile-shared)
ELSE(USING_VCPKG)
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()
ENDIF(USING_VCPKG)
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)
SET(LMMS_HAVE_SF_COMPLEVEL TRUE)
Expand Down Expand Up @@ -402,13 +398,13 @@ ENDIF(WANT_JACK)


# check for FFTW3F-library
IF(USING_VCPKG)
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)
ELSE(USING_VCPKG)
PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0)
ENDIF(USING_VCPKG)
ENDIF()

# check for FLTK
FIND_PACKAGE(FLTK)
Expand Down Expand Up @@ -490,13 +486,13 @@ ELSE()
ENDIF(WANT_DEBUG_FPE)

# check for libsamplerate
IF(USING_VCPKG)
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)
ELSE(USING_VCPKG)
PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8)
ENDIF(USING_VCPKG)
ENDIF()

# set compiler flags
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
Expand Down
65 changes: 2 additions & 63 deletions plugins/vst_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,67 +29,6 @@ SET(EXTERNALPROJECT_CMAKE_ARGS
)

# build 32 bit version of RemoteVstPlugin
IF(LMMS_BUILD_WIN32 AND NOT LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
ELSEIF(LMMS_BUILD_WIN64 AND MSVC)
STRING(REPLACE " Win64" "" GENERATOR ${CMAKE_GENERATOR})

IF(NOT USING_VCPKG)
GET_FILENAME_COMPONENT(QT_BIN_DIR ${QT_QMAKE_EXECUTABLE} DIRECTORY)
SET(QT_32_PREFIX "${QT_BIN_DIR}/../../msvc${MSVC_YEAR}")
IF(NOT (IS_DIRECTORY ${QT_32_PREFIX} AND EXISTS ${QT_32_PREFIX}/bin/qmake.exe))
MESSAGE(SEND_ERROR "Can't build RemoteVstPlugin32, no Qt 32 bit installation found at ${QT_32_PREFIX}")
ENDIF()
ENDIF(NOT USING_VCPKG)

ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_GENERATOR ${GENERATOR}
CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET}
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}"
)
ELSEIF(LMMS_BUILD_LINUX)
# Use winegcc
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_CXX_COMPILER=${WINEGCC}"
"-DCMAKE_CXX_FLAGS=-m32 -mwindows"
)
ELSEIF(CMAKE_TOOLCHAIN_FILE_32)
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_32}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_32}"
)
ELSE()
message(SEND_ERROR "Can't build RemoteVstPlugin32, unknown environment. Please supply CMAKE_TOOLCHAIN_FILE_32 and optionally CMAKE_PREFIX_PATH_32")
ENDIF()

INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin32.cmake")
# build 64 bit version of RemoteVstPlugin
IF(LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64.exe" DESTINATION "${PLUGIN_DIR}")
ELSEIF(LMMS_BUILD_LINUX)
ExternalProject_Add(RemoteVstPlugin64
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_CXX_COMPILER=${WINEGCC}"
"-DCMAKE_CXX_FLAGS=-m64 -mwindows"
)
ENDIF()

IF(TARGET RemoteVstPlugin32)
IF(LMMS_BUILD_LINUX)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}")
ELSEIF(LMMS_BUILD_WIN32)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}")
ENDIF()
ENDIF()
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin64.cmake")
67 changes: 67 additions & 0 deletions plugins/vst_base/RemoteVstPlugin32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
IF(LMMS_BUILD_WIN32 AND NOT LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
ELSEIF(LMMS_BUILD_WIN64 AND MSVC)
SET(MSVC_VER ${CMAKE_CXX_COMPILER_VERSION})

IF(NOT CMAKE_GENERATOR_32)
IF(MSVC_VER VERSION_GREATER 19.0 OR MSVC_VER VERSION_EQUAL 19.0)
SET(CMAKE_GENERATOR_32 "Visual Studio 14 2015")
SET(MSVC_YEAR 2015)
ELSEIF(MSVC_VER VERSION_EQUAL 19.10 OR MSVC_VER VERSION_EQUAL 19.10)
SET(CMAKE_GENERATOR_32 "Visual Studio 15 2017")
SET(MSVC_YEAR 2017)
ELSE()
MESSAGE(SEND_WARNING "Can't build RemoteVstPlugin32, unknown MSVC version ${MSVC_VER} and no CMAKE_GENERATOR_32 set")
RETURN()
ENDIF()
ENDIF()

IF(NOT QT_32_PREFIX AND NOT USING_VCPKG)
GET_FILENAME_COMPONENT(QT_BIN_DIR ${QT_QMAKE_EXECUTABLE} DIRECTORY)
SET(QT_32_PREFIX "${QT_BIN_DIR}/../../msvc${MSVC_YEAR}")
ENDIF()

IF(NOT QT_32_PREFIX)
MESSAGE(WARNING "Can't build RemoteVstPlugin32, QT_32_PREFIX not set")
RETURN()
ELSEIF(NOT (IS_DIRECTORY ${QT_32_PREFIX} AND EXISTS ${QT_32_PREFIX}/bin/qmake.exe))
MESSAGE(WARNING "Can't build RemoteVstPlugin32, no Qt 32 bit installation found at ${QT_32_PREFIX}")
RETURN()
ENDIF()

ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_GENERATOR "${CMAKE_GENERATOR_32}"
#CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}"
)
ELSEIF(LMMS_BUILD_LINUX)
# Use winegcc
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_CXX_COMPILER=${WINEGCC}"
"-DCMAKE_CXX_FLAGS=-m32 -mwindows"
)
ELSEIF(CMAKE_TOOLCHAIN_FILE_32)
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_32}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_32}"
)
ELSE()
message(WARNING "Can't build RemoteVstPlugin32, unknown environment. Please supply CMAKE_TOOLCHAIN_FILE_32 and optionally CMAKE_PREFIX_PATH_32")
RETURN()
ENDIF()

IF(LMMS_BUILD_LINUX)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}")
ELSEIF(LMMS_BUILD_WIN32)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}")
ENDIF()
13 changes: 13 additions & 0 deletions plugins/vst_base/RemoteVstPlugin64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
IF(LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64.exe" DESTINATION "${PLUGIN_DIR}")
ELSEIF(LMMS_BUILD_LINUX)
ExternalProject_Add(RemoteVstPlugin64
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_CXX_COMPILER=${WINEGCC}"
"-DCMAKE_CXX_FLAGS=-m64 -mwindows"
)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin64.exe.so" DESTINATION "${PLUGIN_DIR}")
ENDIF()
14 changes: 7 additions & 7 deletions plugins/vst_base/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ namespace PE
// Utilities for reading PE file machine type
// See specification at https://msdn.microsoft.com/library/windows/desktop/ms680547(v=vs.85).aspx

enum MachineType : uint16_t
enum class MachineType : uint16_t
{
IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
IMAGE_FILE_MACHINE_AMD64 = 0x8664,
IMAGE_FILE_MACHINE_I386 = 0x14c,
unknown = 0x0,
amd64 = 0x8664,
i386 = 0x14c,
};

class FileInfo
Expand Down Expand Up @@ -153,15 +153,15 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
machineType = peInfo.machineType();
} catch (std::runtime_error& e) {
qCritical() << "Error while determining PE file's machine type: " << e.what();
machineType = PE::IMAGE_FILE_MACHINE_UNKNOWN;
machineType = PE::MachineType::unknown;
}

switch(machineType)
{
case PE::IMAGE_FILE_MACHINE_AMD64:
case PE::MachineType::amd64:
tryLoad( "RemoteVstPlugin64" );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I understand correctly, this will try to load 64bit DLL in 32bit system using nonexistent RemoteVstPlugin64. It will print an error message, but Windows users can't see that.
Do we need to try this on 32bit LMMS?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is correct, there's no visible error message in the GUI when loading fails. This PR doesn't change that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think error message issue can be fixed later, but do we ever need to try to load VST with RemoteVstPlugin64 on 32bit systems?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Theoretically, we could ship a RemoteVstPlugin64 with our 32bit Windows installers for users who install 32bit LMMS because they're unaware of the difference. In that case, it's good to try RemoteVstPlugin64. In any other case, there's no harm done here. tryLoad will discover that RemoteVstPlugin64 doesn't exist and will abort, at which point we can easily add an error message later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it, I didn't think about that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we may try to detect processor in runtime if possible, though it looks like out of scope.
Qt provides QSysInfo::currentCpuArchitecture as of Qt 5.4, and it's also possible to use OS-dependent detection.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I opened #4447 to track it.

break;
case PE::IMAGE_FILE_MACHINE_I386:
case PE::MachineType::i386:
tryLoad( "RemoteVstPlugin32" );
break;
default:
Expand Down