naturalatlas / node-gdal

Node.js bindings for GDAL (Geospatial Data Abstraction Library)
http://naturalatlas.github.io/node-gdal/classes/gdal.html
Apache License 2.0
565 stars 124 forks source link

Platform-specific formats #173

Open jwoyame opened 8 years ago

jwoyame commented 8 years ago

I wanted to add a particular format on Windows like so (libgdal.sh):

OGR_FORMATS="shape vrt avc geojson mem mitab kml gpx aeronavfaa
    bna dxf csv edigeo geoconcept georss gml gmt gpsbabel gtm htf
    idrisi dgn openair openfilegdb pds pgdump rec s57 sdts segukooa
    segy sua svg sxf ntf xplane wasp"

# OS-specific formats
if [[ "$(expr substr $OS 1 7)" == "Windows" ]]; then
    OGR_FORMATS+=" mssqlspatial"
fi

But this will of course produce an include file (libgdal_formats.gypi) that includes the GYP file on all platforms. It seems like it would be nice to have platform-specific GYP references, but I can't think of an easy way to fit this in the current workflow. Thoughts?

wilhelmberg commented 8 years ago

Platform specific sections in gyp can be achieved like this:

"conditions": [
            ["OS == 'win'", {
jwoyame commented 8 years ago

Thanks for the response @BergWerkGIS! I would like to add a workflow for platform-specific formats to the project, and I want to do it in the cleanest/preferred way.

First, I suppose I should ask, are platform-specific formats a good idea?

Second, would this be a decent workflow:

  1. Add an OGR_FORMATS_WIN list to libgdal.sh.
  2. Have libgdal.sh use the gyp-templates/libgdal_formats.gypi template to generate a platform-specific include file arch/win/libgdal_formats.gypi.
  3. Include arch/win/libgdal_formats.gypi conditionally in libgdal.gyp.

It is partly a matter of taste, but the above workflow would limit the actual conditional behavior to libgdal.gyp.