Skip to content

Commit

Permalink
Feature/cpp20 (#740)
Browse files Browse the repository at this point in the history
Activate cpp20 flag for compilation
Use devtoolset 10 on centOS.
Use gcc 10 on CentOS and Ubuntu
  • Loading branch information
JasonMarechal25 authored Jan 4, 2024
1 parent 32c263b commit 9b407b7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build_centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
merge_group:
push:
branches:
- main
- develop
pull_request:
release:
Expand Down Expand Up @@ -131,7 +130,7 @@ jobs:
- name: Configure
run: |
[[ ${{ matrix.xprs }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF"
source /opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-10/enable
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
cmake3 -B _build -S . \
Expand All @@ -145,7 +144,7 @@ jobs:
-DALLOW_RUN_AS_ROOT=ON
- name: Build
run: |
source /opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-10/enable
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
cmake3 --build _build --config Release -j8 --target install
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y ccache cmake libgtest-dev libjsoncpp-dev libtbb-dev libopenmpi-dev
sudo apt-get install -y g++-10 gcc-10
- name: Read antares-solver version
id: antares-version
Expand Down Expand Up @@ -103,7 +104,9 @@ jobs:
[[ ${{ matrix.xprs }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF"
cmake -B _build -S . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \
-DDEPS_INSTALL_DIR=rte-antares-deps-Release \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set(CMAKE_INSTALL_RPATH $ORIGIN)
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

set (CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
2 changes: 1 addition & 1 deletion docker/centos7-system-deps
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN yum install -y epel-release

RUN \
yum install -y wget git epel-release redhat-lsb-core gcc gcc-c++ make centos-release-scl scl-utils &&\
yum install -y cmake3 devtoolset-9 environment-modules rpm-build zlib-devel &&\
yum install -y cmake3 devtoolset-10-gcc* environment-modules rpm-build zlib-devel &&\
yum install -y jsoncpp-devel openmpi-devel doxygen graphviz &&\
yum install -y gtest-devel &&\
yum install -y install python3-devel && \
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/helpers/FileInBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FileBuffer FileInBuffer::run(const std::filesystem::path& filePath) {
std::ifstream file(filePath);
std::stringstream buffer;
if (file.bad()) {
std::cerr << "Error while reading file : " << filePath.c_str() << std::endl;
std::cerr << "Error while reading file : " << filePath << std::endl;
return {};
}
buffer << file.rdbuf();
Expand Down

0 comments on commit 9b407b7

Please sign in to comment.