Initial restbed port (#4232)

* Restbed port

* [restbed] Disable tests to simplify build. Only build one flavor.
This commit is contained in:
Tom Henoch 2018-10-16 10:59:33 +02:00 committed by Robert Schumacher
parent f451d95a39
commit de7bc03245
3 changed files with 91 additions and 0 deletions

4
ports/restbed/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: restbed
Version: 4.16-07-28-2018
Description: Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++11 applications.
Build-Depends: asio

59
ports/restbed/cmake.patch Normal file
View File

@ -0,0 +1,59 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b66143e..85c5315 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,9 @@ endif ( )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake" )
find_package( asio REQUIRED )
+if(NOT DISABLE_TESTS)
find_package( catch REQUIRED )
+endif()
if ( BUILD_SSL )
find_package( openssl REQUIRED )
endif ( )
@@ -54,6 +56,7 @@ include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${kashmir_INCLUDE} ${
#
file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" )
+if(NOT BUILD_SHARED_LIBS)
set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" )
add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} )
set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 )
@@ -64,7 +67,9 @@ if ( BUILD_SSL )
else ( )
target_link_libraries( ${STATIC_LIBRARY_NAME} )
endif ( )
+endif()
+if(BUILD_SHARED_LIBS)
set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" )
add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} )
set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 )
@@ -76,12 +81,15 @@ if ( BUILD_SSL )
else ( )
target_link_libraries( ${SHARED_LIBRARY_NAME} )
endif ( )
+endif()
+if(NOT DISABLE_TESTS)
enable_testing( )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/unit" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/feature" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/regression" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/integration" )
+endif()
#
# Install
@@ -90,5 +98,8 @@ file( GLOB ARTIFACTS "${SOURCE_DIR}/*.hpp" )
install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" )
install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" )
-install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+if(NOT BUILD_SHARED_LIBS)
+install( TARGETS ${STATIC_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+else()
+install( TARGETS ${SHARED_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+endif()

View File

@ -0,0 +1,28 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Corvusoft/restbed
REF 0f8af8d8ed183a88e208adeb22da0080d5d74d1e
SHA512 f0175a10c88f1ad4f16c8e4cff7ceea7b80c56b0724b59791c23e91f1ecf146dfdbda9e9238d31a35f21d8cdcc413b586cc633725dd0ba87de6b599a7087916f
HEAD_REF master
PATCHES cmake.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_SSL=OFF
-DDISABLE_TESTS=ON
)
vcpkg_install_cmake()
#Remove include debug files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/restbed/copyright COPYONLY)