[docopt] Add new port to fix #3935 (#4343)

* [docopt] Add docopt.cpp to fix #3935

* [docopt] Cleanup

* [docopt] Disable vcpkg_test_cmake due to misbehavior on x64

* [docopt] Install only one flavor (static/shared)
This commit is contained in:
myd7349 2018-10-18 02:52:23 +08:00 committed by Robert Schumacher
parent 0fe909718c
commit d45c9779a7
5 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,28 @@
diff --git a/docopt.h b/docopt.h
index 4c40741..06a04f8 100644
--- a/docopt.h
+++ b/docopt.h
@@ -85,6 +85,9 @@ namespace docopt {
bool help = true,
std::string const& version = {},
bool options_first = false) noexcept;
+
+ /// Write out the contents to the ostream
+ std::ostream DOCOPT_API & operator<<(std::ostream&, value const&);
}
#ifdef DOCOPT_HEADER_ONLY
diff --git a/docopt_value.h b/docopt_value.h
index a923219..7f0d6d6 100644
--- a/docopt_value.h
+++ b/docopt_value.h
@@ -102,9 +102,6 @@ namespace docopt {
Kind kind = Kind::Empty;
Variant variant {};
};
-
- /// Write out the contents to the ostream
- std::ostream& operator<<(std::ostream&, value const&);
}
namespace std {

View File

@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1aba5ae..5407e4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,7 +113,10 @@ endif()
set(export_name "docopt-targets")
# Runtime package
-install(TARGETS docopt EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(TARGETS docopt EXPORT ${export_name}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# Development package
install(TARGETS docopt_s EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})

3
ports/docopt/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: docopt
Version: 2018-04-16-2
Description: Command line arguments parser that will make you smile (C++11 port).

View File

@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bff867c..cc7d706 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,13 +113,15 @@ endif()
set(export_name "docopt-targets")
# Runtime package
+if(BUILD_SHARED_LIBS)
install(TARGETS docopt EXPORT ${export_name}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-
+else()
# Development package
install(TARGETS docopt_s EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
install(FILES ${docopt_HEADERS} DESTINATION include/docopt)
# CMake Package

View File

@ -0,0 +1,46 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO docopt/docopt.cpp
REF 4f491249e6def236937dbfac7602852e7d99aff8
SHA512 d3a61f8d8a8c11723064f3405f03eb838a2ac9aa574f86771b1db89a2dd81996b639215fe5d4465343b893bf71502da178c7af8d883c112c1e45f43c17d473b7
HEAD_REF master
PATCHES
001-fix-unresolved-symbol.patch
002-fix-install-path.patch
install-one-flavor.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DWITH_EXAMPLE=OFF
-DWITH_TESTS=OFF
-DUSE_BOOST_REGEX=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/docopt)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(READ ${CURRENT_PACKAGES_DIR}/include/docopt/docopt.h _contents)
string(REPLACE "#ifdef DOCOPT_DLL" "#if 1" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/docopt/docopt.h "${_contents}")
endif()
# Header-only style when DOCOPT_HEADER_ONLY is defined
file(COPY
${SOURCE_PATH}/docopt.cpp
DESTINATION ${CURRENT_PACKAGES_DIR}/include/docopt)
# Handle copyright
file(INSTALL
${SOURCE_PATH}/LICENSE-MIT
DESTINATION ${CURRENT_PACKAGES_DIR}/share/docopt RENAME copyright)
vcpkg_copy_pdbs()