-
There are some tools to generate C code such as:
-- luacheck: ignore 113
---@diagnostic disable: undefined-global
add_rules("mode.debug", "mode.release")
rule("lua-native-object")
do
set_extensions(".nobj.lua")
before_build_file(function(target, sourcefile)
import("core.project.config")
os.run("native_objects.lua -outpath %s -gen lua %s", get_config("buildir"), sourcefile)
target:add("files", get_config("buildir") .. "/" .. path.basename(sourcefile) .. ".c")
end)
end
target("tellenc")
do
add_rules("luarocks.module", "lua-native-object")
add_files("*.cpp", "*.nobj.lua")
add_links("stdc++")
end However,
It looks like when we convert lua to C code then add it to sources, it will miss compiling, so |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Dec 6, 2024
Replies: 1 comment 2 replies
-
see https://github.com/xmake-io/xmake/blob/dev/xmake/rules/lex_yacc/lex/xmake.lua |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Freed-Wu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://github.com/xmake-io/xmake/blob/dev/xmake/rules/lex_yacc/lex/xmake.lua