injector: add package (#3391)
* injector: add package * injector: add license * injector: split on_install * injector: mingw use nmake * injector: remove languages config * injector: remove cmd and mingw use make * injector: set kind headeronly * injector: fix io replace * injector: copy and install dll * injector: copy dll and add prefix * injector: separate on_install * injector: add `all` * injector: remove install * injector: use xmake port * injector: use less `add_defines` * injector: add on_config * injector: fix add_defines for linux * injector: add files for mingw * injector: add sys_links * injector: add rules * injector: add is_arch x64 * injector: remove is_arch("arm32") * injector: use is_arch("arm") * injector: mingw only add syslinkspull/3399/head
parent
1c314a89c4
commit
d2dba431ec
2 changed files with 72 additions and 0 deletions
@ -0,0 +1,45 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
if is_plat("mingw") then |
||||
add_syslinks("advapi32", "dbghelp", "psapi") |
||||
end |
||||
|
||||
target("injector") |
||||
set_kind("$(kind)") |
||||
set_languages("c") |
||||
|
||||
add_headerfiles("include/(*.h)") |
||||
add_includedirs("include", {public = true}) |
||||
|
||||
if is_arch("arm.*") then |
||||
add_defines("__arm__") |
||||
if is_arch("arm") then |
||||
add_defines("_M_ARMT") |
||||
elseif is_arch("arm64") then |
||||
add_defines("__arm64__", "__aarch64__", "_M_ARM64") |
||||
end |
||||
elseif is_arch("x86_64") then |
||||
add_defines("__x86_64__") |
||||
elseif is_arch("x86") then |
||||
add_defines("__i386__", "_M_IX86") |
||||
elseif is_arch("x64") then |
||||
add_defines("_M_AMD64") |
||||
end |
||||
|
||||
if is_plat("windows", "mingw") then |
||||
add_files("src/windows/*.c") |
||||
if is_plat("windows") then |
||||
add_defines("_WIN32") |
||||
end |
||||
elseif is_plat("macosx") then |
||||
add_headerfiles("src/macos/*.h") |
||||
add_files("src/macos/*.c") |
||||
elseif is_plat("linux") then |
||||
add_files("src/linux/*.c", "src/linux/*.S") |
||||
add_defines("__linux__") |
||||
end |
||||
on_config(function (target) |
||||
if target:has_tool("gcc", "gxx") then |
||||
target:add("defines", "__USE_GNU") |
||||
end |
||||
end) |
@ -0,0 +1,27 @@ |
||||
package("injector") |
||||
set_homepage("https://github.com/kubo/injector") |
||||
set_description("Library for injecting a shared library into a Linux or Windows process") |
||||
set_license("LGPL-2.1") |
||||
|
||||
add_urls("https://github.com/kubo/injector.git") |
||||
add_versions("2024.02.18", "c719b4f6b3bde75fd18d4d0c6b752a68dce593aa") |
||||
|
||||
if is_plat("mingw") then |
||||
add_syslinks("advapi32", "dbghelp", "psapi") |
||||
end |
||||
|
||||
on_install("windows", "linux", "macosx", "mingw", function (package) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
local configs = {} |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <injector.h> |
||||
void test() { |
||||
injector_t *injector; |
||||
injector_attach(&injector, 1234); |
||||
} |
||||
]]})) |
||||
end) |
Loading…
Reference in new issue