Procházet zdrojové kódy

platformfolders: add package (#4095)

* platformfolders: add package

* fix mingw syslinks

* fix mingw syslinks
star9029 před 1 rokem
rodič
revize
fb365c8727

+ 12 - 0
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"
+ 	)

+ 35 - 0
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)