Use Pigweed modules in your project#

Once you have set up Pigweed, you can start using Pigweed modules in your project.

Use pw_add_library#

Pigweed provides a helper function pw_add_library which simplifies library creation and automatically handles some Pigweed-specific configuration. It is recommended to use this for your own libraries that depend on Pigweed.

include($ENV{PW_ROOT}/pw_build/pigweed.cmake)

pw_add_library(my_library
  SOURCES
    my_library.cc
  PUBLIC_DEPS
    pw_containers.vector
)

See CMake for more details on pw_add_library.

Protobuf Generation#

Pigweed provides CMake support for generating C++ and Python code from Protobuf files.

include($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)

pw_proto_library(my_protos
  SOURCES
    my_proto.proto
)

pw_add_library(my_lib
  SOURCES
    my_lib.cc
  PUBLIC_DEPS
    my_protos.pwpb
)

See pw_protobuf_compiler for more details.