2022-07-04 07:45:18 -04:00
|
|
|
|
|
|
|
set(SOURCES
|
2023-02-02 05:00:30 -05:00
|
|
|
HelperProcess.cpp
|
2022-09-19 05:06:23 -04:00
|
|
|
Utilities.cpp
|
2022-07-04 07:45:18 -04:00
|
|
|
)
|
2023-08-08 00:14:22 -04:00
|
|
|
set(LADYBIRD_HEADERS
|
|
|
|
HelperProcess.h
|
|
|
|
Types.h
|
|
|
|
Utilities.h
|
|
|
|
)
|
2022-07-04 07:45:18 -04:00
|
|
|
|
2023-08-07 21:42:06 -04:00
|
|
|
if (ENABLE_QT)
|
|
|
|
qt_add_executable(ladybird ${SOURCES})
|
|
|
|
target_sources(ladybird PRIVATE
|
2024-04-12 17:15:09 -04:00
|
|
|
Qt/Application.cpp
|
2023-05-30 21:44:16 -04:00
|
|
|
Qt/AutoComplete.cpp
|
2023-08-07 21:42:06 -04:00
|
|
|
Qt/BrowserWindow.cpp
|
|
|
|
Qt/EventLoopImplementationQt.cpp
|
|
|
|
Qt/EventLoopImplementationQtEventTarget.cpp
|
2024-05-29 15:12:21 -04:00
|
|
|
Qt/FindInPageWidget.cpp
|
2023-11-05 07:45:43 -05:00
|
|
|
Qt/Icon.cpp
|
2023-08-07 21:42:06 -04:00
|
|
|
Qt/InspectorWidget.cpp
|
|
|
|
Qt/LocationEdit.cpp
|
|
|
|
Qt/Settings.cpp
|
|
|
|
Qt/SettingsDialog.cpp
|
|
|
|
Qt/Tab.cpp
|
2024-04-02 21:24:17 -04:00
|
|
|
Qt/TabBar.cpp
|
2024-03-26 13:38:12 -04:00
|
|
|
Qt/TaskManagerWindow.cpp
|
2023-08-07 21:42:06 -04: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 16:14:31 -04:00
|
|
|
elseif (APPLE)
|
|
|
|
add_executable(ladybird MACOSX_BUNDLE
|
|
|
|
${SOURCES}
|
|
|
|
AppKit/main.mm
|
|
|
|
AppKit/Application/Application.mm
|
2024-04-15 19:39:48 -04:00
|
|
|
AppKit/Application/ApplicationBridge.cpp
|
2023-08-20 16:14:31 -04:00
|
|
|
AppKit/Application/ApplicationDelegate.mm
|
|
|
|
AppKit/Application/EventLoopImplementation.mm
|
|
|
|
AppKit/UI/Event.mm
|
2023-09-13 14:55:34 -04:00
|
|
|
AppKit/UI/Inspector.mm
|
|
|
|
AppKit/UI/InspectorController.mm
|
2023-08-20 16:14:31 -04:00
|
|
|
AppKit/UI/LadybirdWebView.mm
|
|
|
|
AppKit/UI/LadybirdWebViewBridge.cpp
|
2023-08-26 23:12:30 -04:00
|
|
|
AppKit/UI/Palette.mm
|
2024-05-30 13:35:10 -04:00
|
|
|
AppKit/UI/SearchPanel.mm
|
2023-08-20 16:14:31 -04:00
|
|
|
AppKit/UI/Tab.mm
|
|
|
|
AppKit/UI/TabController.mm
|
2024-04-09 22:35:20 -04:00
|
|
|
AppKit/UI/TaskManager.mm
|
|
|
|
AppKit/UI/TaskManagerController.mm
|
2023-08-20 16:14:31 -04:00
|
|
|
AppKit/Utilities/Conversions.mm
|
|
|
|
)
|
|
|
|
target_include_directories(ladybird PRIVATE AppKit)
|
2024-03-14 22:45:28 -04:00
|
|
|
target_link_libraries(ladybird PRIVATE "-framework Cocoa -framework UniformTypeIdentifiers" LibUnicode)
|
2023-08-20 16:14:31 -04:00
|
|
|
target_compile_options(ladybird PRIVATE
|
|
|
|
-fobjc-arc
|
|
|
|
-Wno-deprecated-anon-enum-enum-conversion # Required for CGImageCreate
|
|
|
|
)
|
2023-09-02 11:30:21 -04:00
|
|
|
elseif(ANDROID)
|
|
|
|
add_library(ladybird SHARED
|
|
|
|
${SOURCES}
|
|
|
|
Android/src/main/cpp/LadybirdActivity.cpp
|
|
|
|
Android/src/main/cpp/WebViewImplementationNative.cpp
|
2023-09-15 14:35:20 -04:00
|
|
|
Android/src/main/cpp/WebViewImplementationNativeJNI.cpp
|
2023-09-09 00:12:42 -04:00
|
|
|
Android/src/main/cpp/ALooperEventLoopImplementation.cpp
|
|
|
|
Android/src/main/cpp/TimerExecutorService.cpp
|
2023-09-24 01:05:15 -04:00
|
|
|
Android/src/main/cpp/JNIHelpers.cpp
|
2023-09-02 11:30:21 -04:00
|
|
|
)
|
2023-09-15 14:35:20 -04:00
|
|
|
target_link_libraries(ladybird PRIVATE LibArchive jnigraphics android)
|
2023-08-07 21:42:06 -04: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 16:14:31 -04:00
|
|
|
|
2024-04-04 16:10:08 -04:00
|
|
|
if (APPLE)
|
|
|
|
target_sources(ladybird PRIVATE MachPortServer.cpp)
|
|
|
|
target_link_libraries(ladybird PRIVATE LibThreading)
|
|
|
|
endif()
|
|
|
|
|
2023-08-08 00:14:22 -04:00
|
|
|
target_sources(ladybird PUBLIC FILE_SET ladybird TYPE HEADERS
|
2024-06-03 08:40:19 -04:00
|
|
|
BASE_DIRS ${LADYBIRD_SOURCE_DIR}
|
2023-08-08 00:14:22 -04:00
|
|
|
FILES ${LADYBIRD_HEADERS}
|
|
|
|
)
|
2024-04-22 12:31:29 -04:00
|
|
|
target_link_libraries(ladybird PRIVATE AK LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibJS LibMain LibSQL LibWeb LibWebView LibProtocol LibURL)
|
2022-07-04 07:45:18 -04:00
|
|
|
|
2022-10-05 09:23:41 -04:00
|
|
|
target_include_directories(ladybird PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
2024-06-03 08:40:19 -04:00
|
|
|
target_include_directories(ladybird PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/)
|
|
|
|
target_include_directories(ladybird PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/Services/)
|
2022-10-05 09:23:41 -04:00
|
|
|
|
2024-02-23 19:02:17 -05:00
|
|
|
function(set_helper_process_properties)
|
|
|
|
set(targets ${ARGV})
|
2024-02-21 18:16:15 -05:00
|
|
|
if (APPLE)
|
|
|
|
# Store helper processes in the same bundle directory as the main application
|
2024-02-23 19:02:17 -05:00
|
|
|
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:ladybird>")
|
|
|
|
else()
|
2024-02-25 00:01:17 -05:00
|
|
|
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_LIBEXECDIR}")
|
2024-02-23 19:02:17 -05: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 18:16:15 -05:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2023-08-05 12:42:26 -04:00
|
|
|
add_executable(headless-browser
|
2024-06-03 08:40:19 -04:00
|
|
|
${LADYBIRD_SOURCE_DIR}/Userland/Utilities/headless-browser.cpp
|
2023-03-12 12:38:15 -04:00
|
|
|
HelperProcess.cpp
|
|
|
|
Utilities.cpp)
|
|
|
|
|
|
|
|
target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
2024-06-03 08:40:19 -04:00
|
|
|
target_include_directories(headless-browser PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/)
|
2024-06-04 02:00:13 -04: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 12:38:15 -04:00
|
|
|
|
2022-07-11 03:14:53 -04:00
|
|
|
if (ANDROID)
|
|
|
|
include(cmake/AndroidExtras.cmake)
|
|
|
|
endif()
|
|
|
|
|
2024-06-03 15:24:20 -04:00
|
|
|
add_custom_target(run-ladybird
|
2024-06-03 08:40:19 -04:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" "$<TARGET_FILE:ladybird>" $ENV{LAGOM_ARGS}
|
2022-07-04 07:45:18 -04:00
|
|
|
USES_TERMINAL
|
2023-01-26 06:51:48 -05:00
|
|
|
VERBATIM
|
2022-07-04 07:45:18 -04:00
|
|
|
)
|
|
|
|
|
2024-06-03 15:24:20 -04:00
|
|
|
add_custom_target(debug-ladybird
|
2024-06-03 08:40:19 -04: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 07:45:18 -04:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2023-09-08 06:30:50 -04:00
|
|
|
add_subdirectory(ImageDecoder)
|
|
|
|
add_subdirectory(RequestServer)
|
2022-12-05 13:09:42 -05:00
|
|
|
add_subdirectory(SQLServer)
|
2022-10-07 19:08:29 -04:00
|
|
|
add_subdirectory(WebContent)
|
2022-11-14 12:09:14 -05:00
|
|
|
add_subdirectory(WebDriver)
|
2023-11-08 13:47:41 -05:00
|
|
|
add_subdirectory(WebWorker)
|
2024-02-21 18:16:15 -05:00
|
|
|
|
2024-03-16 14:52:20 -04:00
|
|
|
set(ladybird_helper_processes ImageDecoder RequestServer SQLServer WebContent WebWorker)
|
|
|
|
|
2024-02-21 18:16:15 -05:00
|
|
|
add_dependencies(ladybird ${ladybird_helper_processes})
|
2024-03-16 14:52:20 -04:00
|
|
|
add_dependencies(headless-browser ${ladybird_helper_processes})
|
|
|
|
add_dependencies(WebDriver ladybird headless-browser)
|
2023-03-26 11:53:32 -04:00
|
|
|
|
2023-08-14 15:08:14 -04:00
|
|
|
function(create_ladybird_bundle target_name)
|
|
|
|
set_target_properties(${target_name} PROPERTIES
|
2023-09-03 10:16:49 -04:00
|
|
|
OUTPUT_NAME "Ladybird"
|
2023-08-14 15:08:14 -04: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 08:40:19 -04:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST "${LADYBIRD_SOURCE_DIR}/Ladybird/Info.plist"
|
2023-08-14 15:08:14 -04:00
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.SerenityOS.Ladybird
|
2023-03-26 11:53:32 -04:00
|
|
|
)
|
2023-08-14 15:08:14 -04:00
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set(bundle_dir "$<TARGET_BUNDLE_DIR:${target_name}>")
|
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD
|
2024-02-21 20:11:45 -05:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory "${bundle_dir}/Contents/Resources"
|
2024-06-03 08:40:19 -04: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 15:08:14 -04:00
|
|
|
)
|
2024-06-03 15:24:20 -04: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 15:08:14 -04:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2023-08-20 16:14:31 -04:00
|
|
|
create_ladybird_bundle(ladybird)
|
2024-02-23 19:02:17 -05:00
|
|
|
set_helper_process_properties(${ladybird_helper_processes})
|
2024-03-16 14:52:20 -04:00
|
|
|
if (APPLE)
|
|
|
|
set_helper_process_properties(headless-browser WebDriver)
|
|
|
|
endif()
|
2022-10-07 19:08:29 -04:00
|
|
|
|
2024-02-21 20:11:45 -05:00
|
|
|
include(cmake/ResourceFiles.cmake)
|
2024-02-25 00:01:17 -05:00
|
|
|
set(resource_base_dir "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_DATADIR}/Lagom")
|
2024-02-21 20:11:45 -05: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 06:08:24 -04:00
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
|
|
|
include(cmake/InstallRules.cmake)
|
|
|
|
endif()
|
2023-03-10 12:45:50 -05:00
|
|
|
|
|
|
|
if (BUILD_TESTING)
|
|
|
|
add_test(
|
2023-05-27 13:46:17 -04:00
|
|
|
NAME LibWeb
|
2024-06-03 08:40:19 -04:00
|
|
|
COMMAND $<TARGET_FILE:headless-browser> --resources "${resource_base_dir}" --run-tests ${LADYBIRD_SOURCE_DIR}/Tests/LibWeb --dump-failed-ref-tests
|
2023-03-10 12:45:50 -05:00
|
|
|
)
|
2023-08-19 15:46:26 -04:00
|
|
|
add_test(
|
|
|
|
NAME WPT
|
|
|
|
CONFIGURATIONS Integration
|
2024-06-03 15:24:20 -04:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../Tests/LibWeb/WPT/run.sh --webdriver-binary=$<TARGET_FILE:WebDriver>
|
2023-08-19 15:46:26 -04:00
|
|
|
)
|
|
|
|
set_tests_properties(LibWeb WPT PROPERTIES
|
|
|
|
DEPENDS ladybird
|
|
|
|
ENVIRONMENT QT_QPA_PLATFORM=offscreen
|
2024-06-03 08:40:19 -04:00
|
|
|
ENVIRONMENT "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}"
|
2023-08-19 15:46:26 -04:00
|
|
|
)
|
2023-03-10 12:45:50 -05:00
|
|
|
endif()
|