aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Gautier <jeanga@users.noreply.github.com>2020-07-31 07:33:26 +0200
committerGitHub <noreply@github.com>2020-07-30 22:33:26 -0700
commit8cfa3e8e31393c3c0de2c63f6e212b27f2d809fe (patch)
tree4368e81b8670e8753dbd6a1d4076ee7ea9003c09
parent565df6ec85bbe38c7f70707b91cde9ea36573b37 (diff)
downloadvcpkg-8cfa3e8e31393c3c0de2c63f6e212b27f2d809fe.tar.gz
vcpkg-8cfa3e8e31393c3c0de2c63f6e212b27f2d809fe.zip
[stx] Add new port (#12011)
* Add port STX * stx: improve include files handling, disabled shared library support * [stx] remove CMakeLists.txt, add CMakeLists.patch, fixes * Update ports/stx/CMakeLists.patch to remove comments Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * CMakeLists.txt remove comment for installed region * Update ports/stx/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/stx/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Use vcpkg_check_linkage(ONLY_STATIC_LIBRARY) instead of custom logic Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update portfile.cmake Co-authored-by: Jean Gautier <jean.gautier@ssi.gouv.fr> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
-rw-r--r--ports/stx/CMakeLists.patch71
-rw-r--r--ports/stx/CONTROL8
-rw-r--r--ports/stx/portfile.cmake35
3 files changed, 114 insertions, 0 deletions
diff --git a/ports/stx/CMakeLists.patch b/ports/stx/CMakeLists.patch
new file mode 100644
index 000000000..70aaccbfd
--- /dev/null
+++ b/ports/stx/CMakeLists.patch
@@ -0,0 +1,71 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e4ed99e..b0d2b15 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -204,12 +204,7 @@ endif()
+ # ===============================================
+
+ if(STX_ENABLE_BACKTRACE)
+- if(NOT EXISTS third_party/abseil)
+- execute_process(
+- COMMAND git submodule update --init --recursive third_party/abseil
+- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+- endif()
+- add_subdirectory(third_party/abseil)
++ find_package(absl CONFIG REQUIRED)
+ endif()
+
+ # the atomics library doesn't automatically link on my Android phone
+@@ -246,13 +241,17 @@ else()
+ add_library(stx STATIC ${STX_SRCS})
+ endif()
+
+-target_include_directories(stx PUBLIC include)
++target_include_directories(stx PUBLIC
++ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++ $<INSTALL_INTERFACE:include>
++)
++
+ target_compile_options(stx PRIVATE ${STX_FLAGS} ${STX_WARNING_FLAGS})
+ target_compile_definitions(stx PUBLIC ${STX_COMPILER_DEFS})
+ target_link_libraries(stx ${STX_LIB_DEPENDENCIES})
+
+ if(STX_ENABLE_BACKTRACE)
+- target_link_libraries(stx absl::stacktrace absl::symbolize)
++ target_link_libraries(stx PUBLIC absl::stacktrace absl::symbolize)
+ endif()
+
+ if(ANDROID)
+@@ -288,6 +287,7 @@ endif()
+ #
+ # ===============================================
+
++
+ if(STX_BUILD_BENCHMARKS)
+
+ if(NOT EXISTS third_party/benchmark)
+@@ -433,3 +433,24 @@ if(STX_BUILD_DOCS)
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/docs/html/assets)
+
+ endif()
++
++install(
++ TARGETS stx
++ EXPORT stx
++ ARCHIVE DESTINATION lib
++ LIBRARY DESTINATION lib
++ RUNTIME DESTINATION bin
++)
++
++install(
++ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
++ DESTINATION include
++ FILES_MATCHING PATTERN "*.h*")
++
++install(
++ EXPORT stx
++ DESTINATION share/stx
++ FILE stxConfig.cmake
++ NAMESPACE stx::
++)
++
diff --git a/ports/stx/CONTROL b/ports/stx/CONTROL
new file mode 100644
index 000000000..cd6886925
--- /dev/null
+++ b/ports/stx/CONTROL
@@ -0,0 +1,8 @@
+Source: stx
+Version: 1.0.1
+Homepage: https://github.com/lamarrr/STX
+Description: C++17 & C++ 20 error-handling and utility extensions
+
+Feature: backtrace
+Description: stacktrace support for STX
+Build-Depends: abseil
diff --git a/ports/stx/portfile.cmake b/ports/stx/portfile.cmake
new file mode 100644
index 000000000..ebfca54ab
--- /dev/null
+++ b/ports/stx/portfile.cmake
@@ -0,0 +1,35 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO lamarrr/STX
+ REF v1.0.1
+ SHA512 544ca32f07cd863082fa9688f5d56e2715b0129ff90d2a8533cc24a92c943e5848c4b2b06a71f54c12668f6e89e9e3c649f595f9eb886f671a5fa18d343f794b
+ HEAD_REF master
+ PATCHES
+ "CMakeLists.patch"
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ backtrace STX_ENABLE_BACKTRACE
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DSTX_BUILD_DOCS=OFF
+ -DSTX_BUILD_BENCHMARKS=OFF
+ -DSTX_BUILD_SHARED=OFF
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/stx)
+vcpkg_copy_pdbs()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+)