Skip to content

Commit

Permalink
Replace Luabind with kaguya (hooray!)
Browse files Browse the repository at this point in the history
  • Loading branch information
systemed committed Nov 4, 2016
1 parent a62c455 commit 42091e9
Show file tree
Hide file tree
Showing 8 changed files with 12,675 additions and 192 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Expand Up @@ -26,9 +26,6 @@ include_directories(${LIBSHP_INCLUDE_DIR})
find_package(Lua REQUIRED)
include_directories(${LUA_INCLUDE_DIR})

find_package(Luabind REQUIRED)
include_directories(${LUABIND_INCLUDE_DIR})

find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})

Expand All @@ -49,6 +46,6 @@ ADD_CUSTOM_COMMAND(OUTPUT osmformat.pb.cc osmformat.pb.h
ARGS --cpp_out ${CMAKE_BINARY_DIR} -I ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/osmformat.proto)

add_executable(tilemaker vector_tile.pb.cc osmformat.pb.cc src/tilemaker.cpp)
target_link_libraries(tilemaker ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUABIND_LIBRARIES} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB})
target_link_libraries(tilemaker ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB})

install(TARGETS tilemaker RUNTIME DESTINATION bin)
7 changes: 3 additions & 4 deletions CONFIGURATION.md
Expand Up @@ -182,11 +182,10 @@ You can then find out whether a node is within one of these polygons using the `

if node:Intersects("countries") then print("Looks like it's on land"); end

Or you can find out what country(/ies) the node is within using `FindIntersecting`:
Or you can find out what country(/ies) the node is within using `FindIntersecting`, which returns a table:

for name in node:FindIntersecting("countries") do
print(name)
end
names = node:FindIntersecting("countries")
print(table.concat(name,","))

To enable these functions, set `index` to true in your shapefile layer definition. `index_column` is not needed for `Intersects` but required for `FindIntersecting`.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,7 +1,7 @@
LUA_CFLAGS := -I/usr/local/include/lua5.1 -I/usr/include/lua5.1
LUA_LIBS := -llua5.1
CXXFLAGS := -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++11 -pthread $(CONFIG)
LIB := -L/usr/local/lib -lz $(LUA_LIBS) -lboost_program_options -lluabind -lsqlite3 -lboost_filesystem -lboost_system -lprotobuf -lshp
LIB := -L/usr/local/lib -lz $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lprotobuf -lshp
INC := -I/usr/local/include -I./include -I./src $(LUA_CFLAGS)

all: tilemaker
Expand Down
37 changes: 17 additions & 20 deletions README.md
Expand Up @@ -14,47 +14,42 @@ Tilemaker is written in C++11. The chief dependencies are:

* Google Protocol Buffers
* Boost 1.56 or later (for boost::geometry, boost::program_options, boost::filesystem, boost::variant)
* Lua 5.1 and Luabind
* Lua 5.1
* sqlite3
* shapelib

rapidjson (MIT) and sqlite_modern_cpp (MIT) are bundled in the include/ directory.
rapidjson, sqlite_modern_cpp, and kaguya are bundled in the include/ directory.

On OS X, you can install all dependencies with Homebrew:
### OS X

brew install protobuf boost lua51 luabind shapelib
Install all dependencies with Homebrew:

On Ubuntu, start with:
brew install protobuf boost lua51 shapelib

### Ubuntu

Start with:

sudo apt-get install build-essential liblua5.1-0 liblua5.1-0-dev libprotobuf-dev libsqlite3-dev protobuf-compiler shapelib libshp-dev

You'll then need to install a recent Boost from [this PPA](https://launchpad.net/~ostogvin/+archive/ubuntu/tjo-develop):
If you're using Ubuntu 16.04, you can install Boost with `sudo apt-get install libboost-all-dev`. For 12.04 or 14.04, you'll need to install a recent Boost from [this PPA](https://launchpad.net/~ostogvin/+archive/ubuntu/tjo-develop):

sudo add-apt-repository ppa:ostogvin/tjo-develop
sudo apt-get update
sudo apt-get install libboost1.58-all-dev

Finally, we need to install luabind manually because the Ubuntu package (sigh) requires Boost 1.54, whereas we need 1.56 or later. So:

git clone https://github.com/rpavlik/luabind.git
cd luabind
# The following line might not be necessary for you,
# but I needed it to make sure that liblua was in /usr/lib:
ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/
sudo bjam install
sudo ln -s /usr/local/lib/libluabindd.so /usr/local/lib/libluabind.so
sudo ldconfig

Once you've installed those, then `cd` back to your Tilemaker directory and simply:

make
sudo make install

If it fails, check that the LIB and INC lines in the Makefile correspond with your system, then try again.

On Fedora start with:
### Fedora

Start with:

dnf install lua-devel luajit-devel luabind-devel sqlite-devel protobuf-devel protobuf-compiler shapelib-devel
dnf install lua-devel luajit-devel sqlite-devel protobuf-devel protobuf-compiler shapelib-devel

then build either with lua:

Expand All @@ -66,6 +61,8 @@ or with luajit:
make LUA_CFLAGS="$(pkg-config --cflags luajit)" LUA_LIBS="$(pkg-config --libs luajit)"
make install

### Saving memory

To save memory (on any platform), you can choose 32-bit storage for node IDs rather than 64-bit. You will need to run `osmium renumber` or a similar tool over your .osm.pbf first. Then compile Tilemaker with an additional flag:

make CONFIG="-DCOMPACT_NODES"
Expand Down Expand Up @@ -118,7 +115,7 @@ Formatting: braces and indents as shown, hard tabs (4sp). (Yes, I know.) Please
Copyright and contact
---------------------

Richard Fairhurst and contributors, 2015-2016. The tilemaker code is licensed as FTWPL; you may do anything you like with this code and there is no warranty. The included rapidjson (Milo Yip and THL A29) and sqlite_modern_cpp (Amin Roosta) libraries are MIT.
Richard Fairhurst and contributors, 2015-2016. The tilemaker code is licensed as FTWPL; you may do anything you like with this code and there is no warranty. The included rapidjson (Milo Yip and THL A29) and sqlite_modern_cpp (Amin Roosta) libraries are MIT; [kaguya](https://github.com/satoren/kaguya) is licensed under the Boost Software Licence.

If you'd like to sponsor development of Tilemaker, you can contact me at richard@systemeD.net.

Expand Down
75 changes: 0 additions & 75 deletions cmake/FindLuabind.cmake

This file was deleted.

0 comments on commit 42091e9

Please sign in to comment.