2020-05-17 18:26:59 +08:00
############################################################################
# libs/libxx/libcxx.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you 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.
#
###########################################################################
2021-08-30 11:48:56 +08:00
LIBCXX_VERSION=12.0.0
2020-05-17 18:26:59 +08:00
2022-08-28 00:21:40 +08:00
# Download and unpack tarball if no git repo found
ifeq ($(wildcard libcxx/.git),)
2021-08-30 11:48:56 +08:00
libcxx-$(LIBCXX_VERSION).src.tar.xz:
$(Q) curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION)/libcxx-$(LIBCXX_VERSION).src.tar.xz
2020-10-23 08:33:36 +08:00
2021-08-30 11:48:56 +08:00
libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
$(Q) tar -xf libcxx-$(LIBCXX_VERSION).src.tar.xz \
--exclude libcxx-$(LIBCXX_VERSION).src/test/std/pstl
$(Q) mv libcxx-$(LIBCXX_VERSION).src libcxx
2021-07-30 18:40:42 +08:00
$(Q) patch -p0 < 0001-Remove-the-locale-fallback-for-NuttX.patch
2021-08-28 09:54:14 +08:00
$(Q) patch -p0 < 0001-libc-avoid-the-waring-__EXCEPTIONS-is-not-defined-ev.patch
2022-03-25 21:47:09 +08:00
$(Q) patch -p1 < 0001-libcxx-Rename-PS-macro-to-avoid-clashing-with-Xtensa.patch
2022-03-26 02:55:33 +08:00
ifeq ($(CONFIG_LIBC_ARCH_ATOMIC),y)
$(Q) patch -p1 < 0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch
endif
2020-10-23 06:57:19 +08:00
$(Q) touch $@
2022-08-28 00:21:40 +08:00
endif
2020-10-23 06:57:19 +08:00
$(TOPDIR)/include/libcxx: libcxx
2020-05-17 18:26:59 +08:00
$(Q) $(DIRLINK) $(CURDIR)/libcxx/include $(TOPDIR)/include/libcxx
2021-08-19 01:31:06 +08:00
context:: $(TOPDIR)/include/libcxx
2020-05-17 18:26:59 +08:00
distclean::
$(Q) $(DIRUNLINK) $(TOPDIR)/include/libcxx
2022-08-28 00:21:40 +08:00
ifeq ($(wildcard libcxx/.git),)
$(Q) $(DELFILE) libcxx-$(LIBCXX_VERSION).src.tar.xz
2020-05-17 18:26:59 +08:00
$(call DELDIR, libcxx)
2022-08-28 00:21:40 +08:00
endif
2020-05-17 18:26:59 +08:00
2022-11-01 21:47:53 +08:00
CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY
2020-05-17 18:26:59 +08:00
2021-08-30 12:09:08 +08:00
ifeq ($(CONFIG_LIBSUPCXX), y)
2022-11-01 21:47:53 +08:00
CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
2021-08-19 17:13:43 +08:00
endif
2020-10-23 07:12:47 +08:00
# Workaround the following warning with "c++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0"
#
# libcxx/src/barrier.cpp: In constructor 'std::__1::__barrier_algorithm_base::__barrier_algorithm_base(ptrdiff_t&)':
# libcxx/src/barrier.cpp:35:9: warning: declaration of '__expected' shadows a member of 'std::__1::__barrier_algorithm_base' [-Wshadow]
# 35 | : __expected(__expected)
# | ^
# libcxx/src/barrier.cpp:29:24: note: shadowed declaration is here
# 29 | ptrdiff_t& __expected;
# | ^~~~~~~~~~
libcxx/src/barrier.cpp_CXXFLAGS += -Wno-shadow
2020-10-23 08:16:07 +08:00
libcxx/src/locale.cpp_CXXFLAGS += -Wno-shadow
2020-10-23 07:12:47 +08:00
2020-10-23 10:49:52 +08:00
libcxx/src/filesystem/directory_iterator.cpp_CXXFLAGS += -Wno-shadow
libcxx/src/filesystem/operations.cpp_CXXFLAGS += -Wno-shadow
2023-02-20 18:21:25 +08:00
# Workaround the following warning with "GCC 12.2"
#
# ...
# include/libcxx/string:2156:35: warning: '__temp' may be used uninitialized [-Wmaybe-uninitialized]
# 2156 | this->__throw_length_error();
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
# include/libcxx/string:614:1: note: by argument 1 of type 'const std::__1::__basic_string_common<true>*' to 'void std::__1::__basic_string_common<<anonymous> >::__throw_length_error() const [with bool <anonymous> = true]' declared here
# 614 | __basic_string_common<__b>::__throw_length_error() const
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~
# include/libcxx/string:2676:32: note: '__temp' declared here
# 2676 | const basic_string __temp (__first, __last, __alloc());
# | ^~~~~~
2023-02-21 13:16:13 +08:00
GCCVER = $(shell $(CXX) --version | grep gcc | sed -r 's/.* ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
ifeq ($(GCCVER),12.2.1)
libcxx/src/filesystem/operations.cpp_CXXFLAGS += -Wno-maybe-uninitialized
endif
2023-02-20 18:21:25 +08:00
2020-05-17 18:26:59 +08:00
CPPSRCS += $(notdir $(wildcard libcxx/src/*.cpp))
CPPSRCS += $(notdir $(wildcard libcxx/src/experimental/*.cpp))
CPPSRCS += $(notdir $(wildcard libcxx/src/filesystem/*.cpp))
DEPPATH += --dep-path libcxx/src
DEPPATH += --dep-path libcxx/src/experimental
DEPPATH += --dep-path libcxx/src/filesystem
VPATH += libcxx/src
VPATH += libcxx/src/experimental
VPATH += libcxx/src/filesystem