Skip to content

Commit

Permalink
[lua] Add vcpkg-cmake-wrapper (microsoft#11870)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBoosY authored Jun 11, 2020
1 parent 1caebee commit 6b32f92
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ports/lua/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: lua
Version: 5.3.5-4
Version: 5.3.5-5
Homepage: https://www.lua.org
Description: a powerful, fast, lightweight, embeddable scripting language

Expand Down
17 changes: 10 additions & 7 deletions ports/lua/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(vcpkg_common_functions)

vcpkg_download_distfile(ARCHIVE
URLS "https://www.lua.org/ftp/lua-5.3.5.tar.gz"
FILENAME "lua-5.3.5.tar.gz"
Expand All @@ -25,7 +23,9 @@ vcpkg_configure_cmake(

vcpkg_install_cmake()

set(ENABLE_LUA_CPP 0)
if("cpp" IN_LIST FEATURES)
set(ENABLE_LUA_CPP 1)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
Expand All @@ -39,6 +39,10 @@ if("cpp" IN_LIST FEATURES)
vcpkg_install_cmake()
endif()

vcpkg_copy_pdbs()

vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
file(READ ${CURRENT_PACKAGES_DIR}/include/luaconf.h LUA_CONF_H)
Expand All @@ -47,10 +51,9 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
endif()
endif()

vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua)
# Handle post-build CMake instructions
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

# Handle copyright
file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua/copyright)
# Handle post-build CMake instructions
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua)
vcpkg_copy_pdbs()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
6 changes: 6 additions & 0 deletions ports/lua/vcpkg-cmake-wrapper.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_find_package(${ARGS})

if (@ENABLE_LUA_CPP@)
find_library(lua_cpp NAMES lua-c++ liblua-c++ REQUIRED)
set(LUA_LIBRARIES ${LUA_LIBRARIES} ${lua_cpp})
endif()

0 comments on commit 6b32f92

Please sign in to comment.