From fc3f96abcb7ed0b7c8086c4e592b88b9162fac67 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Mon, 25 Sep 2017 11:18:21 +0200 Subject: [PATCH] Use pkg-config to find lua in non-standard locations --- CMakeLists.txt | 10 ++++------ cmake/FindLua.cmake | 3 +++ docker/Dockerfile | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7fb38bf8..9d5912bf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -517,12 +517,10 @@ else() find_package(BZip2 REQUIRED) add_dependency_includes(${BZIP2_INCLUDE_DIR}) - FIND_PACKAGE(Lua 5.2 EXACT) - IF (LUA_FOUND) - MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}") - ELSE() - MESSAGE(FATAL_ERROR "Lua 5.2 was not found.") - ENDIF() + find_package(Lua 5.2 REQUIRED) + if (LUA_FOUND) + message(STATUS "Using Lua ${LUA_VERSION_STRING}") + endif() set(USED_LUA_LIBRARIES ${LUA_LIBRARIES}) add_dependency_includes(${LUA_INCLUDE_DIR}) diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake index 49b6ae304..7bfb9f954 100644 --- a/cmake/FindLua.cmake +++ b/cmake/FindLua.cmake @@ -36,6 +36,8 @@ # This is because, the lua location is not standardized and may exist in # locations other than lua/ +include(FindPkgConfig) + unset(_lua_include_subdirs) unset(_lua_library_names) unset(_lua_append_versions) @@ -81,6 +83,7 @@ function(_lua_set_version_vars) lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} ) + pkg_check_modules(LUA QUIET "lua${ver}") endforeach () set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0c4ba0215..e3444e60c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,7 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ apk update && \ apk upgrade && \ - apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.1-dev libtbb@testing libtbb-dev@testing && \ + apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \ \ echo "Building libstxxl" && \ cd /opt && \ @@ -46,8 +46,8 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ rm /usr/local/lib/libstxxl* && \ cd /opt && \ apk del boost-dev && \ - apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.1-dev git make gcc && \ - apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.1 expat && \ + apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.2-dev git make gcc && \ + apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat && \ rm -rf /src /opt/stxxl /usr/local/bin/stxxl_tool /usr/local/lib/libosrm* EXPOSE 5000