From e88761b2b97957b755c7406388acede614356a65 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 8 Aug 2021 00:06:55 -0600 Subject: [PATCH] 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. --- .github/workflows/cmake.yml | 4 ++-- .github/workflows/libjs-test262.yml | 2 +- Meta/Azure/Caches.yml | 4 ++-- .../Libraries/LibUnicode => Meta/CMake}/unicode_data.cmake | 3 --- Meta/Lagom/CMakeLists.txt | 5 ++++- Userland/Libraries/LibUnicode/CMakeLists.txt | 3 ++- 6 files changed, 11 insertions(+), 10 deletions(-) rename {Userland/Libraries/LibUnicode => Meta/CMake}/unicode_data.cmake (98%) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ccad4c02ab..bf656add08 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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. diff --git a/.github/workflows/libjs-test262.yml b/.github/workflows/libjs-test262.yml index 3221c1c728..815c3d2bb0 100644 --- a/.github/workflows/libjs-test262.yml +++ b/.github/workflows/libjs-test262.yml @@ -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 diff --git a/Meta/Azure/Caches.yml b/Meta/Azure/Caches.yml index 55d30688f1..f65fd2a739 100644 --- a/Meta/Azure/Caches.yml +++ b/Meta/Azure/Caches.yml @@ -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' diff --git a/Userland/Libraries/LibUnicode/unicode_data.cmake b/Meta/CMake/unicode_data.cmake similarity index 98% rename from Userland/Libraries/LibUnicode/unicode_data.cmake rename to Meta/CMake/unicode_data.cmake index 16b279afd0..59c1466ebf 100644 --- a/Userland/Libraries/LibUnicode/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -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() diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 4347e53910..5797ce98d4 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -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=$) # WASM file(GLOB LIBWASM_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWasm/*/*.cpp") diff --git a/Userland/Libraries/LibUnicode/CMakeLists.txt b/Userland/Libraries/LibUnicode/CMakeLists.txt index c7ded76f1e..c06d6d1793 100644 --- a/Userland/Libraries/LibUnicode/CMakeLists.txt +++ b/Userland/Libraries/LibUnicode/CMakeLists.txt @@ -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=$)