[chakracore] msbuild (#33182)

* chakracore msbuild

* v db

* add features

* fix control flow

* v db

* format-manifest

* v db

* Fix build

* v db
This commit is contained in:
Alexander Neumann 2023-08-17 23:22:37 +02:00 committed by GitHub
parent 9f3362129f
commit 3c268c7706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 40 deletions

View File

@ -10,22 +10,24 @@ vcpkg_from_github(
add-missing-reference.patch # https://github.com/chakra-core/ChakraCore/pull/6862
)
set(BUILDTREE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(REMOVE_RECURSE ${BUILDTREE_PATH})
file(COPY ${SOURCE_PATH}/ DESTINATION ${BUILDTREE_PATH})
if(WIN32)
set(BUILDTREE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(additional_options NO_TOOLCHAIN_PROPS) # don't know how to fix the linker error about __guard_check_icall_thunk
endif()
set(CHAKRA_RUNTIME_LIB "static_library") # ChakraCore only supports static CRT linkage
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(PLATFORM_ARG PLATFORM x86) # it's x86, not Win32 in sln file
endif()
vcpkg_install_msbuild(
SOURCE_PATH "${BUILDTREE_PATH}"
PROJECT_SUBPATH "Build/Chakra.Core.sln"
vcpkg_msbuild_install(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH Build/Chakra.Core.sln
OPTIONS
"/p:CustomBeforeMicrosoftCommonTargets=${CMAKE_CURRENT_LIST_DIR}/no-warning-as-error.props"
"/p:RuntimeLib=${CHAKRA_RUNTIME_LIB}"
${PLATFORM_ARG}
${additional_options}
)
file(GLOB_RECURSE LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*.lib")
file(GLOB_RECURSE DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib")
@ -45,11 +47,11 @@ else()
message(WARNING "${PORT} requires Clang from the system package manager, this can be installed on Ubuntu systems via sudo apt install clang")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
if(NOT DEFINED VCPKG_BUILD_TYPE)
list(APPEND configs "debug")
execute_process(
COMMAND bash "build.sh" "--arch=${CHAKRACORE_TARGET_ARCH}" "--debug" "-j=${VCPKG_CONCURRENCY}"
WORKING_DIRECTORY "${BUILDTREE_PATH}"
WORKING_DIRECTORY "${BUILDTREE_PATH}-dbg"
OUTPUT_VARIABLE CHAKRA_BUILD_SH_OUT
ERROR_VARIABLE CHAKRA_BUILD_SH_ERR
@ -58,33 +60,32 @@ else()
ECHO_ERROR_VARIABLE
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
list(APPEND configs "release")
execute_process(
COMMAND bash "build.sh" "--arch=${CHAKRACORE_TARGET_ARCH}" "-j=${VCPKG_CONCURRENCY}"
WORKING_DIRECTORY "${BUILDTREE_PATH}"
OUTPUT_VARIABLE CHAKRA_BUILD_SH_OUT
ERROR_VARIABLE CHAKRA_BUILD_SH_ERR
RESULT_VARIABLE CHAKRA_BUILD_SH_RES
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
)
endif()
list(APPEND configs "release")
execute_process(
COMMAND bash "build.sh" "--arch=${CHAKRACORE_TARGET_ARCH}" "-j=${VCPKG_CONCURRENCY}"
WORKING_DIRECTORY "${BUILDTREE_PATH}-rel"
OUTPUT_VARIABLE CHAKRA_BUILD_SH_OUT
ERROR_VARIABLE CHAKRA_BUILD_SH_ERR
RESULT_VARIABLE CHAKRA_BUILD_SH_RES
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
)
endif()
file(INSTALL
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCore.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCommon.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraDebug.h"
"${BUILDTREE_PATH}-rel/lib/Jsrt/ChakraCore.h"
"${BUILDTREE_PATH}-rel/lib/Jsrt/ChakraCommon.h"
"${BUILDTREE_PATH}-rel/lib/Jsrt/ChakraDebug.h"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
)
if(WIN32)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(INSTALL
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCommonWindows.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCoreWindows.h"
"${BUILDTREE_PATH}-rel/lib/Jsrt/ChakraCommonWindows.h"
"${BUILDTREE_PATH}-rel/lib/Jsrt/ChakraCoreWindows.h"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
)
# Do not install dll/exe/lib files here because they are handled by vcpkg_install_msbuild
else()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(out_file libChakraCore.so)
@ -92,10 +93,10 @@ else()
set(out_file lib/libChakraCoreStatic.a)
endif()
set(destination_dir_debug "${CURRENT_PACKAGES_DIR}/debug/lib")
set(destination_dir_release "${CURRENT_PACKAGES_DIR}/lib")
set(out_dir_debug "${BUILDTREE_PATH}/out/Debug")
set(out_dir_release "${BUILDTREE_PATH}/out/Release")
set(destination_dir_debug "${CURRENT_PACKAGES_DIR}/debug/bin")
set(destination_dir_release "${CURRENT_PACKAGES_DIR}/bin")
set(out_dir_debug "${BUILDTREE_PATH}-dbg/out/Debug")
set(out_dir_release "${BUILDTREE_PATH}-rel/out/Release")
foreach(config ${configs})
file(INSTALL
${out_dir_${config}}/${out_file}
@ -112,17 +113,15 @@ else()
SEARCH_DIR "${out_dir_release}"
)
endif()
endif()
vcpkg_copy_pdbs()
endif()
file(INSTALL
"${CMAKE_CURRENT_LIST_DIR}/unofficial-chakracore-config.cmake"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}"
)
file(INSTALL
vcpkg_install_copyright(FILE_LIST
"${SOURCE_PATH}/LICENSE.txt"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/chakracore"
RENAME copyright
)

View File

@ -1,7 +1,7 @@
{
"name": "chakracore",
"version-date": "2022-11-09",
"port-version": 3,
"port-version": 4,
"description": "Core part of the Chakra Javascript engine",
"homepage": "https://github.com/Microsoft/ChakraCore",
"license": "MIT",
@ -14,6 +14,14 @@
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-msbuild",
"host": true,
"features": [
"pkg-config"
],
"platform": "windows"
}
]
}

View File

@ -1502,7 +1502,7 @@
},
"chakracore": {
"baseline": "2022-11-09",
"port-version": 3
"port-version": 4
},
"charls": {
"baseline": "2.4.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cc06634190b18bc8003202b9490c6af7919821a3",
"version-date": "2022-11-09",
"port-version": 4
},
{
"git-tree": "0e3461099e02572100a3a6731b04fa0c3d12b223",
"version-date": "2022-11-09",