Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4a1e70c
build(msvc): RED: pin /W4 and no /WX in link options (#2626)
zackees Oct 27, 2026
59752e5
build(msvc): compile at /W4 and drop the dead /WX link option (#2626)
zackees Oct 27, 2026
993a2e8
build(msvc): exempt the vendored deps from the /W4-only warnings (#2626)
zackees Oct 27, 2026
9d28ea4
build(msvc): extend the vendored /W4 exemptions to C4701-C4703 (#2626)
zackees Oct 27, 2026
e767cd7
build(msvc): fix the first-party libobs /W4 findings at the site (#2626)
zackees Oct 27, 2026
7010b93
build(msvc): name the graphics-hook unions and rename the hidden para…
zackees Oct 27, 2026
4a99011
build(msvc): fix the DbgHelp unions and the crash-handler /W4 finding…
zackees Oct 27, 2026
e303806
build(msvc): fix the next libobs /W4 findings (#2626)
zackees Oct 27, 2026
1ad5438
build(msvc): zero-init the pending audio actions (#2626)
zackees Oct 27, 2026
e81b0f2
build(msvc): keep crate names out of the C4702 exemption comment (#2626)
zackees Oct 27, 2026
27bc7bd
build(msvc): zero-init the proc call copy (#2626)
zackees Oct 27, 2026
15fd4fa
build(msvc): apply the C4702 uthash exemption to every C target (#2626)
zackees Oct 28, 2026
d74d575
build(msvc): exempt vendored libnsgif from C4701/C4703 (#2626)
zackees Oct 28, 2026
b8e8173
build(msvc): apply gersemi formatting to the libobs CMake exemption (…
zackees Oct 28, 2026
29a0ad8
build(msvc): initialize libnsgif's decompressed pointer (#2626)
zackees Oct 28, 2026
c4af002
build(msvc): load RtlGetVersion through a union (#2626)
zackees Oct 28, 2026
a0123af
build(msvc): exempt the C tests from the /W4-only classes (#2626)
zackees Oct 28, 2026
062028a
build(msvc): fix the next first-party /W4 findings at the site (#2626)
zackees Oct 28, 2026
320b618
build(msvc): clear the wave 4 /W4 findings in obs-outputs and the tests
zackees Oct 28, 2026
885f56a
build(msvc): fix the wave 5 /W4 findings in libobs-opengl and libobs-…
zackees Oct 28, 2026
35c6deb
fix(msvc): fix the /W4 findings the Windows app lane reports in the p…
zackees Oct 28, 2026
7902584
test(msvc): require the product C++ targets to carry the C4201 exempt…
zackees Oct 28, 2026
c03d89c
build(msvc): exempt C4201 per product C++ target and pin the app-lane…
zackees Oct 28, 2026
482a858
test(msvc): pin the C4201 helper as a no-op without a target (#2626)
zackees Oct 28, 2026
7c72f5c
build(msvc): make the C4201 helper a no-op when the module is disable…
zackees Oct 28, 2026
b4f71c6
fix(msvc): write the graphics-hook C4201 exemption inline (#2626)
zackees Oct 28, 2026
67a2092
fix(msvc): clear the wave 7 /W4 findings from the Windows app lane (#…
zackees Oct 28, 2026
78003eb
test(msvc): pin the submodule pointers that carry the wave 6-7 /W4 re…
zackees Oct 28, 2026
7c05aeb
build(msvc): bump the submodules to the wave 6-7 /W4 renames (#2626)
zackees Oct 28, 2026
43b5dc9
fix(msvc): clear the wave 8 /W4 findings from the Windows app lane (#…
zackees Oct 28, 2026
00fbdc3
fix(msvc): clear the wave 9 first-party /W4 findings (#2626)
zackees Oct 28, 2026
fbd3fe2
test(msvc): pin the submodule pointers that carry the wave 9 /W4 rena…
zackees Oct 28, 2026
f6b484b
build(msvc): bump the submodules to the wave 9 /W4 renames (#2626)
zackees Oct 28, 2026
06e3aa6
fix(msvc): clear the wave 10 win-capture C4457 findings (#2626)
zackees Oct 28, 2026
c4e0e63
test(msvc): pin the obs-browser pointer at the panel renames (#2626)
zackees Oct 28, 2026
c5d5fea
build(msvc): bump obs-browser to the panel renames (#2626)
zackees Oct 28, 2026
575be38
build(msvc): exempt the /W4 findings left in the vendored deps (#2626)
zackees Oct 28, 2026
ceaaced
build(msvc): clear the wave 11 /W4 findings in the vendored trees (#2…
zackees Oct 28, 2026
376b99c
fix(msvc): give the disabled module a provably-set declaration (#2626)
zackees Oct 28, 2026
5909af1
build(msvc): exempt ElgatoUVCDevice's C4244 at /W4 (#2626)
zackees Oct 28, 2026
01227c5
build(msvc): exempt librtmp md5's C4244 and win-dshow's C4201 at /W4 …
zackees Oct 28, 2026
65caeac
build(msvc): clear the wave 14 /W4 findings in the hardware test tool…
zackees Oct 28, 2026
b7f6d9a
build(msvc): exempt obs-browser's dead static at /W4 (#2626)
zackees Oct 28, 2026
e12f74d
build(msvc): name the adapter print binding after the caps, not the a…
zackees Oct 28, 2026
9349045
build(msvc): clear the wave 16 /W4 findings in the Qt frontend (#2626)
zackees Oct 28, 2026
64b29f3
build(msvc): name the properties undo/redo blob after its content, no…
zackees Oct 28, 2026
3ecc3dc
build(msvc): name the importer locals after what they hold (#2626)
zackees Oct 28, 2026
fd967f7
build(msvc): name the settings locals and handler params after their …
zackees Oct 28, 2026
6f3ff51
build(msvc): name the frontend utility locals after what they hold (#…
zackees Oct 28, 2026
3795bc7
build(msvc): name the thumbnail and simple-output locals after their …
zackees Oct 28, 2026
f21914b
build(msvc): keep the member streamOutput in UpdateRecording (#2626)
zackees Oct 28, 2026
d8ad44d
build(msvc): name the widget-layer locals after what they hold (#2626)
zackees Oct 28, 2026
39cf1a8
build(msvc): name the hotkey and undo params at their declarations (#…
zackees Oct 29, 2026
074c9d4
build(msvc): name the transition, studio-mode and projector locals (#…
zackees Oct 29, 2026
852bcb1
build(msvc): lead HandleFindData with its over-aligned member (#2626)
zackees Oct 29, 2026
d3feb20
build(msvc): initialize the popup menu's source and flags (#2626)
zackees Oct 29, 2026
f9d5a62
fix(shared): spell the address length conversion in the socket platfo…
zackees Oct 29, 2026
6f62d60
build(msvc): name the wizard and app locals after what they hold (#2626)
zackees Oct 29, 2026
dea368f
build(msvc): make ParseMath's variable type chain exhaustive (#2626)
zackees Oct 29, 2026
bdfd01c
build(msvc): drop the unused path and cast the detour hook (#2626)
zackees Oct 29, 2026
99cca6c
build(msvc): copy the detour hook address through a union, not a cast
zackees Oct 29, 2026
9998693
build(msvc): rename Multiview::Update's parameters off the members (#…
zackees Oct 29, 2026
7793515
build(msvc): rename the audio-control parameters that shadow their me…
zackees Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions ci/test_browser_submodule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env -S uv run --script
"""plugins/obs-browser must point at a commit that carries the /W4 shadowing fixes.

uv run python -m unittest ci/test_browser_submodule.py

The MSVC ``/W4`` ratchet (#2626) reports ``browser-app.cpp``'s shadowing locals in
the app build, which no PR path compiles. Those two fixes live in the submodule
(obs-rust/obs-browser#15), so the product build only becomes clean once this
checkout's pointer is at that commit or a descendant of it. A pointer that moves
back to an older submodule commit silently reintroduces the C4456/C4457 findings.
"""

from __future__ import annotations

import subprocess
import unittest
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
SUBMODULE = "plugins/obs-browser"
# obs-rust/obs-browser#15: rename the browser-app locals that hide a parameter
# and a local (C4457 `frame`, C4456 `args`) for obs-studio#2626.
WARNING_SHADOWING_FIX = "b9c5db137711717bc02cdd265801ad26f270bd66"
# obs-rust/obs-browser#16: rename browser-client.cpp's shadowing `name` (C4456) and
# `channels` (C4458) locals, found in the same app-lane build.
WARNING_SHADOWING_FIX_CLIENT = "96e724b2c948c8500a263320520f971f3f6565c2"
# obs-rust/obs-browser#17: rename the panel locals that hide a class member
# (C4458 `script` in browser-panel-client.cpp, `url` in browser-panel.cpp).
WARNING_SHADOWING_FIX_PANEL = "463e16b468ba607dfea2cc8bfcc1a0204b441ed3"


def git(*args: str, cwd: Path = ROOT) -> subprocess.CompletedProcess:
return subprocess.run(["git", *args], cwd=cwd, capture_output=True, text=True, check=False)


class BrowserSubmoduleTest(unittest.TestCase):
def _assert_pointer_at_least(self, commit: str, what: str) -> None:
tree = git("ls-tree", "HEAD", SUBMODULE).stdout.split()
self.assertEqual(tree[:2], ["160000", "commit"], f"{SUBMODULE} is not a submodule")
pointer = tree[2]
if pointer == commit:
return
sub = ROOT / SUBMODULE
if not (sub / ".git").exists():
self.skipTest(f"{SUBMODULE} is not checked out; cannot check ancestry of {pointer}")
has = git("merge-base", "--is-ancestor", commit, pointer, cwd=sub)
if has.returncode != 0:
known = git("cat-file", "-e", f"{commit}^{{commit}}", cwd=sub).returncode == 0
shallow = git("rev-parse", "--is-shallow-repository", cwd=sub).stdout.strip() == "true"
if not known and shallow:
# A shallow checkout may stop above the fix, so a miss here proves nothing.
self.skipTest(f"{SUBMODULE} history is shallow; cannot check ancestry of {pointer[:9]}")
self.assertEqual(
has.returncode,
0,
f"{SUBMODULE} points at {pointer[:9]}, which lacks {what} ({commit[:9]})",
)

def test_pointer_keeps_the_browser_app_renames(self) -> None:
self._assert_pointer_at_least(WARNING_SHADOWING_FIX, "the browser-app shadowing renames (#15)")

def test_pointer_keeps_the_browser_client_renames(self) -> None:
self._assert_pointer_at_least(WARNING_SHADOWING_FIX_CLIENT, "the browser-client shadowing renames (#16)")

def test_pointer_keeps_the_panel_renames(self) -> None:
self._assert_pointer_at_least(WARNING_SHADOWING_FIX_PANEL, "the panel shadowing renames (#17)")


if __name__ == "__main__":
unittest.main()
189 changes: 189 additions & 0 deletions ci/test_msvc_warning_level.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
#!/usr/bin/env -S uv run --script
"""The MSVC build compiles at /W4 and does not hand /WX to the linker (#2626).

uv run python -m unittest ci/test_msvc_warning_level.py

`/WX` is not a compile flag this file sets: `CMAKE_COMPILE_WARNING_AS_ERROR`
in `cmake/common/compiler_common.cmake` makes CMake pass it to `cl.exe`
(#516). The `add_link_options(/WX)` block was dead — `link.exe` ignores
`/WX` — so it is gone and only the compile-time setting carries the intent.
The warning level itself is `/W4`, the strictest level `cl.exe` has.
"""

from __future__ import annotations

import re
import unittest
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
WINDOWS = ROOT / "cmake" / "windows" / "compilerconfig.cmake"
COMMON = ROOT / "cmake" / "common" / "compiler_common.cmake"


def call_tokens(text: str, name: str) -> list[str]:
"""Every whitespace-separated argument of each `name(...)` call."""
calls = re.findall(rf"{name}\(([^)]*)\)", text, re.S)
if not calls:
raise AssertionError(f"no {name}( call")
return [token for body in calls for token in body.split()]


class MsvcWarningLevelTest(unittest.TestCase):
def setUp(self) -> None:
self.text = WINDOWS.read_text(encoding="utf-8")

def test_compile_options_request_w4(self) -> None:
options = call_tokens(self.text, "add_compile_options")
self.assertIn("/W4", options)
self.assertNotIn("/W3", options)

def test_no_w3_anywhere(self) -> None:
self.assertIsNone(re.search(r"(?<![\w/])/W3\b", self.text), "/W3 left in the MSVC config")

def test_link_options_do_not_pass_wx(self) -> None:
self.assertNotIn("/WX", call_tokens(self.text, "add_link_options"))

def test_wx_comes_from_the_compile_time_setting(self) -> None:
common = COMMON.read_text(encoding="utf-8")
self.assertIn("set(CMAKE_COMPILE_WARNING_AS_ERROR ON)", common)
self.assertNotIn("/WX", call_tokens(self.text, "add_compile_options"))


HELPERS = ROOT / "cmake" / "common" / "helpers_common.cmake"

# Every product C++ target that compiles a translation unit including
# libobs/graphics/vec{2,3,4}.h, libobs/util/profiler.h or
# frontend/api/obs-frontend-api.h, and so reports C4201 at /W4. The warnings come
# from the headers, not from the target's own code, and the nameless unions in
# them are legal C11 (6.7.2.1p13) consumed from C, so #2626 decided a per-target
# exemption for exactly these targets rather than renaming the types (an API
# break) or disabling C4201 for every C++ target.
C4201_TARGETS = {
"aja-output-ui": "plugins/aja-output-ui/CMakeLists.txt",
"coreaudio-encoder": "plugins/coreaudio-encoder/CMakeLists.txt",
"decklink": "plugins/decklink/CMakeLists.txt",
"decklink-output-ui": "plugins/decklink-output-ui/CMakeLists.txt",
"frontend-tools": "plugins/frontend-tools/CMakeLists.txt",
"libobs-d3d11": "libobs-d3d11/CMakeLists.txt",
"obs-studio": "frontend/CMakeLists.txt",
"obs-browser": "plugins/CMakeLists.txt",
"obs-vst": "plugins/obs-vst/CMakeLists.txt",
"obs-websocket": "plugins/CMakeLists.txt",
"win-dshow": "plugins/win-dshow/CMakeLists.txt",
}


class MsvcNamelessUnionExemptionTest(unittest.TestCase):
"""C4201 is exempted per target, for the C++ targets that include those headers."""

def test_helper_is_cxx_and_msvc_scoped(self) -> None:
text = HELPERS.read_text(encoding="utf-8")
self.assertIn("function(obs_msvc_exempt_c4201 target)", text)
helper = text.split("function(obs_msvc_exempt_c4201 target)", 1)[1].split("endfunction()", 1)[0]
self.assertIn("/wd4201", helper)
self.assertIn("COMPILE_LANG_AND_ID:CXX,MSVC", helper)

def test_helper_is_a_no_op_when_the_module_is_disabled(self) -> None:
"""ENABLE_BROWSER=OFF / ENABLE_WEBSOCKET=OFF leave no target to exempt."""
text = HELPERS.read_text(encoding="utf-8")
helper = text.split("function(obs_msvc_exempt_c4201 target)", 1)[1].split("endfunction()", 1)[0]
guard = helper.find("if(NOT TARGET ${target})")
self.assertNotEqual(guard, -1, "the helper must tolerate a target the config did not create")
self.assertLess(guard, helper.find("target_compile_options"), "return before touching the target")

def test_no_blanket_exemption_in_the_msvc_config(self) -> None:
windows = WINDOWS.read_text(encoding="utf-8")
self.assertIsNone(
re.search(r"(?<![\w/])/wd4201\b", windows),
"the MSVC config must not disable C4201 for every C++ target",
)

def test_child_configured_targets_use_inline_flags(self) -> None:
# The child architecture build configures win-capture/graphics-hook (and
# friends) without cmake/common/helpers_common.cmake, so an
# obs_msvc_exempt_c4201() call there fails configuration.
hook = (ROOT / "plugins" / "win-capture" / "graphics-hook" / "CMakeLists.txt").read_text(encoding="utf-8")
self.assertNotIn("obs_msvc_exempt_c4201", hook)
self.assertIn("/wd4201", hook)
child = (ROOT / "cmake" / "windows" / "architecture.cmake").read_text(encoding="utf-8")
self.assertIn("add_subdirectory(plugins/win-capture/graphics-hook)", child)

def test_generated_wrapper_and_padded_queue_exemptions(self) -> None:
obslua = (ROOT / "shared" / "obs-scripting" / "obslua" / "CMakeLists.txt").read_text(encoding="utf-8")
for flag in ("/wd4100", "/wd4189"):
self.assertIn(flag, obslua, "the SWIG-generated wrapper is not edited by hand")
decklink = (ROOT / "plugins" / "decklink" / "CMakeLists.txt").read_text(encoding="utf-8")
self.assertIn("/wd4324", decklink, "FrameQueue pads for false-sharing avoidance")

def test_each_product_cxx_target_opts_in(self) -> None:
missing = []
for target, relative in sorted(C4201_TARGETS.items()):
body = (ROOT / relative).read_text(encoding="utf-8")
if f"obs_msvc_exempt_c4201({target})" not in body:
missing.append(f"{relative}: {target}")
self.assertEqual(missing, [])


class MsvcDeadInternalFunctionExemptionTest(unittest.TestCase):
"""C4505 is exempted only for the obs-browser helper target (#2626)."""

def helper(self) -> str:
text = HELPERS.read_text(encoding="utf-8")
self.assertIn("function(obs_msvc_exempt_c4505 target)", text)
return text.split("function(obs_msvc_exempt_c4505 target)", 1)[1].split("endfunction()", 1)[0]

def test_helper_is_cxx_and_msvc_scoped(self) -> None:
helper = self.helper()
self.assertIn("/wd4505", helper)
self.assertIn("COMPILE_LANG_AND_ID:CXX,MSVC", helper)

def test_helper_is_a_no_op_when_the_module_is_disabled(self) -> None:
helper = self.helper()
guard = helper.find("if(NOT TARGET ${target})")
self.assertNotEqual(guard, -1, "the helper must tolerate a target the config did not create")
self.assertLess(guard, helper.find("target_compile_options"), "return before touching the target")

def test_only_the_obs_browser_helper_opts_in(self) -> None:
# The dead static is `SetHighDPIv2Scaling()` in the obs-browser
# submodule, so the exemption belongs to that target and nowhere else;
# deleting the function is an obs-rust/obs-browser change.
body = (ROOT / "plugins" / "CMakeLists.txt").read_text(encoding="utf-8")
self.assertIn("obs_msvc_exempt_c4505(obs-browser-helper)", body)
self.assertEqual(body.count("obs_msvc_exempt_c4505("), 1)
windows = WINDOWS.read_text(encoding="utf-8")
self.assertIsNone(
re.search(r"(?<![\w/])/wd4505\b", windows),
"the MSVC config must not disable C4505 for every C++ target",
)


OUTPUTS = ROOT / "plugins" / "obs-outputs" / "CMakeLists.txt"
DSHOW = ROOT / "deps" / "libdshowcapture" / "CMakeLists.txt"


class MsvcVendoredDependencyExemptionTest(unittest.TestCase):
"""The /W4-only findings left in vendored code are suppressed, not edited (#516)."""

def test_librtmp_exempts_its_w4_only_classes_on_msvc(self) -> None:
text = OUTPUTS.read_text(encoding="utf-8")
block = text.split("set_source_files_properties(", 1)[1].split("\n)", 1)[0]
self.assertIn("librtmp/rtmp.c", block)
self.assertRegex(
block,
r"COMPILE_LANG_AND_ID:C,MSVC>:/wd4244;/wd4245;/wd4456;/wd4702;/wd4706>",
"librtmp needs C4244, C4245, C4456, C4702 and C4706 at /W4, scoped to the C language",
)

def test_libdshowcapture_exempts_its_shadowed_locals_on_msvc_cxx(self) -> None:
text = DSHOW.read_text(encoding="utf-8")
self.assertRegex(
text,
r"COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4244;/wd4456;/wd4458>",
"device.cpp:483 and encoder.cpp/output-filter.cpp/ElgatoUVCDevice.cpp "
"are vendored; C4244/C4456/C4458 stay suppressed",
)


if __name__ == "__main__":
unittest.main()
12 changes: 12 additions & 0 deletions ci/test_websocket_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
# obs-rust/obs-websocket#22: Stop() reads the drain predicate under the session
# mutex and bounds the wait (obs-studio#2713).
BOUNDED_SESSION_DRAIN = "3253206ff1ba62213936f4e9458e0ebf5eb421ea"
# obs-rust/obs-websocket#24: rename the two inner errorCode locals in onMessage
# (C4456) for the MSVC /W4 ratchet (obs-studio#2626), which the app build reports.
WARNING_SHADOWING_FIX = "960b99e702f116f9cc80ff6b2d3741dc917b7d87"
# obs-rust/obs-websocket#25: the structured binding in Json.cpp's
# obs_data_set_json_array hides the function's own `key` parameter (C4457).
WARNING_JSON_BINDING_FIX = "c2366e8d2c212be569a4fce6687d8a3fb7c6be70"
# Upstream commits without the fix that stale checkouts have committed (#492, #496).
KNOWN_BAD = {"073a294cd0646fa1744b0ebf3293bfa63a869b50"}

Expand Down Expand Up @@ -59,6 +65,12 @@ def test_pointer_keeps_the_bounded_parser(self):
def test_pointer_keeps_the_bounded_session_drain(self):
self._assert_pointer_at_least(BOUNDED_SESSION_DRAIN, "the bounded session drain (#2713)")

def test_pointer_keeps_the_warning_renames(self):
self._assert_pointer_at_least(WARNING_SHADOWING_FIX, "the /W4 shadowing renames (#24)")

def test_pointer_keeps_the_json_binding_rename(self):
self._assert_pointer_at_least(WARNING_JSON_BINDING_FIX, "the Json.cpp binding rename (#25)")


class SessionDrainShapeTest(unittest.TestCase):
"""Stop() must read the drain predicate under the session mutex and bound the wait."""
Expand Down
33 changes: 33 additions & 0 deletions cmake/common/helpers_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,39 @@ function(target_disable target)
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_DISABLED ${target})
endfunction()

# obs_msvc_exempt_c4201: Disable C4201 on one C++ target (MSVC /W4, #2626)
#
# /W4 reports C4201 "nameless struct/union" for the unions in
# libobs/graphics/vec{2,3,4}.h, libobs/util/profiler.h and
# frontend/api/obs-frontend-api.h. They are legal C11 (6.7.2.1p13) and consumed
# from C, so naming them is an API break; #2626 therefore decided on a
# per-target exemption, only for the C++ targets that include those headers and
# never as a blanket /wd4201 for every C++ target.
function(obs_msvc_exempt_c4201 target)
# The module options (ENABLE_BROWSER, ENABLE_WEBSOCKET, ...) make a submodule's
# CMakeLists return before add_library, so the target exists only when that
# module is actually built; nothing to exempt otherwise.
if(NOT TARGET ${target})
return()
endif()
target_compile_options(${target} PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4201>)
endfunction()

# obs_msvc_exempt_c4505: Disable C4505 on one C++ target (MSVC /W4, #2626)
#
# /W4 reports C4505 "unreferenced function with internal linkage has been
# removed" for the static SetHighDPIv2Scaling() in the obs-browser submodule's
# obs-browser-page-main.cpp. That function is dead in obs-browser, not in this
# tree: deleting it belongs to an obs-rust/obs-browser change, so until that
# lands the target gets the same per-target exemption properties-view already
# uses, and never a blanket /wd4505 for every C++ target.
function(obs_msvc_exempt_c4505 target)
if(NOT TARGET ${target})
return()
endif()
target_compile_options(${target} PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4505>)
endfunction()

# _handle_generator_expression_dependency: Helper function to yield dependency from a generator expression
function(_handle_generator_expression_dependency library)
set(oneValueArgs FOUND_VAR)
Expand Down
6 changes: 1 addition & 5 deletions cmake/windows/compilerconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if(CMAKE_CXX_STANDARD GREATER_EQUAL 20)
endif()

add_compile_options(
/W3
/W4
/utf-8
/Brepro
/permissive-
Expand Down Expand Up @@ -97,7 +97,3 @@ add_link_options(
/DEBUG
/Brepro
)

if(CMAKE_COMPILE_WARNING_AS_ERROR)
add_link_options(/WX)
endif()
6 changes: 6 additions & 0 deletions deps/libcaption/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ target_compile_options(
$<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang,GNU>:-Wno-cast-qual>
$<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-comma>
$<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang,GNU>:-Wno-pedantic>
# MSVC /W4 (#2626): vendored upstream C stays vendored, with its own
# suppressions instead of edits (the #516 vendored-code exemption).
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4244>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4701>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4702>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4703>
)

set_target_properties(caption PROPERTIES FOLDER deps POSITION_INDEPENDENT_CODE TRUE)
14 changes: 13 additions & 1 deletion deps/libdshowcapture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,16 @@ target_include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/src/external/capture-device-support/Library")

target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
target_compile_options(libdshowcapture INTERFACE /wd4005 /wd4018)

# /wd4005 and /wd4018 are the vendored-code suppressions this library has always
# carried. The MSVC /W4-only C4244/C4456/C4458 below belong to the same exempt set
# (#2626, #516): src/source/device.cpp:483 shadows its `defaultMT` local,
# src/source/encoder.cpp / output-filter.cpp shadow the class members `config`
# and `pin`, and external/capture-device-support/Library/ElgatoUVCDevice.cpp:218
# stores an int into a uint8_t. Fixing them would mean editing the vendored
# submodule, so the warnings are suppressed for the consumers that compile these
# sources (win-dshow, obs-virtualcam-module).
target_compile_options(
libdshowcapture
INTERFACE /wd4005 /wd4018 $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4244;/wd4456;/wd4458>
)
15 changes: 15 additions & 0 deletions deps/w32-pthreads/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ target_sources(

target_compile_definitions(w32-pthreads PRIVATE __CLEANUP_C PTW32_BUILD)

# MSVC /W4 (#2626): vendored pthreads-win32 keeps its own suppressions rather
# than source edits (the #516 vendored-code exemption): C4324 alignment
# padding, C4057 indirection of a volatile LONG64/size_t pair in the MCS lock,
# C4310 a truncating constant cast, C4456 a shadowed local, C4702 the
# unreachable path after its own assert.
target_compile_options(
w32-pthreads
PRIVATE
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4057>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4702>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4310>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4324>
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4456>
)

target_include_directories(w32-pthreads PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")

configure_file(cmake/windows/obs-module.rc.in w32-pthreads.rc)
Expand Down
Loading
Loading