aboutsummaryrefslogtreecommitdiff
path: root/ports/outcome
diff options
context:
space:
mode:
Diffstat (limited to 'ports/outcome')
-rw-r--r--ports/outcome/CONTROL7
-rw-r--r--ports/outcome/outcome-prune-sources.patch12
-rw-r--r--ports/outcome/portfile.cmake76
-rw-r--r--ports/outcome/usage4
4 files changed, 92 insertions, 7 deletions
diff --git a/ports/outcome/CONTROL b/ports/outcome/CONTROL
index 449485ed9..947330ee0 100644
--- a/ports/outcome/CONTROL
+++ b/ports/outcome/CONTROL
@@ -1,4 +1,9 @@
Source: outcome
-Version: 2.1.3
+Version: 2.2.0-b9e664fb
Homepage: https://github.com/ned14/outcome
Description: Provides very lightweight outcome<T> and result<T> (non-Boost edition)
+Build-Depends: ned14-internal-quickcpplib, status-code
+Supports: !uwp
+
+Feature: run-tests
+Description: Build and run the dependency validation tests
diff --git a/ports/outcome/outcome-prune-sources.patch b/ports/outcome/outcome-prune-sources.patch
new file mode 100644
index 000000000..59c5db01a
--- /dev/null
+++ b/ports/outcome/outcome-prune-sources.patch
@@ -0,0 +1,12 @@
+diff --git "a/cmake/headers.cmake" "b/cmake/headers.cmake"
+index 108038d16..bf4807e16 100644
+--- "a/cmake/headers.cmake"
++++ "b/cmake/headers.cmake"
+@@ -47,7 +47,6 @@ set(outcome_HEADERS
+ "include/outcome/experimental/status-code/include/system_code_from_exception.hpp"
+ "include/outcome/experimental/status-code/include/system_error2.hpp"
+ "include/outcome/experimental/status-code/include/win32_code.hpp"
+- "include/outcome/experimental/status-code/single-header/system_error2.hpp"
+ "include/outcome/experimental/status_outcome.hpp"
+ "include/outcome/experimental/status_result.hpp"
+ "include/outcome/iostream_support.hpp"
diff --git a/ports/outcome/portfile.cmake b/ports/outcome/portfile.cmake
index 0d1223fc7..77275f1d5 100644
--- a/ports/outcome/portfile.cmake
+++ b/ports/outcome/portfile.cmake
@@ -1,13 +1,77 @@
-# header-only library
+# Outcome is composed of other third party libraries:
+# Outcome
+# <= status-code
+# <= quickcpplib
+# <= byte-lite
+# <= gsl-lite
+# <= Optional
+#
+# byte-lite and gsl-lite are in vcpkg, but may not be versions
+# known to be compatible with Outcome. It has occurred in the
+# past that newer versions were severely broken with Outcome.
+#
+# One can fetch an 'all sources' tarball from
+# https://github.com/ned14/outcome/releases which contains
+# the exact copy of those third party libraries known to
+# have passed Outcome's CI process.
+
+message(WARNING [=[
+Outcome depends on QuickCppLib which uses the vcpkg versions of gsl-lite and byte-lite, rather than the versions tested by QuickCppLib's and Outcome's CI. It is not guaranteed to work with other versions, with failures experienced in the past up-to-and-including runtime crashes. See the warning message from QuickCppLib for how you can pin the versions of those dependencies in your manifest file to those with which QuickCppLib was tested. Do not report issues to upstream without first pinning the versions as QuickCppLib was tested against.
+]=])
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ned14/outcome
- REF 34f3bd55e2bcaf246cb79efe64a5600e89b91b66 #v2.1.3
- SHA512 83eba50e2095e7c768dacb3af5f82db117c3451f1d5bc2f73d716608d56f7b73006ec33d0f3842fdefd076f0e82b72ece5777868712f75e83eac93aa8adf351c
+ REF all_tests_passed_b9e664fbf87a4122731f7f19590abad24f1448b8
+ SHA512 50666de7c6fed8260780a3bbd97eb8c8a27cf02541f15a19c316ddef30eafce155817ea8d77efee0180dbd07ad5da06a888275c324a554e25d5ce6bb80666071
HEAD_REF develop
+ PATCHES
+ outcome-prune-sources.patch
+)
+
+# Outcome needs a copy of QuickCppLib with which to bootstrap its cmake
+file(COPY "${CURRENT_INSTALLED_DIR}/include/quickcpplib"
+ DESTINATION "${SOURCE_PATH}/quickcpplib/repo/include/"
+)
+file(COPY "${CURRENT_INSTALLED_DIR}/share/ned14-internal-quickcpplib/"
+ DESTINATION "${SOURCE_PATH}/quickcpplib/repo/"
+)
+
+# Outcome expects status-code to live inside its include directory
+file(COPY "${CURRENT_INSTALLED_DIR}/include/status-code/"
+ DESTINATION "${SOURCE_PATH}/include/outcome/experimental/status-code/include/"
+)
+file(COPY "${CURRENT_INSTALLED_DIR}/include/status-code/detail/"
+ DESTINATION "${SOURCE_PATH}/include/outcome/experimental/status-code/include/detail/"
)
-file(GLOB_RECURSE OUTCOME_HEADERS "${SOURCE_PATH}/single-header/*.hpp")
-file(INSTALL ${OUTCOME_HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+# Because outcome's deployed files are header-only, the debug build is not necessary
+set(VCPKG_BUILD_TYPE release)
+
+# Already installed dependencies don't appear on the include path, which Outcome assumes.
+string(APPEND VCPKG_CXX_FLAGS " \"-I${CURRENT_INSTALLED_DIR}/include\"")
+string(APPEND VCPKG_C_FLAGS " \"-I${CURRENT_INSTALLED_DIR}/include\"")
+
+# Use Outcome's own build process, skipping examples and tests.
+vcpkg_configure_cmake(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PREFER_NINJA
+ OPTIONS
+ -DPROJECT_IS_DEPENDENCY=On
+ -Dquickcpplib_FOUND=1
+ -DOUTCOME_ENABLE_DEPENDENCY_SMOKE_TEST=ON # Leave this always on to test everything compiles
+ -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
+)
+
+if("run-tests" IN_LIST FEATURES)
+ vcpkg_build_cmake(TARGET test)
+endif()
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/outcome)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
-file(INSTALL ${SOURCE_PATH}/Licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+file(INSTALL "${SOURCE_PATH}/Licence.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/ports/outcome/usage b/ports/outcome/usage
new file mode 100644
index 000000000..6bf004036
--- /dev/null
+++ b/ports/outcome/usage
@@ -0,0 +1,4 @@
+The package outcome provides CMake targets:
+
+ find_package(outcome CONFIG REQUIRED)
+ target_link_libraries(main PUBLIC outcome::hl)