Skip to content

English

English

Appearance

Using c library

EXPLORER
src
main.c
test.proto
xmake.lua
Lua xmake.lua
12345678
add_requires("protobuf-c")

target("console_c")
 set_kind("binary")
 add_packages("protobuf-c")
 add_rules("protobuf.c")
 add_files("src/*.c")
 add_files("src/*.proto")

We can also set proto_public = true to export the proto's header search directory and make it available for other parent targets to inherit from.

lua
 add_packages("protobuf-c", {public = true})
 add_files("src/**.proto", {proto_public = true})

NOTE

Since the headers generated by protobuf reference the headers of the protobuf-c package, we also need to mark the package headers as {public = true} to export it.

Using the C++ library

EXPLORER
src
main.cpp
test.proto
xmake.lua
Lua xmake.lua
123456789
add_requires("protobuf-cpp")

target("console_cpp")
 set_kind("binary")
 set_languages("c++11")
 add_packages("protobuf-cpp")
 add_rules("protobuf.cpp")
 add_files("src/*.cpp")
 add_files("src/*.proto")

We can also set proto_public = true to export the proto's header search directory and make it available for other parent targets to inherit from.

lua
 add_packages("protobuf-cpp", {public = true})
 add_files("src/**.proto", {proto_public = true})

NOTE

Since the headers generated by protobuf reference the headers of the protobuf-cpp package, we also need to mark the package headers as {public = true} to export it.

AltStyle によって変換されたページ (->オリジナル) /