Skip to content

Commit

Permalink
Require C++17 w/ GCC 7, Clang 5, ICC 18
Browse files Browse the repository at this point in the history
This also requires upgrade of CMake to 3.8 and Boost to 1.61.

Issue #250
  • Loading branch information
rakhimov committed Jan 5, 2018
1 parent e9123df commit edcc3f3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 47 deletions.
32 changes: 16 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ env:
- PATH=$HOME/.local/bin:$PATH:$PWD/install/bin
- QT_QPA_FONTDIR=/usr/share/fonts
- QT_QPA_PLATFORM=offscreen
- GCC_VERSION=4.9
- GCC_VERSION=7
matrix:
- CONFIG=Debug
- CONFIG=Release

addons:
apt:
packages:
- gcc-4.9
- g++-4.9
- libboost-program-options1.58-dev
- libboost-math1.58-dev
- libboost-random1.58-dev
- libboost-filesystem1.58-dev
- libboost-date-time1.58-dev
- gcc-7
- g++-7
- libboost-program-options1.61-dev
- libboost-math1.61-dev
- libboost-random1.61-dev
- libboost-filesystem1.61-dev
- libboost-date-time1.61-dev
- libxml2-dev
- libgoogle-perftools-dev
- qtbase5-dev
Expand All @@ -51,7 +51,7 @@ addons:
- lcov
sources: &Sources
- ubuntu-toolchain-r-test
- sourceline: "ppa:kzemek/boost"
- sourceline: "ppa:rakhimov/boost"

jobs:
include:
Expand All @@ -76,13 +76,13 @@ jobs:
addons:
apt:
packages:
- gcc-4.9
- g++-4.9
- libboost-program-options1.58-dev
- libboost-math1.58-dev
- libboost-random1.58-dev
- libboost-filesystem1.58-dev
- libboost-date-time1.58-dev
- gcc-7
- g++-7
- libboost-program-options1.61-dev
- libboost-math1.61-dev
- libboost-random1.61-dev
- libboost-filesystem1.61-dev
- libboost-date-time1.61-dev
- libxml2-dev
- valgrind
sources: *Sources
Expand Down
27 changes: 11 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.8)

# In-source build prevention.
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
Expand Down Expand Up @@ -27,8 +27,8 @@ option(PACKAGE "Package for distribution" OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Needed for Clang Tooling.

# Default to C++14.
set(CMAKE_CXX_STANDARD 14)
# Default to C++17.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand All @@ -44,26 +44,23 @@ set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Werror -Wno-sign-compare -Wnon-virtual-dtor -Wno-missing-field-initializers -Wold-style-cast")

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
CHECK_COMPILER_VERSION("4.9") # TODO: Wpedantic with gcc 4.9 errors with default arg lambdas.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-new-ttp-matching") # TODO: Boost ICL failure.
CHECK_COMPILER_VERSION("7.1")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wredundant-decls -Wcast-align -Wlogical-op -Wvla -Wuseless-cast -Wunreachable-code")

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wshadow -Wpedantic -Wmissing-declarations")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wshadow -Wpedantic -Wmissing-declarations")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wimplicit-fallthrough=0") # TODO: Consider explicit fallthrough.

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
CHECK_COMPILER_VERSION("3.6")
CHECK_COMPILER_VERSION("5.0")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wno-missing-braces -Wshadow -Wunused-exception-parameter")

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
CHECK_COMPILER_VERSION("6.1")

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
CHECK_COMPILER_VERSION("17.0.2")
# TODO: CMAKE_CXX_STANDARD has no effect on icc.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
CHECK_COMPILER_VERSION("18.0.1")
# TODO: Warning with overload of private override.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -diag-disable=1125")
endif()
Expand Down Expand Up @@ -153,11 +150,9 @@ list(APPEND LIBS ${LIBXML2_LIBRARIES})

# Include the boost header files and the program_options library.
# Please be sure to use Boost rather than BOOST.
set(BOOST_MIN_VERSION "1.61.0")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BOOST_MIN_VERSION "1.58.0")
list(APPEND LIBS ${CMAKE_DL_LIBS})
else()
set(BOOST_MIN_VERSION "1.61.0")
list(APPEND LIBS ${CMAKE_DL_LIBS}) # TODO: Use Boost DLL lib instead of POSIX on Linux.
endif()

if(NOT WIN32)
Expand Down
30 changes: 15 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,38 +73,38 @@ or the following commands must be executed after a normal clone.
Dependencies
============

==================== ====================
==================== ===============
Package Minimum Version
==================== ====================
CMake 3.5
boost 1.61 (1.58 on Linux)
==================== ===============
CMake 3.8
boost 1.61
libxml2 2.9.1
Python 2.7.3 or 3.3
Qt 5.2.1
==================== ====================
==================== ===============


Optional Dependencies
---------------------

==================== ==================
==================== ===============
Package Minimum Version
==================== ==================
==================== ===============
TCMalloc 1.7
JEMalloc 3.6
==================== ==================
==================== ===============


Compilers
---------

==================== ==================
==================== ===============
Package Minimum Version
==================== ==================
GCC/G++ 4.9
Clang/LLVM 3.6
Intel 17.0.2
==================== ==================
==================== ===============
GCC/G++ 7.1
Clang/LLVM 5.0
Intel 18.0.1
==================== ===============


Installing Dependencies
Expand All @@ -114,7 +114,7 @@ Ubuntu
------

Python and GCC/G++ compiler are assumed to be available on the system.
The process is tested on Ubuntu 16.04 LTS using ``apt-get`` as the package manager:
The process is tested on Ubuntu 17.10 using ``apt-get`` as the package manager:

.. code-block:: bash
Expand Down
3 changes: 3 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_NO_CAST_FROM_ASCII -DQT
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# TODO: MOC generated code has some useless casts.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-useless-cast")
if(Qt5Widgets_VERSION_STRING VERSION_LESS 5.4) # TODO: Failure on Trusty.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-missing-declarations")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# TODO: Qt moc offsetof applied to non-POD types is nonstandard.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -diag-disable=1875")
Expand Down

0 comments on commit edcc3f3

Please sign in to comment.