From 1682e46df9039327e547048374d732298e385919 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 24 Oct 2023 10:35:33 -0400 Subject: [PATCH] Ladybird+Meta: Make the AppKit chrome the default on macOS The Qt chrome is still available and may be enabled with CMake. --- Documentation/BuildInstructionsLadybird.md | 23 ++++++++++++++-------- Ladybird/CMakeLists.txt | 7 ++++++- Meta/Azure/Lagom.yml | 17 ---------------- Meta/serenity.sh | 13 ++---------- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index 4005fceadf8..a2c0fe02567 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -47,7 +47,12 @@ Note that Xcode 13.x does not have sufficient C++20 support to build ladybird. X ``` xcode-select --install -brew install cmake qt ninja ccache +brew install cmake ninja ccache +``` + +If you also plan to use the Qt chrome on macOS: +``` +brew install qt ``` On OpenIndiana: @@ -71,7 +76,7 @@ MinGW/MSYS2 are not supported, but may work with sufficient elbow grease. Native For Android: On a Unix-like platform, install the prerequisites for that platform and then see the [Android Studio guide](AndroidStudioConfiguration.md). -Or, download a version of Gradle >= 8.0.0, and run the ``gradlew`` program in ``Ladybird/Android`` +Or, download a version of Gradle >= 8.0.0, and run the ``gradlew`` program in ``Ladybird/Android`` ## Build steps @@ -85,19 +90,21 @@ The simplest way to build and run ladybird is via the serenity.sh script: ./Meta/serenity.sh gdb lagom ladybird ``` -By default, the above commands will build Ladybird using Qt for the browser chrome. We also support -the following platform-specific browser chromes: - +The above commands will build Ladybird with one of the following browser chromes, depending on the platform: +* [Android UI](https://developer.android.com/develop/ui) - The native chrome on Android. * [AppKit](https://developer.apple.com/documentation/appkit?language=objc) - The native chrome on macOS. +* [Qt](https://doc.qt.io/qt-6/) - The chrome used on all other platforms. -To build Ladybird using one of these chromes on the appropriate platform, use the following serenity.sh -commands: +The Qt chrome is available on platforms where it is not the default as well (except on Android). To build the +Qt chrome, install the Qt dependencies for your platform, and enable the Qt chrome via CMake: ```bash # From /path/to/serenity -./Meta/serenity.sh run lagom ladybird-appkit # Use the AppKit chrome on macOS. +cmake -S Meta/Lagom -B Build/lagom -DENABLE_QT=ON ``` +To re-disable the Qt chrome, run the above command with `-DENABLE_QT=OFF`. + ### Disabling Ladybird Note that running ladybird from the script will change the CMake cache in your Build/lagom build diff --git a/Ladybird/CMakeLists.txt b/Ladybird/CMakeLists.txt index 36e0fc7a14d..84d34e09aa3 100644 --- a/Ladybird/CMakeLists.txt +++ b/Ladybird/CMakeLists.txt @@ -80,7 +80,12 @@ add_compile_options(-DAK_DONT_REPLACE_STD) add_compile_options(-Wno-expansion-to-defined) add_compile_options(-Wno-user-defined-literals) -serenity_option(ENABLE_QT ON CACHE BOOL "Build ladybird application using Qt GUI") +if (ANDROID OR APPLE) + serenity_option(ENABLE_QT OFF CACHE BOOL "Build ladybird application using Qt GUI") +else() + serenity_option(ENABLE_QT ON CACHE BOOL "Build ladybird application using Qt GUI") +endif() + if (ANDROID AND ENABLE_QT) message(STATUS "Disabling Qt for Android") set(ENABLE_QT OFF CACHE BOOL "" FORCE) diff --git a/Meta/Azure/Lagom.yml b/Meta/Azure/Lagom.yml index 5641999a7bd..6d344b0232c 100644 --- a/Meta/Azure/Lagom.yml +++ b/Meta/Azure/Lagom.yml @@ -168,23 +168,6 @@ jobs: SERENITY_SOURCE_DIR: '$(Build.SourcesDirectory)' QT_QPA_PLATFORM: 'offscreen' - - ${{ if and(eq(parameters.fuzzer, 'NoFuzz'), eq(parameters.os, 'macOS') ) }}: - - script: | - set -e - cmake -DENABLE_QT=OFF -B Build - displayName: 'Enable the Ladybird AppKit chrome' - workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom - env: - CCACHE_DIR: '$(SERENITY_CCACHE_DIR)' - - - script: | - set -e - cmake --build . - displayName: 'Build Ladybird AppKit chrome' - workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build - env: - CCACHE_DIR: '$(SERENITY_CCACHE_DIR)' - - ${{ if eq(parameters.lagom_lints, true) }}: - script: | set -e diff --git a/Meta/serenity.sh b/Meta/serenity.sh index 9e51801cb4f..ff1fb13b9c4 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -111,15 +111,6 @@ CMAKE_ARGS+=( "-DSERENITY_TOOLCHAIN=$TOOLCHAIN_TYPE" ) CMD_ARGS=( "$@" ) -LADYBIRD_ENABLE_QT=1 - -if [ "$TARGET" = "lagom" ]; then - if [ "${CMD_ARGS[0]}" = "ladybird-appkit" ]; then - CMD_ARGS[0]="ladybird" - LADYBIRD_ENABLE_QT=0 - fi -fi - get_top_dir() { git rev-parse --show-toplevel } @@ -140,7 +131,7 @@ is_valid_target() { if [ "$TARGET" = "lagom" ]; then CMAKE_ARGS+=("-DBUILD_LAGOM=ON") if [ "${CMD_ARGS[0]}" = "ladybird" ]; then - CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}") + CMAKE_ARGS+=("-DENABLE_LAGOM_LADYBIRD=ON") fi return 0 fi @@ -211,7 +202,7 @@ build_target() { # invoked superbuild for serenity target that doesn't set -DBUILD_LAGOM=ON local EXTRA_CMAKE_ARGS=() if [ "${CMD_ARGS[0]}" = "ladybird" ]; then - EXTRA_CMAKE_ARGS=("-DENABLE_LAGOM_LADYBIRD=ON" "-DENABLE_QT=${LADYBIRD_ENABLE_QT}") + EXTRA_CMAKE_ARGS=("-DENABLE_LAGOM_LADYBIRD=ON") fi cmake -S "$SERENITY_SOURCE_DIR/Meta/Lagom" -B "$BUILD_DIR" -DBUILD_LAGOM=ON "${EXTRA_CMAKE_ARGS[@]}" fi