Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jun 18, 2020
2 parents 6d8ddd2 + 84dfbff commit 41e4c60
Show file tree
Hide file tree
Showing 63 changed files with 1,263 additions and 979 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

version: 1.0.{build}-{branch}

Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
# Copyright 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

#
# Generic Azure Pipelines build script for boostorg repositories
Expand Down
54 changes: 26 additions & 28 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

name: CI Tests

on:
Expand All @@ -20,55 +24,49 @@ jobs:
generator: Visual Studio 16 2019
- os: ubuntu-16.04
buildType: Debug
- os: windows-latest
generator: Unix Makefiles
runs-on: ${{matrix.os}}
env:
DEP_DIR: ${{github.workspace}}/dependencies
BOOST_VERSION: 1.56.0
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
id: cache-boost
with:
path: ${{env.DEP_DIR}}
key: ${{matrix.os}}-${{matrix.generator}}-${{env.BOOST_VERSION}}
# Install newer CMake to be able to find Boost
- name: Install CMake
if: runner.os == 'Linux' && matrix.standalone == 'Boost'
run: wget -qO- https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz | sudo tar --strip-components=1 -xzC /usr/local
# Install Boost, no wget on Windows -.-
- name: Download Boost
shell: cmake -P {0}
- name: Set BOOST_ROOT
if: matrix.standalone == 'Boost'
id: downloadBoost
run: |
string(REPLACE "." "_" filename boost_$ENV{BOOST_VERSION})
set(BOOST_ROOT $ENV{DEP_DIR}/${filename})
message("::set-env name=BOOST_ROOT::${BOOST_ROOT}")
if(EXISTS ${BOOST_ROOT}/include)
message("::set-output name=update::0")
else()
message("::set-output name=update::1")
set(boost_url https://sourceforge.net/projects/boost/files/boost/$ENV{BOOST_VERSION}/${filename}.7z/download)
set(DEP_BUILD_DIR $ENV{DEP_DIR}/build)
file(MAKE_DIRECTORY ${DEP_BUILD_DIR})
file(DOWNLOAD "${boost_url}" ${DEP_BUILD_DIR}/boost.7z SHOW_PROGRESS)
endif()
shell: bash
run: echo "::set-env name=BOOST_ROOT::${DEP_DIR//\\/\/}/boost_${BOOST_VERSION//./_}"
# Install Boost
- uses: actions/checkout@v2
if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true'
with:
repository: boostorg/boost
ref: boost-${{env.BOOST_VERSION}}
path: __buildBoost
fetch-depth: 1
- name: Build Boost
shell: bash
if: matrix.standalone == 'Boost' && steps.downloadBoost.outputs.update == 1
working-directory: ${{env.DEP_DIR}}/build
if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true'
run: |
7z x boost.7z > /dev/null
cd $(basename "$BOOST_ROOT")
[[ "${{matrix.generator}}" =~ "Unix" ]] && toolset=gcc || toolset=mingw
./bootstrap.sh --with-toolset="$toolset" --with-libraries=system,filesystem,chrono threading=multi || (cat bootstrap.log && false)
cd __buildBoost
git submodule update --init --jobs 3 tools/boostdep libs/filesystem tools/inspect libs/wave # Last 2 are required for pre-1.64
(cd tools/boostdep && git fetch && git checkout boost-1.73.0 && git checkout boost-1.63.0 -- depinst/exceptions.txt)
python tools/boostdep/depinst/depinst.py --include tools --exclude test --git_args '--jobs 3' filesystem
[[ "${{matrix.os}}" =~ "windows" ]] && toolset=mingw || toolset=gcc
./bootstrap.sh --with-toolset="$toolset" --with-libraries=system,filesystem threading=multi || (cat bootstrap.log && false)
sed -i 's/mingw/gcc/' project-config.jam
[[ "${{matrix.generator}}" =~ "Visual Studio" ]] && toolset=msvc-14.0 || toolset=gcc
./b2 headers
./b2 link=static toolset=$toolset address-model=64 -j$(nproc) --prefix="$BOOST_ROOT" install
cd "$DEP_DIR"
# Workaround for "Device or resource busy" error
if ! rm -r build; then sleep 30s; rm -r build || true; fi
cd ..
rm -r __buildBoost || true
- name: Create standalone
if: matrix.standalone == 'Standalone'
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

on:
push:
tags:
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/update_standalone.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

on:
push:
branches: [develop]
Expand All @@ -19,15 +23,24 @@ jobs:
git config --global user.name "$GITHUB_ACTOR"
git fetch
- name: Create standalone version
id: standalone
run: |
bash tools/create_standalone.sh /tmp/nowide_standalone
git checkout "$STANDALONE_BRANCH_NAME" -- || git checkout -b "$STANDALONE_BRANCH_NAME"
git rm -r *
mv /tmp/nowide_standalone/* .
git add .
# Check if anything changed to avoid later failure.
# E.g. nothing changes if only CI files are modified which are removed by the above
if git diff --quiet; then
echo "::set-output name=changed::false"
else
echo "::set-output name=changed::true"
fi
- name: Commit and push
if: steps.standalone.outputs.changed == 'true'
run: |
git commit -am "Include '${{github.event.head_commit.message}}'"
git add .
git commit -m "Include '${{github.event.head_commit.message}}'"
remote_repo="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
git push "$remote_repo" HEAD:$STANDALONE_BRANCH_NAME
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

language: cpp
os: linux
Expand Down
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)

# Builds the libraries for Boost.Nowide
#
# Options:
Expand All @@ -11,7 +15,7 @@

cmake_minimum_required(VERSION 3.9)
# Version number starts at 10 to avoid conflicts with Boost version
set(_version 10.0.2)
set(_version 11.0.0)
if(BOOST_SUPERPROJECT_SOURCE_DIR)
set(_version ${BOOST_SUPERPROJECT_VERSION})
endif()
Expand All @@ -30,13 +34,17 @@ endif()

include(BoostAddOptions)
include(BoostAddWarnings)
include(CheckCXXSourceCompiles)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(CTest)
endif()

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/test/check_lfs_support.cpp lfsSource)
check_cxx_source_compiles("${lfsSource}" BOOST_NOWIDE_HAS_LFS)

# Using glob here is ok as it is only for headers
file(GLOB_RECURSE headers include/*.hpp)
add_library(boost_nowide src/cstdio.cpp src/cstdlib.cpp src/iostream.cpp ${headers})
add_library(boost_nowide src/cstdio.cpp src/cstdlib.cpp src/filebuf.cpp src/iostream.cpp src/stat.cpp ${headers})
add_library(Boost::nowide ALIAS boost_nowide)
set_target_properties(boost_nowide PROPERTIES
CXX_VISIBILITY_PRESET hidden
Expand All @@ -47,18 +55,17 @@ set_target_properties(boost_nowide PROPERTIES
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_nowide PUBLIC BOOST_NOWIDE_DYN_LINK)
endif()
if(NOT BOOST_NOWIDE_HAS_LFS)
target_compile_definitions(boost_nowide PRIVATE BOOST_NOWIDE_NO_LFS)
endif()
target_compile_definitions(boost_nowide PUBLIC BOOST_NOWIDE_NO_LIB)
target_include_directories(boost_nowide PUBLIC include)
boost_add_warnings(boost_nowide pedantic ${Boost_NOWIDE_WERROR})
target_compile_features(boost_nowide PUBLIC cxx_std_11)

if(BOOST_SUPERPROJECT_SOURCE_DIR)
target_link_libraries(boost_nowide PUBLIC Boost::config Boost::smart_ptr Boost::static_assert)
set(Boost_NOWIDE_INSTALL OFF) # smart_ptr does not support installation
target_link_libraries(boost_nowide PUBLIC Boost::config)
else()
# Default boost libs are static on windows and dynamic on linux
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost 1.56 REQUIRED)
target_link_libraries(boost_nowide PUBLIC Boost::boost)
endif()
Expand Down
6 changes: 1 addition & 5 deletions Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ set(_boost_nowide_superproject "@BOOST_SUPERPROJECT_SOURCE_DIR@")

include(CMakeFindDependencyMacro)
if(_boost_nowide_superproject)
foreach(dep IN ITEMS boost_config boost_smart_ptr boost_static_assert)
foreach(dep IN ITEMS boost_config)
find_dependency(${dep})
endforeach()
else()
# Default boost libs are static on windows and dynamic on linux
if(WIN32 AND "${Boost_USE_STATIC_LIBS}" STREQUAL "")
set(Boost_USE_STATIC_LIBS ON)
endif()
find_dependency(Boost 1.56)
endif()

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org

### Properties

* C++03 **(will be raised to C++11 by mid 2020)**
* optional C++11/17 support
* optional C++17 (filesystem) support
* Usable outside of Boost via CMake
* Compiled library on every OS

Note on the last point:
Having a compiled library allows cross-platform access to e.g. `setenv` which would not be available when using a `-std=c++nn` flag.
This is different to the version available prior to the inclusion in Boost.

### Requirements (All versions)

* C++11 (or higher) compatible compiler
* MSVC 2015 and up work
* libstdc++ < 5 is unsupported as it is silently lacking C++11 features

### Requirements (Boost version)

* C++03 (or higher) compatible compiler
* Boost (>= 1.56)
* CMake (when not using as part of Boost) or B2 (otherwise)

Expand All @@ -38,7 +42,6 @@ The [standalone branch](https://github.com/boostorg/nowide/tree/standalone) keep
It is automatically updated so referring to a specific commit is recommended.
You can also use the standalone source archive which is part of every release.

* C++11 (or higher) compatible compiler
* CMake

# Quickstart
Expand Down
42 changes: 30 additions & 12 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
# Boost Nowide Library Build Jamfile

# (C) Copyright Beman Dawes 2002, 2006, Artyom Beilis 2012
# Copyright (c) 2002, 2006 Beman Dawes
# Copyright (c) 2012 Artyom Beilis (Tonkikh)
# Copyright (c) 2020 Alexander Grund
#

# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or www.boost.org/LICENSE_1_0.txt)

# (See accompanying file LICENSE or www.boost.org/LICENSE_1_0.txt)
# See library home page at http://www.boost.org/libs/nowide

import ../../config/checks/config : requires ;

local requirements =
<link>shared:<define>BOOST_NOWIDE_DYN_LINK=1
;

obj cxx11_moveable_fstreams : ../test/check_movable_fstreams.cpp ;
explicit cxx11_moveable_fstreams ;
obj lfs_support : ../test/check_lfs_support.cpp ;
explicit lfs_support ;

project boost/nowide
: source-location ../src
: usage-requirements # pass these requirement to dependents (i.e. users)
<link>shared:<define>BOOST_NOWIDE_DYN_LINK=1
;
: source-location ../src
: requirements $(requirements)
[ requires
cxx11_defaulted_functions
cxx11_noexcept
cxx11_rvalue_references
cxx11_static_assert
]
[ check-target-builds cxx11_moveable_fstreams "std::fstream is moveable and swappable" : : <build>no ]
[ check-target-builds lfs_support "Has Large File Support" : : <define>BOOST_NOWIDE_NO_LFS ]
: usage-requirements $(requirements)
;

SOURCES = cstdio cstdlib iostream ;
local SOURCES = cstdio cstdlib filebuf iostream stat ;

lib boost_nowide
: $(SOURCES).cpp
: <link>shared:<define>BOOST_NOWIDE_DYN_LINK=1
;
: $(SOURCES).cpp
;

boost-install boost_nowide ;
2 changes: 1 addition & 1 deletion doc/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2019-2019 Alexander Grund
# Distributed under the Boost Software License, Version 1.0
# (see accompanying file LICENSE_1_0.txt or a copy at
# (see accompanying file LICENSE or a copy at
# http://www.boost.org/LICENSE_1_0.txt)

using doxygen ;
Expand Down
9 changes: 8 additions & 1 deletion doc/changelog.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
// Copyright (c) 2019-2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

/*! \page changelog_page Changelog

\section changelog Changelog

\subsection changelog_11_0_0 Nowide 11.0.0

- Require C++11 compatible compiler and stdlib
- LFS: Add support for files > 2 GB where the underlying system supports it
- Generic UTF conversion functions are now available in the boost::nowide::utf namespace
- Add support for stat with UTF-8 paths

\subsection changelog_10_0_2 Nowide 10.0.2

- boost::nowide::cin now ignores CR (\r) characters and treats CTRL+Z at the beginning of a line as EOF (matching std::cin behavior)
Expand Down
2 changes: 1 addition & 1 deletion doc/gendoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# accompanying file LICENSE or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#

Expand Down
2 changes: 1 addition & 1 deletion doc/main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Copyright (c) 2019-2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

Expand Down
Loading

0 comments on commit 41e4c60

Please sign in to comment.