-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathBuildDependencies.cmake
More file actions
155 lines (131 loc) · 4.12 KB
/
BuildDependencies.cmake
File metadata and controls
155 lines (131 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.19)
include(FetchContent)
set(absl_URL https://github.com/abseil/abseil-cpp.git)
set(absl_TAG d04b964d82ed5146f7e5e34701a5ba69f9514c9a)
set(re2_URL https://github.com/google/re2.git)
set(re2_TAG 2024-07-02)
set(gtest_URL https://github.com/google/googletest.git)
set(gtest_TAG v1.16.0)
# From https://www.antlr.org/download.html
set(antlr_cpp_URL https://www.antlr.org/download/antlr4-cpp-runtime-4.12.0-source.zip)
set(antlr_cpp_MD5 acf7371bd7562188712751266d8a7b90)
set(proto_URL https://github.com/protocolbuffers/protobuf.git)
set(proto_TAG v30.2)
set(nlohmann_json_URL https://github.com/nlohmann/json.git)
set(nlohmann_json_TAG v3.11.3)
set(flatbuffers_URL https://github.com/google/flatbuffers.git)
set(flatbuffers_TAG v25.2.10)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
endif()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_ABSL)
FetchContent_Declare(
abseil-cpp
GIT_REPOSITORY ${absl_URL}
GIT_TAG ${absl_TAG}
)
else()
find_package(absl REQUIRED)
endif()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_RE2)
FetchContent_Declare(
re2
GIT_REPOSITORY ${re2_URL}
GIT_TAG ${re2_TAG}
)
else()
find_package(re2 REQUIRED)
endif()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_GTEST)
FetchContent_Declare(
googletest
GIT_REPOSITORY ${gtest_URL}
GIT_TAG ${gtest_TAG}
)
else()
find_package(GTest REQUIRED)
endif()
FetchContent_Declare(
antlr_cpp
URL ${antlr_cpp_URL}
URL_HASH MD5=${antlr_cpp_MD5}
)
if (FUZZTEST_BUILD_FLATBUFFERS)
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_FLATBUFFERS)
FetchContent_Declare(
flatbuffers
GIT_REPOSITORY ${flatbuffers_URL}
GIT_TAG ${flatbuffers_TAG}
)
else()
find_package(flatbuffers REQUIRED)
endif()
endif()
if (FUZZTEST_BUILD_TESTING)
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_PROTOBUF)
FetchContent_Declare(
protobuf
GIT_REPOSITORY ${proto_URL}
GIT_TAG ${proto_TAG}
)
else()
find_package(Protobuf REQUIRED)
if(TARGET Protobuf::protobuf AND NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf ALIAS Protobuf::protobuf)
endif()
endif ()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_NLOHMANN)
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY ${nlohmann_json_URL}
GIT_TAG ${nlohmann_json_TAG}
)
else()
find_package(nlohmann_json REQUIRED)
endif()
endif ()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES)
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_ENABLE_INSTALL ON)
FetchContent_MakeAvailable(abseil-cpp)
endif()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_RE2)
set(RE2_BUILD_TESTING OFF)
FetchContent_MakeAvailable(re2)
endif ()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_ABSL)
set(GTEST_HAS_ABSL ON)
FetchContent_MakeAvailable(googletest)
endif()
FetchContent_MakeAvailable(antlr_cpp)
if (FUZZTEST_BUILD_TESTING)
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_PROTOBUF)
set(protobuf_BUILD_TESTS OFF)
set(protobuf_INSTALL OFF)
FetchContent_MakeAvailable(protobuf)
endif()
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_NLOHMANN)
FetchContent_MakeAvailable(nlohmann_json)
endif()
endif ()
if (FUZZTEST_BUILD_FLATBUFFERS)
if(FUZZTEST_DOWNLOAD_DEPENDENCIES OR FUZZTEST_DOWNLOAD_FLATBUFFERS)
set(FLATBUFFERS_BUILD_TESTS OFF)
set(FLATBUFFERS_BUILD_INSTALL OFF)
FetchContent_MakeAvailable(flatbuffers)
endif()
endif()