xref: /aosp_15_r20/external/openthread/tests/fuzz/CMakeLists.txt (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1#
2#  Copyright (c) 2021, The OpenThread Authors.
3#  All rights reserved.
4#
5#  Redistribution and use in source and binary forms, with or without
6#  modification, are permitted provided that the following conditions are met:
7#  1. Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9#  2. Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#  3. Neither the name of the copyright holder nor the
13#     names of its contributors may be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26#  POSSIBILITY OF SUCH DAMAGE.
27#
28
29set(COMMON_INCLUDES
30    ${PROJECT_SOURCE_DIR}/include
31    ${PROJECT_SOURCE_DIR}/src/core
32)
33
34set(COMMON_COMPILE_OPTIONS
35    -DOPENTHREAD_FTD=1
36    -DOPENTHREAD_MTD=0
37    -DOPENTHREAD_RADIO=0
38    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1
39)
40
41set(COMMON_SOURCES
42    fuzzer_platform.cpp
43)
44
45set(COMMON_LIBS
46    openthread-ftd
47    ${OT_MBEDTLS}
48    $ENV{LIB_FUZZING_ENGINE}
49    ot-config
50)
51
52add_executable(ot-cli-received-fuzzer
53    cli_received.cpp
54    ${COMMON_SOURCES}
55)
56
57target_compile_options(ot-cli-received-fuzzer
58    PRIVATE
59        ${COMMON_COMPILE_OPTIONS}
60)
61
62target_include_directories(ot-cli-received-fuzzer
63    PRIVATE
64        ${COMMON_INCLUDES}
65)
66
67target_link_libraries(ot-cli-received-fuzzer
68    PRIVATE
69        openthread-cli-ftd
70        ${COMMON_LIBS}
71)
72
73add_executable(ot-ip6-send-fuzzer
74    ip6_send.cpp
75    ${COMMON_SOURCES}
76)
77
78target_compile_options(ot-ip6-send-fuzzer
79    PRIVATE
80        ${COMMON_COMPILE_OPTIONS}
81)
82
83target_include_directories(ot-ip6-send-fuzzer
84    PRIVATE
85        ${COMMON_INCLUDES}
86)
87
88target_link_libraries(ot-ip6-send-fuzzer
89    PRIVATE
90        ${COMMON_LIBS}
91)
92
93add_executable(ot-radio-receive-done-fuzzer
94    radio_receive_done.cpp
95    ${COMMON_SOURCES}
96)
97
98target_compile_options(ot-radio-receive-done-fuzzer
99    PRIVATE
100        ${COMMON_COMPILE_OPTIONS}
101)
102
103target_include_directories(ot-radio-receive-done-fuzzer
104    PRIVATE
105        ${COMMON_INCLUDES}
106)
107
108target_link_libraries(ot-radio-receive-done-fuzzer
109    PRIVATE
110        ${COMMON_LIBS}
111)
112
113add_executable(ot-ncp-hdlc-received-fuzzer
114    ncp_hdlc_received.cpp
115    ${COMMON_SOURCES}
116)
117
118target_compile_options(ot-ncp-hdlc-received-fuzzer
119    PRIVATE
120        ${COMMON_COMPILE_OPTIONS}
121)
122
123target_include_directories(ot-ncp-hdlc-received-fuzzer
124    PRIVATE
125        ${COMMON_INCLUDES}
126)
127
128target_link_libraries(ot-ncp-hdlc-received-fuzzer
129    PRIVATE
130        openthread-ncp-ftd
131        ${COMMON_LIBS}
132)
133