xref: /aosp_15_r20/external/pigweed/third_party/emboss/CMakeLists.txt (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16include($ENV{PW_ROOT}/third_party/emboss/emboss.cmake)
17
18# Hardcoding overrides to use pw_assert. This could potentially be done in a
19# more clever way.
20pw_add_library(pw_third_party.emboss.config_assert INTERFACE
21  PUBLIC_DEPS
22    pw_assert.assert
23  PUBLIC_DEFINES
24    EMBOSS_CHECK=PW_DASSERT
25    EMBOSS_CHECK_ABORTS
26    EMBOSS_DCHECK=PW_DASSERT
27    EMBOSS_DCHECK_ABORTS
28  PUBLIC_COMPILE_OPTIONS
29    -include pw_assert/assert.h
30)
31
32pw_add_library(pw_third_party.emboss._disable_warnings INTERFACE
33  PUBLIC_COMPILE_OPTIONS
34    -Wno-unused-parameter
35    $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
36)
37
38set(dir_pw_third_party_emboss "" CACHE PATH "Path to the emboss installation.")
39
40if("${dir_pw_third_party_emboss}" STREQUAL "")
41  pw_add_error_target(pw_third_party.emboss
42    MESSAGE
43    "Attempted to use emboss without configuring it, see "
44    "pigweed.dev/third_party/emboss/"
45  )
46  return()
47endif()
48
49pw_add_library(pw_third_party.emboss.cpp_utils INTERFACE
50  HEADERS
51    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic.h
52    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic_all_known_generated.h
53    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic_maximum_operation_generated.h
54    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_array_view.h
55    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_bit_util.h
56    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_constant_view.h
57    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_cpp_types.h
58    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_cpp_util.h
59    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_defines.h
60    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_enum_view.h
61    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_maybe.h
62    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_memory_util.h
63    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_prelude.h
64    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_text_util.h
65    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_view_parameters.h
66  PUBLIC_INCLUDES
67    ${dir_pw_third_party_emboss}
68  PUBLIC_DEPS
69    pw_third_party.emboss.config_assert
70    pw_third_party.emboss._disable_warnings
71)
72