incubator-nuttx/libs/libxx/libcxx.defs

76 lines
2.8 KiB
Plaintext

############################################################################
# libs/libxx/libcxx.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
#
###########################################################################
LIBCXX_VERSION=$(patsubst "%",%,$(CONFIG_LIBCXX_VERSION))
# Download and unpack tarball if no git repo found
ifeq ($(wildcard libcxx/.git),)
libcxx-$(LIBCXX_VERSION).src.tar.xz:
$(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION),libcxx-$(LIBCXX_VERSION).src.tar.xz)
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
$(Q) patch -p0 < 0001_fix_stdatomic_h_miss_typedef.patch
$(Q) patch -p2 < mbstate_t.patch
$(Q) patch -p0 < 0001-libcxx-remove-mach-time-h.patch
$(Q) patch -p0 < 0001-libcxx-fix-ld-errors.patch
$(Q) touch $@
endif
$(TOPDIR)/include/libcxx: libcxx
$(Q) $(DIRLINK) $(CURDIR)/libcxx/include $(TOPDIR)/include/libcxx
$(Q) cp $(CURDIR)/__config_site $(TOPDIR)/include/libcxx/__config_site
context:: $(TOPDIR)/include/libcxx
distclean::
$(Q) $(DIRUNLINK) $(TOPDIR)/include/libcxx
ifeq ($(wildcard libcxx/.git),)
$(Q) $(DELFILE) libcxx-$(LIBCXX_VERSION).src.tar.xz
$(call DELDIR, libcxx)
endif
CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY
CXXFLAGS += ${INCDIR_PREFIX}$(CURDIR)/libcxx/src
ifeq ($(CONFIG_LIBSUPCXX), y)
CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
endif
CXXFLAGS += -Wno-shadow -Wno-sign-compare
CXXFLAGS += -Wno-attributes -Wno-deprecated-declarations
ifeq ($(GCCVER),)
export GCCVER = $(shell $(CXX) --version | grep ++ | sed -E 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
endif
ifeq ($(shell expr $(GCCVER) \>= 12), 1)
CXXFLAGS += -Wno-maybe-uninitialized -Wno-alloc-size-larger-than
endif
CPPSRCS += $(wildcard libcxx/src/*.cpp)
CPPSRCS += $(wildcard libcxx/src/experimental/*.cpp)
CPPSRCS += $(wildcard libcxx/src/filesystem/*.cpp)
CPPSRCS += $(wildcard libcxx/src/ryu/*.cpp)