Skip to content

BUILD: enable final link via C++ #389

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions targets/linux/build-binary
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ make_sounds make_soundfile_linux
echo " => compiling application.."
tgt=$apptgtdir/$SYS_APPNAME$SYS_EXEFIX

if echo $ldflag_additions | grep -q c++ ; then
# a slightly bad trick to switch the compiler
echo WARNING: SWITCHING TO C-PLUS-PLUS
SYS_CC=$SYS_CXX
cflag_additions="$cflag_additions -fpermissive"
fi

if [ "$SYS_MODE" = "debug" ]; then
# enable profiling
cflag_additions="$cflag_additions -pg"
Expand Down
2 changes: 1 addition & 1 deletion targets/win32/build-binary
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if [ `is_standalone_app` = "yes" ]; then
else
if [ `is_gui_app` = yes ]; then
veval "$SYS_CC -I$SYS_PREFIX/include \
$cflag_additions -mwindows win32_microgl.c main.c icon.o -o $tgt \
$cflag_additions -mwindows -fpermissive win32_microgl.c main.c icon.o -o $tgt \
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the -fpermissive also only be applied when using a c++ compiler, as I thought this was only needed if you use non-conforming code?

-L$SYS_PREFIX/lib $ldflag_additions -lpayload -lglu32 -lopengl32 -lgdi32 -lwinmm -lwsock32 -lws2_32 -lrpcrt4 -lcrypt32 -lm"
else
veval "$SYS_CC -I$SYS_PREFIX/include \
Expand Down
5 changes: 5 additions & 0 deletions targets/win32/host_linux
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
win_sysroot=`ls -1d ${WIN32SDK}/i?86-*mingw32* | head -n 1`
win_cross=`ls -1 ${WIN32SDK}/bin/*mingw32*-gcc | head -n 1 | sed 's/gcc$//'`

test -f ${SYS_PREFIX}/include/WinSock2.h || ln -s $win_sysroot/include/winsock2.h ${SYS_PREFIX}/include/WinSock2.h
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you doing this instead of adding another -I$win_sysroot/include in targets/win32/build-binary#L89? Also, does this filename case matter?

test -f ${SYS_PREFIX}/include/WS2tcpip.h || ln -s $win_sysroot/include/ws2tcpip.h ${SYS_PREFIX}/include/WS2tcpip.h
test -f ${SYS_PREFIX}/include/Windows.h || ln -s $win_sysroot/include/windows.h ${SYS_PREFIX}/include/Windows.h
test -f ${SYS_PREFIX}/include/Shlwapi.h || ln -s $win_sysroot/include/shlwapi.h ${SYS_PREFIX}/include/Shlwapi.h

SYS_CC=$win_cross"gcc $SYS_DEBUGFLAG -isysroot $win_sysroot -DWIN32 -DWINVER=0x0501 $cflag_additions"
SYS_CXX=$win_cross"g++ $SYS_DEBUGFLAG -isysroot $win_sysroot -DWIN32 -DWINVER=0x0501 $cflag_additions"
SYS_AR=$win_cross"ar"
Expand Down