[all-commits] [llvm/llvm-project] 800051: [libc] Implement FLAGS option for generating all c...

lntue via All-commits all-commits at lists.llvm.org
Tue May 31 21:54:38 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 800051487f13e5506502c0c4021a97a53b89bcde
      https://github.com/llvm/llvm-project/commit/800051487f13e5506502c0c4021a97a53b89bcde
  Author: Tue Ly <lntue.h at gmail.com>
  Date:   2022-06-01 (Wed, 01 Jun 2022)

  Changed paths:
    M libc/CMakeLists.txt
    A libc/cmake/modules/LLVMLibCFlagRules.cmake
    M libc/cmake/modules/LLVMLibCLibraryRules.cmake
    M libc/cmake/modules/LLVMLibCObjectRules.cmake
    M libc/cmake/modules/LLVMLibCRules.cmake
    M libc/cmake/modules/LLVMLibCTestRules.cmake
    M libc/test/src/CMakeLists.txt
    M libc/test/src/__support/File/CMakeLists.txt
    M libc/test/src/__support/OSUtil/linux/x86_64/CMakeLists.txt
    M libc/test/src/math/exhaustive/CMakeLists.txt
    M libc/test/src/stdio/printf_core/CMakeLists.txt
    M libc/test/src/string/CMakeLists.txt
    M libc/test/src/string/memory_utils/CMakeLists.txt

  Log Message:
  -----------
  [libc] Implement FLAGS option for generating all combinations for targets.

Add FLAGS option for add_header_library, add_object_library,
add_entrypoint_object, and add_libc_unittest.

In general, a flag is a string provided for supported functions under the
multi-valued option `FLAGS`.  It should be one of the following forms:
  FLAG_NAME
  FLAG_NAME__NO
  FLAG_NAME__ONLY
A target will inherit all the flags of its upstream dependency.

When we create a target `TARGET_NAME` with a flag using (add_header_library,
add_object_library, ...), its behavior will depend on the flag form as follow:
- FLAG_NAME: The following 2 targets will be generated:
    `TARGET_NAME` that has `FLAG_NAME` in its `FLAGS` property.
    `TARGET_NAME.__NO_FLAG_NAME` that depends on `DEP.__NO_FLAG_NAME` if
       `TARGET_NAME` depends on `DEP` and `DEP` has `FLAG_NAME` in its `FLAGS`
       property.
- FLAG_NAME__ONLY: Only generate 1 target `TARGET_NAME` that has `FLAG_NAME`
    in its `FLAGS` property.
- FLAG_NAME__NO: Only generate 1 target `TARGET_NAME.__NO_FLAG_NAME` that
    depends on `DEP.__NO_FLAG_NAME` if `DEP` is in its DEPENDS list and `DEP`
    has `FLAG_NAME` in its `FLAGS` property.

To show all the targets generated, pass SHOW_INTERMEDIATE_OBJECTS=ON to cmake.
To show all the targets' dependency and flags, pass
`SHOW_INTERMEDIATE_OBJECTS=DEPS` to cmake.

To completely disable a flag FLAG_NAME expansion, set the variable
`SKIP_FLAG_EXPANSION_FLAG_NAME=TRUE`.

Reviewed By: michaelrj, sivachandra

Differential Revision: https://reviews.llvm.org/D125174




More information about the All-commits mailing list