diff --git a/ports/faker-cxx/CMakeLists.txt.patch b/ports/faker-cxx/CMakeLists.txt.patch new file mode 100644 index 00000000000000..f3b023cfb7df59 --- /dev/null +++ b/ports/faker-cxx/CMakeLists.txt.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c0c1473..72e6244 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,7 +13,7 @@ if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20 /permissive- /bigobj") + else () + set(CMAKE_CXX_FLAGS +- "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wconversion -Wformat -Werror" ++ "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wconversion -Wformat" + ) + endif () + +@@ -130,9 +130,8 @@ install(EXPORT ${LIBRARY_NAME}-targets + if (APPLE OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION + VERSION_LESS 12)) + +- add_subdirectory(externals/fmt) +- set(FMT_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/fmt/include") +- target_link_libraries(${LIBRARY_NAME} PRIVATE fmt) ++ find_package(fmt CONFIG REQUIRED) ++ target_link_libraries(${LIBRARY_NAME} PRIVATE fmt::fmt) + endif () + + if (BUILD_FAKER_TESTS) diff --git a/ports/faker-cxx/FormatHelper.h.patch b/ports/faker-cxx/FormatHelper.h.patch new file mode 100644 index 00000000000000..d033dd670dc24e --- /dev/null +++ b/ports/faker-cxx/FormatHelper.h.patch @@ -0,0 +1,22 @@ +diff --git a/src/common/FormatHelper.h b/src/common/FormatHelper.h +index 6356ee9..8541469 100644 +--- a/src/common/FormatHelper.h ++++ b/src/common/FormatHelper.h +@@ -5,7 +5,7 @@ + #include + #include + +-#if defined(__APPLE__) || (defined(__GNUC__) && (__GNUC__ < 12) && !defined(__clang__)) ++#if defined(__APPLE__) || defined(__ANDROID__) || (defined(__GNUC__) && (__GNUC__ < 12) && !defined(__clang__)) + #include + #else + #include +@@ -16,7 +16,7 @@ namespace faker + class FormatHelper + { + public: +-#if defined(__APPLE__) || (defined(__GNUC__) && (__GNUC__ < 12) && !defined(__clang__)) ++#if defined(__APPLE__) || defined(__ANDROID__) || (defined(__GNUC__) && (__GNUC__ < 12) && !defined(__clang__)) + template + static std::string format(fmt::format_string fmt, Args&&... args) + { diff --git a/ports/faker-cxx/Helper.h.patch b/ports/faker-cxx/Helper.h.patch new file mode 100644 index 00000000000000..fe9c6515dade35 --- /dev/null +++ b/ports/faker-cxx/Helper.h.patch @@ -0,0 +1,13 @@ +diff --git a/include/faker-cxx/Helper.h b/include/faker-cxx/Helper.h +index 51d5eab..c17e41c 100644 +--- a/include/faker-cxx/Helper.h ++++ b/include/faker-cxx/Helper.h +@@ -89,7 +89,7 @@ public: + { + throw std::invalid_argument{"Data is empty."}; + } +- T item; ++ T item{}; + std::sample(data.begin(), data.end(), &item, 1, pseudoRandomGenerator); + return item; + } diff --git a/ports/faker-cxx/portfile.cmake b/ports/faker-cxx/portfile.cmake new file mode 100644 index 00000000000000..30498b982dfe64 --- /dev/null +++ b/ports/faker-cxx/portfile.cmake @@ -0,0 +1,29 @@ +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cieslarmichal/faker-cxx + REF "v${VERSION}" + SHA512 0ad3550d45df2adda70ad64fc1afffc2d39f6644e46029b6b3f0fd42eed071b55daeee9da7456b8b75e1da566bd0d1605518722b2831dba31bf9787506ecfa9d + HEAD_REF master + PATCHES + CMakeLists.txt.patch + FormatHelper.h.patch + Helper.h.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_FAKER_TESTS=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/faker-cxx) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/faker-cxx/usage b/ports/faker-cxx/usage new file mode 100644 index 00000000000000..c1b1d44dee14c7 --- /dev/null +++ b/ports/faker-cxx/usage @@ -0,0 +1,4 @@ +faker-cxx provides CMake targets: + + find_package(faker-cxx CONFIG REQUIRED) + target_link_libraries(main PRIVATE faker-cxx::faker-cxx) diff --git a/ports/faker-cxx/vcpkg.json b/ports/faker-cxx/vcpkg.json new file mode 100644 index 00000000000000..34e10ccc95d841 --- /dev/null +++ b/ports/faker-cxx/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "faker-cxx", + "version-string": "v1.0.0", + "description": "C++ Faker library for generating fake (but realistic) data.", + "homepage": "https://github.com/cieslarmichal/faker-cxx", + "license": "MIT", + "supports": "!android", + "dependencies": [ + "fmt", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 0c65240f59fc08..03c9e65a8a23f8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2592,6 +2592,10 @@ "baseline": "2.4.0", "port-version": 2 }, + "faker-cxx": { + "baseline": "v1.0.0", + "port-version": 0 + }, "fameta-counter": { "baseline": "2021-02-13", "port-version": 0 diff --git a/versions/f-/faker-cxx.json b/versions/f-/faker-cxx.json new file mode 100644 index 00000000000000..82c4fd04b20063 --- /dev/null +++ b/versions/f-/faker-cxx.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "572cbf1a47f1b4bf14d0ef9b2ae2f06b241e7ffe", + "version-string": "v1.0.0", + "port-version": 0 + } + ] +}