forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump protobuf version and add Abseil as compiler dependency. (p4lang#…
…4463) * Bump protobuf version. Fix some missed dependencies here and there * Grab abseil using FetchContent * Disable unity builds for Abseil * Try to bumpprotobuf version in bazel * Pull abseil * Address review comments * Fix UB in json parser that remained from GMP times * Ensure sanitizer options are propagated down to dependencies (protobuf, abseil, etc.) * Some readme refines * See if we can workaround ubsan + int128 bug * Clarify ubsan issue workaround * Fix typo in README.md Co-authored-by: Vladimír Štill <[email protected]> --------- Co-authored-by: Vladimír Štill <[email protected]>
- Loading branch information
Showing
10 changed files
with
121 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
macro(p4c_obtain_abseil) | ||
option( | ||
P4C_USE_PREINSTALLED_ABSEIL | ||
"Look for a preinstalled version of Abseil in the system instead of installing the library using FetchContent." | ||
OFF | ||
) | ||
|
||
# If P4C_USE_PREINSTALLED_ABSEIL is ON just try to find a preinstalled version of Abseil. | ||
if(P4C_USE_PREINSTALLED_ABSEIL) | ||
if(ENABLE_ABSEIL_STATIC) | ||
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a) | ||
endif() | ||
|
||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) | ||
find_package(absl REQUIRED) | ||
|
||
if(ENABLE_ABSEIL_STATIC) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}) | ||
endif() | ||
else() | ||
set(P4C_ABSEIL_VERSION "20240116.1") | ||
message("Fetching Abseil version ${P4C_ABSEIL_VERSION} for P4C...") | ||
|
||
# Unity builds do not work for Abseil... | ||
set(CMAKE_UNITY_BUILD_PREV ${CMAKE_UNITY_BUILD}) | ||
set(CMAKE_UNITY_BUILD OFF) | ||
|
||
# Print out download state while setting up Abseil. | ||
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET}) | ||
set(FETCHCONTENT_QUIET OFF) | ||
|
||
set(ABSL_USE_EXTERNAL_GOOGLETEST ON) | ||
set(ABSL_FIND_GOOGLETEST OFF) | ||
set(ABSL_BUILD_TESTING OFF) | ||
set(ABSL_ENABLE_INSTALL OFF) | ||
set(ABSL_USE_SYSTEM_INCLUDES ON) | ||
set(ABSL_PROPAGATE_CXX_STD ON) | ||
|
||
FetchContent_Declare( | ||
abseil | ||
URL https://github.com/abseil/abseil-cpp/releases/download/${P4C_ABSEIL_VERSION}/abseil-cpp-${P4C_ABSEIL_VERSION}.tar.gz | ||
URL_HASH SHA256=3c743204df78366ad2eaf236d6631d83f6bc928d1705dd0000b872e53b73dc6a | ||
USES_TERMINAL_DOWNLOAD TRUE | ||
GIT_PROGRESS TRUE | ||
) | ||
fetchcontent_makeavailable_but_exclude_install(abseil) | ||
|
||
# Reset temporary variable modifications. | ||
set(CMAKE_UNITY_BUILD ${CMAKE_UNITY_BUILD_PREV}) | ||
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV}) | ||
endif() | ||
|
||
message("Done with setting up Abseil for P4C.") | ||
endmacro(p4c_obtain_abseil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters