Skip to content

Commit e5d2c3f

Browse files
committed
Merge branch 'macos-build-fixes'
2 parents 26a5d03 + fa0a924 commit e5d2c3f

4 files changed

Lines changed: 44 additions & 26 deletions

File tree

Source/WebCore/PlatformQt.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ if (ENABLE_DEVICE_ORIENTATION)
250250
platform/qt/DeviceOrientationClientQt.cpp
251251
platform/qt/DeviceOrientationProviderQt.cpp
252252
)
253+
list(APPEND WebCore_LIBRARIES
254+
Qt6::Sensors
255+
)
253256
endif ()
254257

255258
if (ENABLE_GRAPHICS_CONTEXT_3D)
@@ -302,10 +305,11 @@ list(APPEND WebCore_LIBRARIES
302305
${HYPHEN_LIBRARIES}
303306
${LIBXML2_LIBRARIES}
304307
${LIBXSLT_LIBRARIES}
305-
${Qt6Core_LIBRARIES}
306-
${Qt6Gui_LIBRARIES}
307-
${Qt6Network_LIBRARIES}
308-
${Qt6Sensors_LIBRARIES}
308+
Qt6::Core
309+
Qt6::Gui
310+
Qt6::GuiPrivate
311+
Qt6::Network
312+
Qt6::NetworkPrivate
309313
${SQLITE_LIBRARIES}
310314
${X11_X11_LIB}
311315
${ZLIB_LIBRARIES}
@@ -399,7 +403,7 @@ if (USE_QT_MULTIMEDIA)
399403
platform/graphics/qt/MediaPlayerPrivateQt.cpp
400404
)
401405
list(APPEND WebCore_LIBRARIES
402-
${Qt6Multimedia_LIBRARIES}
406+
Qt6::Multimedia
403407
)
404408
QTWEBKIT_GENERATE_MOC_FILES_H(WebCore platform/graphics/qt/MediaPlayerPrivateQt.h)
405409
endif ()

Source/WebCore/platform/AudioEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Ref<AudioEncoder::CreatePromise> AudioEncoder::create(const String& codecName, c
5151
UNUSED_PARAM(descriptionCallback);
5252
UNUSED_PARAM(outputCallback);
5353

54-
return CreatePromise::createAndReject("Not supported"_s));
54+
return CreatePromise::createAndReject("Not supported"_s);
5555
#endif
5656
}
5757

Source/cmake/OptionsQt.cmake

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,32 @@ macro(CONVERT_PRL_LIBS_TO_CMAKE _qt_component)
7171
endmacro()
7272

7373
macro(CHECK_Qt6_PRIVATE_INCLUDE_DIRS _qt_component _header)
74+
# Qt6 provides private headers via Qt6::${_qt_component}Private target
75+
find_package(Qt6${_qt_component}Private QUIET CONFIG)
76+
77+
if (NOT TARGET Qt6::${_qt_component}Private)
78+
message(FATAL_ERROR "Qt6::${_qt_component}Private target not found. Please make sure Qt6 private headers are installed.")
79+
endif()
80+
7481
set(INCLUDE_TEST_SOURCE
7582
"
7683
#include <${_header}>
7784
int main() { return 0; }
7885
"
7986
)
80-
set(CMAKE_REQUIRED_INCLUDES ${Qt6${_qt_component}_PRIVATE_INCLUDE_DIRS})
81-
set(CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component})
8287

83-
# Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!)
88+
# Use the Private target directly - it provides the include dirs automatically
89+
set(CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component} Qt6::${_qt_component}Private)
90+
8491
check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt6${_qt_component}_PRIVATE_HEADER_FOUND)
8592

8693
unset(INCLUDE_TEST_SOURCE)
87-
unset(CMAKE_REQUIRED_INCLUDES)
8894
unset(CMAKE_REQUIRED_LIBRARIES)
8995

9096
if (NOT Qt6${_qt_component}_PRIVATE_HEADER_FOUND)
9197
message(FATAL_ERROR "Header ${_header} is not found. Please make sure that:
9298
1. Private headers of Qt6${_qt_component} are installed
93-
2. Qt6${_qt_component}_PRIVATE_INCLUDE_DIRS is correctly defined in Qt6${_qt_component}Config.cmake")
99+
2. Qt6${_qt_component}Private package is available")
94100
endif ()
95101
endmacro()
96102

@@ -208,7 +214,6 @@ WEBKIT_OPTION_BEGIN()
208214
if (APPLE)
209215
set(MACOS_COMPATIBILITY_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" CACHE STRING "Compatibility version that macOS dylibs should have")
210216

211-
option(MACOS_FORCE_SYSTEM_XML_LIBRARIES "Use system installation of libxml2 and libxslt on macOS" ON)
212217
option(MACOS_USE_SYSTEM_ICU "Use system installation of ICU on macOS" ON)
213218
option(USE_UNIX_DOMAIN_SOCKETS "Use Unix domain sockets instead of native IPC code on macOS" OFF)
214219
option(USE_APPSTORE_COMPLIANT_CODE "Avoid using private macOS APIs which are not allowed on App Store (experimental)" OFF)
@@ -449,6 +454,12 @@ if (APPLE)
449454
endif ()
450455
endif ()
451456

457+
# Prefer Homebrew libxml2/libxslt over CommandLineTools version on macOS
458+
# Otherwise, CommandLineTools headers get pulled in and cause conflicts
459+
if (APPLE AND EXISTS "/opt/homebrew/opt/libxml2/lib/pkgconfig")
460+
set(ENV{PKG_CONFIG_PATH} "/opt/homebrew/opt/libxml2/lib/pkgconfig:/opt/homebrew/opt/libxslt/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
461+
endif ()
462+
452463
find_package(LibXml2 2.8.0 REQUIRED)
453464
if (ENABLE_XSLT)
454465
find_package(LibXslt 1.1.13 REQUIRED)

Tools/QtTestBrowser/CMakeLists.txt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,37 @@ set(QtTestBrowser_SYSTEM_INCLUDE_DIRECTORIES
4343
)
4444

4545
set(QtTestBrowser_LIBRARIES
46-
${Qt6Gui_LIBRARIES}
47-
${Qt6Network_LIBRARIES}
48-
${Qt6Widgets_LIBRARIES}
49-
${Qt6PrintSupport_LIBRARIES}
50-
${Qt6OpenGLWidgets_LIBRARIES}
51-
${Qt6StateMachine_LIBRARIES}
46+
Qt6::Gui
47+
Qt6::GuiPrivate
48+
Qt6::Network
49+
Qt6::Widgets
5250
WebKitWidgets
5351
${STATIC_LIB_DEPENDENCIES}
5452
)
5553

54+
if (TARGET Qt6::PrintSupport)
55+
list(APPEND QtTestBrowser_LIBRARIES Qt6::PrintSupport)
56+
endif ()
57+
5658
qt_add_resources(QtTestBrowser_SOURCES
5759
QtTestBrowser.qrc
5860
)
5961

60-
if (Qt6OpenGL_FOUND)
61-
list(APPEND QtTestBrowser_SYSTEM_INCLUDE_DIRECTORIES
62-
${Qt6OpenGL_INCLUDE_DIRS}
63-
)
64-
list(APPEND QtTestBrowser_LIBRARIES
65-
${Qt6OpenGL_LIBRARIES}
66-
)
62+
if (TARGET Qt6::OpenGL)
63+
list(APPEND QtTestBrowser_LIBRARIES Qt6::OpenGL)
64+
endif ()
65+
66+
if (TARGET Qt6::OpenGLWidgets)
67+
list(APPEND QtTestBrowser_LIBRARIES Qt6::OpenGLWidgets)
6768
endif ()
6869

6970
if (ENABLE_TEST_SUPPORT)
7071
add_definitions(-DHAVE_QTTESTSUPPORT)
7172
endif ()
7273

73-
if (NOT TARGET Qt6::StateMachine)
74+
if (TARGET Qt6::StateMachine)
75+
list(APPEND QtTestBrowser_LIBRARIES Qt6::StateMachine)
76+
else ()
7477
add_definitions(-DQT_NO_ANIMATION)
7578
endif ()
7679

0 commit comments

Comments
 (0)