Skip to content

Commit 05018fd

Browse files
dodolawaruqi
andauthored
add quickjspp library (#1312)
* add quickjspp library * modify version * Update xmake.lua * Update xmake.lua * Update xmake.lua Co-authored-by: ruki <[email protected]>
1 parent 98cc5e3 commit 05018fd

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

packages/q/quickjspp/xmake.lua

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package("quickjspp")
2+
3+
set_homepage("https://github.com/ftk/quickjspp")
4+
set_description("QuickJS C++ wrapper")
5+
6+
add_urls("https://github.com/ftk/quickjspp.git")
7+
add_versions("2022.6.30", "e2555831d4e86486cf307d49bda803ffca9f0f43")
8+
9+
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
10+
11+
add_includedirs("include", "include/quickjs")
12+
add_linkdirs("lib/quickjs")
13+
add_links("quickjs")
14+
15+
add_deps("cmake")
16+
17+
if is_plat("linux") then
18+
add_syslinks("pthread", "dl", "m")
19+
end
20+
21+
on_install("linux", "macosx", function (package)
22+
local configs = {"-DBUILD_TESTING=OFF"}
23+
-- TODO, disable lto, maybe we need do it better
24+
io.replace("CMakeLists.txt", "set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)", "", {plain = true})
25+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
26+
table.insert(configs, "-DBUILD_TYPE=" .. (package:config("shared") and "Shared" or "Static"))
27+
import("package.tools.cmake").install(package, configs, {})
28+
end)
29+
30+
on_test(function (package)
31+
assert(package:check_cxxsnippets({test = [[
32+
#include <iostream>
33+
void test() {
34+
using namespace qjs;
35+
Runtime runtime;
36+
Context context(runtime);
37+
auto rt = runtime.rt;
38+
auto ctx = context.ctx;
39+
js_std_init_handlers(rt);
40+
js_init_module_std(ctx, "std");
41+
js_init_module_os(ctx, "os");
42+
context.eval(R"xxx(
43+
import * as std from 'std';
44+
import * as os from 'os';
45+
globalThis.std = std;
46+
globalThis.os = os;
47+
)xxx", "<input>", JS_EVAL_TYPE_MODULE);
48+
49+
js_std_loop(ctx);
50+
js_std_free_handlers(rt);
51+
52+
}
53+
]]}, {configs = {languages = "c++17"},
54+
includes = {"quickjspp.hpp","quickjs/quickjs-libc.h"}}))
55+
end)
56+

packages/r/redex/xmake.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ package("redex")
2020

2121
add_includedirs("include/redex/libredex",
2222
"include/redex/libresource",
23+
"include/redex/liblocator",
2324
"include/redex/shared",
2425
"include/redex/sparta",
2526
"include/redex/tools",
27+
"include/redex/tools/common",
28+
"include/redex/tools/tools",
2629
"include/redex/util",
2730
"include/redex/service")
2831

0 commit comments

Comments
 (0)