-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes clang-tidy compatible with HIP, adds an example for using external dependencies and fixes a few clang-tidy warnings.
- Loading branch information
1 parent
e19d31f
commit 70da306
Showing
14 changed files
with
74 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
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,15 @@ | ||
load("@rules_ll//ll:defs.bzl", "ll_binary") | ||
|
||
ll_binary( | ||
name = "external_dependency_example", | ||
srcs = ["main.cpp"], | ||
compile_flags = ["-std=c++2b"], | ||
# The include path, library search path and rpath are already set in | ||
# flake.nix and added to all targets in the workspace. This way we still | ||
# have a reproducible openssl despite it not being tracked by Bazel. | ||
# | ||
# If possible, try to avoid this pattern and write custom BUILD files for | ||
# external dependencies that are not too complicated to port to Bazel. | ||
link_flags = ["-lcrypto"], | ||
visibility = ["@//:__pkg__"], | ||
) |
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,26 @@ | ||
#include <openssl/sha.h> | ||
|
||
#include <array> | ||
#include <format> | ||
#include <iostream> | ||
|
||
auto main() -> int { | ||
constexpr auto kMessageSize = 5; | ||
std::array<unsigned char, kMessageSize> message = {'h', 'e', 'l', 'l', 'o'}; | ||
|
||
auto *hashed_message = SHA256(message.data(), message.size(), nullptr); | ||
|
||
std::array<std::byte, SHA256_DIGEST_LENGTH> output = {}; | ||
std::memcpy(output.data(), hashed_message, SHA256_DIGEST_LENGTH); | ||
|
||
std::cout << "Calculated:\t"; | ||
for (auto val : output) { | ||
std::cout << std::format("{:0>2x}", static_cast<int>(val)); | ||
} | ||
std::cout << "\n"; | ||
|
||
std::cout | ||
<< "Expected:\t" | ||
<< "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" | ||
<< std::endl; | ||
} |
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
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