diff options
author | Andrew Kaster <akaster@serenityos.org> | 2022-10-13 20:14:36 -0600 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-16 16:36:39 +0200 |
commit | 1ae0cfd08b90bb0c2260ebb48a55b5b8b3d7eada (patch) | |
tree | cb03f0ba7397a0deee929190022c895317e30bed /Meta | |
parent | a01c0e81f32df9cdcc2a48ab77b2fdd191264b63 (diff) | |
download | serenity-1ae0cfd08b90bb0c2260ebb48a55b5b8b3d7eada.zip |
CMake+Userland: Use CMakeLists from Userland to build Lagom Libraries
Also do this for Shell.
This greatly simplifies the CMakeLists in Lagom, replacing many glob
patterns with a big list of libraries. There are still a few special
libraries that need some help to conform to the pattern, like LibELF and
LibWebView.
It also lets us remove essentially all of the Serenity or Lagom binary
directory detection logic from code generators, as now both projects
directories enter the generator logic from the same place.
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/CMake/libweb_generators.cmake | 132 | ||||
-rw-r--r-- | Meta/CMake/locale_data.cmake | 51 | ||||
-rw-r--r-- | Meta/CMake/unicode_data.cmake | 26 | ||||
-rw-r--r-- | Meta/CMake/utils.cmake | 2 | ||||
-rw-r--r-- | Meta/Lagom/CMakeLists.txt | 376 |
5 files changed, 161 insertions, 426 deletions
diff --git a/Meta/CMake/libweb_generators.cmake b/Meta/CMake/libweb_generators.cmake index cce8ce7c33..9d8b191d0f 100644 --- a/Meta/CMake/libweb_generators.cmake +++ b/Meta/CMake/libweb_generators.cmake @@ -1,24 +1,12 @@ function (generate_css_implementation) - - if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibWeb") - # Serenity build - SET(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}") - SET(LIBWEB_OUTPUT_FOLDER "") - SET(LIBWEB_META_PREFIX "") - else() - # Lagom Build - SET(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibWeb") - SET(LIBWEB_OUTPUT_FOLDER "LibWeb/") - SET(LIBWEB_META_PREFIX "Lagom") - endif() - + set(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}") invoke_generator( "Enums.cpp" Lagom::GenerateCSSEnums "${LIBWEB_INPUT_FOLDER}/CSS/Enums.json" - "${LIBWEB_META_PREFIX}" - "${LIBWEB_OUTPUT_FOLDER}CSS/Enums.h" - "${LIBWEB_OUTPUT_FOLDER}CSS/Enums.cpp" + "" + "CSS/Enums.h" + "CSS/Enums.cpp" arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Enums.json" ) @@ -26,9 +14,9 @@ function (generate_css_implementation) "MediaFeatureID.cpp" Lagom::GenerateCSSMediaFeatureID "${LIBWEB_INPUT_FOLDER}/CSS/MediaFeatures.json" - "${LIBWEB_META_PREFIX}" - "${LIBWEB_OUTPUT_FOLDER}CSS/MediaFeatureID.h" - "${LIBWEB_OUTPUT_FOLDER}CSS/MediaFeatureID.cpp" + "" + "CSS/MediaFeatureID.h" + "CSS/MediaFeatureID.cpp" arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/MediaFeatures.json" ) @@ -36,9 +24,9 @@ function (generate_css_implementation) "PropertyID.cpp" Lagom::GenerateCSSPropertyID "${LIBWEB_INPUT_FOLDER}/CSS/Properties.json" - "${LIBWEB_META_PREFIX}" - "${LIBWEB_OUTPUT_FOLDER}CSS/PropertyID.h" - "${LIBWEB_OUTPUT_FOLDER}CSS/PropertyID.cpp" + "" + "CSS/PropertyID.h" + "CSS/PropertyID.cpp" arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Properties.json" ) @@ -46,9 +34,9 @@ function (generate_css_implementation) "TransformFunctions.cpp" Lagom::GenerateCSSTransformFunctions "${LIBWEB_INPUT_FOLDER}/CSS/TransformFunctions.json" - "${LIBWEB_META_PREFIX}" - "${LIBWEB_OUTPUT_FOLDER}CSS/TransformFunctions.h" - "${LIBWEB_OUTPUT_FOLDER}CSS/TransformFunctions.cpp" + "" + "CSS/TransformFunctions.h" + "CSS/TransformFunctions.cpp" arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/TransformFunctions.json" ) @@ -56,62 +44,50 @@ function (generate_css_implementation) "ValueID.cpp" Lagom::GenerateCSSValueID "${LIBWEB_INPUT_FOLDER}/CSS/Identifiers.json" - "${LIBWEB_META_PREFIX}" - "${LIBWEB_OUTPUT_FOLDER}CSS/ValueID.h" - "${LIBWEB_OUTPUT_FOLDER}CSS/ValueID.cpp" + "" + "CSS/ValueID.h" + "CSS/ValueID.cpp" arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Identifiers.json" ) add_custom_command( - OUTPUT ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp - COMMAND "${CMAKE_COMMAND}" -E make_directory ${LIBWEB_OUTPUT_FOLDER}CSS - COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" default_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/Default.css" > ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp.tmp - COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp.tmp ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp - COMMAND "${CMAKE_COMMAND}" -E remove ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp.tmp + OUTPUT CSS/DefaultStyleSheetSource.cpp + COMMAND "${CMAKE_COMMAND}" -E make_directory CSS + COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" default_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/Default.css" > CSS/DefaultStyleSheetSource.cpp.tmp + COMMAND "${CMAKE_COMMAND}" -E copy_if_different CSS/DefaultStyleSheetSource.cpp.tmp CSS/DefaultStyleSheetSource.cpp + COMMAND "${CMAKE_COMMAND}" -E remove CSS/DefaultStyleSheetSource.cpp.tmp VERBATIM DEPENDS "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" - MAIN_DEPENDENCY ${LIBWEB_INPUT_FOLDER}/CSS/Default.css + MAIN_DEPENDENCY "${LIBWEB_INPUT_FOLDER}/CSS/Default.css" ) - add_custom_target(generate_${LIBWEB_META_PREFIX}DefaultStyleSheetSource.cpp DEPENDS ${LIBWEB_OUTPUT_FOLDER}CSS/DefaultStyleSheetSource.cpp) - add_dependencies(all_generated generate_${LIBWEB_META_PREFIX}DefaultStyleSheetSource.cpp) + add_custom_target(generate_DefaultStyleSheetSource.cpp DEPENDS CSS/DefaultStyleSheetSource.cpp) + add_dependencies(all_generated generate_DefaultStyleSheetSource.cpp) add_custom_command( - OUTPUT ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp - COMMAND "${CMAKE_COMMAND}" -E make_directory ${LIBWEB_OUTPUT_FOLDER}CSS - COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" quirks_mode_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/QuirksMode.css" > ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp.tmp - COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp.tmp ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp - COMMAND "${CMAKE_COMMAND}" -E remove ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp.tmp + OUTPUT CSS/QuirksModeStyleSheetSource.cpp + COMMAND "${CMAKE_COMMAND}" -E make_directory CSS + COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" quirks_mode_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/QuirksMode.css" > CSS/QuirksModeStyleSheetSource.cpp.tmp + COMMAND "${CMAKE_COMMAND}" -E copy_if_different CSS/QuirksModeStyleSheetSource.cpp.tmp CSS/QuirksModeStyleSheetSource.cpp + COMMAND "${CMAKE_COMMAND}" -E remove CSS/QuirksModeStyleSheetSource.cpp.tmp VERBATIM DEPENDS "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" - MAIN_DEPENDENCY ${LIBWEB_INPUT_FOLDER}/CSS/Default.css + MAIN_DEPENDENCY "${LIBWEB_INPUT_FOLDER}/CSS/Default.css" ) - add_custom_target(generate_${LIBWEB_META_PREFIX}QuirksModeStyleSheetSource.cpp DEPENDS ${LIBWEB_OUTPUT_FOLDER}CSS/QuirksModeStyleSheetSource.cpp) - add_dependencies(all_generated generate_${LIBWEB_META_PREFIX}QuirksModeStyleSheetSource.cpp) + add_custom_target(generate_QuirksModeStyleSheetSource.cpp DEPENDS CSS/QuirksModeStyleSheetSource.cpp) + add_dependencies(all_generated generate_QuirksModeStyleSheetSource.cpp) endfunction() function (generate_js_bindings target) - - if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibWeb") - # Serenity build - SET(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}") - SET(LIBWEB_OUTPUT_FOLDER "") - SET(LIBWEB_META_PREFIX "") - else() - # Lagom Build - SET(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibWeb") - SET(LIBWEB_OUTPUT_FOLDER "LibWeb/") - SET(LIBWEB_META_PREFIX "Lagom") - endif() - + set(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}") function(libweb_js_bindings class) cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_BINDINGS "ITERABLE" "" "") get_filename_component(basename "${class}" NAME) set(BINDINGS_SOURCES - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.h" - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.cpp" - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.h" - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.cpp" + "Bindings/${basename}Constructor.h" + "Bindings/${basename}Constructor.cpp" + "Bindings/${basename}Prototype.h" + "Bindings/${basename}Prototype.cpp" ) set(BINDINGS_TYPES constructor-header @@ -123,8 +99,8 @@ function (generate_js_bindings target) # FIXME: Instead of requiring a manual declaration of iterable bindings, we should ask BindingsGenerator if it's iterable if(LIBWEB_BINDINGS_ITERABLE) list(APPEND BINDINGS_SOURCES - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}IteratorPrototype.h" - "${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}IteratorPrototype.cpp" + "Bindings/${basename}IteratorPrototype.h" + "Bindings/${basename}IteratorPrototype.cpp" ) list(APPEND BINDINGS_TYPES iterator-prototype-header @@ -147,16 +123,16 @@ function (generate_js_bindings target) COMMAND "${CMAKE_COMMAND}" -E remove "${bindings_src}.tmp" VERBATIM DEPENDS Lagom::BindingsGenerator - MAIN_DEPENDENCY ${LIBWEB_INPUT_FOLDER}/${class}.idl + MAIN_DEPENDENCY ${class}.idl ) endforeach() - add_custom_target(generate_${basename}Constructor.h DEPENDS ${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.h) + add_custom_target(generate_${basename}Constructor.h DEPENDS Bindings/${basename}Constructor.h) add_dependencies(all_generated generate_${basename}Constructor.h) - add_custom_target(generate_${basename}Constructor.cpp DEPENDS ${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.cpp) + add_custom_target(generate_${basename}Constructor.cpp DEPENDS Bindings/${basename}Constructor.cpp) add_dependencies(all_generated generate_${basename}Constructor.cpp) - add_custom_target(generate_${basename}Prototype.h DEPENDS ${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.h) + add_custom_target(generate_${basename}Prototype.h DEPENDS Bindings/${basename}Prototype.h) add_dependencies(all_generated generate_${basename}Prototype.h) - add_custom_target(generate_${basename}Prototype.cpp DEPENDS ${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.cpp) + add_custom_target(generate_${basename}Prototype.cpp DEPENDS Bindings/${basename}Prototype.cpp) add_dependencies(all_generated generate_${basename}Prototype.cpp) list(APPEND LIBWEB_ALL_IDL_FILES "${LIBWEB_INPUT_FOLDER}/${class}.idl") @@ -167,27 +143,27 @@ function (generate_js_bindings target) set(exposed_interface_sources DedicatedWorkerExposedInterfaces.cpp DedicatedWorkerExposedInterfaces.h SharedWorkerExposedInterfaces.cpp SharedWorkerExposedInterfaces.h WindowExposedInterfaces.cpp WindowExposedInterfaces.h) - list(TRANSFORM exposed_interface_sources PREPEND "${LIBWEB_OUTPUT_FOLDER}Bindings/") + list(TRANSFORM exposed_interface_sources PREPEND "Bindings/") add_custom_command( OUTPUT ${exposed_interface_sources} COMMAND "${CMAKE_COMMAND}" -E make_directory "tmp" COMMAND $<TARGET_FILE:Lagom::GenerateWindowOrWorkerInterfaces> -o "${CMAKE_CURRENT_BINARY_DIR}/tmp" -b "${LIBWEB_INPUT_FOLDER}" ${LIBWEB_ALL_IDL_FILES} - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.h "${LIBWEB_OUTPUT_FOLDER}Bindings/DedicatedWorkerExposedInterfaces.h" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.cpp "${LIBWEB_OUTPUT_FOLDER}Bindings/DedicatedWorkerExposedInterfaces.cpp" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.h "${LIBWEB_OUTPUT_FOLDER}Bindings/SharedWorkerExposedInterfaces.h" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.cpp "${LIBWEB_OUTPUT_FOLDER}Bindings/SharedWorkerExposedInterfaces.cpp" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.h "${LIBWEB_OUTPUT_FOLDER}Bindings/WindowExposedInterfaces.h" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.cpp "${LIBWEB_OUTPUT_FOLDER}Bindings/WindowExposedInterfaces.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.h "Bindings/DedicatedWorkerExposedInterfaces.h" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.cpp "Bindings/DedicatedWorkerExposedInterfaces.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.h "Bindings/SharedWorkerExposedInterfaces.h" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.cpp "Bindings/SharedWorkerExposedInterfaces.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.h "Bindings/WindowExposedInterfaces.h" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.cpp "Bindings/WindowExposedInterfaces.cpp" COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/tmp" VERBATIM DEPENDS Lagom::GenerateWindowOrWorkerInterfaces ${LIBWEB_ALL_IDL_FILES} ) target_sources(${target} PRIVATE ${exposed_interface_sources}) - add_custom_target("generate_${LIBWEB_META_PREFIX}exposed_interfaces" DEPENDS ${exposed_interface_sources}) - add_dependencies(all_generated "generate_${LIBWEB_META_PREFIX}exposed_interfaces") + add_custom_target("generate_exposed_interfaces" DEPENDS ${exposed_interface_sources}) + add_dependencies(all_generated "generate_exposed_interfaces") endfunction() - include("${LIBWEB_INPUT_FOLDER}/idl_files.cmake") + include("idl_files.cmake") generate_exposed_interface_files() endfunction() diff --git a/Meta/CMake/locale_data.cmake b/Meta/CMake/locale_data.cmake index 376691807f..26fd91310e 100644 --- a/Meta/CMake/locale_data.cmake +++ b/Meta/CMake/locale_data.cmake @@ -40,47 +40,26 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_NUMBERS_SOURCE}/**" "${CLDR_NUMBERS_PATH}") extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_UNITS_SOURCE}/**" "${CLDR_UNITS_PATH}") - set(DATE_TIME_FORMAT_DATA_HEADER LibLocale/DateTimeFormatData.h) - set(DATE_TIME_FORMAT_DATA_IMPLEMENTATION LibLocale/DateTimeFormatData.cpp) + set(DATE_TIME_FORMAT_DATA_HEADER DateTimeFormatData.h) + set(DATE_TIME_FORMAT_DATA_IMPLEMENTATION DateTimeFormatData.cpp) - set(LOCALE_DATA_HEADER LibLocale/LocaleData.h) - set(LOCALE_DATA_IMPLEMENTATION LibLocale/LocaleData.cpp) + set(LOCALE_DATA_HEADER LocaleData.h) + set(LOCALE_DATA_IMPLEMENTATION LocaleData.cpp) - set(NUMBER_FORMAT_DATA_HEADER LibLocale/NumberFormatData.h) - set(NUMBER_FORMAT_DATA_IMPLEMENTATION LibLocale/NumberFormatData.cpp) + set(NUMBER_FORMAT_DATA_HEADER NumberFormatData.h) + set(NUMBER_FORMAT_DATA_IMPLEMENTATION NumberFormatData.cpp) - set(PLURAL_RULES_DATA_HEADER LibLocale/PluralRulesData.h) - set(PLURAL_RULES_DATA_IMPLEMENTATION LibLocale/PluralRulesData.cpp) + set(PLURAL_RULES_DATA_HEADER PluralRulesData.h) + set(PLURAL_RULES_DATA_IMPLEMENTATION PluralRulesData.cpp) - set(RELATIVE_TIME_FORMAT_DATA_HEADER LibLocale/RelativeTimeFormatData.h) - set(RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION LibLocale/RelativeTimeFormatData.cpp) - - set(LOCALE_META_TARGET_PREFIX LibLocale_) - - if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibLocale") # Serenity build. - set(DATE_TIME_FORMAT_DATA_HEADER DateTimeFormatData.h) - set(DATE_TIME_FORMAT_DATA_IMPLEMENTATION DateTimeFormatData.cpp) - - set(LOCALE_DATA_HEADER LocaleData.h) - set(LOCALE_DATA_IMPLEMENTATION LocaleData.cpp) - - set(NUMBER_FORMAT_DATA_HEADER NumberFormatData.h) - set(NUMBER_FORMAT_DATA_IMPLEMENTATION NumberFormatData.cpp) - - set(PLURAL_RULES_DATA_HEADER PluralRulesData.h) - set(PLURAL_RULES_DATA_IMPLEMENTATION PluralRulesData.cpp) - - set(RELATIVE_TIME_FORMAT_DATA_HEADER RelativeTimeFormatData.h) - set(RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION RelativeTimeFormatData.cpp) - - set(LOCALE_META_TARGET_PREFIX "") - endif() + set(RELATIVE_TIME_FORMAT_DATA_HEADER RelativeTimeFormatData.h) + set(RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION RelativeTimeFormatData.cpp) invoke_generator( "DateTimeFormatData" Lagom::GenerateDateTimeFormatData "${CLDR_VERSION_FILE}" - "${LOCALE_META_TARGET_PREFIX}" + "" "${DATE_TIME_FORMAT_DATA_HEADER}" "${DATE_TIME_FORMAT_DATA_IMPLEMENTATION}" arguments -r "${CLDR_CORE_PATH}" -d "${CLDR_DATES_PATH}" @@ -89,7 +68,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "LocaleData" Lagom::GenerateLocaleData "${CLDR_VERSION_FILE}" - "${LOCALE_META_TARGET_PREFIX}" + "" "${LOCALE_DATA_HEADER}" "${LOCALE_DATA_IMPLEMENTATION}" arguments -b "${CLDR_BCP47_PATH}" -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}" @@ -98,7 +77,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "NumberFormatData" Lagom::GenerateNumberFormatData "${CLDR_VERSION_FILE}" - "${LOCALE_META_TARGET_PREFIX}" + "" "${NUMBER_FORMAT_DATA_HEADER}" "${NUMBER_FORMAT_DATA_IMPLEMENTATION}" arguments -r "${CLDR_CORE_PATH}" -n "${CLDR_NUMBERS_PATH}" -u "${CLDR_UNITS_PATH}" @@ -107,7 +86,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "PluralRulesData" Lagom::GeneratePluralRulesData "${CLDR_VERSION_FILE}" - "${LOCALE_META_TARGET_PREFIX}" + "" "${PLURAL_RULES_DATA_HEADER}" "${PLURAL_RULES_DATA_IMPLEMENTATION}" arguments -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" @@ -116,7 +95,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "RelativeTimeFormatData" Lagom::GenerateRelativeTimeFormatData "${CLDR_VERSION_FILE}" - "${LOCALE_META_TARGET_PREFIX}" + "" "${RELATIVE_TIME_FORMAT_DATA_HEADER}" "${RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION}" arguments -d "${CLDR_DATES_PATH}" diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index 967c03165a..50b0d0a991 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -90,29 +90,17 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) download_file("${EMOJI_TEST_URL}" "${EMOJI_TEST_PATH}") - set(UNICODE_DATA_HEADER LibUnicode/UnicodeData.h) - set(UNICODE_DATA_IMPLEMENTATION LibUnicode/UnicodeData.cpp) + set(UNICODE_DATA_HEADER UnicodeData.h) + set(UNICODE_DATA_IMPLEMENTATION UnicodeData.cpp) - set(EMOJI_DATA_HEADER LibUnicode/EmojiData.h) - set(EMOJI_DATA_IMPLEMENTATION LibUnicode/EmojiData.cpp) - - set(UNICODE_META_TARGET_PREFIX LibUnicode_) - - if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build. - set(UNICODE_DATA_HEADER UnicodeData.h) - set(UNICODE_DATA_IMPLEMENTATION UnicodeData.cpp) - - set(EMOJI_DATA_HEADER EmojiData.h) - set(EMOJI_DATA_IMPLEMENTATION EmojiData.cpp) - - set(UNICODE_META_TARGET_PREFIX "") - endif() + set(EMOJI_DATA_HEADER EmojiData.h) + set(EMOJI_DATA_IMPLEMENTATION EmojiData.cpp) invoke_generator( "UnicodeData" Lagom::GenerateUnicodeData "${UCD_VERSION_FILE}" - "${UNICODE_META_TARGET_PREFIX}" + "" "${UNICODE_DATA_HEADER}" "${UNICODE_DATA_IMPLEMENTATION}" arguments -u "${UNICODE_DATA_PATH}" -s "${SPECIAL_CASING_PATH}" -g "${DERIVED_GENERAL_CATEGORY_PATH}" -p "${PROP_LIST_PATH}" -d "${DERIVED_CORE_PROP_PATH}" -b "${DERIVED_BINARY_PROP_PATH}" -a "${PROP_ALIAS_PATH}" -v "${PROP_VALUE_ALIAS_PATH}" -r "${SCRIPTS_PATH}" -x "${SCRIPT_EXTENSIONS_PATH}" -k "${BLOCKS_PATH}" -e "${EMOJI_DATA_PATH}" -m "${NAME_ALIAS_PATH}" -n "${NORM_PROPS_PATH}" -f "${GRAPHEME_BREAK_PROP_PATH}" -w "${WORD_BREAK_PROP_PATH}" -i "${SENTENCE_BREAK_PROP_PATH}" @@ -121,13 +109,13 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "EmojiData" Lagom::GenerateEmojiData "${UCD_VERSION_FILE}" - "${UNICODE_META_TARGET_PREFIX}" + "" "${EMOJI_DATA_HEADER}" "${EMOJI_DATA_IMPLEMENTATION}" arguments -e "${EMOJI_TEST_PATH}" -s "${EMOJI_SERENITY_PATH}" ) - if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build. + if (SERENITYOS) add_custom_command( OUTPUT "${EMOJI_INSTALL_PATH}" COMMAND "${EMOJI_GENERATOR_PATH}" "${EMOJI_TEST_PATH}" "${EMOJI_RES_PATH}" "${EMOJI_INSTALL_PATH}" diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake index ee1d26dd0e..07a2570952 100644 --- a/Meta/CMake/utils.cmake +++ b/Meta/CMake/utils.cmake @@ -155,7 +155,7 @@ function(embed_resource target section file) endfunction() function(link_with_locale_data target) - if (ENABLE_UNICODE_DATABASE_DOWNLOAD) + if (ENABLE_UNICODE_DATABASE_DOWNLOAD AND SERENITYOS) target_link_libraries("${target}" LibLocaleData) endif() endfunction() diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index c55e376ab6..9212519741 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -60,6 +60,15 @@ if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ) set(ENABLE_FUZZERS ON) endif() +# We need to make sure not to build code generators for Fuzzer builds, as they already have their own main.cpp +# Instead, we import them from a previous install of Lagom. This mandates a two-stage build for fuzzers. +# The same concern goes for cross-compile builds, where we need the tools built for the host +set(BUILD_LAGOM_TOOLS ON) +if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING) + find_package(LagomTools REQUIRED) + set(BUILD_LAGOM_TOOLS OFF) +endif() + include(wasm_spec_tests) include(flac_spec_tests) include(lagom_compile_options) @@ -142,9 +151,8 @@ include_directories(../../Userland/Libraries/) include_directories(../../Userland/Services) include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_BINARY_DIR}/Libraries) -include_directories(${CMAKE_BINARY_DIR}/Userland/Libraries) -include_directories(${CMAKE_BINARY_DIR}/Services) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/Userland/Libraries) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/Userland/Services) # install rules, think about moving to its own helper cmake file include(CMakePackageConfigHelpers) @@ -305,10 +313,7 @@ install(TARGETS LibTimeZone EXPORT LagomTargets) # LibIDL # This is used by the BindingsGenerator so needs to always be built. -file(GLOB LIBIDL_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibIDL/*.cpp") -lagom_lib(IDL idl - SOURCES ${LIBIDL_SOURCES} -) +add_serenity_subdirectory(Userland/Libraries/LibIDL) # Manually install AK headers install( @@ -319,284 +324,48 @@ install( ) # Code Generators and other host tools -# We need to make sure not to build code generators for Fuzzer builds, as they already have their own main.cpp -# Instead, we import them from a previous install of Lagom. This mandates a two-stage build for fuzzers. -if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING) - find_package(LagomTools REQUIRED) -else() +if (BUILD_LAGOM_TOOLS) add_subdirectory(Tools) endif() if (BUILD_LAGOM) # Lagom Libraries - - # Archive - file(GLOB LIBARCHIVE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibArchive/*.cpp") - lagom_lib(Archive archive - SOURCES ${LIBARCHIVE_SOURCES} - ) - - # Audio - file(GLOB LIBAUDIO_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibAudio/*.cpp") - list(REMOVE_ITEM LIBAUDIO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibAudio/ConnectionToServer.cpp") - lagom_lib(Audio audio - SOURCES ${LIBAUDIO_SOURCES} - ) - - # Compress - file(GLOB LIBCOMPRESS_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibCompress/*.cpp") - lagom_lib(Compress compress - SOURCES ${LIBCOMPRESS_SOURCES} - LIBS LibCrypto - ) - - # Crypto - file(GLOB LIBCRYPTO_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibCrypto/*.cpp") - file(GLOB LIBCRYPTO_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibCrypto/*/*.cpp") - file(GLOB LIBCRYPTO_SUBSUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibCrypto/*/*/*.cpp") - lagom_lib(Crypto crypto - SOURCES ${LIBCRYPTO_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBCRYPTO_SUBSUBDIR_SOURCES} - ) - - file(GLOB LIBDNS_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibDNS/*.cpp") - lagom_lib(DNS dns - SOURCES ${LIBDNS_SOURCES} - LIBS LibIPC - ) - - # ELF - # FIXME: Excluding arm64 is a temporary hack to circumvent a build problem - # for Lagom on Apple M1 - if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") - file(GLOB LIBELF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibELF/*.cpp") - # There's no way we can reliably make the dynamic loading classes cross platform - list(FILTER LIBELF_SOURCES EXCLUDE REGEX ".*Dynamic.*.cpp$") - lagom_lib(ELF elf - SOURCES ${LIBELF_SOURCES} - ) - endif() - - # Gemini - file(GLOB LIBGEMINI_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGemini/*.cpp") - lagom_lib(Gemini gemini - SOURCES ${LIBGEMINI_SOURCES} - LIBS LibTLS - ) - - # Gfx - file(GLOB LIBGFX_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGfx/*.cpp") - file(GLOB LIBGFX_FILTER_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGfx/Filters/*.cpp") - file(GLOB LIBGFX_FONT_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGfx/Font/*.cpp") - file(GLOB LIBGFX_TTF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGfx/Font/TrueType/*.cpp") - file(GLOB LIBGFX_WOFF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGfx/Font/WOFF/*.cpp") - lagom_lib(Gfx gfx - SOURCES ${LIBGFX_SOURCES} ${LIBGFX_FILTER_SOURCES} ${LIBGFX_FONT_SOURCES} ${LIBGFX_TTF_SOURCES} ${LIBGFX_WOFF_SOURCES} - LIBS m LibCompress LibTextCodec LibIPC - ) - - # GPU - file(GLOB LIBGPU_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGPU/*.cpp") - lagom_lib(GPU gpu - SOURCES ${LIBGPU_SOURCES} - LIBS ${CMAKE_DL_LIBS} - ) - - # GL - file(GLOB LIBGL_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGL/*.cpp") - file(GLOB LIBGL_TEX_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGL/Tex/*.cpp") - lagom_lib(GL gl - SOURCES ${LIBGL_SOURCES} ${LIBGL_TEX_SOURCES} - LIBS m LibGfx LibGPU) - - # GUI - list(APPEND LIBGUI_SOURCES "../../Userland/Libraries/LibGUI/ModelIndex.cpp") - list(APPEND LIBGUI_SOURCES "../../Userland/Libraries/LibGUI/Model.cpp") - list(APPEND LIBGUI_SOURCES "../../Userland/Libraries/LibGUI/Icon.cpp") - lagom_lib(GUI gui - SOURCES ${LIBGUI_SOURCES} - LIBS LibGfx) - - # GUI-GML - file(GLOB LIBGUI_GML_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGUI/GML/*.cpp") - list(REMOVE_ITEM LIBGUI_GML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibGUI/GML/AutocompleteProvider.cpp") - lagom_lib(GML gml - SOURCES ${LIBGUI_GML_SOURCES} - LIBS LibSyntax - ) - - # HTTP - file(GLOB LIBHTTP_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibHTTP/*.cpp") - lagom_lib(HTTP http - SOURCES ${LIBHTTP_SOURCES} - LIBS LibCompress LibTLS - ) - - # IMAP - file(GLOB LIBIMAP_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibIMAP/*.cpp") - lagom_lib(IMAP imap - SOURCES ${LIBIMAP_SOURCES} - LIBS LibTLS - ) - - # IPC - file(GLOB LIBIPC_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibIPC/*.cpp") - lagom_lib(IPC ipc - SOURCES ${LIBIPC_SOURCES} - ) - - # JS - file(GLOB LIBJS_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibJS/*.cpp") - file(GLOB LIBJS_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibJS/*/*.cpp") - file(GLOB LIBJS_SUBSUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibJS/*/*/*.cpp") - list(REMOVE_ITEM LIBJS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibJS/SyntaxHighlighter.cpp") - lagom_lib(JS js - SOURCES ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBJS_SUBSUBDIR_SOURCES} - LIBS m LibCrypto LibRegex LibLocale LibUnicode LibTextCodec + set(lagom_standard_libraries + Archive + Audio + Compress + Crypto + DNS + Gemini + Gfx + GL + GPU + HTTP + IMAP + IPC + JS + Line + Locale + Markdown + PDF + Regex + SoftGPU + SQL + Syntax + TextCodec + Threading + TLS + Unicode + Video + Wasm + WebSocket + XML ) - # Line - file(GLOB LIBLINE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibLine/*.cpp") - lagom_lib(Line line - SOURCES ${LIBLINE_SOURCES} - ) - - # Locale - include(locale_data) - file(GLOB LIBLOCALE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibLocale/*.cpp") - lagom_lib(Locale locale - SOURCES ${LIBLOCALE_SOURCES} ${LOCALE_DATA_SOURCES} - ) - target_compile_definitions(LibLocale PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>) - target_compile_options(LibLocale PRIVATE -Wno-parentheses-equality) - target_link_libraries(LibLocale LibTimeZone LibUnicode) - - # Markdown - file(GLOB LIBMARKDOWN_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibMarkdown/*.cpp") - lagom_lib(Markdown markdown - SOURCES ${LIBMARKDOWN_SOURCES} - LIBS LibJS - ) - - # PDF - file(GLOB LIBPDF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibPDF/*.cpp") - file(GLOB LIBPDF_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibPDF/*/*.cpp") - lagom_lib(PDF pdf - SOURCES ${LIBPDF_SOURCES} ${LIBPDF_SUBDIR_SOURCES} - LIBS LibGfx LibIPC LibTextCodec - ) - - # Regex - file(GLOB LIBREGEX_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibRegex/*.cpp") - lagom_lib(Regex regex - SOURCES ${LIBREGEX_SOURCES} - LIBS LibUnicode - ) - - # Shell - file(GLOB SHELL_SOURCES CONFIGURE_DEPENDS "../../Userland/Shell/*.cpp") - list(REMOVE_ITEM SHELL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Shell/SyntaxHighlighter.cpp") - list(FILTER SHELL_SOURCES EXCLUDE REGEX ".*main.cpp$") - lagom_lib(Shell shell - SOURCES ${SHELL_SOURCES} - LIBS LibLine LibRegex - ) - - # SoftGPU - file(GLOB_RECURSE LIBSOFTGPU_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibSoftGPU/*.cpp") - lagom_lib(SoftGPU softgpu - SOURCES ${LIBSOFTGPU_SOURCES} - LIBS m LibGfx - ) - - # Syntax - file(GLOB LIBSYNTAX_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibSyntax/*.cpp") - lagom_lib(Syntax syntax - SOURCES ${LIBSYNTAX_SOURCES} - ) - - # SQL - file(GLOB_RECURSE LIBSQL_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibSQL/*.cpp") - list(REMOVE_ITEM LIBSQL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibSQL/AST/SyntaxHighlighter.cpp") - list(REMOVE_ITEM LIBSQL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibSQL/SQLClient.cpp") - lagom_lib(SQL sql - SOURCES ${LIBSQL_SOURCES} - LIBS LibRegex - ) - - # TextCodec - file(GLOB LIBTEXTCODEC_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibTextCodec/*.cpp") - lagom_lib(TextCodec textcodec - SOURCES ${LIBTEXTCODEC_SOURCES} - ) - - # TLS - file(GLOB LIBTLS_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibTLS/*.cpp") - lagom_lib(TLS tls - SOURCES ${LIBTLS_SOURCES} - LIBS LibCrypto - ) - - # Unicode - include(unicode_data) - file(GLOB LIBUNICODE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibUnicode/*.cpp") - lagom_lib(Unicode unicode - SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES} - ) - target_compile_definitions(LibUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>) - - # Video - file(GLOB LIBVIDEO_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibVideo/*.cpp") - file(GLOB LIBVIDEO_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibVideo/*/*.cpp") - lagom_lib(Video video - SOURCES ${LIBVIDEO_SOURCES} ${LIBVIDEO_SUBDIR_SOURCES} - LIBS LibAudio LibIPC LibGfx - ) - - # WASM - file(GLOB LIBWASM_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWasm/*/*.cpp") - lagom_lib(Wasm wasm - SOURCES ${LIBWASM_SOURCES} - ) - - # Web if (ENABLE_LAGOM_LIBWEB) - include(libweb_generators) - file(GLOB LIBWEB_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWeb/*.cpp") - file(GLOB LIBWEB_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWeb/*/*.cpp") - file(GLOB LIBWEB_SUBSUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWeb/*/*/*.cpp") - file(GLOB LIBWEB_SUBSUBSUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWeb/*/*/*/*.cpp") - list(REMOVE_ITEM LIBWEB_SUBSUBDIR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.cpp") - list(REMOVE_ITEM LIBWEB_SUBSUBDIR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.cpp") - - generate_css_implementation() - - set(LIBWEB_GENERATED_SOURCES - LibWeb/CSS/DefaultStyleSheetSource.cpp - LibWeb/CSS/Enums.cpp - LibWeb/CSS/MediaFeatureID.cpp - LibWeb/CSS/PropertyID.cpp - LibWeb/CSS/QuirksModeStyleSheetSource.cpp - LibWeb/CSS/TransformFunctions.cpp - LibWeb/CSS/ValueID.cpp - ) - - lagom_lib(Web web - SOURCES ${LIBWEB_SOURCES} ${LIBWEB_SUBDIR_SOURCES} ${LIBWEB_SUBSUBDIR_SOURCES} ${LIBWEB_SUBSUBSUBDIR_SOURCES} ${LIBWEB_GENERATED_SOURCES} - LIBS LibMarkdown LibGemini LibGfx LibGL LibIDL LibJS LibTextCodec LibWasm LibXML - ) - generate_js_bindings(LibWeb) - endif() - - # WebSocket - file(GLOB LIBWEBSOCKET_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWebSocket/*.cpp") - file(GLOB LIBWEBSOCKET_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWebSocket/*/*.cpp") - lagom_lib(WebSocket websocket - SOURCES ${LIBWEBSOCKET_SOURCES} ${LIBWEBSOCKET_SUBDIR_SOURCES} - LIBS LibCrypto LibTLS - ) + list(APPEND lagom_standard_libraries Web) - # WebView - if (ENABLE_LAGOM_LIBWEB) + # WebView list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/DOMTreeModel.cpp") list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/WebContentClient.cpp") @@ -611,23 +380,50 @@ if (BUILD_LAGOM) LIBS LibGUI LibWeb) endif() - # x86 # FIXME: Excluding arm64 is a temporary hack to circumvent a build problem # for Lagom on Apple M1 if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") - file(GLOB LIBX86_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibX86/*.cpp") - lagom_lib(X86 x86 - SOURCES ${LIBX86_SOURCES} + # FIXME: Create a LIBELF_SOURCES macro similar to AK + file(GLOB LIBELF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibELF/*.cpp") + # There's no way we can reliably make the dynamic loading classes cross platform + list(FILTER LIBELF_SOURCES EXCLUDE REGEX ".*Dynamic.*.cpp$") + lagom_lib(ELF elf + SOURCES ${LIBELF_SOURCES} ) + list(APPEND lagom_standard_libraries X86) endif() - file(GLOB LIBXML_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibXML/*/*.cpp") - lagom_lib(XML xml - SOURCES ${LIBXML_SOURCES}) + foreach(lib IN LISTS lagom_standard_libraries) + add_serenity_subdirectory("Userland/Libraries/Lib${lib}") + endforeach() + + # GUI + set(LIBGUI_SOURCES + GML/Lexer.cpp + GML/Parser.cpp + GML/SyntaxHighlighter.cpp + Icon.cpp + Model.cpp + ModelIndex.cpp + ) + list(TRANSFORM LIBGUI_SOURCES PREPEND "${SERENITY_PROJECT_ROOT}/Userland/Libraries/LibGUI/") + lagom_lib(GUI gui + SOURCES ${LIBGUI_SOURCES} + LIBS LibGfx LibSyntax) + + # FIXME: Why doesn't RPATH of the tests handle this properly? + set_target_properties(LibSoftGPU PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + # FIXME: LibLocaleData is an object lib in Lagom, because the weak symbol trick we use on serenity + # straight up isn't supposed to work per ELF rules + target_link_libraries(LibLocale LibTimeZone) + install(TARGETS LibLocaleData EXPORT LagomTargets) + + add_serenity_subdirectory(Userland/Shell) if (NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD AND NOT ANDROID) # Lagom Services - add_subdirectory("${SERENITY_PROJECT_ROOT}/Userland/Services" "${CMAKE_CURRENT_BINARY_DIR}/Services") + add_serenity_subdirectory(Userland/Services) # Lagom Examples add_executable(TestApp TestApp.cpp) @@ -651,7 +447,7 @@ if (BUILD_LAGOM) add_executable(gml-format_lagom ../../Userland/Utilities/gml-format.cpp) set_target_properties(gml-format_lagom PROPERTIES OUTPUT_NAME gml-format) - target_link_libraries(gml-format_lagom LibCore LibGML LibMain) + target_link_libraries(gml-format_lagom LibCore LibGUI LibMain) if (ENABLE_LAGOM_LIBWEB) add_executable(headless_browser_lagom ../../Userland/Utilities/headless-browser.cpp) @@ -661,7 +457,7 @@ if (BUILD_LAGOM) add_executable(js_lagom ../../Userland/Utilities/js.cpp) set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js) - target_link_libraries(js_lagom LibJS LibLine LibMain Threads::Threads) + target_link_libraries(js_lagom LibJS LibLine LibMain LibTextCodec Threads::Threads) add_executable(markdown-check_lagom ../../Userland/Utilities/markdown-check.cpp) set_target_properties(markdown-check_lagom PROPERTIES OUTPUT_NAME markdown-check) @@ -671,10 +467,6 @@ if (BUILD_LAGOM) set_target_properties(ntpquery_lagom PROPERTIES OUTPUT_NAME ntpquery) target_link_libraries(ntpquery_lagom LibCore LibMain) - add_executable(shell_lagom ../../Userland/Shell/main.cpp) - set_target_properties(shell_lagom PROPERTIES OUTPUT_NAME shell) - target_link_libraries(shell_lagom LibCore LibShell LibMain) - add_executable(test262-runner_lagom ../../Tests/LibJS/test262-runner.cpp) set_target_properties(test262-runner_lagom PROPERTIES OUTPUT_NAME test262-runner) target_link_libraries(test262-runner_lagom LibJS LibCore) @@ -736,7 +528,7 @@ if (BUILD_LAGOM) file(COPY "${SERENITY_PROJECT_ROOT}/Tests/LibGL/reference-images" DESTINATION "./") file(GLOB LIBGL_TESTS CONFIGURE_DEPENDS "../../Tests/LibGL/*.cpp") foreach(source ${LIBGL_TESTS}) - lagom_test(${source} WORKING_DIRECTORY LIBS LibGL LibGPU LibSoftGPU) + lagom_test(${source} LIBS LibGL LibGPU LibSoftGPU) endforeach() # Locale @@ -868,7 +660,7 @@ if (BUILD_LAGOM) get_filename_component(TEST_NAME ${TEST_PATH} NAME_WE) add_test( NAME "Shell-${TEST_NAME}" - COMMAND shell_lagom --skip-shellrc "${TEST_PATH}" + COMMAND Shell --skip-shellrc "${TEST_PATH}" WORKING_DIRECTORY ${SERENITY_PROJECT_ROOT}/Userland/Shell/Tests ) set_tests_properties("Shell-${TEST_NAME}" PROPERTIES |