| # Copyright 2023 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("../../libc.gni") |
| |
| llvm_libc_source_set("printf_core") { |
| public = [ "printf_main.h" ] |
| sources = [ "printf_main.cpp" ] |
| functions = [] |
| deps = [ |
| ":converter", |
| ":parser", |
| ":writer", |
| ] |
| } |
| |
| # These aren't really functions, but they follow the pattern of the actual libc |
| # function implementations in each having a corresponding header file and test |
| # file in the usual places. |
| |
| llvm_libc_source_set("converter") { |
| visibility = [ ":*" ] |
| |
| defines = [ |
| # Never support %n. |
| "LIBC_COPT_PRINTF_DISABLE_WRITE_INT", |
| ] |
| |
| # Don't support FP types if the toolchain doesn't. |
| _no_floating_point = toolchain_variant.tags + [ "no-floating-point" ] - |
| [ "no-floating-point" ] != toolchain_variant.tags |
| if (_no_floating_point) { |
| defines += [ "LIBC_COPT_PRINTF_DISABLE_FLOAT" ] |
| } |
| |
| functions = [ "converter" ] |
| |
| deps = [ ":writer" ] |
| } |
| |
| llvm_libc_source_set("parser") { |
| visibility = [ ":*" ] |
| |
| public = [ "parser.h" ] |
| functions = [] |
| |
| # TODO(https://fxbug.dev/42141211): There are parser tests that can be built though |
| # there is no "parser" source file so the build machinery will have to be |
| # custom for those tests. But that test code requires the fancier test |
| # machinery that we don't yet support since zxtest doesn't have the features. |
| } |
| |
| llvm_libc_source_set("writer") { |
| functions = [ "writer" ] |
| } |
| |
| source_set("wrapper") { |
| public = [ "wrapper.h" ] |
| |
| # The llvm-libc headers used by wrapper.h need defines and include_dirs as |
| # used for building libc itself. |
| public_configs = [ "../..:llvm-libc-public.config" ] |
| |
| deps = [ ":printf_core" ] |
| } |