-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix MSVC VST compilation #4421
Changes from 29 commits
884601f
74d4b2f
81a0ec3
c41d59b
2b1b3d3
b416036
9c35487
c3d0dc5
e95a587
e644202
8fce500
f702738
5b9579d
9a9580a
a0bd296
39d83ee
be0c02f
5744c2a
3beac2c
9db8cbf
cd35ec2
225e902
aa2c867
3d98b0a
ad4c4f0
00fda3f
4d5eb7f
0349b97
af57300
57fdaed
40a1e36
642703e
66c2047
65ccaff
d04965a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 ...> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your usage says # 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. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
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 |
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() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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} ) | ||
|
@@ -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}/") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unusual, but it is possible to use 32-bit WINE toolchain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that something we have supported before and that this PR breaks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 | ||
|
@@ -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}") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic doesn't work anymore because we drop
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be a pair of parenthesis:
make appimage || (cat appimage.log && false)
See also: https://unix.stackexchange.com/questions/88850/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PhysSong tested, confirmed...
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I just missed that.