From 8ca8de6926bc67ccc71f4b3f4733ce2f1d3b0547 Mon Sep 17 00:00:00 2001 From: Kevin Lu <6320810+kevinlul@users.noreply.github.com> Date: Tue, 2 Jul 2019 16:49:17 -0400 Subject: [lua] Add [cpp] feature to additionally build lua-c++ (#7101) * [lua] Add [cpp] feature to build lua-c++ * [lua] Switch tab for spaces in CMakeLists, set version to 5.3.5-2 as requested * Use spaces for indentation --- ports/lua/CMakeLists.txt | 3 +++ ports/lua/CONTROL | 5 ++++- ports/lua/portfile.cmake | 23 +++++++++++++++-------- 3 files changed, 22 insertions(+), 9 deletions(-) (limited to 'ports/lua') diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt index 01a1d5a12..dd0a1de35 100644 --- a/ports/lua/CMakeLists.txt +++ b/ports/lua/CMakeLists.txt @@ -52,6 +52,9 @@ ENDIF () #DLL ADD_LIBRARY ( lua ${SRC_LIBLUA} ) +IF (COMPILE_AS_CPP) + SET_TARGET_PROPERTIES(lua PROPERTIES OUTPUT_NAME "lua-c++") +ENDIF() IF (BUILD_SHARED_LIBS AND WIN32) TARGET_COMPILE_DEFINITIONS (lua PUBLIC -DLUA_BUILD_AS_DLL ) diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL index 738aabdfd..eeb26e412 100644 --- a/ports/lua/CONTROL +++ b/ports/lua/CONTROL @@ -1,4 +1,7 @@ Source: lua -Version: 5.3.5-1 +Version: 5.3.5-2 Homepage: https://www.lua.org Description: a powerful, fast, lightweight, embeddable scripting language + +Feature: cpp +Description: Builds lua for C++ linkage. \ No newline at end of file diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index e3c972ac4..b107c6cf9 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -1,12 +1,5 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = -# TARGET_TRIPLET is the current triplet (x86-windows, etc) -# PORT is the current port name (zlib, etc) -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# - 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" @@ -32,6 +25,20 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +if("cpp" IN_LIST FEATURES) + 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() + 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) -- cgit v1.2.3