Re: [hatari-devel] Win32 console patch |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
On Sonntag, 6. November 2022 20:09:09 CET Thorsten Otto wrote: > maybe the SDL2.cmake is causing troubles now?
Building on windows is definitely broken by commit https://git.tuxfamily.org/hatari/hatari.git/commit/?id=79ed0ebc9d2a3bc7b77ba18f75b10352c5e886dd
I've checked out Hatari with and without that commit. The link command in both cases is identical:
cc.exe -std=gnu99 -Wcast-qual -Wbad-function-cast -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wall -Wwrite-strings -Wsign-compare -Wformat-security -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -mwindows -Wl,--as-needed -lssp -Wl,--whole-archive CMakeFiles/hatari.dir/objects.a -Wl,--no-whole-archive -o hatari.exe -Wl,--out-implib,libhatari.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/hatari.dir/linklibs.rsp
However the contents of the linklibs.rsp response file is different. With the non-working SDL2.cmake it looks like this:
-LC:/home/hatari/Release/src/debug -LC:/home/hatari/Release/src/falcon -L"C:/home/hatari/Release/src/gui-sdl" -LC:/home/hatari/Release/src/cpu falcon/libFalcon.a cpu/libUaeCpu.a "gui-sdl/libGuiSdl.a" libFloppy.a debug/libDebug.a C:/msys64/mingw32/lib/libSDL2main.a C:/msys64/mingw32/lib/libSDL2.dll.a C:/msys64/mingw32/lib/libm.a C:/msys64/mingw32/lib/libreadline.dll.a C:/msys64/mingw32/lib/libz.dll.a C:/msys64/mingw32/lib/libpng.dll.a C:/msys64/mingw32/lib/libportmidi.dll.a C:/msys64/mingw32/lib/libcapsimg.dll.a -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
With the working, custom FindSDL2.cmake that was used previously, it looks like this:
-LC:/home/hatari/Release/src/debug -LC:/home/hatari/Release/src/falcon -L"C:/home/hatari/Release/src/gui-sdl" -LC:/home/hatari/Release/src/cpu falcon/libFalcon.a cpu/libUaeCpu.a "gui-sdl/libGuiSdl.a" libFloppy.a debug/libDebug.a -lmingw32 C:/msys64/mingw32/lib/libSDL2main.a C:/msys64/mingw32/lib/libSDL2.dll.a C:/msys64/mingw32/lib/libm.a C:/msys64/mingw32/lib/libSDL2main.a C:/msys64/mingw32/lib/libreadline.dll.a C:/msys64/mingw32/lib/libz.dll.a C:/msys64/mingw32/lib/libpng.dll.a C:/msys64/mingw32/lib/libportmidi.dll.a C:/msys64/mingw32/lib/libcapsimg.dll.a -lws2_32 C:/msys64/mingw32/lib/libSDL2.dll.a C:/msys64/mingw32/lib/libm.a C:/msys64/mingw32/lib/libreadline.dll.a C:/msys64/mingw32/lib/libz.dll.a C:/msys64/mingw32/lib/libpng.dll.a C:/msys64/mingw32/lib/libportmidi.dll.a C:/msys64/mingw32/lib/libcapsimg.dll.a -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
Note that -lmingw32 is missing from the broken version, which seems to be needed to resolve the reference to main() in a Windows GUI program.
Also, libSDL2main.a is specified twice in thw working version, maybe to resolve the reference to SDLmain()
SDL is version 2.0.22, and cmake 3.24.1
PS.: as a quick workaround, i added:
diff --git a/CMakeLists.txt b/CMakeLists.txt index d708371d..761fefcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,9 @@ find_package(SDL2) if(NOT SDL2_FOUND) message(FATAL_ERROR "SDL2 library not found!") endif(NOT SDL2_FOUND) +if(WIN32) + set(SDL2_LIBRARIES "-lmingw32;${SDL2_LIBRARIES}") +endif()
find_package(Math)
which seems to fix it. I also did a quick check, and the console patch seems to work as intended, even when invoking the debugger.
|
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |