vcpkg/ports/luajit/portfile.cmake

86 lines
2.7 KiB
CMake
Raw Normal View History

2017-07-08 04:12:09 +08:00
include(vcpkg_common_functions)
2017-07-08 05:30:44 +08:00
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "LuaJIT currently only supports being built for desktop")
endif()
2017-07-08 04:12:09 +08:00
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LuaJIT-2.0.5)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO LuaJIT/LuaJIT
REF v2.0.5
SHA512 65d982d7fe532a61335613f414f3b8fa5333747bdf7aefc2c2d52022d227594ade827639049b97e3c4ffae9f38f32cb15f1a17b1780fb0a943e1a3af05e2b576
HEAD_REF master
)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/luajit)
set (SRC ${SOURCE_PATH}/src)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set (LJIT_STATIC "")
else()
set (LJIT_STATIC "static")
endif()
2017-07-08 05:21:40 +08:00
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/001-fixStaticBuild.patch
)
2017-07-08 04:12:09 +08:00
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
2017-07-08 05:21:40 +08:00
file(REMOVE "${SRC}/*.dll")
file(REMOVE "${SRC}/*.exe")
file(REMOVE "${SRC}/*.lib")
2017-07-08 04:12:09 +08:00
vcpkg_execute_required_process_repeat(
COUNT 1
2017-07-08 05:21:40 +08:00
COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" debug ${LJIT_STATIC}
2017-07-08 04:12:09 +08:00
WORKING_DIRECTORY "${SOURCE_PATH}/src/"
LOGNAME build-${TARGET_TRIPLET}-dbg
)
file(INSTALL ${SRC}/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools)
2017-07-08 05:21:40 +08:00
file(INSTALL ${SRC}/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
2017-07-08 04:12:09 +08:00
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL ${SRC}/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
2017-07-08 05:27:09 +08:00
vcpkg_copy_pdbs()
2017-07-08 04:12:09 +08:00
2017-07-08 05:21:40 +08:00
file(REMOVE "${SRC}/*.dll")
file(REMOVE "${SRC}/*.exe")
file(REMOVE "${SRC}/*.lib")
2017-07-08 04:12:09 +08:00
message(STATUS "Building ${TARGET_TRIPLET}-rel")
2017-07-08 05:21:40 +08:00
vcpkg_execute_required_process_repeat(d8un
2017-07-08 04:12:09 +08:00
COUNT 1
COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${LJIT_STATIC}
WORKING_DIRECTORY "${SOURCE_PATH}/src/"
LOGNAME build-${TARGET_TRIPLET}-rel
)
2017-07-08 05:21:40 +08:00
file(INSTALL ${SRC}/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(INSTALL ${SRC}/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
2017-07-08 04:12:09 +08:00
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
2017-07-08 05:21:40 +08:00
file(INSTALL ${SRC}/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
2017-07-08 04:12:09 +08:00
endif()
2017-07-08 05:27:09 +08:00
vcpkg_copy_pdbs()
2017-07-08 04:12:09 +08:00
2017-07-08 05:21:40 +08:00
file(INSTALL ${SRC}/lua.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SRC}/luajit.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SRC}/luaconf.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SRC}/lualib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SRC}/lauxlib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SRC}/lua.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(REMOVE "${SRC}/*.dll")
file(REMOVE "${SRC}/*.exe")
file(REMOVE "${SRC}/*.lib")