Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions packages/r/randx/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package("randx")
Comment thread
luadebug marked this conversation as resolved.
set_homepage("https://github.com/lidaixingchen/RandX")
set_description("Modern, fast, and header-only C++ pseudo-random number generator and distribution library (C++17/C++23).")
set_license("MIT")

add_urls("https://github.com/lidaixingchen/RandX/archive/refs/tags/v$(version).tar.gz")

add_versions("1.4.0", "ecf611c6f340986df2abf3191def2222a3287f5e20ec4280c88996770a95eec7")
add_versions("1.3.1", "f271bbcb26bea7747ee292646df895c2305b696bb0d58d69b54e84fe96fab3c1")

on_load(function (package)
package:set("kind", "library", {headeronly = true})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就这么几行配置,没必要放 on_load ,直接描述域 直接配置


-- 跨平台 OS 熵源链接(ChaCha20 CSPRNG 需要)
-- Windows: BCryptGenRandom → bcrypt
-- macOS: SecRandomCopyBytes → Security framework
-- Linux: getrandom → libc 内置,无需额外链接

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释删了

if package:is_plat("windows", "mingw") then
package:add("syslinks", "bcrypt")
elseif package:is_plat("macosx") then
package:add("syslinks", "Security")
end
Comment thread
luadebug marked this conversation as resolved.
Outdated
end)

on_install(function (package)
-- 仅安装两个头文件到 include/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删了中文注释

os.cp("RandX.hpp", package:installdir("include"))
os.cp("RandX_Cpp17.hpp", package:installdir("include"))
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <RandX.hpp>
#include <cstdint>
static void test() {
std::uint64_t v = RandX::RandInt<std::uint64_t>(0, 1000);
(void)v;
}
]]}, {configs = {languages = "c++23"}}))
Comment thread
luadebug marked this conversation as resolved.
Outdated
end)