tx00100xt / SeriousSamClassic-VK

Open source game engine version developed by Croteam for Serious Sam Classic with Vulkan support (Windows, Linux, FreeBSD, OpenBSD, macOS, Raspberry Pi OS). Based on https://github.com/sultim-t/Serious-Engine-Vk and linux port https://github.com/icculus/Serious-Engine
GNU General Public License v2.0
99 stars 12 forks source link

Windows executables compilable from Linux host? #37

Closed dragon99919 closed 1 week ago

dragon99919 commented 2 weeks ago

Hey! I've been trying to make a project that can natively run in both Linux and Windows, and while compiling Linux version on Linux host goes just fine, when trying to use mingw-w64-x86_64 the CMake screams about SDL2 not being found:

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR) Call Stack (most recent call first): /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) cmake/FindSDL2.cmake:164 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:46 (find_package)

Any idea if this is fixable under Linux, or do Windows binaries will have to be compiled via VM (trying to not resort to that)?

If it helps anyhow, I was using a script for CMake found in some other repo that was said would work to compile Windows apps under Linux:

Sample toolchain file for building for Windows from an Ubuntu Linux system. Typical usage: ) install cross compiler: sudo apt-get install mingw-w64 ) cd build *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake .. This is free and unencumbered software released into the public domain.

set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) 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)

tx00100xt commented 2 weeks ago

Hello. SDL2 is used only in the Linux version. When compiling a game for Windows, WinAPI is used. It is required to rewrite CMakeLists.txt for the use MinGW. You may also need a definition in the Engine code. Libraries EntitiesMP and GameMP should be compiled without problems.

I once didn’t bother to write for the MinGW , because projects GameGUIMP , EngineGui, SeriousSkaStudio, Modeler and WorldEditor contain MFC.

It will take a lot of work. It's easier to compile on a virtual machine using Windows. And one of the problems of the engine is that the network code will be incompatible between Windows and Linux https://github.com/tx00100xt/SeriousSamClassic-VK/issues/18

dragon99919 commented 1 week ago

Understandable, well, time to set up a VM, cheers. ; )