Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Commit

Permalink
cmake+Utilities: Ensure WebContent and resources are included in bundle
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ADKaster committed Oct 18, 2022
1 parent 8c43aa5 commit c40654e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ qt_finalize_executable(ladybird)
add_subdirectory(WebContent)
add_dependencies(ladybird WebContent)

if (APPLE)
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:WebContent>" "${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()
4 changes: 4 additions & 0 deletions Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c40654e

Please sign in to comment.