ctrl-c: add package (#2908)
* ctrl-c: add package * ctrl-c: remove deps cmake * ctrl-c: SetCtrlCHandler * ctrl-c: limit on_installpull/2910/head
parent
d1732bed33
commit
4561c46d08
1 changed files with 43 additions and 0 deletions
@ -0,0 +1,43 @@ |
||||
package("ctrl-c") |
||||
set_homepage("https://github.com/evgenykislov/ctrl-c") |
||||
set_description("Crossplatform code to handle Ctrl+C signal") |
||||
set_license("MIT") |
||||
|
||||
add_urls("https://github.com/evgenykislov/ctrl-c.git") |
||||
add_versions("2023.09.02", "98b39d689ecb1a7193a3647c9a7d58a521892f9b") |
||||
|
||||
on_install("windows", "macosx", "linux", "mingw", "android", "msys", "iphoneos", "cross", function (package) |
||||
io.writefile("xmake.lua", [[ |
||||
add_rules("mode.debug", "mode.release") |
||||
target("ctrl-c") |
||||
set_kind("$(kind)") |
||||
add_headerfiles("src/(ctrl-c.h)") |
||||
add_files("src/ctrl-c.cpp") |
||||
set_languages("c++11") |
||||
if is_plat("windows") then |
||||
add_defines("_WIN32") |
||||
end |
||||
if is_plat("linux") then |
||||
add_defines("__linux__") |
||||
end |
||||
if is_plat("macosx") then |
||||
add_defines("__APPLE__") |
||||
end |
||||
]]) |
||||
local configs = {} |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <ctrl-c.h> |
||||
|
||||
void test() { |
||||
std::function<bool(enum CtrlCLibrary::CtrlSignal)> _exit = [](CtrlCLibrary::CtrlSignal signal) -> bool |
||||
{ |
||||
return true; |
||||
}; |
||||
CtrlCLibrary::SetCtrlCHandler(_exit); |
||||
} |
||||
]]}, {configs = {languages = "cxx11"}})) |
||||
end) |
Loading…
Reference in new issue