boku-ilen / geodot-plugin

Godot plugin for loading geospatial data
GNU General Public License v3.0
109 stars 19 forks source link

Find a way to properly package GDAL and the RasterTileExtractor on Windows #1

Closed kb173 closed 4 years ago

kb173 commented 4 years ago

Currently the RasterTileExtractor library has to be moved to /usr/lib, which isn't very portable and practical. Also, GDAL has to be installed.

We need to find a method which is completely portable. Ideally, everything would be in the bin folder of the GDNative plugin.

kb173 commented 4 years ago

With d39f694d61c3561f3ffcaa0a6f3400d9cd8e3ecd, the RasterTileExtractor is properly packaged. Doing the same with GDAL might be more complex - should we just have libgdal-dev as a dependency, like in the landscapelab-server?

chrisgraf commented 4 years ago

landscapelab-server just requires libgdal and not libgdal-dev .. what about windows in that case?

kb173 commented 4 years ago

On Linux, this is done - libgdal.so and libRasterTileExtractor.so can be shipped with libgeodot.so. Unfortunately, I haven't managed to compile it on Windows yet...

MathiasBaumgartinger commented 4 years ago

Trying to get this done, my progress so far:

MathiasBaumgartinger commented 4 years ago

This will result in being able to include the libraries with #include <gdal_priv.h>. So I changed the includes accodingly:

#include <gdal_priv.h>
#include <gdalwarper.h>
MathiasBaumgartinger commented 4 years ago

Make sure to run with C++ 17, settings can be found under: Project >Properties >C/C++ > Language > C++ Language Standard

return (GDALDataset *) GDALOpen(path.c_str(), GA_ReadOnly) in RasterTileExtractor.cpp line 236 will not compile. Change to return (GDALDataset *) GDALOpen(path.u8string().c_str(), GA_ReadOnly).

kb173 commented 4 years ago

All changes were added, the plugin is now confirmed to compile on both Windows and Linux. The README was updated with detailed instructions in https://github.com/boku-ilen/geodot-plugin/commit/e0f05b0d52829513ba133351966a1ae029a59203, so I'd consider this done!