Hi, can someone advise me how to compile both static and dynamic libraries
for win32 on linux32 using mingw-w64?
I already used mercurial to get the latest sdl2 sources and built static
and dynamic (libSDL2.a and libSDL2.so.2.0.0) which works fine …
mkdir build
cd build
cmake …/SDL
make
I also have mingw-w64 setup correctly and have used it in the past to on
linux32 compile openssl for win32/win64 using syntax like
’CROSS_COMPILE=“i686-w64-mingw32-” ./Configure mingw64 no-asm shared &
make’, which outputs win32 static and dynamic libraries correctly.
So my question is, what commands do I issue in linux32 to build the latest
sdl static and dynamic libraries using mingw-w64?
Okay, I believe I got this working. Here is what I did.
First I deleted everything in my build folder, then created a file named
win32.cmake in the same folder with the following contents…
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Then I execute…
cmake -DDIRECTX=NO -DCMAKE_TOOLCHAIN_FILE=./win32.cmake …/SDL
make
And the build completes without errors giving me…
libSDL2.dll
libSDL2.dll.a
libSDL2.a
libSDL2main.a