Skip to content

Commit

Permalink
Fix "websocketpp" on Mac OS X. (#2370)
Browse files Browse the repository at this point in the history
This change fixes the build on Mac OS X. According to the original
CMakeLists.txt, "rt" is not linked on Mac OS X.

        if (NOT APPLE)
            set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
        else()
            set (WEBSOCKETPP_PLATFORM_LIBS pthread)
        endif()
  • Loading branch information
BYVoid committed Jul 11, 2024
1 parent f1ec7c3 commit b177f3e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
9 changes: 9 additions & 0 deletions modules/websocketpp/0.8.2.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module(
name = "websocketpp",
version = "0.8.2.bcr.1",
compatibility_level = 1,
)
bazel_dep(name = "asio", version = "1.28.2")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "zlib", version = "1.3")
bazel_dep(name = "platforms", version = "0.0.10")
28 changes: 28 additions & 0 deletions modules/websocketpp/0.8.2.bcr.1/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- /dev/null
+++ BUILD.bazel
@@ -0,0 +1,25 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "websocketpp",
+ hdrs = glob(["websocketpp/**/*.hpp"]),
+ defines = [
+ "ASIO_STANDALONE",
+ "_WEBSOCKETPP_CPP11_STL_",
+ ],
+ includes = ["."],
+ linkopts = select({
+ "@platforms//os:osx": [
+ "-lpthread",
+ ],
+ "//conditions:default": [
+ "-lpthread",
+ "-lrt",
+ ],
+ }),
+ visibility = ["//visibility:public"],
+ deps = [
+ "@asio",
+ "@zlib",
+ ],
+)
12 changes: 12 additions & 0 deletions modules/websocketpp/0.8.2.bcr.1/patches/module_dot_bazel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- /dev/null
+++ MODULE.bazel
@@ -0,0 +1,9 @@
+module(
+ name = "websocketpp",
+ version = "0.8.2.bcr.1",
+ compatibility_level = 1,
+)
+bazel_dep(name = "asio", version = "1.28.2")
+bazel_dep(name = "rules_cc", version = "0.0.9")
+bazel_dep(name = "zlib", version = "1.3")
+bazel_dep(name = "platforms", version = "0.0.10")
14 changes: 14 additions & 0 deletions modules/websocketpp/0.8.2.bcr.1/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos
- macos_arm64
bazel: [6.x, 7.x]
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- "@websocketpp"
10 changes: 10 additions & 0 deletions modules/websocketpp/0.8.2.bcr.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://github.com/zaphoyd/websocketpp/archive/refs/tags/0.8.2.tar.gz",
"integrity": "sha256-bOiJ2F7Nwtj6B0CNZ4fnNSUQdQ2qZrWtRKrLR76nZ1U=",
"strip_prefix": "websocketpp-0.8.2",
"patches": {
"add_build_file.patch": "sha256-95DACIWxqhjix5VgVssEYee5pjCnf/QWL04mQJwQ2uM=",
"module_dot_bazel.patch": "sha256-h9esq/BSgla/GaK2cdr7QK71dXvYWj64udsLV06S180="
},
"patch_strip": 0
}
3 changes: 2 additions & 1 deletion modules/websocketpp/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"github:zaphoyd/websocketpp"
],
"versions": [
"0.8.2"
"0.8.2",
"0.8.2.bcr.1"
],
"yanked_versions": {}
}

0 comments on commit b177f3e

Please sign in to comment.