| # Copyright 2016 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| sysroot = "fusl_${current_cpu}/sysroot" |
| |
| config("libcxx_common_config") { |
| cflags = [ |
| # Flags from upstream CMake builds. |
| "-D_DEBUG", |
| "-D__STDC_CONSTANT_MACROS", |
| "-D__STDC_FORMAT_MACROS", |
| "-D__STDC_LIMIT_MACROS", |
| |
| "-fPIC", |
| "-fvisibility-inlines-hidden", |
| |
| "-Werror=return-type", |
| |
| "-Wall", |
| |
| "-Wcast-qual", |
| "-Wcovered-switch-default", |
| "-Wdelete-non-virtual-dtor", |
| "-Wmissing-field-initializers", |
| "-Wnon-virtual-dtor", |
| "-Wwrite-strings", |
| |
| "-Wno-error", |
| "-Wno-long-long", |
| "-Wno-unused-function", |
| |
| "-std=c++11", |
| "-nostdinc++", |
| |
| # Use our sysroot. |
| "--sysroot=$sysroot", |
| |
| # Use musl-based libc++ header paths. |
| "-D_LIBCPP_HAS_MUSL_LIBC", |
| ] |
| |
| include_dirs = [ |
| "libcxx/include", |
| "libcxxabi/include", |
| ] |
| } |
| |
| config("libcxx_config") { |
| cflags = [ |
| # Flags from upstream CMake build. |
| "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER", |
| "-Dcxx_EXPORTS", |
| "-DLIBCXX_BUILDING_LIBCXXABI", |
| |
| "-UNDEBUG", |
| |
| "-Wno-unused-parameter", |
| |
| # Build fix for musl. |
| "-Wno-invalid-constexpr", |
| ] |
| } |
| |
| config("libcxxabi_config") { |
| cflags = [ |
| # Flags from upstream CMake build. |
| "-fstrict-aliasing", |
| |
| "-Wchar-subscripts", |
| "-Wconversion", |
| "-Wmismatched-tags", |
| "-Wmissing-braces", |
| "-Wnewline-eof", |
| "-Wshadow", |
| "-Wshorten-64-to-32", |
| "-Wsign-compare", |
| "-Wsign-conversion", |
| "-Wstrict-aliasing=2", |
| "-Wstrict-overflow=4", |
| "-Wundef", |
| "-Wunused-parameter", |
| "-Wunused-variable", |
| |
| "-pedantic", |
| ] |
| } |
| |
| source_set("libcxxabi_sources") { |
| configs = [] |
| configs += [ |
| ":libcxxabi_config", |
| ":libcxx_common_config", |
| ] |
| |
| deps = [ |
| "//fusl:copy_sysroot", |
| ] |
| |
| sources = [ |
| "libcxxabi/src/abort_message.cpp", |
| "libcxxabi/src/cxa_aux_runtime.cpp", |
| "libcxxabi/src/cxa_default_handlers.cpp", |
| "libcxxabi/src/cxa_demangle.cpp", |
| "libcxxabi/src/cxa_exception.cpp", |
| "libcxxabi/src/cxa_exception_storage.cpp", |
| "libcxxabi/src/cxa_guard.cpp", |
| "libcxxabi/src/cxa_handlers.cpp", |
| "libcxxabi/src/cxa_new_delete.cpp", |
| "libcxxabi/src/cxa_personality.cpp", |
| "libcxxabi/src/cxa_thread_atexit.cpp", |
| "libcxxabi/src/cxa_unexpected.cpp", |
| "libcxxabi/src/cxa_vector.cpp", |
| "libcxxabi/src/cxa_virtual.cpp", |
| "libcxxabi/src/exception.cpp", |
| "libcxxabi/src/private_typeinfo.cpp", |
| "libcxxabi/src/stdexcept.cpp", |
| "libcxxabi/src/typeinfo.cpp", |
| ] |
| } |
| |
| source_set("libcxx_sources") { |
| configs = [] |
| configs += [ |
| ":libcxx_config", |
| ":libcxx_common_config", |
| ] |
| |
| deps = [ |
| "//fusl:copy_sysroot", |
| ] |
| |
| sources = [ |
| "libcxx/src/algorithm.cpp", |
| "libcxx/src/any.cpp", |
| "libcxx/src/bind.cpp", |
| "libcxx/src/chrono.cpp", |
| "libcxx/src/condition_variable.cpp", |
| "libcxx/src/debug.cpp", |
| "libcxx/src/exception.cpp", |
| "libcxx/src/future.cpp", |
| "libcxx/src/hash.cpp", |
| "libcxx/src/ios.cpp", |
| "libcxx/src/iostream.cpp", |
| "libcxx/src/locale.cpp", |
| "libcxx/src/memory.cpp", |
| "libcxx/src/mutex.cpp", |
| "libcxx/src/new.cpp", |
| "libcxx/src/optional.cpp", |
| "libcxx/src/random.cpp", |
| "libcxx/src/regex.cpp", |
| "libcxx/src/shared_mutex.cpp", |
| "libcxx/src/stdexcept.cpp", |
| "libcxx/src/string.cpp", |
| "libcxx/src/strstream.cpp", |
| "libcxx/src/system_error.cpp", |
| "libcxx/src/thread.cpp", |
| "libcxx/src/typeinfo.cpp", |
| "libcxx/src/utility.cpp", |
| "libcxx/src/valarray.cpp", |
| ] |
| } |
| |
| static_library("libcxx") { |
| complete_static_lib = true |
| |
| deps = [ |
| ":libcxx_sources", |
| ":libcxxabi_sources", |
| ] |
| } |
| |
| action("generate_libcxx_lit") { |
| script = "generate_lit.py" |
| |
| template_file = "libcxx/test/lit.site.cfg.in" |
| output_file = "$target_out_dir/lit.site.cfg" |
| |
| sysroot = rebase_path(sysroot) |
| cxx = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang++") |
| main_lit_config = rebase_path("libcxx") |
| |
| args = [ |
| rebase_path(template_file), |
| rebase_path(output_file), |
| |
| "AUTO_GEN_COMMENT=# Automatically generated by gn.", |
| "LIBCXX_COMPILER=$cxx", |
| "CMAKE_BINARY_DIR=$sysroot", |
| "LIBCXX_SOURCE_DIR=$main_lit_config", |
| "LIBCXX_BINARY_DIR=$sysroot", |
| "LIBCXX_LIBRARY_DIR=$sysroot/lib", |
| "LIBCXX_ENABLE_EXCEPTIONS=True", |
| "LIBCXX_ENABLE_RTTI=True", |
| "LIBCXX_ENABLE_SHARED=True", |
| "LIBCXX_BUILD_32_BITS=False", |
| "LIBCXX_CXX_ABI_LIBNAME=none", |
| "LLVM_USE_SANITIZER=", |
| "LIBCXX_SANITIZER_LIBRARY=", |
| "LIBCXX_CXX_ABI_LIBRARY_PATH=", |
| "LIBCXX_LIT_VARIANT=libcxx", |
| "LIBCXX_TARGET_TRIPLE=", |
| "LIBCXX_SYSROOT=$sysroot", |
| "LIBCXX_GCC_TOOLCHAIN=", |
| "LIBCXX_GENERATE_COVERAGE=False", |
| "LIBCXX_TARGET_INFO=libcxx.test.target_info.LocalTI", |
| "LIBCXX_EXECUTOR=None", |
| "LIBCXXABI_USE_LLVM_UNWINDER=False", |
| ] |
| |
| outputs = [ |
| output_file, |
| ] |
| } |