mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:27:35 +00:00

We have logic for serenity_generated_sources which works well for source files that are specified in GENERATED_SOURCES prior to calling serenity_lib or serenity_bin. However, code generated with invoke_generator, and the LibWeb generators do not always follow the pattern of the IDL and GML files. For the LibWeb generators, we can just add_dependencies to LibWeb at the time we declare the generate_Foo custom target. However for LibLocale, LibTimeZone, and LibUnicode, we don't have the name of the target available, so export the name in a variable to set into GENERATED_SOURCES. To make this work for Lagom, we need to make sure that lagom_lib and serenity_bin in Lagom/CMakeLists.txt call serenity_generated_sources on the target. This enables the Xcode generator on macOS hosts, at least for Lagom.
35 lines
1 KiB
CMake
35 lines
1 KiB
CMake
include(${SerenityOS_SOURCE_DIR}/Meta/CMake/locale_data.cmake)
|
|
|
|
if (DEFINED LOCALE_DATA_SOURCES)
|
|
set(SOURCES ${LOCALE_DATA_SOURCES})
|
|
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
|
|
if (SERENITYOS)
|
|
serenity_lib(LibLocaleData localedata)
|
|
else()
|
|
add_library(LibLocaleData OBJECT ${SOURCES})
|
|
serenity_generated_sources(LibLocaleData)
|
|
endif()
|
|
target_compile_options(LibLocaleData PRIVATE -g0 -Os -Wno-parentheses-equality)
|
|
target_link_libraries(LibLocaleData LibCore LibTimeZone)
|
|
unset(GENERATED_SOURCES)
|
|
endif()
|
|
|
|
set(SOURCES
|
|
DateTimeFormat.cpp
|
|
Locale.cpp
|
|
NumberFormat.cpp
|
|
PluralRules.cpp
|
|
RelativeTimeFormat.cpp
|
|
)
|
|
|
|
serenity_lib(LibLocale locale)
|
|
target_link_libraries(LibLocale LibCore LibUnicode)
|
|
target_compile_definitions(LibLocale PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)
|
|
|
|
if (DEFINED LOCALE_DATA_SOURCES)
|
|
if (SERENITYOS)
|
|
add_dependencies(LibLocale LibLocaleData)
|
|
else()
|
|
target_link_libraries(LibLocale LibLocaleData)
|
|
endif()
|
|
endif()
|