# HG changeset patch # User Sebastien Jodogne # Date 1619770190 -7200 # Node ID e915102093de1394c60a5ac182ae562c770d8d68 # Parent 56315be75a92d86dcc94445847497b7897c4e3ce New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua diff -r 56315be75a92 -r e915102093de NEWS --- a/NEWS Thu Apr 29 14:34:08 2021 +0200 +++ b/NEWS Fri Apr 30 10:09:50 2021 +0200 @@ -7,6 +7,7 @@ - In asynchronous mode, the temporary files are removed as soon as their job gets canceled * Fix regression in the handling of "DicomCheckModalityHost" configuration option introduced by changeset 4182 in Orthanc 1.7.4 +* New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua Version 1.9.2 (2021-04-22) diff -r 56315be75a92 -r e915102093de OrthancFramework/Resources/CMake/LuaConfiguration.cmake --- a/OrthancFramework/Resources/CMake/LuaConfiguration.cmake Thu Apr 29 14:34:08 2021 +0200 +++ b/OrthancFramework/Resources/CMake/LuaConfiguration.cmake Fri Apr 30 10:09:50 2021 +0200 @@ -120,10 +120,16 @@ source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*) -elseif (CMAKE_CROSSCOMPILING AND - "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") +elseif ((CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") OR + NOT "${ORTHANC_LUA_VERSION}" STREQUAL "") - set(LUA_VERSIONS 5.3 5.2 5.1) + if ("${ORTHANC_LUA_VERSION}" STREQUAL "") + set(LUA_VERSIONS 5.3 5.2 5.1) + else() + # New in Orthanc 1.9.3 + set(LUA_VERSIONS ${ORTHANC_LUA_VERSION}) + endif() unset(LUA_VERSION) foreach(version IN ITEMS ${LUA_VERSIONS}) @@ -138,21 +144,36 @@ message(FATAL_ERROR "Please install the liblua-dev package") endif() - CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB) - if (NOT HAVE_LUA_LIB) + if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + set(LUA_INCLUDE_DIR ${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION}) + else() + # New in Orthanc 1.9.3 + find_path(LUA_INCLUDE_DIR + NAMES lua.h + PATHS + /usr/include/lua${LUA_VERSION} + /usr/local/include/lua${LUA_VERSION} + ) + endif() + + message("Lua include dir: ${LUA_INCLUDE_DIR}") + include_directories(${LUA_INCLUDE_DIR}) + + CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB_1) # Lua 5.1 + CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_callk" "${LUA_LIB_DIR}" HAVE_LUA_LIB_2) # Lua 5.3 + if (NOT HAVE_LUA_LIB_1 AND NOT HAVE_LUA_LIB_2) message(FATAL_ERROR "Please install the liblua package") endif() - include_directories(${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION}) link_libraries(lua${LUA_VERSION}) else() include(FindLua) - + if (NOT LUA_FOUND) message(FATAL_ERROR "Please install the liblua-dev package") endif() - + include_directories(${LUA_INCLUDE_DIR}) link_libraries(${LUA_LIBRARIES}) endif() diff -r 56315be75a92 -r e915102093de OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Thu Apr 29 14:34:08 2021 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Fri Apr 30 10:09:50 2021 +0200 @@ -103,6 +103,7 @@ if (NOT ENABLE_LUA) unset(USE_SYSTEM_LUA CACHE) unset(ENABLE_LUA_MODULES CACHE) + unset(ORTHANC_LUA_VERSION) add_definitions(-DORTHANC_ENABLE_LUA=0) endif() diff -r 56315be75a92 -r e915102093de OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Thu Apr 29 14:34:08 2021 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Fri Apr 30 10:09:50 2021 +0200 @@ -95,6 +95,7 @@ set(EMSCRIPTEN_TRAP_MODE "" CACHE STRING "Sets the trap mode for Emscripten for numeric errors (can notably be empty, or \"clamp\")") set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Version of OpenSSL to be used in static builds (can be \"1.0.2\", or \"1.1.1\")") set(CIVETWEB_OPENSSL_API "1.1" CACHE STRING "Version of the OpenSSL API to be used in civetweb in static builds (can be \"1.0\" or \"1.1\"") +set(ORTHANC_LUA_VERSION "" CACHE STRING "Force the version of Lua to be used by Orthanc (for instance \"5.3\"), if empty, this will be autodetected") mark_as_advanced(CIVETWEB_OPENSSL_API) mark_as_advanced(EMSCRIPTEN_TARGET_MODE) diff -r 56315be75a92 -r e915102093de OrthancServer/Sources/main.cpp --- a/OrthancServer/Sources/main.cpp Thu Apr 29 14:34:08 2021 +0200 +++ b/OrthancServer/Sources/main.cpp Fri Apr 30 10:09:50 2021 +0200 @@ -1109,6 +1109,8 @@ httpServer.SetSslVerifyPeers(false); } + LOG(INFO) << "Version of Lua: " << LUA_VERSION; + if (lock.GetConfiguration().GetBooleanParameter("ExecuteLuaEnabled", false)) { context.SetExecuteLuaEnabled(true);