Ladybird: Improve Xcode generator experience and copy helpers to bundle

We had a mismatch in the GUI Identifier property, causing warnings in
Xcode. It was also missing the Product Identifier Xcode property on
ladybird itself, causing another warning.

Copy all our helper processes to the ladybird.app bundle directory so
that they can be found by ``open ladybird.app`` and the Xcode debugger.

For the future, we should look in ../Resources for resources on macOS.
Copying resources to that directory requires more CMake-fu.
This commit is contained in:
Andrew Kaster 2023-03-26 09:53:32 -06:00 committed by Linus Groh
parent afb3a4a030
commit 4608e4143e
Notes: sideshowbarker 2024-07-16 22:14:50 +09:00
3 changed files with 20 additions and 3 deletions

View file

@ -113,12 +113,13 @@ target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(headless-browser PRIVATE Qt::Core LibWeb LibWebView LibWebSocket LibCrypto LibFileSystem LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibJS)
set_target_properties(ladybird PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER org.serenityos.ladybird
MACOSX_BUNDLE_GUI_IDENTIFIER org.SerenityOS.Ladybird
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.SerenityOS.Ladybird
)
if (ANDROID)
@ -141,7 +142,19 @@ qt_finalize_executable(ladybird)
add_subdirectory(SQLServer)
add_subdirectory(WebContent)
add_subdirectory(WebDriver)
add_dependencies(ladybird SQLServer WebContent WebDriver)
add_dependencies(ladybird SQLServer WebContent WebDriver headless-browser)
if (APPLE)
# FIXME: Create a proper app bundle for each helper process
set(app_dir "$<TARGET_FILE_DIR:ladybird>")
set(bundle_dir "$<TARGET_BUNDLE_DIR:ladybird>")
add_custom_command(TARGET ladybird POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:SQLServer>" "${app_dir}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebContent>" "${app_dir}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebDriver>" "${app_dir}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:headless-browser>" "${app_dir}"
)
endif()
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/InstallRules.cmake)

View file

@ -13,7 +13,7 @@
<key>CFBundleSignature</key>
<string></string>
<key>CFBundleExecutable</key>
<string>Ladybird</string>
<string>ladybird</string>
<key>CFBundleIdentifier</key>
<string>org.SerenityOS.Ladybird</string>
<key>NSPrincipalClass</key>

View file

@ -52,7 +52,11 @@ void platform_init()
if (FileSystem::is_directory(home_lagom))
return home_lagom;
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
# ifdef AK_OS_MACOS
return LexicalPath(app_dir).parent().append("Resources"sv).string();
# else
return LexicalPath(app_dir).parent().append("share"sv).string();
# endif
}();
#endif
}