From fb365c872733a965cd3820851286184c132ce6e0 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 22 May 2024 08:18:53 +0800 Subject: [PATCH] platformfolders: add package (#4095) * platformfolders: add package * fix mingw syslinks * fix mingw syslinks --- .../patches/4.2.0/cmake-install.patch | 12 +++++++ packages/p/platformfolders/xmake.lua | 35 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 packages/p/platformfolders/patches/4.2.0/cmake-install.patch create mode 100644 packages/p/platformfolders/xmake.lua diff --git a/packages/p/platformfolders/patches/4.2.0/cmake-install.patch b/packages/p/platformfolders/patches/4.2.0/cmake-install.patch new file mode 100644 index 000000000..18ed3ac7b --- /dev/null +++ b/packages/p/platformfolders/patches/4.2.0/cmake-install.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ae2017..30e2045 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -83,6 +83,7 @@ if(PLATFORMFOLDERS_ENABLE_INSTALL) + EXPORT "platform_foldersConfig" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + # Tells it where to put the header files + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sago" + ) diff --git a/packages/p/platformfolders/xmake.lua b/packages/p/platformfolders/xmake.lua new file mode 100644 index 000000000..d206db613 --- /dev/null +++ b/packages/p/platformfolders/xmake.lua @@ -0,0 +1,35 @@ +package("platformfolders") + set_homepage("https://github.com/sago007/PlatformFolders") + set_description([[A C++ library to look for special directories like "My Documents" and "%APPDATA%" so that you do not need to write Linux, Windows or Mac OS X specific code]]) + set_license("MIT") + + add_urls("https://github.com/sago007/PlatformFolders/archive/refs/tags/$(version).tar.gz", + "https://github.com/sago007/PlatformFolders.git") + + add_versions("4.2.0", "31bb0f64a27315aec8994f226332aaafe9888d00bb69a2ff2dff9912e2f4ccf4") + + add_patches("4.2.0", "patches/4.2.0/cmake-install.patch", "a38850ff7e9b91034f226685af7633ff692de3aea4798cb3dddecc6b055a7601") + + if is_plat("windows", "mingw") then + add_syslinks("ole32", "shell32", "uuid") + end + + add_deps("cmake") + + on_install(function (package) + local configs = {"-DPLATFORMFOLDERS_BUILD_TESTING=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + if package:is_plat("windows") and package:config("shared") then + table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON") + end + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + sago::getConfigHome(); + } + ]]}, {configs = {languages = "c++11"}, includes = "sago/platform_folders.h"})) + end)