[libgo] Update to 3.1 (#11263)

* [libgo] Update to 3.1

* Add headers in debug sub folder

* Update ci.baseline and remove headers in debug/include directory

* Update the way to install headers and targets on Windows

* Remove the headers in netio/disable_hook on all platforms

* Add unsupported for arm and uwp

* Add only support static build and update ci.baseline

* code review

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
NancyLi1013 2020-05-19 05:09:10 +08:00 committed by GitHub
parent 0e9e59f2c4
commit 3f7bee619a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 83 deletions

View File

@ -1,4 +1,5 @@
Source: libgo
Version: 2.8-2
Build-Depends: boost-context
Version: 3.1
Homepage: https://github.com/yyzybb537/libgo
Description: The best stackful coroutine by c++11.
Support: !(arm|uwp)

View File

@ -1,20 +0,0 @@
diff --git a/libgo/ctx_boost_context/context.h b/libgo/ctx_boost_context/context.h
index 2db71c0..2f321fb 100644
--- a/libgo/ctx_boost_context/context.h
+++ b/libgo/ctx_boost_context/context.h
@@ -1,4 +1,4 @@
-#include <boost/context/all.hpp>
+#include <boost/context/execution_context.hpp>
#if BOOST_EXECUTION_CONTEXT == 2 // boost version >= 1.61
# include "context_v2.h"
diff --git a/libgo/ctx_boost_context/context_v2.h b/libgo/ctx_boost_context/context_v2.h
index e415af4..59e2e29 100644
--- a/libgo/ctx_boost_context/context_v2.h
+++ b/libgo/ctx_boost_context/context_v2.h
@@ -1,4 +1,4 @@
-#include <boost/context/all.hpp>
+#include <boost/context/stack_context.hpp>
namespace co
{

View File

@ -1,34 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dbbdd7d..29396a5 100644
index dfa9b72..ff9827e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,7 +137,7 @@ if (UNIX)
set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Wall -pthread ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-g -pg ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 ${CMAKE_CXX_FLAGS}")
-else ()
+elseif (NOT DISABLE_ADJUST_COMMAND_LINE_FLAGS)
if (NOT DISABLE_DYNAMIC_LIB)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
@@ -159,7 +159,7 @@ set(STATIC_T "libgo_static")
add_library("${STATIC_T}" STATIC ${CO_SRC_LIST})
set_target_properties("${STATIC_T}" PROPERTIES OUTPUT_NAME "${TARGET}")
@@ -152,6 +152,8 @@ if (UNIX)
-if (UNIX)
+if (UNIX OR FORCE_UNIX_TARGETS)
add_subdirectory(${PROJECT_SOURCE_DIR}/libgo/main)
elseif (WIN32)
set_target_properties("${STATIC_T}" PROPERTIES COMPILE_FLAGS "/wd4819 /wd4267")
+ install(TARGETS ${STATIC_T} LIBRARY DESTINATION "lib" ARCHIVE DESTINATION "lib")
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/libgo/ DESTINATION "include/libgo" FILES_MATCHING PATTERN "*.h")
endif()
if (NOT DISABLE_DYNAMIC_LIB)
@@ -180,7 +180,11 @@ if (UNIX)
PATTERN "ctx_boost_coroutine" EXCLUDE
PATTERN "ctx_ucontext" EXCLUDE
PATTERN "*.h")
+ if(UNIX)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/libgo/linux/ DESTINATION "include/libgo" FILES_MATCHING PATTERN "*.h")
+ else()
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/libgo/windows/ DESTINATION "include/libgo" FILES_MATCHING PATTERN "*.h")
+ endif()
#file(WRITE ${PROJECT_SOURCE_DIR}/tools/libgo.conf "${CMAKE_INSTALL_PREFIX}/lib")
#install(FILES ${PROJECT_SOURCE_DIR}/tools/libgo.conf DESTINATION "/etc/ld.so.conf.d")
if (DEPEND_BOOST)
if (WIN32)

View File

@ -1,16 +1,13 @@
include(vcpkg_common_functions)
vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "uwp")
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO yyzybb537/libgo
REF v2.8
SHA512 44784de4aec36ea321195c11c99a73de4f6f51285febdf6980e8aaced1fdfc0a34c6b1a8acc8c6b424e747310a1d7fb1604f722084c28ab91f8ebee15667d59b
REF 5d4f36508e8eb2d5aa17cf37cd951dc91da23096 #v3.1
SHA512 0f281f58116148ba1dd3904febbc391d47190f8e148b70bed7c4b7e6cb3efa5e41e2b7be4832ceeb805996e085f4c2d89fd0cf3b0651e037b32758d6a441411b
HEAD_REF master
PATCHES
cmake.patch
boost-168.patch
PATCHES cmake.patch
)
vcpkg_from_github(
@ -28,36 +25,22 @@ file(RENAME ${XHOOK_SOURCE_PATH} ${SOURCE_PATH}/third_party/xhook)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DDISABLE_ADJUST_COMMAND_LINE_FLAGS=ON
-DDISABLE_DYNAMIC_LIB=ON
-DENABLE_BOOST_CONTEXT=ON
-DFORCE_UNIX_TARGETS=ON
-DDISABLE_SYSTEMWIDE=ON
)
vcpkg_install_cmake()
# remove duplicated include files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libgo/disable_hook)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libgo/netio/disable_hook)
file(GLOB REL_MAIN ${CURRENT_PACKAGES_DIR}/lib/libgo_main.lib ${CURRENT_PACKAGES_DIR}/lib/liblibgo_main.a)
if(REL_MAIN)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(COPY ${REL_MAIN} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(REMOVE ${REL_MAIN})
endif()
file(GLOB DBG_MAIN ${CURRENT_PACKAGES_DIR}/debug/lib/libgo_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/liblibgo_main.a)
if(DBG_MAIN)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(COPY ${DBG_MAIN} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(REMOVE ${DBG_MAIN})
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libgo/netio/unix/static_hook)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libgo/netio/windows)
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libgo/netio/unix)
endif()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libgo RENAME copyright)
file(INSTALL ${CURRENT_PORT_DIR}/libgo-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libgo)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CURRENT_PORT_DIR}/libgo-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

View File

@ -765,11 +765,10 @@ libgd:x64-linux=ignore
libgit2:arm64-windows=fail
libgit2:arm-uwp=fail
libgit2:x64-uwp=fail
libgo:arm-uwp=fail
libgo:x64-uwp=fail
libgo:arm64-windows=fail
libgo:x64-linux=fail
libgo:x64-osx=fail
libgo:x64-windows=fail
libgo:x64-windows-static=fail
libgo:x86-windows=fail
libgpod:arm64-windows=fail
libgpod:arm-uwp=fail