Skip to content

Commit

Permalink
renamed stub code to match valhalla repo. moved valhalla includes int…
Browse files Browse the repository at this point in the history
…o include dir
  • Loading branch information
kevinkreiser committed Dec 2, 2014
1 parent dc8c97e commit 070f903
Show file tree
Hide file tree
Showing 40 changed files with 1,295 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Kevin Kreiser <[email protected]>
Empty file added COPYING
Empty file.
Empty file added ChangeLog
Empty file.
83 changes: 83 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
ACLOCAL_AMFLAGS = -I m4
AM_LDFLAGS = @BOOST_LDFLAGS@ @COVERAGE_LDFLAGS@
AM_CPPFLAGS = \
-Iinclude \
@BOOST_CPPFLAGS@
AM_CXXFLAGS = @COVERAGE_CXXFLAGS@

if HAVE_SQLITE3
AM_CPPFLAGS += @SQLITE3_CFLAGS@
endif

LIBTOOL_DEPS = @LIBTOOL_DEPS@
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool

# conditional test coverage
if ENABLE_COVERAGE
.PHONY: clean-coverage
clean-coverage:
-find -name '*.gcda' -exec rm -rf {} \;
-$(LCOV) --directory $(top_builddir) -z
-rm -rf coverage.info coverage/

.PHONY: coverage-report
coverage-report: clean-coverage
-$(MAKE) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) coverage/index.html

coverage.info:
$(LCOV) --directory $(top_builddir) --base-directory $(top_builddir) --no-external --capture --output-file $@ --no-checksum --compat-libtool

coverage/index.html: coverage.info
$(GENHTML) --prefix $(top_builddir) --output-directory $(@D) --title "Test Coverage" --legend --show-details $<


.PHONY: clean-gcno
clean-gcno:
-find -name '*.gcno' -exec rm -rf {} \;

clean-local: clean-coverage clean-gcno
endif

# proto compilation etc
PROTO_FILES = proto/stub_message.proto
BUILT_SOURCES = include/$(PROTO_FILES:.proto=.pb.h) src/$(PROTO_FILES:.proto=.pb.cc)
CLEANFILES = include/$(PROTO_FILES:.proto=.pb.h) src/$(PROTO_FILES:.proto=.pb.cc)
nodist_libvalhalla_la_SOURCES = src/$(PROTO_FILES:.proto=.pb.cc)
#src/proto/%.pb.cc: include/proto/%.pb.h
#include/proto/%.pb.h: proto/%.proto
src/proto/stub_message.pb.cc: include/proto/stub_message.pb.h
include/proto/stub_message.pb.h: proto/stub_message.proto
@echo " PROTOC $<"; mkdir -p src/proto include/proto; @PROTOC_BIN@ -Iproto --cpp_out=src/proto $< && mv src/proto/$(@F) include/proto

# lib valhalla compilation etc
lib_LTLIBRARIES = libvalhalla.la
include_HEADERS = include/valhalla.hpp
libvalhalla_la_SOURCES = \
src/util.cpp
libvalhalla_la_CPPFLAGS = $(DEPS_CFLAGS) $(BOOST_CPPFLAGS)
libvalhalla_la_LIBADD = $(DEPS_LIBS) @PROTOC_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@
if HAVE_SQLITE3
libvalhalla_la_LIBADD += @SQLITE3_LDFLAGS@
endif

# executable valhalla
bin_PROGRAMS = valhalla
valhalla_SOURCES = \
src/valhalla.cpp
valhalla_CPPFLAGS = $(DEPS_CFLAGS) $(BOOST_CPPFLAGS)
valhalla_LDADD = $(DEPS_LIBS) @BOOST_LDFLAGS@ @BOOST_PROGRAM_OPTIONS_LIB@

# tests
check_PROGRAMS = \
test/valhalla
test_valhalla_SOURCES = test/valhalla.cpp test/test.cpp
test_valhalla_CPPFLAGS = $(DEPS_CFLAGS) $(BOOST_CPPFLAGS)
test_valhalla_LDADD = $(DEPS_LIBS) @BOOST_LDFLAGS@

TESTS = $(check_PROGRAMS)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = sh

test: check
Empty file added NEWS
Empty file.
1 change: 1 addition & 0 deletions README
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
██▒ █▓ ▄▄▄ ██▓ ██░ ██ ▄▄▄ ██▓ ██▓ ▄▄▄
▓██░ █▒▒████▄ ▓██▒ ▓██░ ██▒▒████▄ ▓██▒ ▓██▒ ▒████▄
▓██ █▒░▒██ ▀█▄ ▒██░ ▒██▀▀██░▒██ ▀█▄ ▒██░ ▒██░ ▒██ ▀█▄
▒██ █░░░██▄▄▄▄██ ▒██░ ░▓█ ░██ ░██▄▄▄▄██ ▒██░ ▒██░ ░██▄▄▄▄██
▒▀█░ ▓█ ▓██▒░██████▒░▓█▒░██▓ ▓█ ▓██▒░██████▒░██████▒▓█ ▓██▒
░ ▐░ ▒▒ ▓▒█░░ ▒░▓ ░ ▒ ░░▒░▒ ▒▒ ▓▒█░░ ▒░▓ ░░ ▒░▓ ░▒▒ ▓▒█░
░ ░░ ▒ ▒▒ ░░ ░ ▒ ░ ▒ ░▒░ ░ ▒ ▒▒ ░░ ░ ▒ ░░ ░ ▒ ░ ▒ ▒▒ ░
░░ ░ ▒ ░ ░ ░ ░░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░

Valhalla is an open source routing engine and accompanying libraries for use with Open Street Map data.

Building
--------

Valhalla uses the [GNU Build System](http://www.gnu.org/software/automake/manual/html_node/GNU-Build-System.html) to configure and build itself and has a number of useful dependencies already included for convenience such as: [Boost libraries](http://boost.org/), [Protobuf](https://github.com/google/protobuf/), [cURL](http://curl.haxx.se/), [ZeroMQ](http://zeromq.org/) and [SQLite](http://sqlite.org/). To install on a Debian or Ubuntu system, please first install the prerequisites:

sudo apt-get install libboost-all-dev libprotobuf-dev libcurl4-openssl-dev libzmq3-dev protobuf-compiler libsqlite3-dev lcov

Then you should be able to bootstrap the build system:

./autogen.sh

And then run the standard GNU build install:

./configure --enable-coverage && make && make install

Please see `./configure --help` for more options on how to control the build process.

Using
-----

For convenience valhalla has a main executable, `valhalla`, that makes use of the library it builds. The purpose of this executable to serve as a starting point for building your own custom executable against your own custom library.

To setup another repository of your own, based on `valhalla`, let's call it `foo_bar`, you might try the following sequence of commands:



Contributing
------------

We welcome contributions to valhalla. If you would like to report an issue, please use the [valhalla issue tracker](https://github.com/mapzen/valhalla/issues) on GitHub.

If you would like to make an improvement to the code, please be aware that valhalla is written mostly in C++11, in the K&R (1TBS variant) with two spaces as indentation. We welcome contributions as pull requests to the [repository](https://github.com/mapzen/valhalla).

It is possible to build a test coverage report, please see [test coverage documentation](docs/test_coverage.md) for details.

5 changes: 5 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
mkdir -p include
libtoolize -i
aclocal -I m4
autoreconf -fi
52 changes: 52 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
AC_INIT([valhalla],
[0.0.1],
[https://github.com/mapzen/valhalla/issues],
[valhalla-0.0.1],
[https://github.com/mapzen/valhalla])
AM_INIT_AUTOMAKE([subdir-objects parallel-tests])
LT_INIT
AC_SUBST([LIBTOOL_DEPS])

AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_MACRO_DIR([m4])

AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET

AC_HEADER_STDC
AC_LANG_CPLUSPLUS

# require c++11
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])

# check for protocol buffers compiler and libraries
REQUIRE_PROTOC

# check for SQLite, which we use for HTTP cache information
AX_LIB_SQLITE3([3.6.16])
AM_CONDITIONAL([HAVE_SQLITE3], [test -n "$SQLITE3_VERSION"])

# check for boost and make sure we have the program options library
AX_BOOST_BASE([1.46], , [AC_MSG_ERROR([cannot find Boost libraries, which are are required for building valhalla. Please install libboost-dev.])])
AX_BOOST_PROGRAM_OPTIONS

# check pkg-config packaged packages.
PKG_CHECK_MODULES([DEPS], [protobuf >= 2.4.0 libzmq >= 2.1.10 libcurl >= 7.19.5])

# optionally enable coverage information
CHECK_COVERAGE

AC_CONFIG_FILES([Makefile])

# Debian resets this to no, but this break both Spot and the libtool
# test suite itself. Instead of requiring developer to install a
# non-patched version of Libtool on any Debian they use, we just
# cancel the effect of Debian's patch here.
# see: http://git.lrde.epita.fr/?p=spot.git;a=commitdiff;h=0e74b76521341f670f6b76f8ef24a6dcf6e3813b
link_all_deplibs=yes
link_all_deplibs_CXX=yes

AC_OUTPUT

25 changes: 25 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Valhalla Library #

## Motivation ##

Valhalla was created to serve as a starting point for an autotools project for anyone who might not have experience building one from scratch. It comes with a testing harness and coverage built in and requires a bunch of common dependencies for convenience.

## Building ##

Valhalla does have several dependencies that you must have before configure will properly produce a Makefile. It is true that many of these dependencies are not actually needed to build the valhalla code however we left the dependencies in because they seemed fairly common in most moderatly complex projects. If your project doesn't need a given dependency, delete it from the `m4` directory and update `configure.ac`.

## Testing ##

Tests can be found in the `tests/` directory, and are run by autotools when you run `make check`. If you are preparing a pull request or patch, please make sure these pass before submitting it.

There is a test coverage tool built into the build system, but it's fairly annoying to use. Please see
[the coverage docs](test_coverage.md) for more information and details on running it.

## Components ##

### Util ###

The Valhalla library comes with some examples of standard utilities that may or may not be applicable for a given project. They are mostly just intented as an example of what you might use to build a library within autotools.

## Tests ##
Valhalla comes with a test suite, run with ``make check``. If you find a platform where the tests aren't passing [open an issue](https://github.com/mapzen/valhalla/issues/new).
9 changes: 9 additions & 0 deletions docs/test_coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Test Coverage Report #

You can build a test coverage report using the `--enable-coverage` argument to `./configure`, then running `make coverage-report` to build an HTML coverage report in the `coverage/` directory.

Note also that, because calculating the coverage requires compiler support, you will need to clean any object files from a non-coverage build by running `make clean` before `make coverage-report`.

## Prerequisites ##

For this to work, you will need to have `lcov`, `gcov` and `genhtml` installed. On Ubuntu you can just run `sudo apt-get install lcov` to get these.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions include/valhalla.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef VALHALLA_HPP
#define VALHALLA_HPP

namespace valhalla {





}

#endif
Loading

0 comments on commit 070f903

Please sign in to comment.