Kode / Kinc

Modern low level game library and hardware abstraction.
http://kinc.tech
zlib License
511 stars 121 forks source link

Cross compilation from Linux to Windows #866

Open bluesillybeard opened 6 months ago

bluesillybeard commented 6 months ago

Spinning up a Windows VM to export a project for Windows is a bit of a drag. Doing it from Linux with cross-compilation would save a ton of time and energy.

I don't know how this could be done, but I do know that it requires compiling with clang and/or mingw, adding cross-compilation to kmake, and linking required system libraries when those libraries don't actually exist on the host system.

A solid alternative is to compile Kinc ahead of time as a library (.lib), but that still requires going through the process on a Windows VM for every update.

For some context, I am creating a game engine that uses Kinc.

RobDangerous commented 6 months ago

MingW does now work from what I've heard but if you use Direct3D (which is recommended) you will run into problems compiling shaders. For D3D12 you can probably make it work by using DXC instead of FXC.

bluesillybeard commented 6 months ago

I'm mainly focused on getting Vulkan to work. The command I'm using is ./make --compile --lib --target windows --arch x86_64 --debug --graphics vulkan, which fails due to the Vulkan SDK not being present. The same command works fine on Windows.

bluesillybeard commented 6 months ago

In a week or so I'll be able to focus my time into this, for now though I can't really help much.

SunDaw commented 6 months ago

The Vulkan SDK is neither part of MinGW nor Windows SDK - you will need to install that separately in either case. And on Windows Kinc expects to find the path to it via an environment variable (https://github.com/Kode/Kinc/blob/main/kfile.js#L111) - so you'd need to set that up first before running kmake (and I don't know how well that works for cross-compiling purposes)