blob: d40ed65b7670e860e819c453760c6fce83c9068e [file] [log] [blame]
# Copyright 2023 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config("cxx_config") {
cflags = [ "-nostdinc" ]
cflags_cc = [
"-std=c++20",
"-nostdinc++",
"-fvisibility-inlines-hidden",
"-fms-compatibility-version=19.00",
"-Wall",
"-Wextra",
"-Wwrite-strings",
"-Wno-long-long",
"-Werror=return-type",
"-Wno-user-defined-literals",
"-Wno-bitwise-op-parentheses",
"-Wno-shift-op-parentheses",
"-Wno-error",
"-Wno-unused-parameter",
"-Wno-unused-command-line-argument",
"-fPIC",
]
defines = [
"_LIBCPP_HAS_NO_FSTREAM",
"_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION",
"_LIBCPP_HAS_MUSL_LIBC",
"_LIBCPP_HAS_THREAD_API_EXTERNAL",
# Let the library headers know they are currently being used to build the
# library.
"_LIBCPP_BUILDING_LIBRARY",
# This macro is used to build libcxxabi with libunwind.
"LIBCXX_BUILDING_LIBCXXABI",
]
include_dirs = [
"include",
"src",
"//third_party/llvm-project/libcxxabi/include",
]
}
static_library("cxx") {
sources = [
"src/algorithm.cpp",
"src/any.cpp",
"src/bind.cpp",
"src/chrono.cpp",
"src/condition_variable.cpp",
"src/condition_variable_destructor.cpp",
"src/exception.cpp",
"src/functional.cpp",
"src/future.cpp",
"src/hash.cpp",
"src/ios.cpp",
"src/ios.instantiations.cpp",
"src/locale.cpp",
"src/memory.cpp",
"src/mutex.cpp",
"src/mutex_destructor.cpp",
"src/new.cpp",
"src/optional.cpp",
"src/regex.cpp",
"src/shared_mutex.cpp",
"src/stdexcept.cpp",
"src/string.cpp",
"src/strstream.cpp",
"src/system_error.cpp",
"src/thread.cpp",
"src/typeinfo.cpp",
"src/utility.cpp",
"src/valarray.cpp",
"src/variant.cpp",
"src/vector.cpp",
"src/verbose_abort.cpp",
# src/atomic.cpp is omitted because this file breaks the build.
# src/charconv.cpp is omitted because this file breaks the build. It
# requires C++20's "std::bit_cast".
# src/format.cpp is omitted because this experimental file breaks the build.
# src/iostream.cpp is unneeded. It introduces "getc", "stdin", and "ungetc"
# as API leaks.
# src/random.cpp is unneeded. It introduces "close", "open" and "read" as
# API leaks.
# src/legacy_debug_handler.cpp, src/memory_resource.cpp, and
# src/random_shuffle.cpp are unneeded. These require replacing C++20's
# "constinit" with "_LIBCPP_CONSTINIT".
# src/barrier.cpp, src/debug.cpp, src/legacy_pointer_safety.cpp are unneeded.
]
configs += [ ":cxx_config" ]
configs -= ["//starboard/build/config:default_cpp_standard"]
deps = [
"//starboard:starboard_headers_only",
"//starboard/common",
"//third_party/llvm-project/compiler-rt:compiler_rt",
"//third_party/llvm-project/libcxxabi:cxxabi",
"//third_party/musl:c",
]
}