From c40654e3a0f34836244d41e64033ebdc4f1f06a2 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 17 Oct 2022 23:38:28 -0600 Subject: [PATCH] cmake+Utilities: Ensure WebContent and resources are included in bundle For the build directory only, copy WebContent next to ladybird and add a symlink to the source dir into Content/Resources/ of ladybird.app. This allows building and running ladybird in Xcode and Instruments. --- CMakeLists.txt | 9 +++++++++ Utilities.cpp | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f88a77e0ff8..b62e3a281d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,15 @@ qt_finalize_executable(ladybird) add_subdirectory(WebContent) add_dependencies(ladybird WebContent) +if (APPLE) + set(app_dir "$") + set(bundle_dir "$") + add_custom_command(TARGET ladybird POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$" "${app_dir}" + COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SERENITY_SOURCE_DIR}/Base" "${bundle_dir}/Contents/Resources" + ) +endif() + if(NOT CMAKE_SKIP_INSTALL_RULES) include(cmake/InstallRules.cmake) endif() diff --git a/Utilities.cpp b/Utilities.cpp index 93bd83e2792..914161de264 100644 --- a/Utilities.cpp +++ b/Utilities.cpp @@ -41,7 +41,11 @@ void platform_init() if (Core::File::is_directory(home_lagom)) return home_lagom; auto app_dir = akstring_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 }