2022-07-04 11:45:18 +00:00
|
|
|
|
|
|
|
set(SOURCES
|
2023-02-02 10:00:30 +00:00
|
|
|
HelperProcess.cpp
|
2022-09-19 09:06:23 +00:00
|
|
|
Utilities.cpp
|
2022-07-04 11:45:18 +00:00
|
|
|
)
|
2023-08-08 04:14:22 +00:00
|
|
|
set(LADYBIRD_HEADERS
|
|
|
|
HelperProcess.h
|
|
|
|
Types.h
|
|
|
|
Utilities.h
|
|
|
|
)
|
2022-07-04 11:45:18 +00:00
|
|
|
|
2023-08-08 01:42:06 +00:00
|
|
|
if (ENABLE_QT)
|
|
|
|
qt_add_executable(ladybird ${SOURCES})
|
|
|
|
target_sources(ladybird PRIVATE
|
2024-04-12 21:15:09 +00:00
|
|
|
Qt/Application.cpp
|
2023-05-31 01:44:16 +00:00
|
|
|
Qt/AutoComplete.cpp
|
2023-08-08 01:42:06 +00:00
|
|
|
Qt/BrowserWindow.cpp
|
|
|
|
Qt/EventLoopImplementationQt.cpp
|
|
|
|
Qt/EventLoopImplementationQtEventTarget.cpp
|
2024-05-29 19:12:21 +00:00
|
|
|
Qt/FindInPageWidget.cpp
|
2023-11-05 12:45:43 +00:00
|
|
|
Qt/Icon.cpp
|
2023-08-08 01:42:06 +00:00
|
|
|
Qt/InspectorWidget.cpp
|
|
|
|
Qt/LocationEdit.cpp
|
|
|
|
Qt/Settings.cpp
|
|
|
|
Qt/SettingsDialog.cpp
|
|
|
|
Qt/Tab.cpp
|
2024-04-03 01:24:17 +00:00
|
|
|
Qt/TabBar.cpp
|
2024-03-26 17:38:12 +00:00
|
|
|
Qt/TaskManagerWindow.cpp
|
2023-08-08 01:42:06 +00:00
|
|
|
Qt/TVGIconEngine.cpp
|
|
|
|
Qt/StringUtils.cpp
|
|
|
|
Qt/WebContentView.cpp
|
|
|
|
Qt/ladybird.qrc
|
|
|
|
Qt/main.cpp
|
|
|
|
)
|
|
|
|
target_link_libraries(ladybird PRIVATE Qt::Core Qt::Gui Qt::Network Qt::Widgets)
|
2023-08-20 20:14:31 +00:00
|
|
|
elseif (APPLE)
|
|
|
|
add_executable(ladybird MACOSX_BUNDLE
|
|
|
|
${SOURCES}
|
|
|
|
AppKit/main.mm
|
|
|
|
AppKit/Application/Application.mm
|
2024-04-15 23:39:48 +00:00
|
|
|
AppKit/Application/ApplicationBridge.cpp
|
2023-08-20 20:14:31 +00:00
|
|
|
AppKit/Application/ApplicationDelegate.mm
|
|
|
|
AppKit/Application/EventLoopImplementation.mm
|
|
|
|
AppKit/UI/Event.mm
|
2023-09-13 18:55:34 +00:00
|
|
|
AppKit/UI/Inspector.mm
|
|
|
|
AppKit/UI/InspectorController.mm
|
2023-08-20 20:14:31 +00:00
|
|
|
AppKit/UI/LadybirdWebView.mm
|
|
|
|
AppKit/UI/LadybirdWebViewBridge.cpp
|
2023-08-27 03:12:30 +00:00
|
|
|
AppKit/UI/Palette.mm
|
2024-05-30 17:35:10 +00:00
|
|
|
AppKit/UI/SearchPanel.mm
|
2023-08-20 20:14:31 +00:00
|
|
|
AppKit/UI/Tab.mm
|
|
|
|
AppKit/UI/TabController.mm
|
2024-04-10 02:35:20 +00:00
|
|
|
AppKit/UI/TaskManager.mm
|
|
|
|
AppKit/UI/TaskManagerController.mm
|
2023-08-20 20:14:31 +00:00
|
|
|
AppKit/Utilities/Conversions.mm
|
|
|
|
)
|
|
|
|
target_include_directories(ladybird PRIVATE AppKit)
|
2024-03-15 02:45:28 +00:00
|
|
|
target_link_libraries(ladybird PRIVATE "-framework Cocoa -framework UniformTypeIdentifiers" LibUnicode)
|
2023-08-20 20:14:31 +00:00
|
|
|
target_compile_options(ladybird PRIVATE
|
|
|
|
-fobjc-arc
|
|
|
|
-Wno-deprecated-anon-enum-enum-conversion # Required for CGImageCreate
|
|
|
|
)
|
2023-09-02 15:30:21 +00:00
|
|
|
elseif(ANDROID)
|
|
|
|
add_library(ladybird SHARED
|
|
|
|
${SOURCES}
|
|
|
|
Android/src/main/cpp/LadybirdActivity.cpp
|
|
|
|
Android/src/main/cpp/WebViewImplementationNative.cpp
|
2023-09-15 18:35:20 +00:00
|
|
|
Android/src/main/cpp/WebViewImplementationNativeJNI.cpp
|
2023-09-09 04:12:42 +00:00
|
|
|
Android/src/main/cpp/ALooperEventLoopImplementation.cpp
|
|
|
|
Android/src/main/cpp/TimerExecutorService.cpp
|
2023-09-24 05:05:15 +00:00
|
|
|
Android/src/main/cpp/JNIHelpers.cpp
|
2023-09-02 15:30:21 +00:00
|
|
|
)
|
2023-09-15 18:35:20 +00:00
|
|
|
target_link_libraries(ladybird PRIVATE LibArchive jnigraphics android)
|
2023-08-08 01:42:06 +00:00
|
|
|
else()
|
|
|
|
# TODO: Check for other GUI frameworks here when we move them in-tree
|
|
|
|
# For now, we can export a static library of common files for chromes to link to
|
|
|
|
add_library(ladybird STATIC ${SOURCES})
|
|
|
|
endif()
|
2023-08-20 20:14:31 +00:00
|
|
|
|
2024-04-04 20:10:08 +00:00
|
|
|
if (APPLE)
|
|
|
|
target_sources(ladybird PRIVATE MachPortServer.cpp)
|
|
|
|
target_link_libraries(ladybird PRIVATE LibThreading)
|
|
|
|
endif()
|
|
|
|
|
2023-08-08 04:14:22 +00:00
|
|
|
target_sources(ladybird PUBLIC FILE_SET ladybird TYPE HEADERS
|
2024-06-03 12:40:19 +00:00
|
|
|
BASE_DIRS ${LADYBIRD_SOURCE_DIR}
|
2023-08-08 04:14:22 +00:00
|
|
|
FILES ${LADYBIRD_HEADERS}
|
|
|
|
)
|
2024-04-22 16:31:29 +00:00
|
|
|
target_link_libraries(ladybird PRIVATE AK LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibJS LibMain LibSQL LibWeb LibWebView LibProtocol LibURL)
|
2022-07-04 11:45:18 +00:00
|
|
|
|
2022-10-05 13:23:41 +00:00
|
|
|
target_include_directories(ladybird PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
2024-06-03 12:40:19 +00:00
|
|
|
target_include_directories(ladybird PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/)
|
|
|
|
target_include_directories(ladybird PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/Services/)
|
2022-10-05 13:23:41 +00:00
|
|
|
|
2024-02-24 00:02:17 +00:00
|
|
|
function(set_helper_process_properties)
|
|
|
|
set(targets ${ARGV})
|
2024-02-21 23:16:15 +00:00
|
|
|
if (APPLE)
|
|
|
|
# Store helper processes in the same bundle directory as the main application
|
2024-02-24 00:02:17 +00:00
|
|
|
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:ladybird>")
|
|
|
|
else()
|
2024-02-25 05:01:17 +00:00
|
|
|
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_LIBEXECDIR}")
|
2024-02-24 00:02:17 +00:00
|
|
|
|
|
|
|
if (NOT CMAKE_INSTALL_LIBEXECDIR STREQUAL "libexec")
|
|
|
|
set_source_files_properties(Utilities.cpp PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
|
|
|
set_source_files_properties(Utilities.cpp TARGET_DIRECTORY ${targets} PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
|
|
|
endif()
|
2024-02-21 23:16:15 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2023-08-05 16:42:26 +00:00
|
|
|
add_executable(headless-browser
|
2024-06-03 12:40:19 +00:00
|
|
|
${LADYBIRD_SOURCE_DIR}/Userland/Utilities/headless-browser.cpp
|
2023-03-12 16:38:15 +00:00
|
|
|
HelperProcess.cpp
|
|
|
|
Utilities.cpp)
|
|
|
|
|
|
|
|
target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
2024-06-03 12:40:19 +00:00
|
|
|
target_include_directories(headless-browser PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/)
|
2024-06-04 06:00:13 +00:00
|
|
|
target_link_libraries(headless-browser PRIVATE AK LibCore LibWeb LibWebView LibWebSocket LibCrypto LibFileSystem LibHTTP LibImageDecoderClient LibJS LibGfx LibMain LibSQL LibTLS LibIPC LibDiff LibProtocol LibURL)
|
2023-03-12 16:38:15 +00:00
|
|
|
|
2022-07-11 07:14:53 +00:00
|
|
|
if (ANDROID)
|
|
|
|
include(cmake/AndroidExtras.cmake)
|
|
|
|
endif()
|
|
|
|
|
2024-06-03 19:24:20 +00:00
|
|
|
add_custom_target(run-ladybird
|
2024-06-03 12:40:19 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" "$<TARGET_FILE:ladybird>" $ENV{LAGOM_ARGS}
|
2022-07-04 11:45:18 +00:00
|
|
|
USES_TERMINAL
|
2023-01-26 11:51:48 +00:00
|
|
|
VERBATIM
|
2022-07-04 11:45:18 +00:00
|
|
|
)
|
|
|
|
|
2024-06-03 19:24:20 +00:00
|
|
|
add_custom_target(debug-ladybird
|
2024-06-03 12:40:19 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" gdb -ex "set follow-fork-mode child" "$<TARGET_FILE:ladybird>"
|
2022-07-04 11:45:18 +00:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2023-09-08 10:30:50 +00:00
|
|
|
add_subdirectory(ImageDecoder)
|
|
|
|
add_subdirectory(RequestServer)
|
2022-12-05 18:09:42 +00:00
|
|
|
add_subdirectory(SQLServer)
|
2022-10-07 23:08:29 +00:00
|
|
|
add_subdirectory(WebContent)
|
2022-11-14 17:09:14 +00:00
|
|
|
add_subdirectory(WebDriver)
|
2023-11-08 18:47:41 +00:00
|
|
|
add_subdirectory(WebWorker)
|
2024-02-21 23:16:15 +00:00
|
|
|
|
2024-03-16 18:52:20 +00:00
|
|
|
set(ladybird_helper_processes ImageDecoder RequestServer SQLServer WebContent WebWorker)
|
|
|
|
|
2024-02-21 23:16:15 +00:00
|
|
|
add_dependencies(ladybird ${ladybird_helper_processes})
|
2024-03-16 18:52:20 +00:00
|
|
|
add_dependencies(headless-browser ${ladybird_helper_processes})
|
|
|
|
add_dependencies(WebDriver ladybird headless-browser)
|
2023-03-26 15:53:32 +00:00
|
|
|
|
2023-08-14 19:08:14 +00:00
|
|
|
function(create_ladybird_bundle target_name)
|
|
|
|
set_target_properties(${target_name} PROPERTIES
|
2023-09-03 14:16:49 +00:00
|
|
|
OUTPUT_NAME "Ladybird"
|
2023-08-14 19:08:14 +00:00
|
|
|
MACOSX_BUNDLE_GUI_IDENTIFIER org.SerenityOS.Ladybird
|
|
|
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
|
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
2024-06-03 12:40:19 +00:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST "${LADYBIRD_SOURCE_DIR}/Ladybird/Info.plist"
|
2023-08-14 19:08:14 +00:00
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.SerenityOS.Ladybird
|
2023-03-26 15:53:32 +00:00
|
|
|
)
|
2023-08-14 19:08:14 +00:00
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set(bundle_dir "$<TARGET_BUNDLE_DIR:${target_name}>")
|
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD
|
2024-02-22 01:11:45 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory "${bundle_dir}/Contents/Resources"
|
2024-06-03 12:40:19 +00:00
|
|
|
COMMAND "iconutil" --convert icns "${LADYBIRD_SOURCE_DIR}/Ladybird/Icons/macos/app_icon.iconset" --output "${bundle_dir}/Contents/Resources/app_icon.icns"
|
2023-08-14 19:08:14 +00:00
|
|
|
)
|
2024-06-03 19:24:20 +00:00
|
|
|
|
|
|
|
# Note: This symlink is removed in the install commands
|
|
|
|
# This makes the bundle in the build directory *NOT* relocatable
|
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" "${bundle_dir}/Contents/lib"
|
|
|
|
)
|
2023-08-14 19:08:14 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2023-08-20 20:14:31 +00:00
|
|
|
create_ladybird_bundle(ladybird)
|
2024-02-24 00:02:17 +00:00
|
|
|
set_helper_process_properties(${ladybird_helper_processes})
|
2024-03-16 18:52:20 +00:00
|
|
|
if (APPLE)
|
|
|
|
set_helper_process_properties(headless-browser WebDriver)
|
|
|
|
endif()
|
2022-10-07 23:08:29 +00:00
|
|
|
|
2024-02-22 01:11:45 +00:00
|
|
|
include(cmake/ResourceFiles.cmake)
|
2024-02-25 05:01:17 +00:00
|
|
|
set(resource_base_dir "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_DATADIR}/Lagom")
|
2024-02-22 01:11:45 +00:00
|
|
|
if (APPLE)
|
|
|
|
set(resource_base_dir "$<TARGET_BUNDLE_DIR:ladybird>/Contents/Resources")
|
|
|
|
endif()
|
|
|
|
copy_resources_to_build(${resource_base_dir} ladybird)
|
|
|
|
|
2022-09-16 10:08:24 +00:00
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
|
|
|
include(cmake/InstallRules.cmake)
|
|
|
|
endif()
|
2023-03-10 17:45:50 +00:00
|
|
|
|
|
|
|
if (BUILD_TESTING)
|
|
|
|
add_test(
|
2023-05-27 17:46:17 +00:00
|
|
|
NAME LibWeb
|
2024-06-03 12:40:19 +00:00
|
|
|
COMMAND $<TARGET_FILE:headless-browser> --resources "${resource_base_dir}" --run-tests ${LADYBIRD_SOURCE_DIR}/Tests/LibWeb --dump-failed-ref-tests
|
2023-03-10 17:45:50 +00:00
|
|
|
)
|
2023-08-19 19:46:26 +00:00
|
|
|
add_test(
|
|
|
|
NAME WPT
|
|
|
|
CONFIGURATIONS Integration
|
2024-06-03 19:24:20 +00:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../Tests/LibWeb/WPT/run.sh --webdriver-binary=$<TARGET_FILE:WebDriver>
|
2023-08-19 19:46:26 +00:00
|
|
|
)
|
|
|
|
set_tests_properties(LibWeb WPT PROPERTIES
|
|
|
|
DEPENDS ladybird
|
|
|
|
ENVIRONMENT QT_QPA_PLATFORM=offscreen
|
2024-06-03 12:40:19 +00:00
|
|
|
ENVIRONMENT "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}"
|
2023-08-19 19:46:26 +00:00
|
|
|
)
|
2023-03-10 17:45:50 +00:00
|
|
|
endif()
|