vcpkg/ports/lua/portfile.cmake

60 lines
1.8 KiB
CMake
Raw Normal View History

2016-10-07 19:50:20 +08:00
vcpkg_download_distfile(ARCHIVE
URLS "https://www.lua.org/ftp/lua-5.4.2.tar.gz"
FILENAME "lua-5.4.2.tar.gz"
SHA512 9454a6ffd973598f2f4a2399834c31c4d5090bd12e716776e3189aa57760319d114ee64a8338bbc2ef5e08150bf0adc2ad94a1b2677f38538a43359969d4d920
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES vs2015-impl-c99.patch
2016-10-07 19:50:20 +08:00
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
2017-03-02 21:59:32 +08:00
PREFER_NINJA
OPTIONS
-DCOMPILE_AS_CPP=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
2016-12-05 02:12:21 +08:00
-DSKIP_INSTALL_TOOLS=ON
2016-10-07 19:50:20 +08:00
)
vcpkg_install_cmake()
2020-06-11 17:32:09 +08:00
set(ENABLE_LUA_CPP 0)
if("cpp" IN_LIST FEATURES)
2020-06-11 17:32:09 +08:00
set(ENABLE_LUA_CPP 1)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DCOMPILE_AS_CPP=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
-DSKIP_INSTALL_TOOLS=ON
)
vcpkg_install_cmake()
endif()
2020-06-11 17:32:09 +08:00
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua)
2017-03-02 21:59:32 +08:00
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()
2017-03-02 21:59:32 +08:00
endif()
2020-06-11 17:32:09 +08:00
# 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})
2017-10-18 06:08:30 +08:00
2016-10-07 19:50:20 +08:00
# Handle copyright
2020-06-11 17:32:09 +08:00
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)