2024-06-05 19:04:21 +00:00
|
|
|
include(cmake/ResourceFiles.cmake)
|
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
|
|
|
|
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"
|
2024-07-20 14:42:26 +00:00
|
|
|
MACOSX_BUNDLE_GUI_IDENTIFIER org.ladybird.Ladybird
|
2024-06-04 20:00:26 +00:00
|
|
|
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
|
2024-07-20 14:42:26 +00:00
|
|
|
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.ladybird.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"
|
|
|
|
)
|
2024-06-30 02:06:23 +00:00
|
|
|
|
2024-10-12 03:03:52 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo" AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
|
2024-06-30 02:06:23 +00:00
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD
|
|
|
|
COMMAND codesign -s - -v -f --entitlements "${LADYBIRD_SOURCE_DIR}/Meta/debug.plist" "${bundle_dir}"
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_custom_target(apply-debug-entitlements
|
|
|
|
COMMAND codesign -s - -v -f --entitlements "${LADYBIRD_SOURCE_DIR}/Meta/debug.plist" "${bundle_dir}"
|
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
endif()
|
2024-06-04 20:00:26 +00:00
|
|
|
endif()
|
2024-06-05 19:04:21 +00:00
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set(resource_base_dir "$<TARGET_BUNDLE_DIR:${target_name}>/Contents/Resources")
|
|
|
|
else()
|
|
|
|
set(resource_base_dir "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_DATADIR}/Lagom")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
copy_resources_to_build(${resource_base_dir} ${target_name})
|
2024-06-04 20:00:26 +00:00
|
|
|
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()
|
|
|
|
|
2024-07-20 17:03:24 +00:00
|
|
|
if (ENABLE_INSTALL_HEADERS)
|
|
|
|
target_sources(ladybird PUBLIC FILE_SET ladybird TYPE HEADERS
|
|
|
|
BASE_DIRS ${LADYBIRD_SOURCE_DIR}
|
|
|
|
FILES ${LADYBIRD_HEADERS}
|
|
|
|
)
|
|
|
|
endif()
|
2022-07-04 11:45:18 +00:00
|
|
|
|
2024-07-22 15:09:25 +00:00
|
|
|
if (TARGET ladybird_impl)
|
|
|
|
set(LADYBIRD_TARGET ladybird_impl PUBLIC)
|
|
|
|
else()
|
|
|
|
set(LADYBIRD_TARGET ladybird PRIVATE)
|
|
|
|
endif()
|
|
|
|
|
2024-10-10 15:05:10 +00:00
|
|
|
set(LADYBIRD_LIBS AK LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibJS LibMain LibWeb LibWebView LibRequests LibURL)
|
|
|
|
target_link_libraries(${LADYBIRD_TARGET} PRIVATE ${LADYBIRD_LIBS})
|
2024-07-22 15:09:25 +00:00
|
|
|
|
|
|
|
target_include_directories(${LADYBIRD_TARGET} ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
target_include_directories(${LADYBIRD_TARGET} ${LADYBIRD_SOURCE_DIR}/Userland/)
|
|
|
|
target_include_directories(${LADYBIRD_TARGET} ${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()
|
|
|
|
|
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-30 02:05:33 +00:00
|
|
|
if (APPLE)
|
|
|
|
add_custom_target(debug-ladybird
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" lldb "$<TARGET_BUNDLE_DIR:ladybird>"
|
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_custom_target(debug-ladybird
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" gdb "$<TARGET_FILE:ladybird>"
|
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
endif()
|
2022-07-04 11:45:18 +00:00
|
|
|
|
2024-10-10 15:05:10 +00:00
|
|
|
add_subdirectory(Headless)
|
2024-02-21 23:16:15 +00:00
|
|
|
|
2024-06-04 20:40:48 +00:00
|
|
|
set(ladybird_helper_processes ImageDecoder RequestServer WebContent WebWorker)
|
2024-03-16 18:52:20 +00:00
|
|
|
|
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
|
|
|
|
2022-09-16 10:08:24 +00:00
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
|
|
|
include(cmake/InstallRules.cmake)
|
|
|
|
endif()
|