LibLocale: Move locale source files to the LibLocale library

Everything is now setup to create the LibLocale library and link it
where needed.
This commit is contained in:
Timothy Flynn 2022-09-02 13:08:22 -04:00 committed by Tim Flynn
parent f082b6ae48
commit 9e860d973e
Notes: sideshowbarker 2024-07-17 07:29:50 +09:00
7 changed files with 38 additions and 17 deletions

View File

@ -424,7 +424,7 @@ if (BUILD_LAGOM)
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 LibUnicode LibTextCodec
LIBS m LibCrypto LibRegex LibLocale LibUnicode LibTextCodec
)
# Line
@ -433,6 +433,16 @@ if (BUILD_LAGOM)
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
@ -502,15 +512,11 @@ if (BUILD_LAGOM)
# Unicode
include(unicode_data)
include(locale_data)
file(GLOB LIBUNICODE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibUnicode/*.cpp")
file(GLOB LIBLOCALE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibLocale/*.cpp")
lagom_lib(Unicode unicode
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES} ${LIBLOCALE_SOURCES} ${LOCALE_DATA_SOURCES}
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES}
)
target_compile_definitions(LibUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)
target_compile_options(LibUnicode PRIVATE -Wno-parentheses-equality)
target_link_libraries(LibUnicode LibTimeZone)
# WASM
file(GLOB LIBWASM_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWasm/*/*.cpp")
@ -675,6 +681,12 @@ if (BUILD_LAGOM)
lagom_test(${source} WORKING_DIRECTORY LIBS LibGL LibGPU LibSoftGPU)
endforeach()
# Locale
file(GLOB LIBLOCALE_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibLocale/*.cpp")
foreach(source ${LIBLOCALE_TEST_SOURCES})
lagom_test(${source} LIBS LibLocale LibUnicode)
endforeach()
# PDF
file(GLOB LIBPDF_TESTS CONFIGURE_DEPENDS "../../Tests/LibPDF/*.cpp")
foreach(source ${LIBPDF_TESTS})
@ -727,8 +739,7 @@ if (BUILD_LAGOM)
# Unicode
file(GLOB LIBUNICODE_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibUnicode/*.cpp")
file(GLOB LIBLOCALE_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibLocale/*.cpp")
foreach(source ${LIBUNICODE_TEST_SOURCES} ${LIBLOCALE_TEST_SOURCES})
foreach(source ${LIBUNICODE_TEST_SOURCES})
lagom_test(${source} LIBS LibUnicode)
endforeach()

View File

@ -4,7 +4,7 @@ set(TEST_SOURCES
)
foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibLocale LIBS LibUnicode)
serenity_test("${source}" LibLocale LIBS LibLocale)
get_filename_component(target "${source}" NAME_WLE)
link_with_locale_data("${target}")

View File

@ -6,5 +6,4 @@ foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibUnicode LIBS LibUnicode)
get_filename_component(target "${source}" NAME_WLE)
link_with_locale_data("${target}")
endforeach()

View File

@ -18,5 +18,5 @@ set(SOURCES
)
serenity_app(ClockSettings ICON app-analog-clock) # FIXME: Create a ClockSettings icon.
target_link_libraries(ClockSettings LibGUI LibMain LibUnicode)
target_link_libraries(ClockSettings LibGUI LibMain LibLocale)
link_with_locale_data(ClockSettings)

View File

@ -249,4 +249,4 @@ set(SOURCES
)
serenity_lib(LibJS js)
target_link_libraries(LibJS LibM LibCore LibCrypto LibRegex LibSyntax LibUnicode)
target_link_libraries(LibJS LibM LibCore LibCrypto LibRegex LibSyntax LibLocale LibUnicode)

View File

@ -6,3 +6,19 @@ if (DEFINED LOCALE_DATA_SOURCES)
target_compile_options(LibLocaleData PRIVATE -g0 -Os -Wno-parentheses-equality)
target_link_libraries(LibLocaleData LibCore LibTimeZone)
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)
add_dependencies(LibLocale LibLocaleData)
endif()

View File

@ -3,11 +3,6 @@ include(${SerenityOS_SOURCE_DIR}/Meta/CMake/unicode_data.cmake)
set(SOURCES
CharacterTypes.cpp
CurrencyCode.cpp
../LibLocale/DateTimeFormat.cpp
../LibLocale/Locale.cpp
../LibLocale/NumberFormat.cpp
../LibLocale/PluralRules.cpp
../LibLocale/RelativeTimeFormat.cpp
${UNICODE_DATA_SOURCES}
)