Skip to content

Commit 3b24458

Browse files
authored
Merge pull request #1235 from joto/fix-no-lua-build
Fix build without Lua and test it on travis
2 parents 7a180ff + 3733e91 commit 3b24458

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

.travis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ matrix:
9696
CC=gcc-8 CXX=g++-8 CPPVERSION=11
9797

9898

99+
- os: linux
100+
dist: bionic
101+
compiler: gcc-8
102+
env: T="bionic_gcc8_pg10_no_lua"
103+
PG_VERSIONS=10
104+
POSTGIS_VERSION=2.4
105+
BUILD_TYPE="Debug"
106+
CXXFLAGS="-pedantic -Wextra -Werror"
107+
CC=gcc-8 CXX=g++-8 CPPVERSION=11
108+
109+
99110
- os: linux
100111
dist: focal
101112
compiler: gcc-9
@@ -121,7 +132,8 @@ before_install:
121132
export POSTGIS_PKG="$POSTGIS_PKG $PPG $PPG-scripts";
122133
done
123134
- echo $POSTGIS_PKG
124-
- sudo -E apt-get install -yq --no-install-suggests --no-install-recommends $CC $POSTGIS_PKG liblua$LUA_VERSION-dev lua$LUA_VERSION
135+
- sudo -E apt-get install -yq --no-install-suggests --no-install-recommends $CC $POSTGIS_PKG
136+
- if [ -n "${LUA_VERSION}" ]; then sudo -E apt-get install -yq --no-install-suggests --no-install-recommends liblua$LUA_VERSION-dev lua$LUA_VERSION; fi
125137
# g++ needs extra install, clang doesn't, so ignore errors here
126138
- sudo -E apt-get install -yq --no-install-suggests --no-install-recommends $CXX || true
127139

@@ -132,7 +144,8 @@ before_script:
132144

133145
script:
134146
- mkdir build && cd build
135-
- cmake .. -LA -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_STANDARD=${CPPVERSION} -DWITH_LUAJIT=${LUAJIT_OPTION}
147+
- if [ -z "${LUA_VERSION}" ]; then LUA_OPTIONS="-DWITH_LUA=OFF"; else LUA_OPTIONS="-DWITH_LUA=ON -DWITH_LUAJIT=${LUAJIT_OPTION}"; fi
148+
- cmake .. -LA -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_STANDARD=${CPPVERSION} ${LUA_OPTIONS}
136149
- make -j2
137150
- echo "Running tests ... "
138151
- if [[ $TEST_NODB ]]; then

src/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set(osm2pgsql_lib_SOURCES
55
expire-tiles.cpp
66
gazetteer-style.cpp
77
geometry-processor.cpp
8-
geom-transform.cpp
98
id-tracker.cpp
109
input-handler.cpp
1110
middle-pgsql.cpp
@@ -38,7 +37,6 @@ set(osm2pgsql_lib_SOURCES
3837
expire-tiles.hpp
3938
gazetteer-style.hpp
4039
geometry-processor.hpp
41-
geom-transform.hpp
4240
id-tracker.hpp
4341
input-handler.hpp
4442
middle-pgsql.hpp
@@ -80,6 +78,7 @@ if (LUA_FOUND OR LUAJIT_FOUND)
8078
list(APPEND osm2pgsql_lib_SOURCES
8179
flex-table.cpp
8280
flex-table-column.cpp
81+
geom-transform.cpp
8382
lua-utils.cpp
8483
output-flex.cpp
8584
tagtransform-lua.cpp

src/geom-transform.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
#define OSM2PGSQL_GEOM_TRANSFORM_HPP
33

44
#include "flex-table-column.hpp"
5-
#include "lua.hpp"
65
#include "osmium-builder.hpp"
76

87
#include <osmium/fwd.hpp>
98

9+
extern "C"
10+
{
11+
#include <lua.h>
12+
}
13+
1014
#include <memory>
1115

1216
/**

tests/CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ else()
118118
message(WARNING "Can not find python, regression test disabled")
119119
endif()
120120

121-
if(LUA_EXE)
122-
message(STATUS "Added test: lua-lib")
123-
add_test(NAME lua-lib COMMAND ${LUA_EXE} lua/tests.lua
124-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
125-
set_tests_properties(lua-lib PROPERTIES LABELS NoDB)
126-
else()
127-
message(WARNING "Can not find Lua interpreter, test 'lua-lib' disabled")
121+
if (HAVE_LUA)
122+
if (LUA_EXE)
123+
message(STATUS "Added test: lua-lib")
124+
add_test(NAME lua-lib COMMAND ${LUA_EXE} lua/tests.lua
125+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
126+
set_tests_properties(lua-lib PROPERTIES LABELS NoDB)
127+
else()
128+
message(WARNING "Can not find Lua interpreter, test 'lua-lib' disabled")
129+
endif()
128130
endif()

0 commit comments

Comments
 (0)