工具生成的代码没有参与编译
#5670
-
我需要用工具生成一些代码,然后再一起编译,但是现在发现生成的代码没有参与编译,需要执行两次xmake才行。 target("gen")
set_kind("phony")
set_policy("build.fence", true)
on_build(function (target)
os.run("gen.cmd")
end)
target("app")
set_kind("binary")
add_deps("gen")
add_files("**.cpp")
set_policy("build.across_targets_in_parallel", false) gen.cmd: @echo off
echo void foo(); > gen.h
echo #include "gen.h" > gen.cpp
echo #include ^<stdio.h^> >> gen.cpp
echo void foo() { >> gen.cpp
echo printf("foo\n"); >> gen.cpp
echo } >> gen.cpp main.cpp: #include <stdio.h>
#include "gen.h"
int main() {
foo();
return 0;
} 目录里面只有三个文件:xmake.lua, main.cpp, gen.cmd |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Sep 27, 2024
Replies: 2 comments 3 replies
-
参考 xmake 源码里的 yacc/lex rule |
Beta Was this translation helpful? Give feedback.
0 replies
-
autogen 看下 https://github.com/xmake-io/xmake/tree/dev/tests/projects/other/autogen |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
遍历下不就好了么。。
xmake/xmake/rules/asn1c/xmake.lua
Line 45 in 9738030