From 97435dcb90a5edb4ba87963e01246722714a5a6e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Mon, 16 Jul 2018 23:02:38 -0400 Subject: [PATCH 01/28] Enable CircleCI --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++++++++++ testing/env.py | 8 ++++++-- testing/menu.yml | 17 +++++++++++++---- 3 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..455e8b499 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,39 @@ +version: 2 + +jobs: + build: + docker: + - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-intel2018.1 + user: root + environment: + CIRCLECI_COMPILER: intel + steps: + - checkout + - run: + name: Python dependencies + command: | + pip install --user pipenv --upgrade pip + pipenv install --three + - run: + name: Report + command: | + pipenv run python --version + - run: + shell: /bin/bash + name: Testing + command: | + source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux + pipenv run python testing/collect_tests.py 'chapter-01/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-02/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-03/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-04/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-05/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-06/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-07/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-08/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-09/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-10/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-11/recipe-0[1-3]' && + pipenv run python testing/collect_tests.py 'chapter-12/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-13/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-14/recipe-*' diff --git a/testing/env.py b/testing/env.py index 6e9724ae5..fe9a56d83 100644 --- a/testing/env.py +++ b/testing/env.py @@ -14,8 +14,12 @@ def get_ci_environment(): ci_environment = 'appveyor-vs' else: ci_environment = 'appveyor-msys' - elif os.environ.get('DRONE'): - ci_environment = 'drone' + elif os.environ.get('CIRCLECI'): + circle_compiler = os.environ.get('CIRCLECI_COMPILER') + if circle_compiler == 'intel': + ci_environment = 'circle-intel' + else: + ci_environment = 'circle-pgi' else: ci_environment = 'local' return ci_environment diff --git a/testing/menu.yml b/testing/menu.yml index a2fa25855..340487a89 100644 --- a/testing/menu.yml +++ b/testing/menu.yml @@ -17,15 +17,24 @@ appveyor-msys: env: - 'DIE_HARD': 'True' -drone: +circle-intel: definitions: - - CMAKE_C_COMPILER: 'gcc' - - CMAKE_CXX_COMPILER: 'g++' - - CMAKE_Fortran_COMPILER: 'pgfortran' + - CMAKE_C_COMPILER: 'icc' + - CMAKE_CXX_COMPILER: 'icpc' + - CMAKE_Fortran_COMPILER: 'ifort' - CMAKE_BUILD_TYPE: 'Debug' env: - 'DIE_HARD': 'True' +circle-pgi: + definitions: + - CMAKE_C_COMPILER: 'pgcc' + - CMAKE_CXX_COMPILER: 'pgc++' + - CMAKE_Fortran_COMPILER: 'pgfortran' + - CMAKE_BUILD_TYPE: 'Debug' + env: + - 'DIE_HARD': 'True' + travis-linux: definitions: - CMAKE_C_COMPILER: 'gcc-7' From 4531969cd16f33c7636d454e2dcf06cede05c6a6 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Wed, 8 Aug 2018 16:21:20 -0400 Subject: [PATCH 02/28] Set Eigen3_DIR for CircleCI --- .circleci/config.yml | 119 +++++++++++++----- README.md | 1 + chapter-02/recipe-06/cxx-example/menu.yml | 8 +- chapter-03/recipe-07/cxx-example-3.5/menu.yml | 8 +- chapter-03/recipe-07/cxx-example/menu.yml | 8 +- 5 files changed, 108 insertions(+), 36 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 455e8b499..1e8736da3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,39 +1,98 @@ version: 2 -jobs: - build: +variables: + intel-linux: &intel-linux docker: - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-intel2018.1 user: root environment: CIRCLECI_COMPILER: intel + working_directory: ~/cmake-cookbook + pgi-linux: &pgi-linux + docker: + - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-pgi17.4 + user: root + environment: + CIRCLECI_COMPILER: pgi + working_directory: ~/cmake-cookbook + setup: &setup + run: + name: Set up base system and Python dependencies + command: | + cat >> $BASH_ENV < Date: Wed, 8 Aug 2018 22:28:03 -0400 Subject: [PATCH 03/28] Update testing/README.md --- testing/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testing/README.md b/testing/README.md index f65e6f4f5..987028978 100644 --- a/testing/README.md +++ b/testing/README.md @@ -38,8 +38,12 @@ appveyor-vs: appveyor-msys: ... -# Drone CI -drone: +# Circle CI on Linux with Intel 2018 +circle-intel: + ... + +# Circle CI on Linux with PGI 18.4 +circle-pgi: ... ``` From 4477f16c731b0430b5cc9a93ac98cd4281bfd72b Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Wed, 8 Aug 2018 23:00:51 -0400 Subject: [PATCH 04/28] Fixes for Intel Docker image --- .circleci/config.yml | 3 +-- .../fortran-example/src/evolution/evolution.f90 | 6 +++--- .../cxx-example/external/upstream/boost/CMakeLists.txt | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1e8736da3..99ab588aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,8 +24,7 @@ variables: source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux fi EOF - pip install --user pipenv --upgrade pip - pipenv install --three + pipenv install --python /usr/bin/python3 report: &report run: name: Report diff --git a/chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 b/chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 index 4f4ad639f..40db629e1 100644 --- a/chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 +++ b/chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 @@ -18,7 +18,7 @@ pure subroutine evolve(row, rule_binary) integer, intent(in) :: rule_binary(8) integer :: i integer :: left, center, right - integer :: ancestors + integer :: ancestry integer, allocatable :: new_row(:) allocate(new_row(size(row))) @@ -31,8 +31,8 @@ pure subroutine evolve(row, rule_binary) if (left < 1) left = left + size(row) if (right > size(row)) right = right - size(row) - ancestors = compute_ancestors(row, left, center, right) - new_row(i) = rule_binary(ancestors) + ancestry = compute_ancestors(row, left, center, right) + new_row(i) = rule_binary(ancestry) end do row = new_row diff --git a/chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt b/chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt index f5bc6c1c4..48fa170b3 100644 --- a/chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt +++ b/chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt @@ -21,7 +21,11 @@ else() set(_toolset "clang") set(_cxx_std_flag "-std=c++11") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") - set(_toolset "intel") + if(APPLE) + set(_toolset "intel-darwin") + else() + set(_toolset "intel-linux") + endif() set(_cxx_std_flag "-std=c++11") endif() @@ -43,10 +47,6 @@ else() message(STATUS " Libraries to be built: ${printout}") endif() - set(_user_config_jamfile "${PROJECT_BINARY_DIR}/user-config.jam") - file(WRITE "${_user_config_jamfile}" "using ${_toolset} : : ${CMAKE_CXX_COMPILER} : \"${_cxx_std_flag}\" \"${_cxx_std_flag}\" ;") - set(_build_user_config_args "--user-config=${PROJECT_BINARY_DIR}/user-config.jam") - include(ExternalProject) ExternalProject_Add(boost_external URL From a31380404cb70085c4d34d058f930b6390791e80 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Wed, 8 Aug 2018 23:14:15 -0400 Subject: [PATCH 05/28] Enforce C++11 in chapter 9, recipe 1 --- .../fortran-cxx-example/CMakeLists.txt | 4 ++++ chapter-10/recipe-01/cxx-example/menu.yml | 8 +++++++ chapter-10/recipe-02/cxx-example/menu.yml | 8 +++++++ chapter-10/recipe-03/cxx-example/menu.yml | 8 +++++++ .../recipe-03/cxx-example/src/Message.hpp | 22 ++++++++++++++++++- chapter-10/recipe-04/cxx-example/menu.yml | 8 +++++++ 6 files changed, 57 insertions(+), 1 deletion(-) mode change 120000 => 100644 chapter-10/recipe-03/cxx-example/src/Message.hpp diff --git a/chapter-09/recipe-01/fortran-cxx-example/CMakeLists.txt b/chapter-09/recipe-01/fortran-cxx-example/CMakeLists.txt index 68e9ac839..ee673192c 100644 --- a/chapter-09/recipe-01/fortran-cxx-example/CMakeLists.txt +++ b/chapter-09/recipe-01/fortran-cxx-example/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-01 LANGUAGES Fortran CXX) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/chapter-10/recipe-01/cxx-example/menu.yml b/chapter-10/recipe-01/cxx-example/menu.yml index 936dec66b..70bda9ec3 100644 --- a/chapter-10/recipe-01/cxx-example/menu.yml +++ b/chapter-10/recipe-01/cxx-example/menu.yml @@ -14,6 +14,14 @@ travis-osx: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-01 +circle-intel: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + +circle-pgi: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + local: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-01 diff --git a/chapter-10/recipe-02/cxx-example/menu.yml b/chapter-10/recipe-02/cxx-example/menu.yml index ade098301..0912024ac 100644 --- a/chapter-10/recipe-02/cxx-example/menu.yml +++ b/chapter-10/recipe-02/cxx-example/menu.yml @@ -14,6 +14,14 @@ travis-osx: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-02 +circle-intel: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + +circle-pgi: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + local: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-02 diff --git a/chapter-10/recipe-03/cxx-example/menu.yml b/chapter-10/recipe-03/cxx-example/menu.yml index 2632bdfda..5802a4d7e 100644 --- a/chapter-10/recipe-03/cxx-example/menu.yml +++ b/chapter-10/recipe-03/cxx-example/menu.yml @@ -14,6 +14,14 @@ travis-osx: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 +circle-intel: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + +circle-pgi: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + local: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 diff --git a/chapter-10/recipe-03/cxx-example/src/Message.hpp b/chapter-10/recipe-03/cxx-example/src/Message.hpp deleted file mode 120000 index 5414eabb1..000000000 --- a/chapter-10/recipe-03/cxx-example/src/Message.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../recipe-02/cxx-example/src/Message.hpp \ No newline at end of file diff --git a/chapter-10/recipe-03/cxx-example/src/Message.hpp b/chapter-10/recipe-03/cxx-example/src/Message.hpp new file mode 100644 index 000000000..848ac08d9 --- /dev/null +++ b/chapter-10/recipe-03/cxx-example/src/Message.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +#include "messageExport.h" + +class message_EXPORT Message { +public: + Message(const std::string &m) : message_(m) {} + + friend std::ostream &operator<<(std::ostream &os, Message &obj) { + return obj.printObject(os); + } + +private: + std::string message_; + std::ostream &printObject(std::ostream &os); +}; + +std::string getUUID(); diff --git a/chapter-10/recipe-04/cxx-example/menu.yml b/chapter-10/recipe-04/cxx-example/menu.yml index 396316bbd..9c16d9561 100644 --- a/chapter-10/recipe-04/cxx-example/menu.yml +++ b/chapter-10/recipe-04/cxx-example/menu.yml @@ -14,6 +14,14 @@ travis-osx: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-04 +circle-intel: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + +circle-pgi: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + local: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-04 From 85fdbab77a8fdc9d821ffd88b6daef036d885062 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Wed, 8 Aug 2018 23:57:23 -0400 Subject: [PATCH 06/28] Fix ch 6, r 2 for Intel Docker image testing - Use .resolve() on paths, so that symlinks are properly handled - Use the Path.open syntax of pathlib --- .circleci/config.yml | 28 +++++++++---------- .../fortran-c-example/CMakeLists.txt | 2 +- .../fortran-c-example/configurator.py | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 99ab588aa..57af39690 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ variables: working_directory: ~/cmake-cookbook pgi-linux: &pgi-linux docker: - - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-pgi17.4 + - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-pgi18.4 user: root environment: CIRCLECI_COMPILER: pgi @@ -35,19 +35,19 @@ variables: name: Testing shell: /bin/bash command: | - pipenv run python testing/collect_tests.py 'chapter-01/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-02/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-03/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-04/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-05/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-06/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-07/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-08/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-09/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-10/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-11/recipe-0[1-3]' - pipenv run python testing/collect_tests.py 'chapter-12/recipe-*' - pipenv run python testing/collect_tests.py 'chapter-13/recipe-*' + pipenv run python testing/collect_tests.py 'chapter-01/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-02/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-03/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-04/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-05/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-06/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-07/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-08/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-09/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-10/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-11/recipe-0[1-3]' && + pipenv run python testing/collect_tests.py 'chapter-12/recipe-*' && + pipenv run python testing/collect_tests.py 'chapter-13/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-14/recipe-*' tests-conda: &tests-conda run: diff --git a/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt b/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt index c97abfd15..aca255eab 100644 --- a/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt +++ b/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt @@ -57,7 +57,7 @@ vars_dict = { 'CMAKE_Fortran_COMPILER': '${CMAKE_Fortran_COMPILER}', 'CMAKE_C_COMPILER': '${CMAKE_C_COMPILER}', } -configure_file(input_file, output_file, vars_dict) +configure_file(input_file.resolve(), output_file.resolve(), vars_dict) ") find_package(PythonInterp QUIET REQUIRED) diff --git a/chapter-06/recipe-02/fortran-c-example/configurator.py b/chapter-06/recipe-02/fortran-c-example/configurator.py index 44a6ef88d..738b0cc42 100644 --- a/chapter-06/recipe-02/fortran-c-example/configurator.py +++ b/chapter-06/recipe-02/fortran-c-example/configurator.py @@ -1,10 +1,10 @@ def configure_file(input_file, output_file, vars_dict): - with open(input_file, 'r') as f: + with input_file.open('r') as f: template = f.read() for var in vars_dict: template = template.replace('@' + var + '@', vars_dict[var]) - with open(output_file, 'w') as f: + with output_file.open('w') as f: f.write(template) From e1d32846185a340b56d26023086e1d82cc2987d7 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 22:23:40 -0400 Subject: [PATCH 07/28] Fix chapter 1 for PGI --- chapter-01/recipe-08/cxx-example/menu.yml | 8 +++++++- .../recipe-09/fortran-example/CMakeLists.txt | 1 + chapter-01/recipe-09/fortran-example/menu.yml | 14 ++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/chapter-01/recipe-08/cxx-example/menu.yml b/chapter-01/recipe-08/cxx-example/menu.yml index 749f7bfb5..2c44c30de 100644 --- a/chapter-01/recipe-08/cxx-example/menu.yml +++ b/chapter-01/recipe-08/cxx-example/menu.yml @@ -6,10 +6,16 @@ appveyor-msys: definitions: - CMAKE_CXX_FLAGS: '-fno-exceptions -fno-rtti' -drone: +circle-intel: definitions: - CMAKE_CXX_FLAGS: '-fno-exceptions -fno-rtti' +# PGI does not understand -Wall -Wextra -Wpedantic +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: definitions: - CMAKE_CXX_FLAGS: '-fno-exceptions -fno-rtti' diff --git a/chapter-01/recipe-09/fortran-example/CMakeLists.txt b/chapter-01/recipe-09/fortran-example/CMakeLists.txt index 6102a25d4..b0f10bd5d 100644 --- a/chapter-01/recipe-09/fortran-example/CMakeLists.txt +++ b/chapter-01/recipe-09/fortran-example/CMakeLists.txt @@ -16,6 +16,7 @@ add_library( add_executable(compute-areas compute-areas.f90) # These compiler flags will not work on Windows +# Intel or PGI target_compile_options(geometry PRIVATE "-std=f2008" diff --git a/chapter-01/recipe-09/fortran-example/menu.yml b/chapter-01/recipe-09/fortran-example/menu.yml index 2761cf0dc..cfbefdf7c 100644 --- a/chapter-01/recipe-09/fortran-example/menu.yml +++ b/chapter-01/recipe-09/fortran-example/menu.yml @@ -6,10 +6,16 @@ appveyor-msys: failing_generators: - 'Ninja' -drone: - definitions: - - CMAKE_Fortran_COMPILER: 'gfortran' - failing_generators: +# Intel use -std08 instead of -std=f2008 +circle-intel: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + +# PGI seems not to support Fortran2008 yet +circle-pgi: + skip_generators: + - 'Unix Makefiles' - 'Ninja' travis-linux: From a3463aee2c08e1b399574a65373996f41faa4ca9 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:30:36 -0400 Subject: [PATCH 08/28] Update README-s --- contributing/generate-readmes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/contributing/generate-readmes.py b/contributing/generate-readmes.py index 5db917889..ce69e4467 100644 --- a/contributing/generate-readmes.py +++ b/contributing/generate-readmes.py @@ -60,6 +60,7 @@ def generate_main_readme(directory_of_this_script, chapters, chapter_titles, [![Travis branch](https://img.shields.io/travis/dev-cafe/cmake-cookbook/master.svg?style=flat-square)](https://travis-ci.org/dev-cafe/cmake-cookbook) [![AppVeyor branch](https://img.shields.io/appveyor/ci/bast/cmake-cookbook/master.svg?style=flat-square)](https://ci.appveyor.com/project/bast/cmake-cookbook/branch/master) +[![CircleCI](https://circleci.com/gh/robertodr/cmake-cookbook.svg?style=svg)](https://circleci.com/gh/robertodr/cmake-cookbook) [![GitHub issues](https://img.shields.io/github/issues/dev-cafe/cmake-cookbook.svg?style=flat-square)](https://github.com/dev-cafe/cmake-cookbook/issues) [![GitHub forks](https://img.shields.io/github/forks/dev-cafe/cmake-cookbook.svg?style=flat-square)](https://github.com/dev-cafe/cmake-cookbook/network) From 675c0f5045a71af4995c9f111754d693884c9936 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:31:34 -0400 Subject: [PATCH 09/28] Fix chapter 3 for PGI testing --- chapter-03/recipe-04/cxx-example/menu.yml | 6 ++++++ chapter-03/recipe-07/cxx-example-3.5/menu.yml | 4 ++++ chapter-03/recipe-07/cxx-example/menu.yml | 4 ++++ chapter-03/recipe-08/cxx-example/menu.yml | 6 ++++++ chapter-03/recipe-09/c-example/menu.yml | 6 ++++++ chapter-03/recipe-10/c-example/FindZeroMQ.cmake | 8 +++++++- 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/chapter-03/recipe-04/cxx-example/menu.yml b/chapter-03/recipe-04/cxx-example/menu.yml index 11380f4e6..a0b31a358 100644 --- a/chapter-03/recipe-04/cxx-example/menu.yml +++ b/chapter-03/recipe-04/cxx-example/menu.yml @@ -6,6 +6,12 @@ appveyor-msys: failing_generators: - 'Ninja' +# Need to link against libpgftnrtl and librt +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: failing_generators: - 'Ninja' diff --git a/chapter-03/recipe-07/cxx-example-3.5/menu.yml b/chapter-03/recipe-07/cxx-example-3.5/menu.yml index 4685ff282..f3bdc7e02 100644 --- a/chapter-03/recipe-07/cxx-example-3.5/menu.yml +++ b/chapter-03/recipe-07/cxx-example-3.5/menu.yml @@ -2,7 +2,11 @@ circle-intel: definitions: - Eigen3_DIR: '/opt/eigen/share/eigen3/cmake' +# Compiler errors due to some undefined alignment primitive circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' definitions: - Eigen3_DIR: '/opt/eigen/share/eigen3/cmake' diff --git a/chapter-03/recipe-07/cxx-example/menu.yml b/chapter-03/recipe-07/cxx-example/menu.yml index 4685ff282..f3bdc7e02 100644 --- a/chapter-03/recipe-07/cxx-example/menu.yml +++ b/chapter-03/recipe-07/cxx-example/menu.yml @@ -2,7 +2,11 @@ circle-intel: definitions: - Eigen3_DIR: '/opt/eigen/share/eigen3/cmake' +# Compiler errors due to some undefined alignment primitive circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' definitions: - Eigen3_DIR: '/opt/eigen/share/eigen3/cmake' diff --git a/chapter-03/recipe-08/cxx-example/menu.yml b/chapter-03/recipe-08/cxx-example/menu.yml index 40cbced78..4dcae4ae5 100644 --- a/chapter-03/recipe-08/cxx-example/menu.yml +++ b/chapter-03/recipe-08/cxx-example/menu.yml @@ -3,6 +3,12 @@ appveyor-vs: - BOOST_ROOT: 'C:\Libraries\boost_1_67_0' - CMAKE_CXX_FLAGS: '-DBOOST_ALL_NO_LIB' +# PGI and Boost do not get along +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-osx: definitions: - BOOST_ROOT: '/usr/local/opt/boost@1.59' diff --git a/chapter-03/recipe-09/c-example/menu.yml b/chapter-03/recipe-09/c-example/menu.yml index 9056d0529..8b8a603e4 100644 --- a/chapter-03/recipe-09/c-example/menu.yml +++ b/chapter-03/recipe-09/c-example/menu.yml @@ -1,3 +1,9 @@ appveyor-vs: failing_generators: - 'Visual Studio 15 2017 Win64' + +# Fails to generate imported target for ZeroMQ +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-03/recipe-10/c-example/FindZeroMQ.cmake b/chapter-03/recipe-10/c-example/FindZeroMQ.cmake index 7f67e53f6..b1e406dad 100644 --- a/chapter-03/recipe-10/c-example/FindZeroMQ.cmake +++ b/chapter-03/recipe-10/c-example/FindZeroMQ.cmake @@ -46,7 +46,13 @@ if(ZeroMQ_INCLUDE_DIRS) endif() if(NOT ${CMAKE_C_PLATFORM_ID} STREQUAL "Windows") - find_library(ZeroMQ_LIBRARIES NAMES zmq HINTS ${_ZeroMQ_ROOT}/lib) + find_library(ZeroMQ_LIBRARIES + NAMES + zmq + HINTS + ${_ZeroMQ_ROOT}/lib + ${_ZeroMQ_ROOT}/lib/x86_64-linux-gnu + ) else() find_library(ZeroMQ_LIBRARIES NAMES From 4939a0eb22600afcdecb951c5f2b60fff4dba9c9 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:31:51 -0400 Subject: [PATCH 10/28] Test TARGET PkgConfig:: --- chapter-03/recipe-09/c-example/CMakeLists.txt | 2 +- chapter-05/recipe-08/c-example/CMakeLists.txt | 2 +- .../fortran-uuid-example/src/interfaces/CMakeLists.txt | 2 +- chapter-10/recipe-01/cxx-example/src/CMakeLists.txt | 3 ++- chapter-10/recipe-02/cxx-example/src/CMakeLists.txt | 3 ++- chapter-10/recipe-03/cxx-example/src/CMakeLists.txt | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/chapter-03/recipe-09/c-example/CMakeLists.txt b/chapter-03/recipe-09/c-example/CMakeLists.txt index d5666aff4..8839d9b58 100644 --- a/chapter-03/recipe-09/c-example/CMakeLists.txt +++ b/chapter-03/recipe-09/c-example/CMakeLists.txt @@ -15,7 +15,7 @@ pkg_search_module( IMPORTED_TARGET ) -if(ZeroMQ_FOUND) +if(TARGET PkgConfig::ZeroMQ) message(STATUS "Found ZeroMQ") endif() diff --git a/chapter-05/recipe-08/c-example/CMakeLists.txt b/chapter-05/recipe-08/c-example/CMakeLists.txt index 73e7d40ad..afd263afc 100644 --- a/chapter-05/recipe-08/c-example/CMakeLists.txt +++ b/chapter-05/recipe-08/c-example/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(PkgConfig REQUIRED QUIET) pkg_search_module(UUID REQUIRED uuid IMPORTED_TARGET) -if(UUID_FOUND) +if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") endif() diff --git a/chapter-09/recipe-01/fortran-uuid-example/src/interfaces/CMakeLists.txt b/chapter-09/recipe-01/fortran-uuid-example/src/interfaces/CMakeLists.txt index 348ebbe8a..1fdcc661e 100644 --- a/chapter-09/recipe-01/fortran-uuid-example/src/interfaces/CMakeLists.txt +++ b/chapter-09/recipe-01/fortran-uuid-example/src/interfaces/CMakeLists.txt @@ -3,7 +3,7 @@ FortranCInterface_VERIFY() find_package(PkgConfig REQUIRED QUIET) pkg_search_module(UUID REQUIRED uuid IMPORTED_TARGET) -if(UUID_FOUND) +if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") endif() find_package(Backtrace REQUIRED) diff --git a/chapter-10/recipe-01/cxx-example/src/CMakeLists.txt b/chapter-10/recipe-01/cxx-example/src/CMakeLists.txt index d6581f522..c816ce4bc 100644 --- a/chapter-10/recipe-01/cxx-example/src/CMakeLists.txt +++ b/chapter-10/recipe-01/cxx-example/src/CMakeLists.txt @@ -2,8 +2,9 @@ find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) pkg_search_module(UUID uuid IMPORTED_TARGET) - if(UUID_FOUND) + if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") + set(UUID_FOUND TRUE) endif() endif() diff --git a/chapter-10/recipe-02/cxx-example/src/CMakeLists.txt b/chapter-10/recipe-02/cxx-example/src/CMakeLists.txt index 7343214f7..cbb8fb526 100644 --- a/chapter-10/recipe-02/cxx-example/src/CMakeLists.txt +++ b/chapter-10/recipe-02/cxx-example/src/CMakeLists.txt @@ -2,8 +2,9 @@ find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) pkg_search_module(UUID uuid IMPORTED_TARGET) - if(UUID_FOUND) + if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") + set(UUID_FOUND TRUE) endif() endif() diff --git a/chapter-10/recipe-03/cxx-example/src/CMakeLists.txt b/chapter-10/recipe-03/cxx-example/src/CMakeLists.txt index 92b7ef421..55c7f69d1 100644 --- a/chapter-10/recipe-03/cxx-example/src/CMakeLists.txt +++ b/chapter-10/recipe-03/cxx-example/src/CMakeLists.txt @@ -2,8 +2,9 @@ find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) pkg_search_module(UUID uuid IMPORTED_TARGET) - if(UUID_FOUND) + if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") + set(UUID_FOUND TRUE) endif() endif() From c258f6ab0842ac21d4e70f0697c300e25fa5a0e9 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:37:45 -0400 Subject: [PATCH 11/28] Get back Boost recipe in chapter 3 with PGI --- chapter-03/recipe-08/cxx-example/menu.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/chapter-03/recipe-08/cxx-example/menu.yml b/chapter-03/recipe-08/cxx-example/menu.yml index 4dcae4ae5..bc0e4be08 100644 --- a/chapter-03/recipe-08/cxx-example/menu.yml +++ b/chapter-03/recipe-08/cxx-example/menu.yml @@ -3,11 +3,10 @@ appveyor-vs: - BOOST_ROOT: 'C:\Libraries\boost_1_67_0' - CMAKE_CXX_FLAGS: '-DBOOST_ALL_NO_LIB' -# PGI and Boost do not get along circle-pgi: - skip_generators: - - 'Unix Makefiles' - - 'Ninja' + definitions: + - BOOST_INCLUDEDIR: '/usr/include/boost' + - BOOST_LIBRARYDIR: '/usr/lib/x86_64-linux-gnu' travis-osx: definitions: From ff26d372291362c8bf6d709c991932963bc1042e Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:39:41 -0400 Subject: [PATCH 12/28] Fix chapter 4 for PGI testing --- chapter-04/recipe-04/cxx-example/menu.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chapter-04/recipe-04/cxx-example/menu.yml b/chapter-04/recipe-04/cxx-example/menu.yml index 622402b13..fb597a833 100644 --- a/chapter-04/recipe-04/cxx-example/menu.yml +++ b/chapter-04/recipe-04/cxx-example/menu.yml @@ -3,6 +3,11 @@ appveyor-vs: - BOOST_ROOT: 'C:\Libraries\boost_1_67_0' - CMAKE_CXX_FLAGS: '-DBOOST_ALL_NO_LIB' +circle-pgi: + definitions: + - BOOST_INCLUDEDIR: '/usr/include/boost' + - BOOST_LIBRARYDIR: '/usr/lib/x86_64-linux-gnu' + travis-osx: definitions: - BOOST_ROOT: '/usr/local/opt/boost@1.59' From e237cc8c03b204a1d7290f3f6ac88b47cb71d57c Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:52:42 -0400 Subject: [PATCH 13/28] Fix chapter 5 for PGI testing --- chapter-05/recipe-01/cxx-example/menu.yml | 5 +++++ chapter-05/recipe-03/cxx-example/CMakeLists.txt | 3 ++- chapter-05/recipe-03/cxx-example/menu.yml | 6 ++++++ chapter-05/recipe-04/cxx-example/CMakeLists.txt | 3 ++- chapter-05/recipe-04/cxx-example/menu.yml | 6 ++++++ chapter-05/recipe-09/cxx-example-asan/menu.yml | 6 ++++++ 6 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 chapter-05/recipe-01/cxx-example/menu.yml diff --git a/chapter-05/recipe-01/cxx-example/menu.yml b/chapter-05/recipe-01/cxx-example/menu.yml new file mode 100644 index 000000000..e3ac81c51 --- /dev/null +++ b/chapter-05/recipe-01/cxx-example/menu.yml @@ -0,0 +1,5 @@ +# Compiler errors due to some undefined alignment primitive +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-05/recipe-03/cxx-example/CMakeLists.txt b/chapter-05/recipe-03/cxx-example/CMakeLists.txt index 58d2ee93e..452e01c8c 100644 --- a/chapter-05/recipe-03/cxx-example/CMakeLists.txt +++ b/chapter-05/recipe-03/cxx-example/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(recipe-03 LANGUAGES CXX) +# Fortran needed to discover LAPACK with some compilers +project(recipe-03 LANGUAGES CXX Fortran) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/chapter-05/recipe-03/cxx-example/menu.yml b/chapter-05/recipe-03/cxx-example/menu.yml index e900791dd..d48badf19 100644 --- a/chapter-05/recipe-03/cxx-example/menu.yml +++ b/chapter-05/recipe-03/cxx-example/menu.yml @@ -6,6 +6,12 @@ appveyor-msys: failing_generators: - 'Ninja' +# Need to link against libpgftnrtl and librt +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: failing_generators: - 'Ninja' diff --git a/chapter-05/recipe-04/cxx-example/CMakeLists.txt b/chapter-05/recipe-04/cxx-example/CMakeLists.txt index 2fd109636..b4da1ffe8 100644 --- a/chapter-05/recipe-04/cxx-example/CMakeLists.txt +++ b/chapter-05/recipe-04/cxx-example/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(recipe-04 LANGUAGES CXX) +# Fortran needed to discover LAPACK with some compilers +project(recipe-04 LANGUAGES CXX Fortran) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/chapter-05/recipe-04/cxx-example/menu.yml b/chapter-05/recipe-04/cxx-example/menu.yml index e900791dd..d48badf19 100644 --- a/chapter-05/recipe-04/cxx-example/menu.yml +++ b/chapter-05/recipe-04/cxx-example/menu.yml @@ -6,6 +6,12 @@ appveyor-msys: failing_generators: - 'Ninja' +# Need to link against libpgftnrtl and librt +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: failing_generators: - 'Ninja' diff --git a/chapter-05/recipe-09/cxx-example-asan/menu.yml b/chapter-05/recipe-09/cxx-example-asan/menu.yml index bad8c8357..6f1d9d63a 100644 --- a/chapter-05/recipe-09/cxx-example-asan/menu.yml +++ b/chapter-05/recipe-09/cxx-example-asan/menu.yml @@ -2,3 +2,9 @@ appveyor-vs: definitions: - CMAKE_BUILD_TYPE: 'Release' - CMAKE_CONFIGURATION_TYPES: 'Release' + +# PGI does not understand all compiler options needed +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' From 7389d766ad86a33598f10539e6e71faa0ed8c456 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 9 Aug 2018 23:56:40 -0400 Subject: [PATCH 14/28] Skip one recipe on PGI --- chapter-05/recipe-08/c-example/menu.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chapter-05/recipe-08/c-example/menu.yml b/chapter-05/recipe-08/c-example/menu.yml index 047865567..4849924db 100644 --- a/chapter-05/recipe-08/c-example/menu.yml +++ b/chapter-05/recipe-08/c-example/menu.yml @@ -6,3 +6,9 @@ appveyor-msys: failing_generators: - 'MSYS Makefiles' - 'Ninja' + +# Fails to generate imported target for UUID +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' From 3cf35342487aae488ca660b757b2c734de20afa8 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Fri, 10 Aug 2018 20:08:51 -0400 Subject: [PATCH 15/28] Fix FileNotFoundError: for print_info.c.in I had misunderstood what `.resolve()` does --- chapter-06/recipe-02/fortran-c-example/CMakeLists.txt | 2 +- chapter-12/recipe-03/cxx-example/docs/Doxyfile.in | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt b/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt index aca255eab..c97abfd15 100644 --- a/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt +++ b/chapter-06/recipe-02/fortran-c-example/CMakeLists.txt @@ -57,7 +57,7 @@ vars_dict = { 'CMAKE_Fortran_COMPILER': '${CMAKE_Fortran_COMPILER}', 'CMAKE_C_COMPILER': '${CMAKE_C_COMPILER}', } -configure_file(input_file.resolve(), output_file.resolve(), vars_dict) +configure_file(input_file, output_file, vars_dict) ") find_package(PythonInterp QUIET REQUIRED) diff --git a/chapter-12/recipe-03/cxx-example/docs/Doxyfile.in b/chapter-12/recipe-03/cxx-example/docs/Doxyfile.in index a93040477..b0abceae4 100644 --- a/chapter-12/recipe-03/cxx-example/docs/Doxyfile.in +++ b/chapter-12/recipe-03/cxx-example/docs/Doxyfile.in @@ -45,7 +45,6 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES -TOC_INCLUDE_HEADINGS = 0 AUTOLINK_SUPPORT = YES BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO @@ -206,7 +205,6 @@ HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO -HTML_DYNAMIC_MENUS = YES HTML_DYNAMIC_SECTIONS = NO HTML_INDEX_NUM_ENTRIES = 100 GENERATE_DOCSET = NO @@ -364,7 +362,6 @@ DOTFILE_DIRS = MSCFILE_DIRS = DIAFILE_DIRS = PLANTUML_JAR_PATH = -PLANTUML_CFG_FILE = PLANTUML_INCLUDE_PATH = DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 From f38b5580fe8a0b5087213b0fcd4eb381487edb6c Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:11:23 -0400 Subject: [PATCH 16/28] Skip tests where PGI image cannot find Python libs --- .circleci/config.yml | 10 +++++----- chapter-03/recipe-02/c-example/menu.yml | 6 ++++++ chapter-03/recipe-03/cxx-example/menu.yml | 6 ++++++ chapter-09/recipe-03/cxx-example/menu.yml | 6 ++++++ chapter-09/recipe-04/cxx-example/menu.yml | 6 ++++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 57af39690..1488ff406 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ variables: - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-pgi18.4 user: root environment: - CIRCLECI_COMPILER: pgi + CIRCLECI_COMPILER: pgi working_directory: ~/cmake-cookbook setup: &setup run: @@ -24,17 +24,17 @@ variables: source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux fi EOF - pipenv install --python /usr/bin/python3 + pipenv install --three report: &report run: name: Report command: | pipenv run python --version - tests: &tests + tests: &tests run: name: Testing shell: /bin/bash - command: | + command: | pipenv run python testing/collect_tests.py 'chapter-01/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-02/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-03/recipe-*' && @@ -52,7 +52,7 @@ variables: tests-conda: &tests-conda run: name: Testing Conda recipes - shell: /bin/bash + shell: /bin/bash command: | pipenv run python testing/collect_tests.py 'chapter-11/recipe-04' && pipenv run python testing/collect_tests.py 'chapter-11/recipe-05' diff --git a/chapter-03/recipe-02/c-example/menu.yml b/chapter-03/recipe-02/c-example/menu.yml index bad8c8357..6b1567fa1 100644 --- a/chapter-03/recipe-02/c-example/menu.yml +++ b/chapter-03/recipe-02/c-example/menu.yml @@ -2,3 +2,9 @@ appveyor-vs: definitions: - CMAKE_BUILD_TYPE: 'Release' - CMAKE_CONFIGURATION_TYPES: 'Release' + +# CMake cannot find the Python library +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-03/recipe-03/cxx-example/menu.yml b/chapter-03/recipe-03/cxx-example/menu.yml index c7ee89bd6..c206377d1 100644 --- a/chapter-03/recipe-03/cxx-example/menu.yml +++ b/chapter-03/recipe-03/cxx-example/menu.yml @@ -6,3 +6,9 @@ appveyor-vs: appveyor-msys: definitions: - CMAKE_CXX_FLAGS: '-D_hypot=hypot' + +# CMake cannot find the Python library +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-09/recipe-03/cxx-example/menu.yml b/chapter-09/recipe-03/cxx-example/menu.yml index c3e86f86c..a8a32200d 100644 --- a/chapter-09/recipe-03/cxx-example/menu.yml +++ b/chapter-09/recipe-03/cxx-example/menu.yml @@ -10,3 +10,9 @@ appveyor-msys: definitions: - CMAKE_BUILD_TYPE: 'Release' - CMAKE_CXX_FLAGS: '-D_hypot=hypot' + +# CMake cannot find the Python library +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-09/recipe-04/cxx-example/menu.yml b/chapter-09/recipe-04/cxx-example/menu.yml index a3e6babd7..c6953c09c 100644 --- a/chapter-09/recipe-04/cxx-example/menu.yml +++ b/chapter-09/recipe-04/cxx-example/menu.yml @@ -18,6 +18,12 @@ appveyor-msys: - Boost_USE_STATIC_RUNTIME: 'ON' - CMAKE_CXX_FLAGS: '-D_hypot=hypot' +# CMake cannot find the Python library +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-osx: definitions: - BOOST_ROOT: '/usr/local/opt/boost@1.59' From 010020a90c71380163e5cf3b5ff65a555418a615 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:12:15 -0400 Subject: [PATCH 17/28] Fix chapter 9 for testing with PGI --- .../fortran-c-example/src/bt-randomgen-example.f90 | 2 +- chapter-09/recipe-01/fortran-uuid-example/menu.yml | 6 ++++++ chapter-09/recipe-02/cxx-example/menu.yml | 6 ++++++ chapter-09/recipe-05/cxx-example/menu.yml | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/chapter-09/recipe-01/fortran-c-example/src/bt-randomgen-example.f90 b/chapter-09/recipe-01/fortran-c-example/src/bt-randomgen-example.f90 index adc90e53e..40a4c1ec5 100644 --- a/chapter-09/recipe-01/fortran-c-example/src/bt-randomgen-example.f90 +++ b/chapter-09/recipe-01/fortran-c-example/src/bt-randomgen-example.f90 @@ -15,7 +15,7 @@ program bt_randomgen_example integer(c_int) :: bt_size write(output_unit, '(A)') 'Initializing randomgen C library' - call init_randomgen(time()) + call init_randomgen(int(time())) lower = -2 upper = 42 do i = 1, 20 diff --git a/chapter-09/recipe-01/fortran-uuid-example/menu.yml b/chapter-09/recipe-01/fortran-uuid-example/menu.yml index e2ea2d15c..f4d424d46 100644 --- a/chapter-09/recipe-01/fortran-uuid-example/menu.yml +++ b/chapter-09/recipe-01/fortran-uuid-example/menu.yml @@ -7,6 +7,12 @@ appveyor-msys: - 'MSYS Makefiles' - 'Ninja' +# Fails to generate imported target for UUID +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: failing_generators: - 'Ninja' diff --git a/chapter-09/recipe-02/cxx-example/menu.yml b/chapter-09/recipe-02/cxx-example/menu.yml index 11380f4e6..a0b31a358 100644 --- a/chapter-09/recipe-02/cxx-example/menu.yml +++ b/chapter-09/recipe-02/cxx-example/menu.yml @@ -6,6 +6,12 @@ appveyor-msys: failing_generators: - 'Ninja' +# Need to link against libpgftnrtl and librt +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: failing_generators: - 'Ninja' diff --git a/chapter-09/recipe-05/cxx-example/menu.yml b/chapter-09/recipe-05/cxx-example/menu.yml index a21ec40c5..8ca19c86d 100644 --- a/chapter-09/recipe-05/cxx-example/menu.yml +++ b/chapter-09/recipe-05/cxx-example/menu.yml @@ -8,3 +8,10 @@ appveyor-msys: - CMAKE_CXX_FLAGS: '-D_hypot=hypot' skip_generators: - 'MSYS Makefiles' + +# PGI does not understand -fvisibility flags +# that we get from pybind11 +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' From aae2f4afd57691b20a1a60399cddf8fea402ab0b Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:12:56 -0400 Subject: [PATCH 18/28] Rewrite generate.py --- chapter-06/recipe-03/cxx-example/generate.py | 29 +++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/chapter-06/recipe-03/cxx-example/generate.py b/chapter-06/recipe-03/cxx-example/generate.py index a0c4f98b1..f0bc3b702 100644 --- a/chapter-06/recipe-03/cxx-example/generate.py +++ b/chapter-06/recipe-03/cxx-example/generate.py @@ -2,11 +2,12 @@ Generates C++ vector of prime numbers up to max_number using sieve of Eratosthenes. """ +import pathlib import sys # for simplicity we do not verify argument list max_number = int(sys.argv[-2]) -output_file_name = sys.argv[-1] +output_file_name = pathlib.Path(sys.argv[-1]) numbers = range(2, max_number + 1) is_prime = {number: True for number in numbers} @@ -19,12 +20,20 @@ is_prime[current_position] = False primes = (number for number in numbers if is_prime[number]) -with open(output_file_name, 'w') as f: - f.write('#pragma once\n') - f.write('#include \n\n') - f.write('const std::size_t max_number = {0};\n'.format(max_number)) - f.write('std::vector & primes() {\n') - f.write(' static std::vector primes;\n') - for number in primes: - f.write(' primes.push_back({0});\n'.format(number)) - f.write(' return primes;\n}') +code = """#pragma once + +#include + +const std::size_t max_number = {max_number}; + +std::vector & primes() {{ + static std::vector primes; + +{push_back} + + return primes; +}} +""" +push_back = '\n'.join([' primes.push_back({:d});'.format(x) for x in primes]) +output_file_name.write_text( + code.format(max_number=max_number, push_back=push_back)) From c16ec95590f95c21ab4fbcfd952a9520d0da554b Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:13:11 -0400 Subject: [PATCH 19/28] Skip all of chapter 10 on PGI Somehow searching packages with pkg-config is unable to generate imported targets with the PGI image --- chapter-10/recipe-01/cxx-example/menu.yml | 4 ++++ chapter-10/recipe-02/cxx-example/menu.yml | 4 ++++ chapter-10/recipe-03/cxx-example/menu.yml | 4 ++++ chapter-10/recipe-04/cxx-example/menu.yml | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/chapter-10/recipe-01/cxx-example/menu.yml b/chapter-10/recipe-01/cxx-example/menu.yml index 70bda9ec3..ceb203d20 100644 --- a/chapter-10/recipe-01/cxx-example/menu.yml +++ b/chapter-10/recipe-01/cxx-example/menu.yml @@ -18,9 +18,13 @@ circle-intel: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 +# Fails to generate imported target for UUID circle-pgi: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + skip_generators: + - 'Unix Makefiles' + - 'Ninja' local: definitions: diff --git a/chapter-10/recipe-02/cxx-example/menu.yml b/chapter-10/recipe-02/cxx-example/menu.yml index 0912024ac..6e268f96b 100644 --- a/chapter-10/recipe-02/cxx-example/menu.yml +++ b/chapter-10/recipe-02/cxx-example/menu.yml @@ -18,9 +18,13 @@ circle-intel: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 +# Fails to generate imported target for UUID circle-pgi: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + skip_generators: + - 'Unix Makefiles' + - 'Ninja' local: definitions: diff --git a/chapter-10/recipe-03/cxx-example/menu.yml b/chapter-10/recipe-03/cxx-example/menu.yml index 5802a4d7e..40e4a714c 100644 --- a/chapter-10/recipe-03/cxx-example/menu.yml +++ b/chapter-10/recipe-03/cxx-example/menu.yml @@ -18,9 +18,13 @@ circle-intel: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 +# Fails to generate imported target for UUID circle-pgi: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + skip_generators: + - 'Unix Makefiles' + - 'Ninja' local: definitions: diff --git a/chapter-10/recipe-04/cxx-example/menu.yml b/chapter-10/recipe-04/cxx-example/menu.yml index 9c16d9561..6ac01980a 100644 --- a/chapter-10/recipe-04/cxx-example/menu.yml +++ b/chapter-10/recipe-04/cxx-example/menu.yml @@ -18,9 +18,13 @@ circle-intel: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 +# Fails to generate imported target for UUID circle-pgi: definitions: - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-03 + skip_generators: + - 'Unix Makefiles' + - 'Ninja' local: definitions: From 8043f46efb1e1ebf3870fc531837fa80506a7aec Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:14:01 -0400 Subject: [PATCH 20/28] Fix chapter 11 for testing with PGI --- chapter-11/recipe-01/cxx-example/menu.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chapter-11/recipe-01/cxx-example/menu.yml b/chapter-11/recipe-01/cxx-example/menu.yml index e124c14d7..0a273a017 100644 --- a/chapter-11/recipe-01/cxx-example/menu.yml +++ b/chapter-11/recipe-01/cxx-example/menu.yml @@ -1,2 +1,12 @@ targets: + - install + - test - package + +# Fails to generate imported target for UUID +circle-pgi: + definitions: + - CMAKE_INSTALL_PREFIX: $HOME/Software/recipe-01 + skip_generators: + - 'Unix Makefiles' + - 'Ninja' From bcd03ab7f8272bfb15dbf23a830c8462f45be18d Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:14:19 -0400 Subject: [PATCH 21/28] Fix chapter 14 for PGI testing --- chapter-14/recipe-03/fortran-example/menu.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chapter-14/recipe-03/fortran-example/menu.yml b/chapter-14/recipe-03/fortran-example/menu.yml index e57789e72..c5647d90f 100644 --- a/chapter-14/recipe-03/fortran-example/menu.yml +++ b/chapter-14/recipe-03/fortran-example/menu.yml @@ -17,3 +17,9 @@ travis-linux: travis-osx: failing_generators: - 'Ninja' + +# error stop is Fortran2008 and PGI is not compliant +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' From d85220ee668896f7ecbe01b4fdb34ffa06576b4b Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 14:45:42 -0400 Subject: [PATCH 22/28] Remove symlinks within custom.sh --- .circleci/config.yml | 1 + chapter-11/recipe-02/cxx-example/custom.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1488ff406..e854caf68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,6 +54,7 @@ variables: name: Testing Conda recipes shell: /bin/bash command: | + export PATH=/opt/conda/bin:$PATH pipenv run python testing/collect_tests.py 'chapter-11/recipe-04' && pipenv run python testing/collect_tests.py 'chapter-11/recipe-05' diff --git a/chapter-11/recipe-02/cxx-example/custom.sh b/chapter-11/recipe-02/cxx-example/custom.sh index e8d113656..774a6c238 100755 --- a/chapter-11/recipe-02/cxx-example/custom.sh +++ b/chapter-11/recipe-02/cxx-example/custom.sh @@ -7,6 +7,12 @@ if [ $# -eq 0 ] ; then exit 1 fi +# Remove symlinks +find "$PWD" -type l -exec sh -c ' + file=$(basename "$1") + directory=${1%/*} + (cd "$directory" && cp --remove-destination "$(readlink "$file")" "$file")' sh {} ';' + # build directory is provided by the main script build_directory="$1" mkdir -p "${build_directory}" From 35a0ba96e68dd1d1804ff37597fb653e4b612f84 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 15:09:59 -0400 Subject: [PATCH 23/28] Fix some superbuild recipes by skipping on PGI --- .circleci/config.yml | 2 ++ chapter-08/recipe-02/cxx-example/menu.yml | 6 ++++++ chapter-08/recipe-05/cxx-example/menu.yml | 5 +++++ testing/menu.yml | 2 ++ 4 files changed, 15 insertions(+) create mode 100644 chapter-08/recipe-05/cxx-example/menu.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index e854caf68..d24a59099 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,7 @@ variables: intel-linux: &intel-linux docker: - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-intel2018.1 + name: tsubame user: root environment: CIRCLECI_COMPILER: intel @@ -11,6 +12,7 @@ variables: pgi-linux: &pgi-linux docker: - image: devcafe/cmake-cookbook_circleci_ubuntu16.04-pgi18.4 + name: chabo user: root environment: CIRCLECI_COMPILER: pgi diff --git a/chapter-08/recipe-02/cxx-example/menu.yml b/chapter-08/recipe-02/cxx-example/menu.yml index 6a66fff1e..76805d6c2 100644 --- a/chapter-08/recipe-02/cxx-example/menu.yml +++ b/chapter-08/recipe-02/cxx-example/menu.yml @@ -8,6 +8,12 @@ appveyor-msys: definitions: - Boost_FORCE_SUPERBUILD: 'ON' +# Boost build system does not support PGI +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + travis-linux: definitions: - Boost_FORCE_SUPERBUILD: 'ON' diff --git a/chapter-08/recipe-05/cxx-example/menu.yml b/chapter-08/recipe-05/cxx-example/menu.yml new file mode 100644 index 000000000..a91a67f30 --- /dev/null +++ b/chapter-08/recipe-05/cxx-example/menu.yml @@ -0,0 +1,5 @@ +# Fails to generate imported target for UUID +circle-pgi: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/testing/menu.yml b/testing/menu.yml index 340487a89..7bb198518 100644 --- a/testing/menu.yml +++ b/testing/menu.yml @@ -23,6 +23,7 @@ circle-intel: - CMAKE_CXX_COMPILER: 'icpc' - CMAKE_Fortran_COMPILER: 'ifort' - CMAKE_BUILD_TYPE: 'Debug' + - SITE: 'Circle CI Ubuntu 16.04' env: - 'DIE_HARD': 'True' @@ -32,6 +33,7 @@ circle-pgi: - CMAKE_CXX_COMPILER: 'pgc++' - CMAKE_Fortran_COMPILER: 'pgfortran' - CMAKE_BUILD_TYPE: 'Debug' + - SITE: 'Circle CI Ubuntu 16.04' env: - 'DIE_HARD': 'True' From 55342a1ba00998cb4e5e9e6f0014b2125956a933 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 15:30:39 -0400 Subject: [PATCH 24/28] Make Message.hpp in ch 11, r 1 a real file CMake won't follow symlink when installing. This commit makes the symlink an actual file to avoid being left with an invalid install tree --- .../recipe-01/cxx-example/src/Message.hpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) mode change 120000 => 100644 chapter-11/recipe-01/cxx-example/src/Message.hpp diff --git a/chapter-11/recipe-01/cxx-example/src/Message.hpp b/chapter-11/recipe-01/cxx-example/src/Message.hpp deleted file mode 120000 index f3c2d38a0..000000000 --- a/chapter-11/recipe-01/cxx-example/src/Message.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../chapter-10/recipe-02/cxx-example/src/Message.hpp \ No newline at end of file diff --git a/chapter-11/recipe-01/cxx-example/src/Message.hpp b/chapter-11/recipe-01/cxx-example/src/Message.hpp new file mode 100644 index 000000000..848ac08d9 --- /dev/null +++ b/chapter-11/recipe-01/cxx-example/src/Message.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +#include "messageExport.h" + +class message_EXPORT Message { +public: + Message(const std::string &m) : message_(m) {} + + friend std::ostream &operator<<(std::ostream &os, Message &obj) { + return obj.printObject(os); + } + +private: + std::string message_; + std::ostream &printObject(std::ostream &os); +}; + +std::string getUUID(); From dc8bf920093b56a0c24d2a65239619411d9aa85f Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 15:53:51 -0400 Subject: [PATCH 25/28] Skip ch 11, r 2 on Circle CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d24a59099..cd4eeb6af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,7 +47,7 @@ variables: pipenv run python testing/collect_tests.py 'chapter-08/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-09/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-10/recipe-*' && - pipenv run python testing/collect_tests.py 'chapter-11/recipe-0[1-3]' && + pipenv run python testing/collect_tests.py 'chapter-11/recipe-0[1,3]' && pipenv run python testing/collect_tests.py 'chapter-12/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-13/recipe-*' && pipenv run python testing/collect_tests.py 'chapter-14/recipe-*' From bdbec771092ff002935f60baf91a41775457410d Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 11 Aug 2018 16:28:42 -0400 Subject: [PATCH 26/28] Exclude one more recipe on Intel Also, pass down definitions in menu.yml to ctest when using dashboard.cmake --- .circleci/config.yml | 1 - chapter-14/recipe-03/fortran-example/menu.yml | 6 ++++++ testing/collect_tests.py | 8 +++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd4eeb6af..7fb449076 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,7 +56,6 @@ variables: name: Testing Conda recipes shell: /bin/bash command: | - export PATH=/opt/conda/bin:$PATH pipenv run python testing/collect_tests.py 'chapter-11/recipe-04' && pipenv run python testing/collect_tests.py 'chapter-11/recipe-05' diff --git a/chapter-14/recipe-03/fortran-example/menu.yml b/chapter-14/recipe-03/fortran-example/menu.yml index c5647d90f..63205b75f 100644 --- a/chapter-14/recipe-03/fortran-example/menu.yml +++ b/chapter-14/recipe-03/fortran-example/menu.yml @@ -18,6 +18,12 @@ travis-osx: failing_generators: - 'Ninja' +# ASan not supported by ifort +circle-intel: + skip_generators: + - 'Unix Makefiles' + - 'Ninja' + # error stop is Fortran2008 and PGI is not compliant circle-pgi: skip_generators: diff --git a/testing/collect_tests.py b/testing/collect_tests.py index 4b83deb7f..c5f1a5f66 100644 --- a/testing/collect_tests.py +++ b/testing/collect_tests.py @@ -10,9 +10,10 @@ import colorama import docopt +from packaging import version + from env import (die_hard, get_buildflags, get_ci_environment, get_generator, verbose_output) -from packaging import version from parse import extract_menu_file @@ -210,8 +211,9 @@ def run_example(topdir, generator, ci_environment, buildflags, recipe, example): if dashboard_script_path.exists(): # if this directory contains a dashboard.cmake script, we launch it step = dashboard_script - command = 'ctest -C {0} -S "{1}" -DCTEST_CMAKE_GENERATOR="{2}"'.format( - configuration, dashboard_script_path, generator) + command = 'ctest -C {0} -S "{1}" -DCTEST_CMAKE_GENERATOR="{2}" {3}'.format( + configuration, dashboard_script_path, generator, + definitions_string) return_code += run_command( step=step, command=command, expect_failure=expect_failure) From 74b4d94db5bb60245633ce8b1da7ebb2f3d38b55 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sun, 12 Aug 2018 09:40:04 -0400 Subject: [PATCH 27/28] Re-enable ch 1, r 9 with Intel This only warns about -std=f2008 not being understood, rather than fail. --- chapter-01/recipe-09/fortran-example/menu.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/chapter-01/recipe-09/fortran-example/menu.yml b/chapter-01/recipe-09/fortran-example/menu.yml index cfbefdf7c..a0d363a09 100644 --- a/chapter-01/recipe-09/fortran-example/menu.yml +++ b/chapter-01/recipe-09/fortran-example/menu.yml @@ -6,12 +6,6 @@ appveyor-msys: failing_generators: - 'Ninja' -# Intel use -std08 instead of -std=f2008 -circle-intel: - skip_generators: - - 'Unix Makefiles' - - 'Ninja' - # PGI seems not to support Fortran2008 yet circle-pgi: skip_generators: From aa324837db3653d0eea13ab29cfbdc54a8d7b922 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sun, 12 Aug 2018 10:08:58 -0400 Subject: [PATCH 28/28] Make script a little less aggressive Only removes symlinks in its own directory --- chapter-11/recipe-02/cxx-example/custom.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapter-11/recipe-02/cxx-example/custom.sh b/chapter-11/recipe-02/cxx-example/custom.sh index 774a6c238..a569ce72c 100755 --- a/chapter-11/recipe-02/cxx-example/custom.sh +++ b/chapter-11/recipe-02/cxx-example/custom.sh @@ -8,7 +8,8 @@ if [ $# -eq 0 ] ; then fi # Remove symlinks -find "$PWD" -type l -exec sh -c ' +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +find "$script_dir" -type l -exec sh -c ' file=$(basename "$1") directory=${1%/*} (cd "$directory" && cp --remove-destination "$(readlink "$file")" "$file")' sh {} ';'