Skip to content

Commit

Permalink
Add initial emscripten Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ddohler committed Jan 3, 2017
1 parent 2aa6424 commit e7377ce
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.swp
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
PROJ4 = proj4
GDAL = gdal
EMMAKE ?= emmake
EMCONFIGURE ?= emconfigure
export EMCONFIGURE_JS ?= 0
export EMCC_CFLAGS += -msse

include gdal-configure.opt

########
# GDAL #
########
gdal-lib: $(GDAL)/libgdal.a

$(GDAL)/libgdal.a: $(GDAL)/config.status proj4
cd $(GDAL) && EMCC_FLAGS="-msse" $(EMMAKE) make lib-target

# TODO: Pass the configure params more elegantly so that this uses the
# EMCONFIGURE variable
$(GDAL)/config.status: proj4-native $(GDAL)/configure
cd $(GDAL) && emconfigure ./configure $(GDAL_CONFIG_OPTIONS)

##########
# PROJ.4 #
##########
# The -X parameter cleans only ignored files but not manually added ones
reset-proj4:
cd $(PROJ4) && git clean -X --force

proj4: reset-proj4
cd $(PROJ4) && ./autogen.sh
cd $(PROJ4) && $(EMCONFIGURE) ./configure
cd $(PROJ4) && $(EMMAKE) make

# We need to make proj4-native a separate prerequisite even though it's nearly
# the same thing because make will only run each prerequisite once per
# invocation, and we need to build PROJ.4 twice, once natively to fake out the
# GDAL build script, and once "for real" via emscripten. For the same reason,
# we also can't target any of the file outputs of the PROJ.4 build process
# because the files are exactly the same no matter whether the build is native
# or via emscripten, so if we target individual files, they'll only get built
# once, not twice as we need.
# TODO: Make this cleaner.
reset-proj4-native:
cd $(PROJ4) && git clean -X --force

proj4-native: reset-proj4-native
cd $(PROJ4) && ./autogen.sh
cd $(PROJ4) && ./configure
cd $(PROJ4) && make
61 changes: 33 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
GDAL - Geospatial Data Abstraction Library
====

| Environment | Status |
| ------------------------ |:-------------:|
| Ubuntu 12.04 64 bit | [![Build Status](https://travis-ci.org/OSGeo/gdal.svg?branch=trunk)](https://travis-ci.org/OSGeo/gdal) |
| Ubuntu 12.04 32 bit | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_32bit)](https://travis-ci.org/rouault/gdal_coverage) |
| Ubuntu 14.04 64 bit | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_trusty)](https://travis-ci.org/rouault/gdal_coverage) |
| Python 3 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=python3)](https://travis-ci.org/rouault/gdal_coverage) |
| MacOS X | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_travis_macosx)](https://travis-ci.org/rouault/gdal_coverage) |
| MSVC 2008 | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc9?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MSVC 2013 32 & 64 bit | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc12_full?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MSVC 2015 32 & 64 bit | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc13?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MinGW | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_mingw)](https://travis-ci.org/rouault/gdal_coverage) |
| MinGW_W64 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_mingw_w64)](https://travis-ci.org/rouault/gdal_coverage) |
| Android | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_android)](https://travis-ci.org/rouault/gdal_coverage) |
| GCC 4.8 C++11 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_gcc4.8_stdc11)](https://travis-ci.org/rouault/gdal_coverage) |
| GCC 5.2 C++14 -fsanitize | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_gcc5.2_sanitize)](https://travis-ci.org/rouault/gdal_coverage) |
| Clang Static Analyzer | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_clang_static_analyzer)](https://travis-ci.org/rouault/gdal_coverage) |
| Coverity Scan | [![Build Status](https://scan.coverity.com/projects/749/badge.svg?flat=1)](https://scan.coverity.com/projects/gdal) |

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats. This is a mirror of the GDAL Subversion repository.

* Main site: http://www.gdal.org - Developer and user docs, links to other resources
* SVN repository: http://svn.osgeo.org/gdal
* Download: ftp://ftp.remotesensing.org/gdal, http://download.osgeo.org/gdal
* Wiki: http://trac.osgeo.org/gdal - Bug tracking, various user and developer contributed documentation and hints
* Mailing list: http://lists.osgeo.org/mailman/listinfo/gdal-dev
GDAL JS
==============
An [Emscripten](https://github.com/kripken/emscripten) port of [GDAL](http://www.gdal.org).

Developing
-----------
1. Install Emscripten and its dependencies following the instructions
[here](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html).
2. If you are on a Mac, you may need to run the following if you receive errors like this: `env:
python2: No such file or directory`
```
./emsdk install sdk-incoming-64bit --build=Release
./emsdk activate sdk-incoming-64bit
```
3. From the project directory, run `make gdal-lib`

Usage
---------------
There's not really much you can easily do right now; making a more ergonomic interface to the GDAL C
API is high on my to-do list.

If you're feeling adventurous, Emscripten provides a debugging interface for command-line programs
which I've used successfully with `gdalinfo`. You should be able to compile `gdalinfo`, for example,
by doing something like this from the `gdal` directory:
```
emmake make apps-target
cd apps
em++ -s ALLOW_MEMORY_GROWTH=1 gdalinfo_bin.o ../libgdal.a
-L../../proj4/src/.libs -lproj -lpthread -ldl -o gdalinfo.html
```
Note that you will need to preload a useful file (a GeoTiff) into the Emscripten file system
and pass it to `gdalinfo` as a command line argument in order for this to do anything useful. The
Emscripten docs contain information on how to do both of those things.
82 changes: 82 additions & 0 deletions gdal-configure.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# A is just a temporary variable to keep these lines short; not sure if there's
# a better way to do this.
A = --enable-static
A += --enable-pdf-plugin=no
A += --without-libtool
A += --without-ld-shared
A += --with-threads=yes
A += --with-libz=internal
A += --without-libiconv-prefix
A += --without-liblzma
A += --without-pg
A += --without-grass
A += --without-libgrass
A += --without-cfitsio
A += --without-pcraster
A += --with-png=internal
A += --without-mrf
A += --without-dds
A += --without-gta
A += --with-libtiff=internal
A += --with-geotiff=internal
A += --with-jpeg=internal
A += --without-jpeg12
A += --without-gif
A += --without-ogdi
A += --without-fme
A += --without-sosi
A += --without-mongocxx
A += --without-hdf4
A += --without-hdf5
A += --without-kea
A += --without-netcdf
A += --without-jasper
A += --without-openjpeg
A += --without-fgdb
A += --without-ecw
A += --without-kakadu
A += --without-mrsid
A += --without-jp2mrsid
A += --without-mrsid_lidar
A += --without-msg
A += --without-bsb
A += --without-oci
A += --without-oci-include
A += --without-oci-lib
A += --without-grib
A += --without-mysql
A += --without-ingres
A += --without-xerces
A += --without-expat
A += --without-libkml
A += --without-odbc
A += --with-dods-root=no
A += --without-curl
A += --without-xml2
A += --without-spatialite
A += --without-sqlite3
A += --without-pcre
A += --without-dwgdirect
A += --without-idb
A += --without-sde
A += --without-epsilon
A += --without-webp
A += --without-geos
A += --without-qhull
A += --with-freexl=no
A += --with-libjson-c=internal
A += --without-pam
A += --without-poppler
A += --without-podofo
A += --without-pdfium
A += --without-perl
A += --without-php
A += --without-python
A += --without-java
A += --without-mdb
A += --without-rasdaman
A += --without-armadillo
A += --without-cryptopp
A += --with-static-proj4=$(CURDIR)/../proj4

GDAL_CONFIG_OPTIONS := $(A)
28 changes: 28 additions & 0 deletions gdal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
GDAL - Geospatial Data Abstraction Library
====

| Environment | Status |
| ------------------------ |:-------------:|
| Ubuntu 12.04 64 bit | [![Build Status](https://travis-ci.org/OSGeo/gdal.svg?branch=trunk)](https://travis-ci.org/OSGeo/gdal) |
| Ubuntu 12.04 32 bit | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_32bit)](https://travis-ci.org/rouault/gdal_coverage) |
| Ubuntu 14.04 64 bit | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_trusty)](https://travis-ci.org/rouault/gdal_coverage) |
| Python 3 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=python3)](https://travis-ci.org/rouault/gdal_coverage) |
| MacOS X | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_travis_macosx)](https://travis-ci.org/rouault/gdal_coverage) |
| MSVC 2008 | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc9?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MSVC 2013 32 & 64 bit | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc12_full?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MSVC 2015 32 & 64 bit | [![Build status](https://ci.appveyor.com/api/projects/status/tbtcdve977yd5atp/branch/trunk_vc13?svg=true)](https://ci.appveyor.com/project/rouault/gdal-coverage) |
| MinGW | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_mingw)](https://travis-ci.org/rouault/gdal_coverage) |
| MinGW_W64 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_mingw_w64)](https://travis-ci.org/rouault/gdal_coverage) |
| Android | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_android)](https://travis-ci.org/rouault/gdal_coverage) |
| GCC 4.8 C++11 | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_gcc4.8_stdc11)](https://travis-ci.org/rouault/gdal_coverage) |
| GCC 5.2 C++14 -fsanitize | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_gcc5.2_sanitize)](https://travis-ci.org/rouault/gdal_coverage) |
| Clang Static Analyzer | [![Build Status](https://travis-ci.org/rouault/gdal_coverage.svg?branch=trunk_clang_static_analyzer)](https://travis-ci.org/rouault/gdal_coverage) |
| Coverity Scan | [![Build Status](https://scan.coverity.com/projects/749/badge.svg?flat=1)](https://scan.coverity.com/projects/gdal) |

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats. This is a mirror of the GDAL Subversion repository.

* Main site: http://www.gdal.org - Developer and user docs, links to other resources
* SVN repository: http://svn.osgeo.org/gdal
* Download: ftp://ftp.remotesensing.org/gdal, http://download.osgeo.org/gdal
* Wiki: http://trac.osgeo.org/gdal - Bug tracking, various user and developer contributed documentation and hints
* Mailing list: http://lists.osgeo.org/mailman/listinfo/gdal-dev

0 comments on commit e7377ce

Please sign in to comment.