Meta+LibUnicode: Move unicode_data helper to Meta/CMake

Moving this helper CMake file to the centralized Meta/CMake folder helps
to get a better grasp on what extra files are required for the build,
and what files are generated.

While we're at it, don't use add_compile_definitions for
ENABLE_UNICODE_DATA, which only needs to be seen by LibUnicode sources.
This commit is contained in:
Andrew Kaster 2021-08-08 00:06:55 -06:00 committed by Linus Groh
parent 47471c0ec2
commit e88761b2b9
Notes: sideshowbarker 2024-07-18 05:10:46 +09:00
6 changed files with 11 additions and 10 deletions

View file

@ -126,13 +126,13 @@ jobs:
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
with:
path: ${{ github.workspace }}/Build/UCD
key: UnicodeData-${{ hashFiles('Userland/Libraries/LibUnicode/unicode_data.cmake') }}
key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
- name: UnicodeLocale Cache
# TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
with:
path: ${{ github.workspace }}/Build/CLDR
key: UnicodeLocale-${{ hashFiles('Userland/Libraries/LibUnicode/unicode_data.cmake') }}
key: UnicodeLocale-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
- name: Create build environment with extra debug options
working-directory: ${{ github.workspace }}/Build
# Build the entire project with all available debug options turned on, to prevent code rot.

View file

@ -71,7 +71,7 @@ jobs:
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
with:
path: ${{ github.workspace }}/libjs-test262/Build/UCD
key: UnicodeData-${{ hashFiles('Userland/Libraries/LibUnicode/unicode_data.cmake') }}
key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
- name: Build libjs-test262-runner and test-js
working-directory: libjs-test262

View file

@ -36,13 +36,13 @@ steps:
- ${{ if eq(parameters.with_unicode_caches, true) }}:
- task: Cache@2
inputs:
key: '"unicode_data" | Userland/Libraries/LibUnicode/unicode_data.cmake'
key: '"unicode_data" | Meta/CMake/unicode_data.cmake'
path: $(Build.SourcesDirectory)/${{ parameters.build_directory }}/UCD
displayName: 'UnicodeData Cache'
- task: Cache@2
inputs:
key: '"unicode_locale" | Userland/Libraries/LibUnicode/unicode_data.cmake'
key: '"unicode_locale" | Meta/CMake/unicode_data.cmake'
path: $(Build.SourcesDirectory)/${{ parameters.build_directory }}/CLDR
displayName: 'UnicodeLocale Cache'

View file

@ -144,7 +144,4 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
)
set(UNICODE_DATA_SOURCES ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION} ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
add_compile_definitions(ENABLE_UNICODE_DATA=1)
else()
add_compile_definitions(ENABLE_UNICODE_DATA=0)
endif()

View file

@ -371,12 +371,15 @@ if (BUILD_LAGOM)
set(write_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../write-only-on-difference.sh)
add_subdirectory(../../Userland/Libraries/LibUnicode/CodeGenerators ${CMAKE_CURRENT_BINARY_DIR}/LibUnicode/CodeGenerators)
endif()
include(../../Userland/Libraries/LibUnicode/unicode_data.cmake)
include(${SERENITY_PROJECT_ROOT}/Meta/CMake/unicode_data.cmake)
else()
set(ENABLE_UNICODE_DATABASE_DOWNLOAD OFF)
endif()
file(GLOB LIBUNICODE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibUnicode/*.cpp")
lagom_lib(Unicode unicode
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES}
)
target_compile_definitions(LagomUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)
# WASM
file(GLOB LIBWASM_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWasm/*/*.cpp")

View file

@ -1,4 +1,4 @@
include(unicode_data.cmake)
include(${SerenityOS_SOURCE_DIR}/Meta/CMake/unicode_data.cmake)
SET(SOURCES
${UNICODE_DATA_SOURCES}
@ -8,3 +8,4 @@ SET(SOURCES
serenity_lib(LibUnicode unicode)
target_link_libraries(LibUnicode LibCore)
target_compile_definitions(LibUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)