diff --git a/.github/workflows/fedora35/Dockerfile b/.github/workflows/fedora35/Dockerfile new file mode 100644 index 0000000..6b84fcb --- /dev/null +++ b/.github/workflows/fedora35/Dockerfile @@ -0,0 +1,3 @@ +FROM fedora:35 +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/workflows/fedora35/action.yaml b/.github/workflows/fedora35/action.yaml new file mode 100644 index 0000000..3e42042 --- /dev/null +++ b/.github/workflows/fedora35/action.yaml @@ -0,0 +1,15 @@ +name: 'Compile QCDLOOP' +description: 'QCDLOOP' +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/fedora35/entrypoint.sh b/.github/workflows/fedora35/entrypoint.sh new file mode 100755 index 0000000..75d439c --- /dev/null +++ b/.github/workflows/fedora35/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh -l +set -x +uname -a +cat /etc/issue +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 +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..31f43b1 --- /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: + + compilejobFedora35: + if: "!contains(github.event.head_commit.message, 'skip ci')" + runs-on: ubuntu-latest + name: CI_on_Fedora35 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compile + id: compileindocker + uses: ./.github/workflows/fedora35 + - name: Get the output status + run: exit ${{ steps.compileindocker.outputs.out }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 412b98c..010d4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,18 +15,42 @@ 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(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(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(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(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(CXX_FLAGS_DEBUG_PASSED "${CXX_FLAGS_DEBUG_PASSED} ${fl}" ) + endif() +endforeach() +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 "${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 +110,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@"