aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libhat
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libhat')
-rw-r--r--vcpkg/ports/libhat/0001-CMakeLists.patch44
-rw-r--r--vcpkg/ports/libhat/0002-fix-gcc.patch24
-rw-r--r--vcpkg/ports/libhat/libhat-config.cmake.in3
-rw-r--r--vcpkg/ports/libhat/portfile.cmake42
-rw-r--r--vcpkg/ports/libhat/vcpkg.json23
5 files changed, 136 insertions, 0 deletions
diff --git a/vcpkg/ports/libhat/0001-CMakeLists.patch b/vcpkg/ports/libhat/0001-CMakeLists.patch
new file mode 100644
index 0000000..99b9de2
--- /dev/null
+++ b/vcpkg/ports/libhat/0001-CMakeLists.patch
@@ -0,0 +1,44 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d04055c..ade5ce6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -81,12 +81,12 @@ target_compile_features(libhat PUBLIC cxx_std_20)
+
+ if (MSVC)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+- target_compile_options(libhat PRIVATE /clang:-Wall /clang:-Wextra /clang:-Wconversion /clang:-Werror)
++ target_compile_options(libhat PRIVATE /clang:-Wall /clang:-Wextra /clang:-Wconversion)
+ else()
+ target_compile_options(libhat PRIVATE /W3 /WX)
+ endif()
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+- target_compile_options(libhat PRIVATE -Wall -Wextra -Wconversion -Werror
++ target_compile_options(libhat PRIVATE -Wall -Wextra -Wconversion
+ # temp fix for macOS CI failing due to incorrect LIBHAT_COMPILER_X86_OPTIONS value
+ -Wno-unused-command-line-argument
+ )
+@@ -155,10 +155,24 @@ if(LIBHAT_TESTING)
+ endif()
+
+ if(LIBHAT_INSTALL_TARGET)
++ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/libhat" DESTINATION "include")
+ install(TARGETS libhat
+ EXPORT libhat-targets
+ RUNTIME DESTINATION "bin"
+ ARCHIVE DESTINATION "lib"
+ LIBRARY DESTINATION "lib"
+ )
++ install(EXPORT libhat-targets NAMESPACE libhat:: DESTINATION "share/libhat")
++ include(CMakePackageConfigHelpers)
++ configure_package_config_file(
++ "${CMAKE_CURRENT_LIST_DIR}/libhat-config.cmake.in"
++ "${CMAKE_CURRENT_BINARY_DIR}/libhat-config.cmake"
++ INSTALL_DESTINATION "share/libhat"
++ )
++ write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libhat-config-version.cmake" VERSION "${VERSION}" COMPATIBILITY SameMajorVersion)
++ install(FILES
++ "${CMAKE_CURRENT_BINARY_DIR}/libhat-config.cmake"
++ "${CMAKE_CURRENT_BINARY_DIR}/libhat-config-version.cmake"
++ DESTINATION "share/libhat"
++ )
+ endif()
diff --git a/vcpkg/ports/libhat/0002-fix-gcc.patch b/vcpkg/ports/libhat/0002-fix-gcc.patch
new file mode 100644
index 0000000..ed30775
--- /dev/null
+++ b/vcpkg/ports/libhat/0002-fix-gcc.patch
@@ -0,0 +1,24 @@
+diff --git a/include/libhat/compressed_pair.hpp b/include/libhat/compressed_pair.hpp
+index 7bf839a..1b2be6c 100644
+--- a/include/libhat/compressed_pair.hpp
++++ b/include/libhat/compressed_pair.hpp
+@@ -4,6 +4,7 @@
+ #include <tuple>
+ #endif
+
++#include <cstddef>
+ #include "defines.hpp"
+ #include "type_traits.hpp"
+
+diff --git a/include/libhat/strconv.hpp b/include/libhat/strconv.hpp
+index f23d096..ad527fb 100644
+--- a/include/libhat/strconv.hpp
++++ b/include/libhat/strconv.hpp
+@@ -5,6 +5,7 @@
+ #include <type_traits>
+ #endif
+
++#include <cstdint>
+ #include "concepts.hpp"
+ #include "export.hpp"
+ #include "result.hpp"
diff --git a/vcpkg/ports/libhat/libhat-config.cmake.in b/vcpkg/ports/libhat/libhat-config.cmake.in
new file mode 100644
index 0000000..053d7b4
--- /dev/null
+++ b/vcpkg/ports/libhat/libhat-config.cmake.in
@@ -0,0 +1,3 @@
+@PACKAGE_INIT@
+include("${CMAKE_CURRENT_LIST_DIR}/libhat-targets.cmake")
+check_required_components(libhat)
diff --git a/vcpkg/ports/libhat/portfile.cmake b/vcpkg/ports/libhat/portfile.cmake
new file mode 100644
index 0000000..e33124f
--- /dev/null
+++ b/vcpkg/ports/libhat/portfile.cmake
@@ -0,0 +1,42 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO BasedInc/libhat
+ REF "v${VERSION}"
+ SHA512 07bdca0a84fc48d6c3d941136459d73e7c4f09c398c5a787e307dd01ee0124fc56d2ba827e49b342611b754816408d21109c6f17bede62dcc231a1a2e3c1d225
+ HEAD_REF master
+ PATCHES
+ 0001-CMakeLists.patch
+ 0002-fix-gcc.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/libhat-config.cmake.in" DESTINATION "${SOURCE_PATH}")
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBHAT_BUILD_SHARED)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBHAT_BUILD_STATIC)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "hint" LIBHAT_HINT_X86_64
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DLIBHAT_DISABLE_AVX512=ON # For AVX512, author an overlay-port that removes this line
+ -DLIBHAT_SHARED_C_LIB=${LIBHAT_BUILD_SHARED}
+ -DLIBHAT_STATIC_C_LIB=${LIBHAT_BUILD_STATIC}
+ -DLIBHAT_TESTING=OFF
+ -DLIBHAT_TESTING_ASAN=OFF
+ -DLIBHAT_TESTING_SDE=OFF
+ -DLIBHAT_EXAMPLES=OFF
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libhat/vcpkg.json b/vcpkg/ports/libhat/vcpkg.json
new file mode 100644
index 0000000..70695ce
--- /dev/null
+++ b/vcpkg/ports/libhat/vcpkg.json
@@ -0,0 +1,23 @@
+{
+ "name": "libhat",
+ "version": "0.8.0",
+ "description": "A high-performance, modern, C++20 library designed around game hacking.",
+ "homepage": "https://github.com/BasedInc/libhat",
+ "license": "MIT",
+ "supports": "windows | linux",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "hint": {
+ "description": "Enables support for the x86_64 scan hint, requires a small (2KB) data table"
+ }
+ }
+}