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")