Skip to content

Adding bazelmod #1009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sebastianbergt
Copy link

@sebastianbergt sebastianbergt commented Mar 12, 2025

Hi,

would you accept a bazel module in your code?
I am trying to add CrowCpp to bazel registry and hence did the work anyway.
Also, if you are interested, I can add the test to the bazel build.

@gittiver gittiver marked this pull request as draft March 13, 2025 07:46
@gittiver
Copy link
Member

gittiver commented Mar 13, 2025

bazel build does not work on macOs, I put it back into draft.

MODULE.bazel Outdated
@@ -0,0 +1,2 @@
module(name = "crowcpp", version = "1.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current version is 1.2.1.2 (version is set on branch only)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it. Thank you for noticing!

@@ -0,0 +1,60 @@
name: Build and test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you prefix the name with "bazel - "

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not work on some systems.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping bazelisk local now.

BUILD.bazel Outdated
hdrs = glob(["include/**/*"]),
includes = ["include"],
visibility = ["//visibility:public"],
copts = ["-DCROW_ENABLE_SSL"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crow supports the following options:

option(CROW_BUILD_EXAMPLES "Build the examples in the project" ${CROW_IS_MAIN_PROJECT})
option(CROW_BUILD_TESTS "Build the tests in the project" ${CROW_IS_MAIN_PROJECT})
option(CROW_BUILD_FUZZER "Instrument and build Crow fuzzer" OFF)
option(CROW_AMALGAMATE "Combine all headers into one" OFF)
option(CROW_INSTALL "Add install step for Crow" ON )
option(CROW_USE_BOOST "Use Boost.Asio for Crow" OFF)
option( CROW_RETURNS_OK_ON_HTTP_OPTIONS_REQUEST
"Returns HTTP status code OK (200) instead of 204 for OPTIONS request"
OFF )

option(CROW_ENABLE_SSL "Enable Crow's SSL feature for supporting https" OFF)
option(CROW_ENABLE_COMPRESSION "Enable Crow's Compression feature for supporting compressed http content" OFF)

I would at least set CROW_ENABLE_COMPRESSION too.

Copy link
Author

@sebastianbergt sebastianbergt Mar 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added proper options for CROW_ENABLE_SSL and using it with standalone asio.
Also added CROW_ENABLE_COMPRESSION with zlib support.

All dependencies are pulled from the bazel registry.
Not supporting CROW_USE_BOOST for now.

Can support try to enable more and more options in the future.

@sebastianbergt
Copy link
Author

sebastianbergt commented Mar 29, 2025

bazel build does not work on macOs, I put it back into draft.

Thank you for the quick review and detailled feedback :)

@sebastianbergt sebastianbergt requested a review from gittiver March 29, 2025 08:38
@gittiver
Copy link
Member

There is a problem on macOS.

Copy link
Member

@gittiver gittiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set back to Draft as it does not build on MacOS 13

@sebastianbergt
Copy link
Author

set back to Draft as it does not build on MacOS 13

Hei @gittiver
sorry for the delay. I sadly had to remove mac-os from the list of tested systems,
since dependencies are not compiling on it.

@sebastianbergt sebastianbergt marked this pull request as ready for review May 22, 2025 09:48
@sebastianbergt sebastianbergt requested a review from gittiver May 22, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants