SolarLune / masterplan

MasterPlan is a project management software / visual idea board software. It attempts to be easy to use, lightweight, and fun.
https://solarlune.itch.io/masterplan
509 stars 46 forks source link

Not Compiling on/for Windows #81

Open SammCheese opened 2 years ago

SammCheese commented 2 years ago

Both Cross compiling and Native Windows compiling seems to fail with the build script.

Branch: sdl-rework Commit: latest GO: go1.18.3

image

9D-Tony commented 1 year ago

I've found that printing out the "c.CombinedOutput()" line in the build script gives me this output:

# github.com/veandco/go-sdl2/sdl
In file included from ..\..\..\go\pkg\mod\github.com\veandco\go-sdl2@v0.4.21\sdl\audio.go:4:
./sdl_wrapper.h:2:11: fatal error: SDL2/SDL.h: No such file or directory
    2 |  #include <SDL2/SDL.h>
      |           ^~~~~~~~~~~~
compilation terminated.

<ERROR:  exit status 2>

Seems that one of the packages has a problem finding a SDL header file

9D-Tony commented 1 year ago

I got it to compile, unfortunatley I couldn't get it to run with SDL_gfx so for now I removed all references to gfx and did go mod tidy.

I had to follow all the instruction on the Go SDL github, copying all the header files from the development SDL to my gcc folder. Example: going to https://github.com/libsdl-org/SDL/releases/tag/release-2.0.22 and downloading the SDL2-devel-2.0.22-mingw.zip. You do this for SDL, SDL_ttf and SDL_Image.

Since I am running on TDM-GCC mine was located in C:\TDM-GCC-64\x86_64-w64-mingw32 Then once you have removed all the references to SDL_gfx in the go files you can then build with go run ./build_script/main.go -b NOTE removing sdl_gfx removes the frame limit so the application is going to draw as fast as it can

That is the only way i could get it to run on windows.

eljamm commented 1 year ago

After many failed attempts, I was finally able to compile it successfully on my voidlinux machine following the method @9D-Tony suggested, but i also found a way to keep SDL2_gfx and have frame limiting on.

To make the process more automatic i created this bash script, which in short just uses the static SDL2 libraries and header from go-sdl2 to compile to different targets and architectures from linux. I only used it to build linux and windows binaries, however, but it should be possible for mac too.

After downloading the script, you can remove the .sh extension but make sure it's executable with chmod +x ./masterbuilder. Then, either execute it inside the masterplan directory :

./masterbuilder -t windows -a amd64

or to keep things clean, point to it from another path :

./masterbuilder -t windows -a amd64 -s <path/to/masterplan> -o <path/to/output>

You can check out ./masterbuilder -h for more options.

Everything seemed to work fine during my brief tests, but i still haven't used the app for long enough to know for sure.