2022-07-04 11:45:18 +00:00
|
|
|
|
2024-06-04 20:00:26 +00:00
|
|
|
set(LADYBIRD_SOURCES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/HelperProcess.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/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
|
|
|
|
2024-06-04 20:00:26 +00:00
|
|
|
function(create_ladybird_bundle target_name)
|
|
|
|
set_target_properties(${target_name} PROPERTIES
|
|
|
|
OUTPUT_NAME "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 "${LADYBIRD_SOURCE_DIR}/Ladybird/Info.plist"
|
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.SerenityOS.Ladybird
|
2023-08-08 01:42:06 +00:00
|
|
|
)
|
2024-06-04 20:00:26 +00:00
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set(bundle_dir "$<TARGET_BUNDLE_DIR:${target_name}>")
|
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory "${bundle_dir}/Contents/Resources"
|
|
|
|
COMMAND "iconutil" --convert icns "${LADYBIRD_SOURCE_DIR}/Ladybird/Icons/macos/app_icon.iconset" --output "${bundle_dir}/Contents/Resources/app_icon.icns"
|
|
|
|
)
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Select UI Framework
|
|
|
|
if (ENABLE_QT)
|
|
|
|
add_subdirectory(Qt)
|
2023-08-20 20:14:31 +00:00
|
|
|
elseif (APPLE)
|
2024-06-04 20:00:26 +00:00
|
|
|
add_subdirectory(AppKit)
|
2023-09-02 15:30:21 +00:00
|
|
|
elseif(ANDROID)
|
2024-06-04 20:00:26 +00:00
|
|
|
add_subdirectory(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
|
2024-06-04 20:00:26 +00:00
|
|
|
add_library(ladybird STATIC ${LADYBIRD_SOURCES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT TARGET ladybird)
|
|
|
|
message(FATAL_ERROR "UI Framework selection must declare a ladybird target")
|
2023-08-08 01:42:06 +00:00
|
|
|
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}")
|
2024-06-04 20:00:26 +00:00
|
|
|
set_source_files_properties(Utilities.cpp TARGET_DIRECTORY ladybird PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
2024-02-24 00:02:17 +00:00
|
|
|
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
|
2024-06-04 20:00:26 +00:00
|
|
|
${LADYBIRD_SOURCES})
|
2023-03-12 16:38:15 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2024-06-04 23:07:04 +00:00
|
|
|
add_custom_target(run
|
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
|
|
|
|
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()
|