Skip to content

Commit

Permalink
build: tell libc++ to avoid including transitive headers
Browse files Browse the repository at this point in the history
And apply BOOST_*_NO_DEPRECATED to debug builds only

Change-Id: I4ee56ac53a2ac6d8cd7d449b2792b66d9b811870
  • Loading branch information
Pesa committed Feb 28, 2024
1 parent 3426378 commit f6d7599
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 41 deletions.
2 changes: 0 additions & 2 deletions .jenkins.d/10-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,5 @@ fi
./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
./waf --color=yes build

# (tests will be run against the debug version)

# Install
sudo ./waf --color=yes install
3 changes: 0 additions & 3 deletions .waf-tools/boost.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# encoding: utf-8
#
# partially based on boost.py written by Gernot Vormayr
# written by Ruediger Sonderfeld <[email protected]>, 2008
# modified by Bjoern Michaelsen, 2008
Expand Down
2 changes: 0 additions & 2 deletions .waf-tools/coverage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

from waflib import TaskGen

def options(opt):
Expand Down
13 changes: 7 additions & 6 deletions .waf-tools/default-compiler-flags.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

import platform
from waflib import Configure, Logs, Utils

Expand Down Expand Up @@ -128,16 +126,16 @@ def getCompilerVersion(self, conf):

def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}

def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
return {
'CXXFLAGS': [],
'LINKFLAGS': [],
'DEFINES': ['BOOST_ASIO_NO_DEPRECATED', 'BOOST_FILESYSTEM_NO_DEPRECATED'],
}

def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}

def getOptimizedFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
Expand Down Expand Up @@ -245,6 +243,9 @@ def getDebugFlags(self, conf):
elif self.getCompilerVersion(conf) >= (15, 0, 0):
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
flags['DEFINES'] += ['_LIBCPP_ENABLE_ASSERTIONS=1']
# Tell libc++ to avoid including transitive headers
# https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html
flags['DEFINES'] += ['_LIBCPP_REMOVE_TRANSITIVE_INCLUDES=1']
return flags

def getOptimizedFlags(self, conf):
Expand Down
2 changes: 1 addition & 1 deletion .waf-tools/sanitizers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# Davide Pesavento (LIP6), 2016

def options(opt):
opt.add_option('--with-sanitizer', action='store', default='', dest='sanitizers',
Expand Down
3 changes: 0 additions & 3 deletions .waf-tools/sphinx_build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# encoding: utf-8

# inspired by code by Hans-Martin von Gaudecker, 2012

import os
Expand Down
20 changes: 14 additions & 6 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,29 @@ This document describes how to build and install ndn-tools.

On Debian and Ubuntu:

sudo apt install libpcap-dev
```shell
sudo apt install libpcap-dev
```

On CentOS and Fedora:

sudo dnf install libpcap-devel
```shell
sudo dnf install libpcap-devel
```

## Build Steps

To configure, compile, and install ndn-tools, type the following commands
in ndn-tools source directory:

./waf configure
./waf
sudo ./waf install
```shell
./waf configure
./waf
sudo ./waf install
```

To uninstall:

sudo ./waf uninstall
```shell
sudo ./waf uninstall
```
38 changes: 20 additions & 18 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ Contributions to ndn-tools must be licensed under the GPL v3 or a compatible lic
If you choose the GPL v3, please use the following license boilerplate in all `.hpp`
and `.cpp` files:

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) [Year(s)] [Copyright Holder(s)].
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
*
* ndn-tools is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
```cpp
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) [Year(s)], [Copyright Holder(s)].
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
*
* ndn-tools is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
```

## Directory Structure and Build Script

Expand Down

0 comments on commit f6d7599

Please sign in to comment.