-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake gcc workflows build and some unit tests (#275)
- Loading branch information
Showing
26 changed files
with
1,900 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CMake build and unit tests | ||
on: [push, pull_request] | ||
|
||
env: | ||
BUILD_DIR: _build | ||
|
||
jobs: | ||
gcc-cmake-build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
fc: [gfortran-10] | ||
cc: [gcc-10] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install CMake | ||
run: pip3 install cmake | ||
|
||
- name: Git Sumbodules Setup | ||
run: | | ||
git submodule update --init | ||
- name: Configure build | ||
run: cmake -B ${{ env.BUILD_DIR }} | ||
env: | ||
FC: ${{ matrix.fc }} | ||
CC: ${{ matrix.cc }} | ||
|
||
- name: Build project | ||
run: cmake --build ${{ env.BUILD_DIR }} | ||
|
||
- name: Run unit tests | ||
run: make test | ||
working-directory: ${{ env.BUILD_DIR }} | ||
env: | ||
OMP_NUM_THREADS: 2,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This file is part of crest. | ||
# SPDX-Identifier: LGPL-3.0-or-later | ||
# | ||
# crest is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# crest is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with crest. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
set(_lib "test-drive") | ||
set(_pkg "TEST-DRIVE") | ||
set(_url "https://github.com/fortran-lang/test-drive") | ||
|
||
if(NOT DEFINED "${_pkg}_FIND_METHOD") | ||
set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") | ||
|
||
crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") | ||
|
||
if(TARGET "${_lib}::${_lib}") | ||
set (found TRUE) | ||
else() | ||
set (found FALSE) | ||
endif() | ||
message(STATUS "Found test-drive: ${found}") | ||
|
||
unset(_lib) | ||
unset(_pkg) | ||
unset(_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tblite
updated
87 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[wrap-git] | ||
directory = tblite | ||
url = https://github.com/pprcht/tblite | ||
revision = ompleak | ||
url = https://github.com/tblite/tblite | ||
revision = main |
Submodule test-drive
added at
a78870
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Unit testing | ||
set( | ||
tests | ||
"tblite" | ||
"gfnff" | ||
"gfn0" | ||
"gfn0occ" | ||
"optimization" | ||
) | ||
set( | ||
test-srcs | ||
"testmol.f90" | ||
"main.f90" | ||
) | ||
foreach(t IN LISTS tests) | ||
string(MAKE_C_IDENTIFIER ${t} t) | ||
list(APPEND test-srcs "test_${t}.F90") | ||
endforeach() | ||
|
||
add_executable( | ||
"${PROJECT_NAME}-tester" | ||
"${test-srcs}" | ||
) | ||
target_link_libraries( | ||
"${PROJECT_NAME}-tester" | ||
PRIVATE | ||
"lib-${PROJECT_NAME}-static" | ||
"test-drive::test-drive" | ||
) | ||
|
||
foreach(t IN LISTS tests) | ||
add_test("${PROJECT_NAME}/${t}" "${PROJECT_NAME}-tester" "${t}") | ||
endforeach() |
Oops, something went wrong.