From a9c2cbe7027a75cda4416642c721d3d8b9914ecf Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Thu, 18 Aug 2022 17:21:35 +0200 Subject: [PATCH 1/4] Added CI and cleaned up the CMakeLists.txt --- .github/workflows/centos8/Dockerfile | 3 ++ .github/workflows/centos8/action.yaml | 15 ++++++++ .github/workflows/centos8/entrypoint.sh | 14 ++++++++ .github/workflows/main.yml | 22 ++++++++++++ CMakeLists.txt | 46 ++++++++++++++++++------- src/qcdloop/config.h.in | 2 +- 6 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/centos8/Dockerfile create mode 100644 .github/workflows/centos8/action.yaml create mode 100755 .github/workflows/centos8/entrypoint.sh create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/centos8/Dockerfile b/.github/workflows/centos8/Dockerfile new file mode 100644 index 0000000..7040348 --- /dev/null +++ b/.github/workflows/centos8/Dockerfile @@ -0,0 +1,3 @@ +FROM centos:8 +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/workflows/centos8/action.yaml b/.github/workflows/centos8/action.yaml new file mode 100644 index 0000000..814bc40 --- /dev/null +++ b/.github/workflows/centos8/action.yaml @@ -0,0 +1,15 @@ +name: 'Compile OneLOOP' +description: 'OneLOOP' +inputs: + who-to-greet: # id of input + description: 'Set something' + required: true + default: 'Hi !' +outputs: + time: # id of output + description: 'Some result' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.who-to-greet }} diff --git a/.github/workflows/centos8/entrypoint.sh b/.github/workflows/centos8/entrypoint.sh new file mode 100755 index 0000000..34eead6 --- /dev/null +++ b/.github/workflows/centos8/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh -l +set -x +uname -a +cat /etc/issue +yum -y install epel-release dnf-plugins-core +dnf config-manager --set-enabled powertools +yum -y install gcc gcc-c++ gcc-gfortran make which cmake cmake-data cmake-filesystem + +cmake -S . -B BUILD -DCMAKE_INSTALL_PREFIX=$(pwd)/INSTALL +cmake --build BUILD +cmake --install BUILD + +out=$? +echo ::set-output name=out::$out diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4157fb8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,22 @@ +name: build +on: + push: + pull_request: + schedule: +#Every 50 days at midnight + - cron: "0 0 1/600 * *" + +jobs: + + compilejobCentOS8: + if: "!contains(github.event.head_commit.message, 'skip ci')" + runs-on: ubuntu-latest + name: CI_on_CentOS8 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compile + id: compileindocker + uses: ./.github/workflows/centos8 + - name: Get the output status + run: exit ${{ steps.compileindocker.outputs.out }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 412b98c..78d6b91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,18 +15,40 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() project(qcdloop) - +include(GNUInstallDirs) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(VERSION "\"2.0.9\"") -set(CMAKE_CXX_FLAGS "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -fext-numeric-literals") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fPIC ${CMAKE_CXX_FLAGS}" CACHE STRING "debug compile flags" FORCE) -set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address" CACHE STRING "debug linker flags" FORCE) +set(VERSION 2.0.9) +include(CheckCXXCompilerFlag) +if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fstack-protector-strong -O2 -pipe -fext-numeric-literals") + set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address" CACHE STRING "debug linker flags" FORCE) +else() + set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra") + set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) +endif() +set(CMAKE_CXX_FLAGS_PASSED ) +set(CMAKE_CXX_FLAGS_DEBUG_PASSED ) +foreach(fl ${CXX_FLAGS_TO_CHECK}) + CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) + if(COMPILER_SUPPORTS_${fl}) + set(CMAKE_CXX_FLAGS_PASSED "${CMAKE_CXX_FLAGS_PASSED} ${fl}" ) + endif() +endforeach() +foreach(fl ${CXX_FLAGS_DEBUG_TO_CHECK}) + CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) + if(COMPILER_SUPPORTS_${fl}) + set(CMAKE_CXX_FLAGS_DEBUG_PASSED "${CMAKE_CXX_FLAGS_DEBUG_PASSED} ${fl}" ) + endif() +endforeach() +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_PASSED}) +set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG_PASSED}) set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "${prefix}") -set(includedir "${prefix}/include") -set(libdir "${prefix}/lib") +set(exec_prefix ${CMAKE_INSTALL_PREFIX}) +set(includedir "${CMAKE_INSTALL_INCLUDE_DIR}") +set(libdir "${CMAKE_INSTALL_LIBDIR}") configure_file( "${PROJECT_SOURCE_DIR}/src/qcdloop/config.h.in" @@ -86,13 +108,13 @@ add_library(qcdloop SHARED src/box.cc ${Headers} ) -target_link_libraries(qcdloop) +target_link_libraries(qcdloop ${QUADMATH_LIBRARY}) install(FILES ${CMAKE_BINARY_DIR}/src/qcdloop-config DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -install(FILES ${PROJECT_SOURCE_DIR}/src/qcdloop.pc DESTINATION lib/pkgconfig) -install(DIRECTORY src/qcdloop DESTINATION include) -install(TARGETS qcdloop DESTINATION lib) +install(FILES ${PROJECT_SOURCE_DIR}/src/qcdloop.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(DIRECTORY src/qcdloop DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(TARGETS qcdloop DESTINATION ${CMAKE_INSTALL_LIBDIR}) # enable disable fortran/wrapper (to avoid name conflicts with ql1.x) option(ENABLE_FORTRAN_WRAPPER "Enable fortran wrapper" ON) diff --git a/src/qcdloop/config.h.in b/src/qcdloop/config.h.in index 07f5548..a44b122 100644 --- a/src/qcdloop/config.h.in +++ b/src/qcdloop/config.h.in @@ -1 +1 @@ -#define VERSION @VERSION@ +#define VERSION "@VERSION@" From 36b78d46caf5dae197f129e0152484b449cb7597 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Thu, 18 Aug 2022 17:28:19 +0200 Subject: [PATCH 2/4] Cleanup --- .github/workflows/{centos8 => fedora35}/Dockerfile | 2 +- .github/workflows/{centos8 => fedora35}/action.yaml | 4 ++-- .github/workflows/{centos8 => fedora35}/entrypoint.sh | 4 +--- .github/workflows/main.yml | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) rename .github/workflows/{centos8 => fedora35}/Dockerfile (81%) rename .github/workflows/{centos8 => fedora35}/action.yaml (84%) rename .github/workflows/{centos8 => fedora35}/entrypoint.sh (57%) diff --git a/.github/workflows/centos8/Dockerfile b/.github/workflows/fedora35/Dockerfile similarity index 81% rename from .github/workflows/centos8/Dockerfile rename to .github/workflows/fedora35/Dockerfile index 7040348..6b84fcb 100644 --- a/.github/workflows/centos8/Dockerfile +++ b/.github/workflows/fedora35/Dockerfile @@ -1,3 +1,3 @@ -FROM centos:8 +FROM fedora:35 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/workflows/centos8/action.yaml b/.github/workflows/fedora35/action.yaml similarity index 84% rename from .github/workflows/centos8/action.yaml rename to .github/workflows/fedora35/action.yaml index 814bc40..3e42042 100644 --- a/.github/workflows/centos8/action.yaml +++ b/.github/workflows/fedora35/action.yaml @@ -1,5 +1,5 @@ -name: 'Compile OneLOOP' -description: 'OneLOOP' +name: 'Compile QCDLOOP' +description: 'QCDLOOP' inputs: who-to-greet: # id of input description: 'Set something' diff --git a/.github/workflows/centos8/entrypoint.sh b/.github/workflows/fedora35/entrypoint.sh similarity index 57% rename from .github/workflows/centos8/entrypoint.sh rename to .github/workflows/fedora35/entrypoint.sh index 34eead6..75d439c 100755 --- a/.github/workflows/centos8/entrypoint.sh +++ b/.github/workflows/fedora35/entrypoint.sh @@ -2,9 +2,7 @@ set -x uname -a cat /etc/issue -yum -y install epel-release dnf-plugins-core -dnf config-manager --set-enabled powertools -yum -y install gcc gcc-c++ gcc-gfortran make which cmake cmake-data cmake-filesystem +dnf -y install gcc gcc-c++ gcc-gfortran make which cmake cmake-data cmake-filesystem cmake -S . -B BUILD -DCMAKE_INSTALL_PREFIX=$(pwd)/INSTALL cmake --build BUILD diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4157fb8..2863ecf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: jobs: - compilejobCentOS8: + compilejobFedora35: if: "!contains(github.event.head_commit.message, 'skip ci')" runs-on: ubuntu-latest name: CI_on_CentOS8 From cf65c196b67688a9c937ad7d102e4839d5496490 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Thu, 18 Aug 2022 17:30:19 +0200 Subject: [PATCH 3/4] Cleanup --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2863ecf..31f43b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,12 +11,12 @@ jobs: compilejobFedora35: if: "!contains(github.event.head_commit.message, 'skip ci')" runs-on: ubuntu-latest - name: CI_on_CentOS8 + name: CI_on_Fedora35 steps: - name: Checkout uses: actions/checkout@v2 - name: Compile id: compileindocker - uses: ./.github/workflows/centos8 + uses: ./.github/workflows/fedora35 - name: Get the output status run: exit ${{ steps.compileindocker.outputs.out }} From 2b3b6a64e5dc8bf77b43eb6dfa10f8dd160866a9 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Thu, 18 Aug 2022 17:40:47 +0200 Subject: [PATCH 4/4] Cleanup --- CMakeLists.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d6b91..010d4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,29 +22,31 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(VERSION 2.0.9) include(CheckCXXCompilerFlag) if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") - set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fstack-protector-strong -O2 -pipe -fext-numeric-literals") - set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address" CACHE STRING "debug linker flags" FORCE) + set(CXX_FLAGS_TO_CHECK "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fstack-protector-strong -O2 -pipe -fext-numeric-literals") + set(CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address") else() - set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) + set(CXX_FLAGS_TO_CHECK "-Wall -Wextra") + set(CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}") endif() -set(CMAKE_CXX_FLAGS_PASSED ) -set(CMAKE_CXX_FLAGS_DEBUG_PASSED ) +set(CXX_FLAGS_PASSED ) +set(CXX_FLAGS_DEBUG_PASSED ) foreach(fl ${CXX_FLAGS_TO_CHECK}) CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) if(COMPILER_SUPPORTS_${fl}) - set(CMAKE_CXX_FLAGS_PASSED "${CMAKE_CXX_FLAGS_PASSED} ${fl}" ) + set(CXX_FLAGS_PASSED "${CXX_FLAGS_PASSED} ${fl}" ) endif() endforeach() foreach(fl ${CXX_FLAGS_DEBUG_TO_CHECK}) CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) if(COMPILER_SUPPORTS_${fl}) - set(CMAKE_CXX_FLAGS_DEBUG_PASSED "${CMAKE_CXX_FLAGS_DEBUG_PASSED} ${fl}" ) + set(CXX_FLAGS_DEBUG_PASSED "${CXX_FLAGS_DEBUG_PASSED} ${fl}" ) endif() endforeach() -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_PASSED}) -set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG_PASSED}) +set(CMAKE_CXX_FLAGS ${CXX_FLAGS_PASSED}) +set(CMAKE_CXX_FLAGS_DEBUG ${CXX_FLAGS_DEBUG_PASSED}) +message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}") +message(STATUS "CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}") set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}) set(includedir "${CMAKE_INSTALL_INCLUDE_DIR}")