tangram-es icon indicating copy to clipboard operation
tangram-es copied to clipboard

Windows (MinGW)

Open karimnaaji opened this issue 5 years ago • 5 comments

Supersedes PR https://github.com/tangrams/tangram-es/pull/1812 (thanks to @tehKaiN for the initial work on this):

  • Add platform layer for Windows platform.
  • Add initial AppVeyor configuration (https://ci.appveyor.com/project/karimnaaji/tangram-es -- currently building my own fork in these logs, but once merged, simply enabling AppVeyor for this repo should work), can be greatly improved by using a docker container having pre-installed dependencies, this initial work builds z-lib and curl from source which isn't the best.
  • Conan wasn't an alternative for the build as it doesn't have dependencies built for MinGW and was failing for unclear reasons when building from source. It could be of use if MSVC is ever supported.
  • ~~curl multi API support hasn't been added yet, still TODO for that PR~~ (added in https://github.com/tangrams/tangram-es/pull/1994).

karimnaaji avatar Feb 13 '19 02:02 karimnaaji

After the installation of MinGW you should be adding the appropriate path of the MinGW libraries to your PATH. An issue like this is most likely the runtime .dlls not available in your PATH. Did you make that step?

Dependency walker is a great tool to manage and resolve those kind of issues.

karimnaaji avatar Feb 14 '19 13:02 karimnaaji

Success! I got the exe to launch after updating my PATH to include my mingw64 bin folder and my "cmake install" bin folder. Might be worth noting that in the README for troubleshooting.

The next issue was that the file path to the default scene was incorrect at launch:

TANGRAM C:\Users\Matt\Documents\tangram-es\platforms\windows\src\main.cpp:25: Base URL: file://C:\Users\Matt\Documents\tangram-es\build\windows
TANGRAM C:\Users\Matt\Documents\tangram-es\core\src\map.cpp:244: Loading scene file (async): file://C:\Users\Matt\Documents\tangram-es\build\windows/scene.yaml
WARNING C:\Users\Matt\Documents\tangram-es\core\src\platform.cpp:29: Failed to read file at path: /scene.yaml

This was the output from launching either from Command Prompt or by clicking the exe in File Explorer. We might need to adjust the file path logic in WindowsPlatform - I don't think our Url class is able to reformat Windows-style paths.

However, once I corrected the file path manually the scene loaded and rendered! 🎉

matteblair avatar Feb 15 '19 08:02 matteblair

@matteblair @karimnaaji I've hacked around it in one of my commits, In main.cpp

    // Resolve the input path against the current directory.
    Url baseUrl("file:///");
    char pathBuffer[PATH_MAX] = {0};
    if (_getcwd(pathBuffer, PATH_MAX) != nullptr) {
        // URL handler apparently needs slash at end of it
        strcat(pathBuffer, "/");
        baseUrl = Url("file:///" + std::string(pathBuffer)).resolved(baseUrl);
    }

IIRC this fixed path problem for me. Of course proper fix would be better but perhaps it'd guide you to the root of the cause.

tehKaiN avatar Feb 15 '19 08:02 tehKaiN

Any progress in this PR?

charlenni avatar Feb 10 '21 21:02 charlenni

I've been sadly neglecting this PR for a long time. I had been attempting to create a "native" port that doesn't require MinGW, but it's clear that having a port of some kind is still really valuable! I'll attempt to fix the conflicts in this PR and test it again over the next week.

matteblair avatar Feb 13 '21 20:02 matteblair