serpent icon indicating copy to clipboard operation
serpent copied to clipboard

Basic Windows build

Open Superbelko opened this issue 4 years ago • 8 comments

Sorry for not going normal fork-PR procedure. But if you insist I can do it that way.

So, anyway. In order to build on Windows you need to handle dependencies with dub and handle platform init.

dub.json - split 'posix' deps (these are your current deps) and 'windows' deps (also note you have bxRelease two times, which is probably a type or copy paste error)

	"libs-posix": [
		"SDL2", "SDL2_image",
		"bgfxRelease", "bxRelease", "bimgRelease",
		"stdc++", "GL", "x11", "bxRelease",
	],
	"libs-windows": [
		"SDL2", "SDL2_image",
		"bgfxRelease", "bxRelease", "bimgRelease",
	],

However this is not enough, LDC will happily tell you that unreachable code is detected in file source\serpent\graphics\pipeline\bgfx\pipeline.d somewhere inside integrateWindowBgfx() function.

Let's fix this, and while we are here let's also change platform handling to proper static assert which will clearly state the problem and give a hint to potential devs what they should do before they can build and use it.

source\serpent\graphics\pipeline\bgfx\pipeline.d

    final void integrateWindowBgfx() @system
    {
        // ...
        version (Posix)
        {
            // ... 
        }
        else version (Windows)
        {
            pd.nwh = wm.info.win.window;
        }
        else
        {
            static assert(0, "Unsupported platform");
        }
        // ...
    }

Assuming you've already build SDL2, SDL2_Image and bgfx libraries and placed them inside that same folder(a hacky solution for now) you will be able to build demo scene project like the one on a repo page.

Superbelko avatar Feb 29 '20 03:02 Superbelko

bxRelease was actually repeated due to linkage issues :) I'll implement the bits I can, but I can't validate as I haven't got Windows >_> - Thanks bud

ikeycode avatar Mar 06 '20 16:03 ikeycode

FWIW I know some stuff is going to fail on paths so I'll preempt some of that

ikeycode avatar Mar 06 '20 16:03 ikeycode

Some initial changes now in

ikeycode avatar Mar 06 '20 16:03 ikeycode

We're gonna need to figure out compilation of shaders on Windows too which will be fun..

ikeycode avatar Mar 06 '20 17:03 ikeycode

Ok, tried it again, and there is some issues with coordination of things. Paths and other stuff isn't uniform right now, there is discrepancies in behavior between prepare-shaders.d and .sh variants and some other little nasty things.

I see there is plans to use google shaderc instead bgfx one, but anyway, for some reason script uses plain shaderc name while bgfx built version adds suffixes like 'Release' and 'Debug'.

So I got the exception about world context manager assets/World doesn't exists, adding empty folder solved this.

After all manipulations it worked as before. But for now I assume it is better just to wait until things settle up a bit and demo game is extracted to the separate repo.

Superbelko avatar Mar 07 '20 03:03 Superbelko

Aye, I'm in the process of deprecating the current scripts in favour of prepare-shaders.d. Note that our builds use the serpent-support repo which expects certain filenames, as there just isn't really a convention for bgfx builds.

I need to fix some bugs in the repo so that the demo-rpg repo can build against this repo and benefit from the internal shaders, which means we won't need to load any files in the core, helping with portability and startup speed a lot.

Primarily our focus is Linux, so we need to be able to correctly link against the system libraries and runtime stuff like bgfx. Eventually we expect Serpent games to bundle minimal requirements such as bgfx and the LDC runtime, to run correctly everywhere. Unfortunately bgfx has no release process, no versioning and no SONAME, so we're having to jimmy the whole lot together.

prepare-shaders.d will precook the shaders into a built/ path ready for import. We're also planning #12 to do shader caching too, so there is a lot of work going on in the 'make shaders not suck' department. Eventually all that will exist in assets/ is the shader source.

ikeycode avatar Mar 07 '20 09:03 ikeycode

Hi, sorry for bothering again.

But this has to be capitalized. Only 'linux' one is all lower case for some historical reasons, all the rest version identifiers names are capitalized (ok, iOS is funky too).[1] https://github.com/lispysnake/serpent/blob/master/scripts/prepare-shaders.d#L59

[1] https://dlang.org/spec/version.html#predefined-versions

Superbelko avatar Mar 10 '20 09:03 Superbelko

Derp, my bad sorry. don't mind the the bothering it helps me :D

ikeycode avatar Mar 10 '20 10:03 ikeycode