diff --git a/docs/BUILD.gn b/docs/BUILD.gn index c28ffc4e0d..6ad6ebfc4f 100644 --- a/docs/BUILD.gn +++ b/docs/BUILD.gn @@ -99,6 +99,7 @@ group("module_docs") { group("third_party_docs") { deps = [ "$dir_pigweed/third_party/boringssl:docs", + "$dir_pigweed/third_party/emboss:docs", "$dir_pigweed/third_party/freertos:docs", "$dir_pigweed/third_party/fuchsia:docs", "$dir_pigweed/third_party/googletest:docs", diff --git a/third_party/emboss/BUILD.gn b/third_party/emboss/BUILD.gn index 89df5c4239..a0ef87dda1 100644 --- a/third_party/emboss/BUILD.gn +++ b/third_party/emboss/BUILD.gn @@ -18,7 +18,20 @@ import("$dir_pw_build/python.gni") import("$dir_pw_docgen/docs.gni") import("$dir_pw_third_party/emboss/emboss.gni") +config("default_config") { + # EMBOSS_DCHECK is used as an assert() for logic embedded in Emboss, where + # EMBOSS_CHECK is used to check preconditions on application logic (e.g. + # Write() checks the [requires: ...] attribute). + defines = [ + "EMBOSS_CHECK=PW_DCHECK", + "EMBOSS_CHECK_ABORTS", + "EMBOSS_DCHECK=PW_DCHECK", + "EMBOSS_DCHECK_ABORTS", + ] +} + source_set("cpp_utils") { + public_configs = [ pw_third_party_emboss_CONFIG ] sources = [ "$dir_pw_third_party_emboss/runtime/cpp/emboss_arithmetic.h", "$dir_pw_third_party_emboss/runtime/cpp/emboss_arithmetic_all_known_generated.h", diff --git a/third_party/emboss/docs.rst b/third_party/emboss/docs.rst index 59ab754087..1cabc8aaeb 100644 --- a/third_party/emboss/docs.rst +++ b/third_party/emboss/docs.rst @@ -18,7 +18,7 @@ Git submodule: .. code-block:: sh - git submodule add https://github.com/google/emboss.git third_party/emboss/src + git submodule add https://github.com/google/emboss.git third_party/emboss/src Next, set the GN variable ``dir_pw_third_party_emboss`` to the path of your Emboss installation. If using the submodule path from above, add the following to the @@ -26,7 +26,19 @@ installation. If using the submodule path from above, add the following to the .. code-block:: - dir_pw_third_party_emboss = "//third_party/emboss/src" + dir_pw_third_party_emboss = "//third_party/emboss/src" + +.. + inclusive-language: disable + +Optionally, configure the Emboss defines documented at +`dir_pw_third_party_emboss/runtime/cpp/emboss_defines.h +`_ +by setting the ``pw_third_party_emboss_CONFIG`` variable to a config that +overrides the defines. By default, checks will use PW_DCHECK. + +.. + inclusive-language: enable ------------ Using Emboss diff --git a/third_party/emboss/emboss.gni b/third_party/emboss/emboss.gni index 4f90627922..93d8396d7c 100644 --- a/third_party/emboss/emboss.gni +++ b/third_party/emboss/emboss.gni @@ -12,8 +12,14 @@ # License for the specific language governing permissions and limitations under # the License. +import("//build_overrides/pigweed.gni") + declare_args() { # If compiling with Emboss, this variable is set to the path to the Emboss # source code. dir_pw_third_party_emboss = "" + + # config target for overriding Emboss defines (e.g. EMBOSS_CHECK). + pw_third_party_emboss_CONFIG = + "$dir_pigweed/third_party/emboss:default_config" }