[lua] Reduce post-install work needed in portfile by adding them to CMakeLists.txt

This commit is contained in:
Robert Schumacher 2016-10-07 14:49:49 -07:00
parent 057069e87b
commit d3a453e638
2 changed files with 28 additions and 21 deletions

View File

@ -6,9 +6,6 @@ ENDIF()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# remove warnings
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS )
SET (HDR_LIBLUA
src/lapi.h src/lauxlib.h src/lcode.h src/lctype.h src/ldebug.h src/ldo.h src/lfunc.h
src/lgc.h src/llex.h src/llimits.h src/lmem.h src/lobject.h src/lopcodes.h src/lparser.h
@ -16,9 +13,6 @@ src/lstate.h src/lstring.h src/ltable.h src/ltm.h src/lua.h src/luaconf.h src/lu
src/lundump.h src/lvm.h src/lzio.h
)
#SET_SOURCE_FILES_PROPERTIES(${HDR_LIBLUA} PROPERTIES HEADER_FILE_ONLY TRUE)
#include_directories(src)
# Build Libraries
SET (SRC_LIBLUA
src/lapi.c src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcode.c src/lcorolib.c
@ -28,16 +22,33 @@ src/lopcodes.c src/loslib.c src/lparser.c src/lstate.c src/lstring.c src/lstrlib
src/ltable.c src/ltablib.c src/ltm.c src/lundump.c src/lutf8lib.c src/lvm.c src/lzio.c
)
SET ( SRC_LUA src/lua.c )
# append headers to sources to make them show up in MSVC GUI
LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA})
#DLL
ADD_LIBRARY ( lua53 SHARED ${SRC_LIBLUA} ${SRC_LUA} )
SET_TARGET_PROPERTIES (lua53 PROPERTIES DEFINE_SYMBOL "LUA_BUILD_AS_DLL" )
IF (BUILD_SHARED_LIBS)
ADD_DEFINITIONS ( -DLUA_BUILD_AS_DLL )
ENDIF ()
INSTALL ( TARGETS lua53 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
INSTALL(DIRECTORY src/ DESTINATION include
FILES_MATCHING PATTERN lualib.h PATTERN luaconf.h
PATTERN lua.hpp PATTERN lua.h PATTERN lauxlib.h)
# remove warnings
ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS )
#DLL
ADD_LIBRARY ( lua ${SRC_LIBLUA} )
INSTALL ( TARGETS lua
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)
IF (NOT DEFINED SKIP_INSTALL_HEADERS)
INSTALL(
FILES
src/lualib.h
src/lua.h
src/luaconf.h
src/lua.hpp
src/lauxlib.h
DESTINATION include
)
ENDIF ()

View File

@ -20,16 +20,12 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/lua53.dll ${CURRENT_PACKAGES_DIR}/debug/bin/lua53.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/lua53.dll ${CURRENT_PACKAGES_DIR}/bin/lua53.dll)
# Handle copyright
file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua)
vcpkg_copy_pdbs()