mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
CMake: Add a command for codesigning with the get-task-allow entitlement
This allows developers on macOS to open Ladybird.app in Instruments. Add some documentation for how to use the command as well. It is enabled automatically when CMAKE_BUILD_TYPE is not Release or RelWithDebInfo.
This commit is contained in:
parent
3cdd4fb769
commit
d220cf3abd
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/d220cf3abd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/317 Reviewed-by: https://github.com/trflynn89
3 changed files with 34 additions and 1 deletions
|
@ -204,8 +204,22 @@ After running Ladybird as suggested above with `./Meta/ladybird.sh run ladybird`
|
|||
|
||||
Now breakpoints, stepping and variable inspection will work.
|
||||
|
||||
### Debugging with Xcode on macOS
|
||||
### Debugging with Xcode or Instruments on macOS
|
||||
|
||||
If all you want to do is use Instruments, then an Xcode project is not required.
|
||||
|
||||
Simply run the `ladybird.sh` script as normal, and then make sure to codesign the Ladybird binary with the proper entitlements to allow Instruments to attach to it.
|
||||
|
||||
```
|
||||
./Meta/ladybird.sh build
|
||||
ninja -C build/ladybird apply-debug-entitlements
|
||||
# or
|
||||
codesign -s - -v -f --entitlements Meta/debug.plist Build/ladybird/bin/Ladybird.app
|
||||
```
|
||||
|
||||
Now you can open the Instruments app and point it to the Ladybird app bundle.
|
||||
|
||||
If you want to use Xcode itself for debugging, you will need to generate an Xcode project.
|
||||
The `ladybird.sh` build script does not know how to generate Xcode projects, so creating the project must be done manually.
|
||||
|
||||
```
|
||||
|
|
|
@ -34,6 +34,17 @@ function(create_ladybird_bundle target_name)
|
|||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" "${bundle_dir}/Contents/lib"
|
||||
)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo")
|
||||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
COMMAND codesign -s - -v -f --entitlements "${LADYBIRD_SOURCE_DIR}/Meta/debug.plist" "${bundle_dir}"
|
||||
)
|
||||
else()
|
||||
add_custom_target(apply-debug-entitlements
|
||||
COMMAND codesign -s - -v -f --entitlements "${LADYBIRD_SOURCE_DIR}/Meta/debug.plist" "${bundle_dir}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
|
|
8
Meta/debug.plist
Normal file
8
Meta/debug.plist
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.get-task-allow</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Loading…
Reference in a new issue