Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add quickjspp library #1312

Merged
merged 5 commits into from Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions packages/q/quickjspp/xmake.lua
@@ -0,0 +1,56 @@
package("quickjspp")

set_homepage("https://github.com/ftk/quickjspp")
set_description("QuickJS C++ wrapper")

add_urls("https://github.com/ftk/quickjspp.git")
add_versions("2022.6.30", "e2555831d4e86486cf307d49bda803ffca9f0f43")

add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})

add_includedirs("include", "include/quickjs")
add_linkdirs("lib/quickjs")
add_links("quickjs")

add_deps("cmake")

if is_plat("linux") then
add_syslinks("pthread", "dl", "m")
end

on_install("linux", "macosx", function (package)
local configs = {"-DBUILD_TESTING=OFF"}
-- TODO, disable lto, maybe we need do it better
io.replace("CMakeLists.txt", "set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)", "", {plain = true})
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_TYPE=" .. (package:config("shared") and "Shared" or "Static"))
import("package.tools.cmake").install(package, configs, {})
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <iostream>
void test() {
using namespace qjs;
Runtime runtime;
Context context(runtime);
auto rt = runtime.rt;
auto ctx = context.ctx;
js_std_init_handlers(rt);
js_init_module_std(ctx, "std");
js_init_module_os(ctx, "os");
context.eval(R"xxx(
import * as std from 'std';
import * as os from 'os';
globalThis.std = std;
globalThis.os = os;
)xxx", "<input>", JS_EVAL_TYPE_MODULE);

js_std_loop(ctx);
js_std_free_handlers(rt);

}
]]}, {configs = {languages = "c++17"},
includes = {"quickjspp.hpp","quickjs/quickjs-libc.h"}}))
end)

3 changes: 3 additions & 0 deletions packages/r/redex/xmake.lua
Expand Up @@ -20,9 +20,12 @@ package("redex")

add_includedirs("include/redex/libredex",
"include/redex/libresource",
"include/redex/liblocator",
"include/redex/shared",
"include/redex/sparta",
"include/redex/tools",
"include/redex/tools/common",
"include/redex/tools/tools",
"include/redex/util",
"include/redex/service")

Expand Down