Skip to content

Commit

Permalink
Merge pull request #23 from andriish/small_cmake_updates
Browse files Browse the repository at this point in the history
Small cmake updates
  • Loading branch information
scarrazza authored Nov 12, 2024
2 parents f8de304 + 2b3b6a6 commit c01f525
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/fedora35/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM fedora:35
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
15 changes: 15 additions & 0 deletions .github/workflows/fedora35/action.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
12 changes: 12 additions & 0 deletions .github/workflows/fedora35/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}
48 changes: 36 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/qcdloop/config.h.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION @VERSION@
#define VERSION "@VERSION@"

0 comments on commit c01f525

Please sign in to comment.