<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>312033</bug_id>
          
          <creation_ts>2026-04-11 01:28:10 -0700</creation_ts>
          <short_desc>[CMake] Mirror PlatformEnableCocoa.h derived features in Mac CMake build</short_desc>
          <delta_ts>2026-04-11 20:16:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CMake</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>312071</dependson>
    
    <dependson>312017</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="pascoe@apple.com">pascoe</reporter>
          <assigned_to name="pascoe@apple.com">pascoe</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2199152</commentid>
    <comment_count>0</comment_count>
    <who name="pascoe@apple.com">pascoe</who>
    <bug_when>2026-04-11 01:28:10 -0700</bug_when>
    <thetext>IDL/CSS codegen only sees CMake FEATURE_DEFINES_WITH_SPACE_SEPARATOR, not preprocessor values from PlatformEnableCocoa.h. When they disagree, generated bindings have variant type mismatches. Currently ~25 flags are manually mirrored in OptionsMac.cmake.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2199333</commentid>
    <comment_count>1</comment_count>
    <who name="pascoe@apple.com">pascoe</who>
    <bug_when>2026-04-11 20:01:21 -0700</bug_when>
    <thetext>some notes about this one:

The root cause of the CMake/Xcode divergence is the #if !defined() guard pattern in PlatformEnableCocoa.h.

When a feature is registered in WebKitFeatures.cmake, it gets written to cmakeconfig.h (included before Platform.h). If OptionsMac.cmake doesn&apos;t explicitly set it ON, cmakeconfig.h emits #define ENABLE_X 0. This poisons the #if !defined(ENABLE_X) guard in PlatformEnableCocoa.h, making that header&apos;s value dead code.

Features that are ONLY in PlatformEnableCocoa.h (~200+, never registered in WebKitFeatures.cmake) work correctly -- the !defined() guard fires and the header drives the value. The problem is exclusively features that exist in both places.

This affects more than IDL/CSS codegen. The UnifiedWebPreferences.yaml pipeline emits #if ENABLE(X) guards verbatim in all generated preference files. When cmake&apos;s ENABLE flags disagree with what Xcode would set, entire preference blocks get #if-0&apos;d out. The generated files are textually identical to Xcode&apos;s, but compile to different code.

Currently confirmed divergences: ENABLE_WEBGPU (bug 312031), ENABLE_WEB_CODECS, ENABLE_WEBDRIVER_BIDI. Each is enabled by PlatformEnableCocoa.h for Mac but defaults OFF in WebKitFeatures.cmake with no OptionsMac.cmake override.

Possible fix approaches:
(A) Don&apos;t register Cocoa-handled features in WebKitFeatures.cmake (let headers drive them). Breaks cross-platform feature queries in cmake.
(B) Add a CI script that diffs WebKitFeatures.cmake defaults against PlatformEnableCocoa.h outcomes and flags divergences.
(C) Keep manually mirroring in OptionsMac.cmake (current approach, known to drift silently).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>