Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lua] Add [cpp] feature to additionally build lua-c++ #7101

Merged
merged 3 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ports/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
5 changes: 4 additions & 1 deletion ports/lua/CONTROL
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 15 additions & 8 deletions ports/lua/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# 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"
Expand All @@ -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)
Expand Down