Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ matrix:
- cmake3-data
- clang
- clang-format-3.9
- gfortran-4.6
- gfortran
- libboost-math-dev
env:
- CXX_COMPILER='clang++'
- C_COMPILER='clang'
- Fortran_COMPILER='gfortran-4.6'
- Fortran_COMPILER='gfortran'
- BUILD_TYPE='release'
- PYTHON='--three'
- RUN_DANGER=true
Expand All @@ -45,14 +45,14 @@ matrix:
packages:
- cmake3
- cmake3-data
- g++-4.6
- gcc-4.6
- gfortran-4.6
- g++
- gcc
- gfortran
- libboost-math-dev
env:
- CXX_COMPILER='g++-4.6'
- C_COMPILER='gcc-4.6'
- Fortran_COMPILER='gfortran-4.6'
- CXX_COMPILER='g++'
- C_COMPILER='gcc'
- Fortran_COMPILER='gfortran'
- BUILD_TYPE='release'
- PYTHON='--two'
- RUN_DANGER=false
Expand Down Expand Up @@ -82,15 +82,15 @@ matrix:
packages:
- cmake3
- cmake3-data
- g++-4.8
- gcc-4.8
- gfortran-4.8
- g++
- gcc
- gfortran
- libboost-math-dev
- lcov
env:
- CXX_COMPILER='g++-4.8'
- C_COMPILER='gcc-4.8'
- Fortran_COMPILER='gfortran-4.8'
- CXX_COMPILER='g++'
- C_COMPILER='gcc'
- Fortran_COMPILER='gfortran'
- BUILD_TYPE='debug'
- PYTHON='--two'
- COVERAGE='--coverage'
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
Messina (J. Chem. Phys. 2002, 117 (24), 11062) and
Delgado _et al._ (J. Chem. Phys. 2013, 139 (2), 024105)

### Deprecated

- C++03 support is effectively **deprecated** in favor of C++11. Support for GCC
4.6 and earlier has been dropped. Please consider upgrading your C++ compiler
to a [fully standard-compliant one](https://en.cppreference.com/w/cpp/compiler_support#cpp11)

### Changed

- The versioning machinery has been updated. The update was inspired by the
Expand All @@ -31,6 +37,7 @@
- The `ENABLE_Fortran_API` configuration option has been renamed
`TEST_Fortran_API`, since it now only triggers compilation of the
`Fortran_host` test case.
- **BREAKING CHANGE** The minimum required version of CMake is now 3.3

### Fixed

Expand Down
45 changes: 39 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (c) 2015-2018 by Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors.

# set minimum cmake version
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)

# project name
project(PCMSolver CXX C Fortran)
project(PCMSolver LANGUAGES CXX C Fortran)

# do not rebuild if rules (compiler flags) change
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
Expand All @@ -15,10 +15,44 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

# Options handling utilities
include(CMakeDependentOption)
# Macro for printing an option in a consistent manner
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# Syntax: print_option(<option to print> <was specified>)
macro(print_option variable default)
if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "")
message(STATUS "Setting (unspecified) option ${variable}: ${default}")
else()
message(STATUS "Setting option ${variable}: ${${variable}}")
endif()
endmacro()

# Wraps an option with default ON/OFF. Adds nice messaging to option()
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# Syntax: option_with_print(<option name> <description> <default value>)
macro(option_with_print variable msge default)
print_option(${variable} ${default})
option(${variable} ${msge} ${default})
endmacro()

# Wraps an option with a default other than ON/OFF and prints it
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# NOTE: Can't combine with above b/c CMake handles ON/OFF options specially
# NOTE2: CMake variables are always defined so need to further check for if
# they are the NULL string. This is also why we need the force
# Syntax: option_with_default(<option name> <description> <default value>)
macro(option_with_default variable msge default)
print_option(${variable} "${default}")
if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "")
set(${variable} "${default}" CACHE STRING ${msge} FORCE)
endif()
endmacro()

# directories which hold included cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/custom)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/custom/compilers)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/downloaded)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom/compilers)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/downloaded)

# included cmake modules
include(autocmake_fc)
Expand All @@ -28,7 +62,6 @@ include(Fortran_C)
include(CXXFlags)
include(CFlags)
include(FortranFlags)
include(options_wrappers)
include(autocmake_custom_color_messages)
include(autocmake_ccache)
include(windows)
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
[![Travis CI build status](https://travis-ci.org/PCMSolver/pcmsolver.svg?branch=release%2F1.2.Z)](https://travis-ci.org/PCMSolver/pcmsolver)
[![Documentation Status](https://readthedocs.org/projects/pcmsolver/badge/?version=stable)](http://pcmsolver.readthedocs.org/en/latest/?badge=latest)
[![Coverage Status](https://codecov.io/gh/PCMSolver/pcmsolver/branch/release%2F1.2.Z/graph/badge.svg)](https://codecov.io/gh/PCMSolver/pcmsolver)
[![Coverity Scan Build](https://scan.coverity.com/projects/3046/badge.svg)](https://scan.coverity.com/projects/3046)

PCMSolver
=========
Expand All @@ -29,17 +28,11 @@ Python and Python packages are installed and managed _via_ [Pipenv](http://pipen
using the `Pipfile` and `Pipfile.lock` files. The following
compilers are used:

1. GCC 4.6, Python 2.7 This build generates _both_ the shared and static
1. GCC 4.8, Python 2.7 This build generates _both_ the shared and static
libraries, linking executables to the former.
2. GCC 6.3.0, Python 2.7 This build generates _only_ the static library.
3. Clang 3.5, GFortran 4.6, Python 3.5 This build generates _both_ the shared and static
3. Clang 3.5, GFortran 4.8, Python 3.5 This build generates _both_ the shared and static
libraries, linking executables to the former.
4. GCC 4.8, Python 2.7 This is a _debug_ build generating _both_ the shared and static
libraries, linking executables to the former. The build is run with
coverage analysis for submission to [Codecov](https://codecov.io).

The build needed for submission to [Coverity scan](https://scan.coverity.com/)
is triggered by pushes to the `coverity_scan` branch. It is run on
Ubuntu 12.04 LTS 64-bit with Python 2.7, CMake 3.3.2 and Boost 1.55.0
this is the environment offered by [Travis CI](https://travis-ci.org) pulling
in various PPA. GCC 5.1 is used, in debug mode.
3 changes: 1 addition & 2 deletions cmake/autocmake.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PCMSolver
min_cmake_version: 2.8.10
min_cmake_version: 3.3
setup_script: setup.py
url_root: https://github.com/coderefinery/autocmake/raw/master/
default_build_type: debug
Expand All @@ -22,7 +22,6 @@ modules:
- 'custom/compilers/FortranFlags.cmake'
- plugins:
- source:
- 'custom/options_wrappers.cmake'
- '%(url_root)modules/custom_color_messages.cmake'
- '%(url_root)modules/ccache.cmake'
- 'custom/windows.cmake'
Expand Down
43 changes: 41 additions & 2 deletions cmake/autocmake/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,43 @@ def autogenerated_notice():
return '\n'.join(s)


def gen_cmake_options_wrappers():
s = """\n# Options handling utilities
include(CMakeDependentOption)
# Macro for printing an option in a consistent manner
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# Syntax: print_option(<option to print> <was specified>)
macro(print_option variable default)
if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "")
message(STATUS "Setting (unspecified) option ${variable}: ${default}")
else()
message(STATUS "Setting option ${variable}: ${${variable}}")
endif()
endmacro()

# Wraps an option with default ON/OFF. Adds nice messaging to option()
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# Syntax: option_with_print(<option name> <description> <default value>)
macro(option_with_print variable msge default)
print_option(${variable} ${default})
option(${variable} ${msge} ${default})
endmacro()

# Wraps an option with a default other than ON/OFF and prints it
# Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard)
# NOTE: Can't combine with above b/c CMake handles ON/OFF options specially
# NOTE2: CMake variables are always defined so need to further check for if
# they are the NULL string. This is also why we need the force
# Syntax: option_with_default(<option name> <description> <default value>)
macro(option_with_default variable msge default)
print_option(${variable} "${default}")
if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "")
set(${variable} "${default}" CACHE STRING ${msge} FORCE)
endif()
endmacro()"""
return s


def gen_setup(config, default_build_type, relative_path, setup_script_name):
"""
Generate setup script.
Expand Down Expand Up @@ -132,7 +169,7 @@ def gen_cmakelists(project_name, project_language, min_cmake_version, default_bu
s.append('cmake_minimum_required(VERSION {0} FATAL_ERROR)'.format(min_cmake_version))

s.append('\n# project name')
s.append('project({0} {1})'.format(project_name, project_language))
s.append('project({0} LANGUAGES {1})'.format(project_name, project_language))

s.append('\n# do not rebuild if rules (compiler flags) change')
s.append('set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)')
Expand All @@ -148,6 +185,8 @@ def gen_cmakelists(project_name, project_language, min_cmake_version, default_bu
s.append(' set(CMAKE_BUILD_TYPE "{0}")'.format(_build_type))
s.append('endif()')

s.append(gen_cmake_options_wrappers())

if len(modules) > 0:
s.append('\n# directories which hold included cmake modules')

Expand All @@ -159,7 +198,7 @@ def gen_cmakelists(project_name, project_language, min_cmake_version, default_bu
rel_cmake_module_path = os.path.join(relative_path, directory)
# on windows cmake corrects this so we have to make it wrong again
rel_cmake_module_path = rel_cmake_module_path.replace('\\', '/')
s.append('set(CMAKE_MODULE_PATH ${{CMAKE_MODULE_PATH}} ${{PROJECT_SOURCE_DIR}}/{0})'.format(rel_cmake_module_path))
s.append('list(APPEND CMAKE_MODULE_PATH ${{PROJECT_SOURCE_DIR}}/{0})'.format(rel_cmake_module_path))

if len(modules) > 0:
s.append('\n# included cmake modules')
Expand Down
25 changes: 24 additions & 1 deletion cmake/custom/compilers/CXXFlags.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
option(ENABLE_CXX11_SUPPORT "Enable C++11 compiler support" ON)
option_with_print(ENABLE_CXX11_SUPPORT "Enable C++11 compiler support" ON)

# Discover C++11 support
if(ENABLE_CXX11_SUPPORT)
include(SetCompilerFlag)
set_compiler_flag(
RESULT cxx11_flag
LANGUAGE CXX
REQUIRED
FLAGS "-std=c++11;-std=c++0x;--c++11;--c++0x"
)
if(cxx11_flag)
set(CXX_STANDARD_FLAG ${cxx11_flag})
set(HAS_CXX11 TRUE)
message(STATUS "Using C++11 standard")
else()
set(CXX_STANDARD_FLAG "-std=gnu++98")
set(HAS_CXX11 FALSE)
message(STATUS "Using C++03 standard")
message(WARNING "Upgrade your compiler! C++03 support is DEPRECATED and will be removed")
endif()
else()
message(WARNING "Upgrade your compiler! C++03 support is DEPRECATED and will be removed")
endif()

include(GNU.CXX)
include(Clang.CXX)
Expand Down
Loading