keeping bazel local and adding options for compression and ssl

This commit is contained in:
Sebastian Bergt
2025-03-29 09:32:10 +01:00
committed by gittiver
parent a70f4f265c
commit 6eb561bd50
3 changed files with 50 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
name: Build and test
name: bazel - Build and test
on:
push:
@@ -35,7 +35,6 @@ jobs:
if [ "$RUNNER_OS" == "Linux" ]; then
curl --tlsv1.2 --proto =https -Lo bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64
chmod +x bazel
sudo mv bazel /usr/bin/
sudo apt-get update && \
sudo apt-get install -yq \
@@ -45,7 +44,6 @@ jobs:
elif [ "$RUNNER_OS" == "macOS" ]; then
curl --tlsv1.2 --proto =https -Lo bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-darwin-amd64
chmod +x bazel
sudo mv bazel /usr/bin/
brew install asio openssl zlib
else
@@ -55,6 +53,6 @@ jobs:
shell: bash
- name: Build bazel
run: bazel build //...
run: ./bazel build //...

View File

@@ -1,7 +1,48 @@
package(default_visibility = ["//visibility:public"])
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
bool_flag(
name = "ssl_enabled_flag",
build_setting_default = True,
visibility = ["//visibility:public"],
)
config_setting(
name = "ssl_enabled",
flag_values = {
"//:ssl_enabled_flag": "True",
},
)
bool_flag(
name = "compression_enabled_flag",
build_setting_default = True,
visibility = ["//visibility:public"],
)
config_setting(
name = "compression_enabled",
flag_values = {
"//:compression_enabled_flag": "True",
},
)
cc_library(
name = "crow",
hdrs = glob(["include/**/*"]),
includes = ["include"],
visibility = ["//visibility:public"],
copts = ["-DCROW_ENABLE_SSL"]
copts = select({
":ssl_enabled": ["-DASIO_STANDALONE", "-DCROW_ENABLE_SSL"],
"//conditions:default": [],
}) + select({
":compression_enabled": ["-DCROW_ENABLE_COMPRESSION"],
"//conditions:default": [],
}),
deps = select({
":ssl_enabled": ["@asio//:asio"],
"//conditions:default": [],
}) + select({
":compression_enabled": ["@zlib//:zlib"],
"//conditions:default": [],
}),
)

View File

@@ -1,2 +1,6 @@
module(name = "crowcpp", version = "1.0")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
bazel_dep(name = "asio", version = "1.32.0")