Skip to content

Commit

Permalink
platformfolders: add package (#4095)
Browse files Browse the repository at this point in the history
* platformfolders: add package

* fix mingw syslinks

* fix mingw syslinks
  • Loading branch information
star-hengxing authored May 22, 2024
1 parent dcf7102 commit fb365c8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/p/platformfolders/patches/4.2.0/cmake-install.patch
Original file line number Diff line number Diff line change
@@ -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 changes: 35 additions & 0 deletions packages/p/platformfolders/xmake.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit fb365c8

Please sign in to comment.