Add macros to generate ydl descriptors
@@ -3354,11 +3354,43 @@ macro _SRC("supp", SRC, SRCFLAGS...) {
.CMD=$COPY_CMD ${input:SRC} ${output;suf=.o:SRC} ${kv;hide:"p SP"} ${kv;hide:"pc light-cyan"}
}
+YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
+YDL_DESC_FLAGS=
+
macro _SRC("ydl", SRC, SRCFLAGS...) {
- .CMD=${tool:"statbox/ydl/compiler/tooling/ydlc/bin"} --force-color -I ${ARCADIA_ROOT} --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${output_include;hide:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
+ .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} c $YDL_FLAGS --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${output_include;hide:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
.PEERDIR+=statbox/ydl/runtime/cpp
}
+### @usage BUILD_YDL_DESC(Input Symbol Output)
+###
+### Generate a descriptor for a symbol Symbol located in a ydl module Input, and put it to the file Output.
+###
+### @example:
+### PACKAGE()
+### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
+### END()
+###
+### This will parse file ../types.ydl, generate a descriptor for a symbol Event defined in the said file, and put the descriptor to the Event.ydld.
+macro BUILD_YDL_DESC(Input, Symbol, Output) {
+ .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} ti $YDL_FLAGS $YDL_DESC_FLAGS -o ${output;noauto:Output} ${input:Input} ${Symbol} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
+}
+
+### @usage: YDL_DESC_USE_BINARY()
+###
+### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
+###
+### @example:
+### PACKAGE()
+### YDL_DESC_USE_BINARY()
+### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
+### END()
+### This will generate descriptor Event.ydld in a binary format.
+macro YDL_DESC_USE_BINARY() {
+ YDL_DESC_FLAGS_BINARY= --binary
+ SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
+}
+
### @usage SRC(File Flags...)
###
### Compile single file with extra Flags.
