Skip to content

Commit

Permalink
third_party/emboss: Configure EMBOSS_CHECK define to use PW_DCHECK
Browse files Browse the repository at this point in the history
Add pw_third_party_emboss_CONFIG GN variable that is used to configure
Emboss defines.

Configure Emboss to use PW_DCHECK for checks by default.

Add Emboss docs to //docs:third_party_docs.

Change-Id: If9af2140641a2f0f25fad77c9ac01b1f6f8c3d6e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/133565
Reviewed-by: Chad Norvell <[email protected]>
Commit-Queue: Ben Lawson <[email protected]>
  • Loading branch information
BenjaminLawson authored and CQ Bot Account committed Mar 11, 2023
1 parent 7485834 commit ae1a41e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 13 additions & 0 deletions third_party/emboss/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 14 additions & 2 deletions third_party/emboss/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ 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
``default_args`` of your project's ``.gn`` file:

.. 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
<https://github.com/google/emboss/blob/master/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
Expand Down
6 changes: 6 additions & 0 deletions third_party/emboss/emboss.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit ae1a41e

Please sign in to comment.