vcpkg/ports/lua/portfile.cmake
Park DongHa 1045e88e42
[lua] support iOS triplets (#16107)
* [lua] support iOS triplets

* separate interpreter/compiler to lua[tools] feature
* update git-tree SHA

* [lua] revert feature separation

* [lua] update port SHA

* [lua] make 'tools' default-feature

* set `ENABLE_LUA_CPP` for cmake wrapper

* [lua] fix after collision

* Update ports/lua/portfile.cmake

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* Update ports/lua/portfile.cmake

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* [lua] import TargetConditionals for apple platform

* Update ports/lua/vcpkg.json

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* Update ports/lua/portfile.cmake

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* [lua] remove negations for 'tool' config

use FEATURES instread of INVERTED_FEATURES to prevent confusions

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2021-04-19 17:13:08 -07:00

68 lines
2.1 KiB
CMake

vcpkg_download_distfile(ARCHIVE
URLS "https://www.lua.org/ftp/lua-5.4.3.tar.gz"
FILENAME "lua-5.4.3.tar.gz"
SHA512 3a1a3ee8694b72b4ec9d3ce76705fe179328294353604ca950c53f41b41161b449877d43318ef4501fee44ecbd6c83314ce7468d7425ba9b2903c9c32a28bbc0
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
vs2015-impl-c99.patch
fix-ios-system.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools INSTALL_TOOLS
)
if(VCPKG_TARGET_IS_IOS AND "tools" IN_LIST FEATURES)
message(FATAL_ERROR "lua[tools] is not supported for iOS platform build")
endif()
set(ENABLE_LUA_CPP 0)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_RELEASE
${FEATURE_OPTIONS}
OPTIONS
-DCOMPILE_AS_CPP=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
if("cpp" IN_LIST FEATURES) # lua[cpp] will create lua-c++, which uses C++ name mangling.
set(ENABLE_LUA_CPP 1)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DCOMPILE_AS_CPP=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
endif()
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
if(VCPKG_TARGET_IS_WINDOWS)
file(READ ${CURRENT_PACKAGES_DIR}/include/luaconf.h LUA_CONF_H)
string(REPLACE "defined(LUA_BUILD_AS_DLL)" "1" LUA_CONF_H "${LUA_CONF_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/luaconf.h "${LUA_CONF_H}")
endif()
endif()
# 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(INSTALL ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)