Skip to content
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

[FEATURE] - Windows Compilation Support #27

Closed
thatnerdjosh opened this issue Sep 25, 2022 · 4 comments
Closed

[FEATURE] - Windows Compilation Support #27

thatnerdjosh opened this issue Sep 25, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@thatnerdjosh
Copy link
Collaborator

thatnerdjosh commented Sep 25, 2022

Describe the feature

It would be nice to be able to compile the engine and dependencies for a Windows environment.

What has been tried so far

mingw Support @Toasterbirb

  1. Installed mingw on Gentoo
  2. Enabled mingw support in CMakeLists.txt https://cmake.org/cmake/help/latest/variable/MINGW.html
  3. Tried installing SDL development libraries for mingw from portage

What we found so far

  • mingw support in CMakeLists.txt caused issue with compilation in Linux (SDL2_mixer)
  • SDL development libraries for mingw had dependency issues
    • GObjectIntrospection issue requiring python which the mingw environment doesn't have

MSVC Support @thatnerdjosh

We installed the following on a Windows 10 host:

  1. Visual Studio 2022 Build Tools - https://visualstudio.microsoft.com/downloads/
  2. Visual Studio 2010 Build Tools - https://go.microsoft.com/fwlink/p/?LinkId=838916
  3. https://github.com/microsoft/vcpkg/blob/master/ports/sdl2-gfx/CMakeLists.txt brought into sdl2-gfx for CMake support
  4. Configured CMakeLists.txt to compile SDL2_gfx in the same way as the other SDL libraries.

Within the "Developer Command Prompt for VS 2022":

mkdir build
cmake ..
msbuild Birb2D.sln

What we found so far

We need to fix warnings that affect portability of the program. A port has already been completed that we may be able to leverage to resolve some (or all) of these.

@thatnerdjosh thatnerdjosh added the enhancement New feature or request label Sep 25, 2022
@thatnerdjosh
Copy link
Collaborator Author

thatnerdjosh commented Sep 25, 2022

We think it would make sense to go further down the mingw route for now, and revisit MSVC at a later time.

It would probably make sense to get a Dockerfile setup with mingw

@Toasterbirb
Copy link
Owner

The rest of the warnings (generated by -Wall -Wextra -Wpedantic) should be gone now after commit cca7f91. The engine code is now compiled with -Werror, so warnings are treated as errors thus preventing any further clear cases of not-so-portable code

@Toasterbirb Toasterbirb pinned this issue Oct 3, 2022
@Toasterbirb
Copy link
Owner

I have managed to get SDL to mostly compile with mingw. The missing puzzle piece to that was not setting the C compiler to mingw

Toasterbirb added a commit that referenced this issue Oct 4, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Not closing #27 yet, but
windows "support" is getting close. I got
[this](https://github.com/Toasterbirb/Ludum-Dare-51) project to compile
for windows and it ran successfully in wine
@Toasterbirb
Copy link
Owner

I'd consider Windows builds functional at this point. The tests compile but don't run due to some issue with the doctest + mingw combo. So far this LD project is the only test case for this build configuration and further testing is needed for more streamlined experience.

To configure a windows build, use the included scripts/win_build.sh script. It will create a new build directory and configure it with mingw and some other variables

The full build time dependency list isn't yet known, but the following are required at minimum for compiling Birb2D on windows:

  • cmake
  • make
  • gcc-mingw-w64-x86-64
  • g++-mingw-w64-x86-64

These should be pretty simple to setup in WSL. Since most of the issues came from non-portable code and other issues, using Visual Studio and such without mingw should also be possible, but I can't give any guidance for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants