From 4ffca2089e31805c447f2abb8fcfa58aad3b4b36 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 30 Sep 2024 09:55:48 -0400 Subject: [PATCH] Meta: Change the default build directories to exclude "ladybird" prefix The reason for this change is that CMake/vcpkg are unable to detect a change to VCPKG_LIBRARY_LINKAGE. So when we switch to dynamic builds, the switch would be non-functional, and every developer would have to remove their Build and vcpkg cache directories manually. By changing these directories, vcpkg is able to detect it must rebuild. --- .clangd | 2 +- CMakePresets.json | 8 ++--- Documentation/AdvancedBuildInstructions.md | 2 +- Documentation/BuildInstructionsLadybird.md | 28 +++++++-------- .../EditorConfiguration/EmacsConfiguration.md | 2 +- .../QtCreatorConfiguration.md | 8 ++--- .../VSCodeConfiguration.md | 34 +++++++++---------- Documentation/Testing.md | 6 ++-- Meta/shell_include.sh | 6 ++-- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.clangd b/.clangd index b5e8fe31684..6eaf259af89 100644 --- a/.clangd +++ b/.clangd @@ -1,5 +1,5 @@ CompileFlags: - CompilationDatabase: Build/ladybird + CompilationDatabase: Build/release Diagnostics: UnusedIncludes: None diff --git a/CMakePresets.json b/CMakePresets.json index 984fc39dc69..ee569282325 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,7 +10,7 @@ "hidden": true, "name": "default_base", "displayName": "Default Config", - "binaryDir": "${fileDir}/Build/ladybird", + "binaryDir": "${fileDir}/Build/release", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo", "SERENITY_CACHE_DIR": "${fileDir}/Build/caches", @@ -92,7 +92,7 @@ "inherits": "default", "displayName": "Debug Config", "description": "Debug build using Ninja generator", - "binaryDir": "${fileDir}/Build/ladybird-debug", + "binaryDir": "${fileDir}/Build/debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/debug-triplets" @@ -103,7 +103,7 @@ "inherits": "default", "displayName": "Sanitizer Config", "description": "Sanitizer build using Ninja generator", - "binaryDir": "${fileDir}/Build/ladybird-sanitizers", + "binaryDir": "${fileDir}/Build/sanitizers", "cacheVariables": { "ENABLE_UNDEFINED_SANITIZER": "ON", "ENABLE_ADDRESS_SANITIZER": "ON", @@ -145,7 +145,7 @@ ], "displayName": "Fuzzers Config", "description": "Fuzzers build with GitHub Actions cache", - "binaryDir": "${fileDir}/Build/ladybird-fuzzers", + "binaryDir": "${fileDir}/Build/fuzzers", "cacheVariables": { "CMAKE_BUILD_TYPE": "", "ENABLE_QT": "OFF", diff --git a/Documentation/AdvancedBuildInstructions.md b/Documentation/AdvancedBuildInstructions.md index 1c2b651a754..abe130bddd3 100644 --- a/Documentation/AdvancedBuildInstructions.md +++ b/Documentation/AdvancedBuildInstructions.md @@ -6,7 +6,7 @@ This file covers a few advanced scenarios that go beyond what the basic build gu The `Meta/ladybird.sh` script provides an abstraction over the build targets which are made available by CMake. The following build targets cannot be accessed through the script and have to be used directly by changing the current -directory to `Build/ladybird` and then running `ninja `: +directory to `Build/release` and then running `ninja `: - `ninja check-style`: Runs the same linters the CI does to verify project style on changed files - `ninja lint-shell-scripts`: Checks style of shell scripts in the source tree with shellcheck diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index 609c3989542..a6064942c83 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -254,17 +254,17 @@ Elapsed time to handle skia:x64-linux: 1.6 s -- Running vcpkg install - failed CMake Error at Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message): vcpkg install failed. See logs for more information: - Build/ladybird/vcpkg-manifest-install.log + Build/release/vcpkg-manifest-install.log Call Stack (most recent call first): /usr/share/cmake-3.30/Modules/CMakeDetermineSystem.cmake:146 (include) CMakeLists.txt:15 (project) CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. -- Configuring incomplete, errors occurred! See logs for more information: - Build/ladybird/vcpkg-manifest-install.log + Build/release/vcpkg-manifest-install.log ``` -If the error is not immediately clear from the terminal output, be sure to check `Build/ladybird/vcpkg-manifest-install.log` +If the error is not immediately clear from the terminal output, be sure to check the specified `vcpkg-manifest-install.log`. for more information. ### Resource files @@ -278,7 +278,7 @@ to CMAKE_INSTALL_PREFIX. If it is not, things will break. ### Custom CMake build directory The script Meta/ladybird.sh and the default preset in CMakePresets.json both define a build directory of -`Build/ladybird`. For distribution purposes, or when building multiple configurations, it may be useful to create a custom +`Build/release`. For distribution purposes, or when building multiple configurations, it may be useful to create a custom CMake build directory. The install rules in Ladybird/cmake/InstallRules.cmake define which binaries and libraries will be @@ -302,20 +302,20 @@ If you don't want to use the ladybird.sh script to run the application, you can To automatically run in gdb: ``` -ninja -C Build/ladybird debug-ladybird +ninja -C Build/release debug-ladybird ``` To run without ninja rule on non-macOS systems: ``` -./Build/ladybird/bin/Ladybird +./Build/release/bin/Ladybird ``` To run without ninja rule on macOS: ``` -open -W --stdout $(tty) --stderr $(tty) ./Build/ladybird/bin/Ladybird.app +open -W --stdout $(tty) --stderr $(tty) ./Build/release/bin/Ladybird.app # Or to launch with arguments: -open -W --stdout $(tty) --stderr $(tty) ./Build/ladybird/bin/Ladybird.app --args https://ladybird.dev +open -W --stdout $(tty) --stderr $(tty) ./Build/release/bin/Ladybird.app --args https://ladybird.dev ``` ### Experimental GN build @@ -344,9 +344,9 @@ Simply run the `ladybird.sh` script as normal, and then make sure to codesign th ``` ./Meta/ladybird.sh build - ninja -C build/ladybird apply-debug-entitlements + ninja -C Build/release apply-debug-entitlements # or - codesign -s - -v -f --entitlements Meta/debug.plist Build/ladybird/bin/Ladybird.app + codesign -s - -v -f --entitlements Meta/debug.plist Build/release/bin/Ladybird.app ``` Now you can open the Instruments app and point it to the Ladybird app bundle. @@ -355,7 +355,7 @@ If you want to use Xcode itself for debugging, you will need to generate an Xcod The `ladybird.sh` build script does not know how to generate Xcode projects, so creating the project must be done manually. ``` -cmake -GXcode -B Build/ladybird +cmake -GXcode -B Build/release ``` After generating an Xcode project into the specified build directory, you can open `ladybird.xcodeproj` in Xcode. The project has a ton of targets, many of which are generated code. @@ -373,7 +373,7 @@ When running Ladybird, make sure that XDG_RUNTIME_DIR is set, or it will immedia doesn't find a writable directory for its sockets. ``` -CMAKE_PREFIX_PATH=/usr/lib/qt/6.2/lib/amd64/cmake cmake -GNinja -B Build/ladybird -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -cmake --build Build/ladybird -XDG_RUNTIME_DIR=/var/tmp ninja -C Build/ladybird run +CMAKE_PREFIX_PATH=/usr/lib/qt/6.2/lib/amd64/cmake cmake -GNinja -B Build/release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ +cmake --build Build/release +XDG_RUNTIME_DIR=/var/tmp ninja -C Build/release run ``` diff --git a/Documentation/EditorConfiguration/EmacsConfiguration.md b/Documentation/EditorConfiguration/EmacsConfiguration.md index 9f401e660f7..38445ae7303 100644 --- a/Documentation/EditorConfiguration/EmacsConfiguration.md +++ b/Documentation/EditorConfiguration/EmacsConfiguration.md @@ -7,7 +7,7 @@ Emacs can be configured with `lsp-mode` and `clangd` to work well. The official clangd extension can be used for C++ comprehension. Run cmake (`Meta/ladybird.sh run ladybird` or similar) at least once for clangd -to work, as doing so will generate the `Build/ladybird/compile_commands.json` +to work, as doing so will generate the `Build/release/compile_commands.json` that is needed by `clangd`. ### lsp-mode diff --git a/Documentation/EditorConfiguration/QtCreatorConfiguration.md b/Documentation/EditorConfiguration/QtCreatorConfiguration.md index b042fe51625..365d6508eee 100644 --- a/Documentation/EditorConfiguration/QtCreatorConfiguration.md +++ b/Documentation/EditorConfiguration/QtCreatorConfiguration.md @@ -25,10 +25,10 @@ First, make sure you have a working toolchain and can build and run Ladybird. Go Userland/ Userland/Libraries/ Userland/Services/ - Build/ladybird/ - Build/ladybird/Userland/ - Build/ladybird/Userland/Libraries/ - Build/ladybird/Userland/Services/ + Build/release/ + Build/release/Userland/ + Build/release/Userland/Libraries/ + Build/release/Userland/Services/ AK/ ``` diff --git a/Documentation/EditorConfiguration/VSCodeConfiguration.md b/Documentation/EditorConfiguration/VSCodeConfiguration.md index 45c35f6d45f..77786e31024 100644 --- a/Documentation/EditorConfiguration/VSCodeConfiguration.md +++ b/Documentation/EditorConfiguration/VSCodeConfiguration.md @@ -28,7 +28,7 @@ Clangd has the best support for modern compilers, especially if configured as no The official clangd extension can be used for C++ comprehension. It is recommended in general, as it is most likely to work on all platforms. -clangd uses ``compile_commands.json`` files to understand the project. CMake will generate these in Build/ladybird. +clangd uses ``compile_commands.json`` files to understand the project. CMake will generate these in Build/release. Run ``./Meta/ladybird.sh run ladybird`` at least once to generate the ``compile_commands.json`` file. @@ -58,10 +58,10 @@ following ``c_cpp_properties.json`` to circumvent some errors. Even with the con "name": "ladybird-gcc", "includePath": [ "${workspaceFolder}", - "${workspaceFolder}/Build/ladybird/", - "${workspaceFolder}/Build/ladybird/Userland", - "${workspaceFolder}/Build/ladybird/Userland/Libraries", - "${workspaceFolder}/Build/ladybird/Userland/Services", + "${workspaceFolder}/Build/release/", + "${workspaceFolder}/Build/release/Userland", + "${workspaceFolder}/Build/release/Userland/Libraries", + "${workspaceFolder}/Build/release/Userland/Services", "${workspaceFolder}/Userland", "${workspaceFolder}/Userland/Libraries", "${workspaceFolder}/Userland/Services" @@ -72,7 +72,7 @@ following ``c_cpp_properties.json`` to circumvent some errors. Even with the con "cStandard": "c17", "cppStandard": "c++23", "intelliSenseMode": "linux-gcc-x86", - "compileCommands": "Build/ladybird/compile_commands.json", + "compileCommands": "Build/release/compile_commands.json", "compilerArgs": [ "-Wall", "-Wextra", @@ -81,16 +81,16 @@ following ``c_cpp_properties.json`` to circumvent some errors. Even with the con "browse": { "path": [ "${workspaceFolder}", - "${workspaceFolder}/Build/ladybird/", - "${workspaceFolder}/Build/ladybird/Userland", - "${workspaceFolder}/Build/ladybird/Userland/Libraries", - "${workspaceFolder}/Build/ladybird/Userland/Services", + "${workspaceFolder}/Build/release/", + "${workspaceFolder}/Build/release/Userland", + "${workspaceFolder}/Build/release/Userland/Libraries", + "${workspaceFolder}/Build/release/Userland/Services", "${workspaceFolder}/Userland", "${workspaceFolder}/Userland/Libraries", "${workspaceFolder}/Userland/Services" ], "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "${workspaceFolder}/Build/ladybird/" + "databaseFilename": "${workspaceFolder}/Build/release/" } } ], @@ -165,7 +165,7 @@ The following three example tasks should suffice in most situations, and allow y "base": "$gcc", "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ] } ], @@ -199,14 +199,14 @@ The following three example tasks should suffice in most situations, and allow y "base": "$gcc", "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ] }, { "source": "gcc", "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ], "pattern": [ { @@ -241,14 +241,14 @@ The following three example tasks should suffice in most situations, and allow y "base": "$gcc", "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ] }, { "source": "gcc", "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ], "pattern": [ { @@ -275,7 +275,7 @@ The following three example tasks should suffice in most situations, and allow y ], "fileLocation": [ "relative", - "${workspaceFolder}/Build/ladybird" + "${workspaceFolder}/Build/release" ] } ] diff --git a/Documentation/Testing.md b/Documentation/Testing.md index cf565e19b08..9e1a5df77a6 100644 --- a/Documentation/Testing.md +++ b/Documentation/Testing.md @@ -8,7 +8,7 @@ Tests of internal C++ code go in their own `TestFoo.cpp` file in `Tests/LibWeb`. ## Running Tests -> [!NOTE] +> [!NOTE] > To reproduce a CI failure, see the section on [Running with Sanitizers](#running-with-sanitizers). The easiest way to run tests is to use the `ladybird.sh` script. The LibWeb tests are registered with CMake as a test in @@ -91,7 +91,7 @@ Enabling the Qt chrome is recommended when running the Web Platform Tests on Mac following command: ```sh -cmake -GNinja Build/ladybird -DENABLE_QT=ON +cmake -GNinja Build/release -DENABLE_QT=ON ``` Example usage: @@ -107,7 +107,7 @@ git checkout my-css-change # Pull the latest changes from the upstream WPT repository ./Meta/WPT.sh update # Run all of the Web Platform Tests, outputting the results to results.log -./Meta/WPT.sh run --log results.log +./Meta/WPT.sh run --log results.log ``` ### Importing Web Platform Tests diff --git a/Meta/shell_include.sh b/Meta/shell_include.sh index 855ac95514f..afc1c2fe115 100644 --- a/Meta/shell_include.sh +++ b/Meta/shell_include.sh @@ -67,13 +67,13 @@ get_build_dir() { # Note: Keep in sync with buildDir defaults in CMakePresets.json case "$1" in "default") - BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird" + BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/release" ;; "Debug") - BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-debug" + BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/debug" ;; "Sanitizer") - BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-sanitizers" + BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/sanitizers" ;; *) echo "Unknown BUILD_PRESET: '$1'" >&2