VST build fixes

This commit is contained in:
Lukas W
2017-11-27 21:26:03 +01:00
parent ea154694f9
commit bba072d54e
7 changed files with 90 additions and 63 deletions

63
cmake/linux/winegcc_wrapper.in Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/sh
# Wrapper script for winegcc to remove .exe file ending automatically
# appended by winebuild.
# Usage: winegcc <args ...>
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

View File

@@ -9,11 +9,12 @@
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_PATH(WINE_INCLUDE_DIR wine/exception.h PATH_SUFFIXES wine)
FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine)
FIND_PROGRAM(WINE_CXX
NAMES wineg++ winegcc winegcc64 winegcc32 winegcc-stable
PATHS /usr/lib/wine)
FIND_PROGRAM(WINE_BUILD NAMES winebuild)
SET(WINE_INCLUDE_DIRS ${WINE_INCLUDE_DIR} )
SET(WINE_LIBRARIES ${WINE_LIBRARY} )
@@ -41,4 +42,12 @@ 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_LIBRARY_FIX)
SET(WINE_32_FLAGS "-L${WINE_LIBRARY_FIX}wine/ -L${WINE_LIBRARY_FIX}")
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")

View File

@@ -7,6 +7,10 @@ INCLUDE(ExternalProject)
ADD_SUBDIRECTORY(vstbase)
IF(LMMS_BUILD_LINUX AND WANT_VST_NOWINE)
RETURN()
ENDIF()
SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR})
SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR})
@@ -25,7 +29,6 @@ SET(EXTERNALPROJECT_CMAKE_ARGS
# build 32 bit version of RemoteVstPlugin
IF(LMMS_BUILD_WIN64 AND MSVC)
SET(MSVC_VER ${CMAKE_CXX_COMPILER_VERSION})
IF(MSVC_VER VERSION_GREATER 19.0 OR MSVC_VER VERSION_EQUAL 19.0)
@@ -53,24 +56,25 @@ IF(LMMS_BUILD_WIN64 AND MSVC)
)
ELSEIF(LMMS_BUILD_WIN32)
ADD_SUBDIRECTORY(RemoteVstPlugin)
ELSEIF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE)
ELSEIF(LMMS_BUILD_LINUX)
ExternalProject_Add(RemoteVstPlugin32
${EXTERNALPROJECT_ARGS}
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
${EXTERNALPROJECT_CMAKE_ARGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin/winegcc
-DCMAKE_CXX_FLAGS="-m32"
-DCMAKE_CXX_COMPILER=${WINEGCC}
"-DCMAKE_CXX_FLAGS=-m32 -mwindows"
)
ENDIF()
# build 64 bit version of RemoteVstPlugin
IF(LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
ELSEIF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE)
ELSEIF(LMMS_BUILD_LINUX)
ExternalProject_Add(RemoteVstPlugin64
${EXTERNALPROJECT_ARGS}
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
${EXTERNALPROJECT_CMAKE_ARGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin/winegcc
-DCMAKE_CXX_COMPILER=${WINEGCC}
"-DCMAKE_CXX_FLAGS=-m64 -mwindows"
)
ENDIF()

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.1)
project(RemoteVstPlugin
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)

View File

@@ -1,49 +0,0 @@
#!/bin/sh
# Wrapper script for winegcc to remove .exe file ending automatically
# appended by winebuild.
# Usage: winegcc <args ...>
set -e
args="$@"
# Find output name
POSITIONAL=()
while [ $# -gt 0 ]; do
key="$1"
case $key in
-o)
output=$2
shift
;;
-c)
no_link=true
;;
*)
;;
esac
shift
done
if [ -z "$output" ]; then
if [ "$no_link" != true ]; then
output="a.out"
no_move=true
fi
# echo "Fatal error in winegcc wrapper: Can't find output file name in args."
# exit 1
fi
wineg++ $args
if [ -z "$no_link" ] && [ "$no_move" != true ]; then
if [ ! -e "$output.exe" ]; then
echo "Fatal error in winegcc wrapper: No output file \"$output.exe\" found."
exit 1
fi
mv $output.exe $output
fi

View File

@@ -81,14 +81,14 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
{
setSplittedChannels( true );
#ifdef LMMS_HOST_X86_64
#ifdef LMMS_BUILD_WIN64
tryLoad( "RemoteVstPlugin64" );
if( m_badDllFormat )
{
m_badDllFormat = false;
#endif
tryLoad( "RemoteVstPlugin32" );
#ifdef LMMS_HOST_X86_64
#ifdef LMMS_BUILD_WIN64
}
#endif

View File

@@ -123,7 +123,7 @@ RemotePlugin::RemotePlugin() :
connect( &m_process, SIGNAL( finished( int, QProcess::ExitStatus ) ),
this, SLOT( processFinished( int, QProcess::ExitStatus ) ) );
connect( &m_process, SIGNAL( errorOccured( QProcess::ProcessError ) ),
connect( &m_process, SIGNAL( errorOccurred( QProcess::ProcessError ) ),
this, SLOT( processErrored( QProcess::ProcessError ) ) );
}