diff --git a/.bazelrc b/.bazelrc index 9e4c0f91e..50a372e09 100644 --- a/.bazelrc +++ b/.bazelrc @@ -29,6 +29,10 @@ build:linux --features=layering_check build:linux --cxxopt='-std=c++2b' build:linux --cxxopt='-fno-rtti' +build:macos --features=layering_check +build:macos --cxxopt='-std=c++2b' +build:macos --cxxopt='-fno-rtti' + # Force DWARF-4 format for debug symbols for compatibility with valgrind. # See: https://bugs.kde.org/show_bug.cgi?id=452758 build:linux --copt='-gdwarf-4' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 37bc84698..96048c8b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -166,6 +166,16 @@ jobs: echo "
This is an example page.
" >example.html ./bazelisk run browser:tui file://$(pwd)/example.html + macos: + runs-on: macos-13 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + #- run: brew install icu4c + - run: brew --prefix + - run: find -L /usr/local/ -iname 'icu-config' + - run: export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"; export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH"; bazelisk test //net/... //type/... //uri/... //url/... //util/... //wasm/... + windows-msvc: runs-on: windows-2022 timeout-minutes: 40 diff --git a/WORKSPACE b/WORKSPACE index 7a40338de..3cfd52b00 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -60,7 +60,7 @@ http_archive( http_archive( name = "bazel_clang_tidy", # Hack to have every .h-header treated as C++. - patch_cmds = ["""sed -i '47i \\ args.add("-xc++")' clang_tidy/clang_tidy.bzl"""], + patch_cmds = ["""sed -i'' -e '47i\\\n args.add("-xc++")' clang_tidy/clang_tidy.bzl"""], sha256 = "e2721c47f4215ac36ad1da55ebdb968a094125dbc397aa7733f067001600b2ee", strip_prefix = "bazel_clang_tidy-133d89a6069ce253a92d32a93fdb7db9ef100e9d", url = "https://github.com/erenon/bazel_clang_tidy/archive/133d89a6069ce253a92d32a93fdb7db9ef100e9d.tar.gz", @@ -82,7 +82,7 @@ http_archive( # boringssl//:ssl cheats and pulls in private includes from boringssl//:crypto. http_archive( name = "boringssl", # OpenSSL + ISC - patch_cmds = ["""sed -i '33i package(features=["-layering_check"])' BUILD"""], + patch_cmds = ["""sed -i'' -e '33i\\\npackage(features=["-layering_check"])' BUILD"""], sha256 = "6369980cd79b3847a17a8e078dce37688671911a6fadb1c84e27fb505d827511", strip_prefix = "boringssl-22b3ea0c113b544e4334377541cabe8d8038d0c7", url = "https://github.com/google/boringssl/archive/22b3ea0c113b544e4334377541cabe8d8038d0c7.tar.gz", @@ -187,7 +187,7 @@ http_archive( # in MSVC debug builds with "cannot seek string_view iterator after end". # See: https://github.com/SFML/SFML/issues/2113 patch_cmds = [ - "sed -i 's/if (begin + trailingBytes < end)/if (trailingBytes < std::distance(begin, end))/' include/SFML/System/Utf.inl", + "sed -i'' -e 's/if (begin + trailingBytes < end)/if (trailingBytes < std::distance(begin, end))/' include/SFML/System/Utf.inl", ], sha256 = "6124b5fe3d96e7f681f587e2d5b456cd0ec460393dfe46691f1933d6bde0640b", strip_prefix = "SFML-2.5.1", diff --git a/net/BUILD b/net/BUILD index 655a58edf..a35aa1edc 100644 --- a/net/BUILD +++ b/net/BUILD @@ -7,6 +7,10 @@ NET_COPTS = HASTUR_COPTS + select({ "-Wno-shadow", "-Wno-unknown-pragmas", ], + "@platforms//os:macos": [ + "-Wno-shadow", + "-Wno-unknown-pragmas", + ], "//conditions:default": [], }) diff --git a/os/BUILD b/os/BUILD index e74e060ba..f85cf2d10 100644 --- a/os/BUILD +++ b/os/BUILD @@ -8,11 +8,13 @@ cc_library( OS_DEPS = select({ "@platforms//os:linux": [], + "@platforms//os:macos": [], "@platforms//os:windows": [":windows_setup"], }) OS_LOCAL_DEFINES = select({ "@platforms//os:linux": [], + "@platforms//os:macos": [], "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN"], }) @@ -20,12 +22,14 @@ cc_library( name = "memory", srcs = select({ "@platforms//os:linux": ["memory_linux.cpp"], + "@platforms//os:macos": ["memory_linux.cpp"], "@platforms//os:windows": ["memory_windows.cpp"], }), hdrs = ["memory.h"], copts = HASTUR_COPTS, linkopts = select({ "@platforms//os:linux": [], + "@platforms//os:macos": [], "@platforms//os:windows": [ "-DEFAULTLIB:Kernel32", ], @@ -50,12 +54,14 @@ cc_library( name = "system_info", srcs = select({ "@platforms//os:linux": ["system_info_linux.cpp"], + "@platforms//os:macos": ["system_info_linux.cpp"], "@platforms//os:windows": ["system_info_windows.cpp"], }), hdrs = ["system_info.h"], copts = HASTUR_COPTS, linkopts = select({ "@platforms//os:linux": [], + "@platforms//os:macos": [], "@platforms//os:windows": [ "-DEFAULTLIB:Shcore", "-DEFAULTLIB:User32", @@ -71,7 +77,10 @@ cc_test( size = "small", srcs = ["system_info_linux_test.cpp"], copts = HASTUR_COPTS, - target_compatible_with = ["@platforms//os:linux"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//os:macos", + ], deps = [ ":system_info", "//etest", @@ -82,12 +91,14 @@ cc_library( name = "xdg", srcs = select({ "@platforms//os:linux": ["xdg_linux.cpp"], + "@platforms//os:macos": ["xdg_linux.cpp"], "@platforms//os:windows": ["xdg_windows.cpp"], }), hdrs = ["xdg.h"], copts = HASTUR_COPTS, linkopts = select({ "@platforms//os:linux": [], + "@platforms//os:macos": [], "@platforms//os:windows": [ "-DEFAULTLIB:Shell32", "-DEFAULTLIB:Kernel32", @@ -115,7 +126,10 @@ cc_test( size = "small", srcs = ["xdg_linux_test.cpp"], copts = HASTUR_COPTS, - target_compatible_with = ["@platforms//os:linux"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//os:macos", + ], deps = [ ":xdg", "//etest", diff --git a/third_party/icu.BUILD b/third_party/icu.BUILD index 3531e7f35..9b9ee600f 100644 --- a/third_party/icu.BUILD +++ b/third_party/icu.BUILD @@ -65,10 +65,8 @@ cc_library( }), linkstatic = True, local_defines = ["U_TOOLUTIL_IMPLEMENTATION"] + select({ - "@platforms//os:windows": [], - "//conditions:default": [ - "U_ELF", - ], + "@platforms//os:linux": ["U_ELF"], + "//conditions:default": [], }), strip_include_prefix = "source/tools/toolutil", visibility = ["//visibility:private"], diff --git a/third_party/spdlog.BUILD b/third_party/spdlog.BUILD index 2bce3e98f..7f75abab3 100644 --- a/third_party/spdlog.BUILD +++ b/third_party/spdlog.BUILD @@ -15,6 +15,7 @@ cc_library( includes = ["include/"], linkopts = select({ "@platforms//os:linux": ["-lpthread"], + "@platforms//os:macos": ["-lpthread"], "@platforms//os:windows": [], }), strip_include_prefix = "include", diff --git a/type/BUILD b/type/BUILD index 6cc4b239f..eefaa9317 100644 --- a/type/BUILD +++ b/type/BUILD @@ -30,6 +30,7 @@ cc_test( SFML_TYPE_COPTS = HASTUR_COPTS + select({ # SFML leaks this into our code. "@platforms//os:linux": ["-Wno-implicit-fallthrough"], + "@platforms//os:macos": ["-Wno-implicit-fallthrough"], "//conditions:default": [], })