Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new cmake harness, round 3 #233

Open
wants to merge 187 commits into
base: features/new-cmake-harness
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
f9fd25c
int_am.cmake work to allow arbitrary deriv, new components format, mo…
loriab Jan 13, 2022
671a2be
standardize copyright date for new files
loriab Jan 13, 2022
08ad883
misc. fixes
loriab Jan 14, 2022
74389ad
fill out options descriptions. simpler cmake if/else/endif syntax.
loriab Jan 14, 2022
591599f
Boost::boost -> Boost::headers upon CMake 3.15
loriab Jan 14, 2022
82541de
new inbuilt CMake Python detection upon CMake 3.15
loriab Jan 14, 2022
80ab815
TWOBODY -> ERI
loriab Jan 14, 2022
af677e5
more gha. bump cmake to 3.18
loriab Jan 14, 2022
c83d69d
more gha fix
loriab Jan 14, 2022
c83bf68
weird quotes gha behavior
loriab Jan 14, 2022
ed49e12
gha after fixing features
loriab Jan 15, 2022
58eb4e2
use std::rand instead of std::random_device to seed RandomShellSet ..…
evaleev Jan 15, 2022
b871233
prefactors.cc: pacify gcc
evaleev Jan 16, 2022
343f2ca
fortran eri test must compare absolute precision, not relative, just …
evaleev Jan 16, 2022
8ebf0e6
Merge branch 'features/new-cmake-harness' into new-cmake-harness-lab-rb1
evaleev Jan 16, 2022
953960f
Merge branch 'features/new-cmake-harness' into new-cmake-harness-lab-rb1
evaleev Jan 16, 2022
656b40a
separate target export files. remove full paths from install config.
loriab Jan 17, 2022
26c2f0d
Merge branch 'features/new-cmake-harness' into new-cmake-harness-lab-rb1
evaleev Jan 18, 2022
702a24d
int_am.cmake work to allow arbitrary deriv, new components format, mo…
loriab Jan 13, 2022
f0624df
standardize copyright date for new files
loriab Jan 13, 2022
a3c502b
misc. fixes
loriab Jan 14, 2022
299f396
fill out options descriptions. simpler cmake if/else/endif syntax.
loriab Jan 14, 2022
8164585
Boost::boost -> Boost::headers upon CMake 3.15
loriab Jan 14, 2022
b464394
new inbuilt CMake Python detection upon CMake 3.15
loriab Jan 14, 2022
17dc02e
TWOBODY -> ERI
loriab Jan 14, 2022
eac771c
more gha. bump cmake to 3.18
loriab Jan 14, 2022
7ddc714
more gha fix
loriab Jan 14, 2022
bdf8ab4
weird quotes gha behavior
loriab Jan 14, 2022
560c71b
gha after fixing features
loriab Jan 15, 2022
864022b
use std::rand instead of std::random_device to seed RandomShellSet ..…
evaleev Jan 15, 2022
c85c416
prefactors.cc: pacify gcc
evaleev Jan 16, 2022
ac5ee1a
fortran eri test must compare absolute precision, not relative, just …
evaleev Jan 16, 2022
ba21519
separate target export files. remove full paths from install config.
loriab Jan 17, 2022
69d48fb
move eigen detection to config
loriab Jan 18, 2022
c13828c
fix up after rebase
loriab Jan 18, 2022
b15294f
organize lib defs, NS->L2, back to 3 char ordering component in Config
loriab Jan 19, 2022
9eaeeab
Merge branch 'new-cmake-harness-lab-rb1' of github.com:loriab/libint …
evaleev Jan 19, 2022
14b875c
target documentation
loriab Jan 19, 2022
6828c7d
hide libtool files
loriab Jan 20, 2022
2d32dff
reconsolidate version storage, computing, and transfer. get basis set…
loriab Jan 20, 2022
2309175
2.7.1 -> 2.7.0 btwn configure.ac -> CMakeLists.txt
loriab Jan 20, 2022
6fb5bae
fix datadir
loriab Jan 21, 2022
f869960
one more fix
loriab Jan 21, 2022
abe04cc
allow and document non-standard install locations
loriab Jan 21, 2022
4ce4105
paths take 2
loriab Jan 21, 2022
ead9698
Merge branch 'new-cmake-harness-lab-rb1' of github.com:loriab/libint …
evaleev Jan 21, 2022
2c60cd3
fixup
evaleev Jan 21, 2022
6ba89f8
reconcile line numbers
loriab Jan 21, 2022
1574ad2
help pkgconfig file paths
loriab Jan 21, 2022
bd81d66
work on aliases
loriab Jan 22, 2022
cc13041
test BUILD_TESTING. simplify for newer cmake version
loriab Jan 24, 2022
8893070
onebody and pure_sh components for psi
loriab Jan 25, 2022
e2709e3
cmake for doxygen. standardize some spacing
loriab Jan 25, 2022
f242c01
add install component to library installs
loriab Jan 25, 2022
14118c7
tidy config file. more docs.
loriab Jan 25, 2022
8d988cd
start sorting out gmp and mpfr
loriab Jan 28, 2022
0b38bf3
more dependencies
loriab Jan 28, 2022
7d8e49f
don't disable system gmp
loriab Jan 28, 2022
9dc3da5
Update INSTALL.md
loriab Jan 29, 2022
65fbb53
help fortran maybe
loriab Jan 29, 2022
30f085e
incomplete eigen edits
loriab Jan 29, 2022
0b5f807
fix eigen
loriab Jan 29, 2022
8e509c6
Update INSTALL.md
loriab Jan 29, 2022
9ae21fc
Update INSTALL.md
loriab Jan 29, 2022
81c3ebe
misc tidying, tentative fort install
loriab Jan 31, 2022
f24f65f
ci 1
loriab Feb 1, 2022
706270f
ci 2
loriab Feb 1, 2022
38fb786
ci 3
loriab Feb 1, 2022
b7b562c
ci 4
loriab Feb 1, 2022
19d0c01
ci 5
loriab Feb 1, 2022
84b3c6c
ci 6
loriab Feb 1, 2022
694c337
ci 7
loriab Feb 1, 2022
33fa36d
ci 8
loriab Feb 1, 2022
b0ab1da
ci 9
loriab Feb 1, 2022
8d2dcdc
ci 10
loriab Feb 1, 2022
a9715f9
ci 11
loriab Feb 1, 2022
84ea2b3
ci 12
loriab Feb 1, 2022
439fbe7
ci 13
loriab Feb 1, 2022
fcf2c28
ci 14
loriab Feb 1, 2022
54af352
ci 15
loriab Feb 1, 2022
80c75fc
ci 16
loriab Feb 2, 2022
ad85ee2
ci 17
loriab Feb 2, 2022
c847b87
ci 18
loriab Feb 2, 2022
7d73ab9
ci 19
loriab Feb 2, 2022
7b1e776
ci 20
loriab Feb 2, 2022
8a6c1df
ci 21
loriab Feb 2, 2022
112f337
ci 22
loriab Feb 2, 2022
f85b5df
ci 23
loriab Feb 2, 2022
8ac1454
ci 24
loriab Feb 2, 2022
bf92f91
ci 25
loriab Feb 2, 2022
e7a46f9
ci 26
loriab Feb 2, 2022
978074f
ci 27
loriab Feb 2, 2022
a1b9d36
ci 28
loriab Feb 2, 2022
416696f
ci 29
loriab Feb 2, 2022
65fa628
ci 30
loriab Feb 2, 2022
40ee39c
ci 31
loriab Feb 2, 2022
143205b
ci 32
loriab Feb 2, 2022
fae673c
ci 33
loriab Feb 2, 2022
dc5661b
ci 34
loriab Feb 2, 2022
bd654a1
ci 35
loriab Feb 2, 2022
01f42e2
ci 36
loriab Feb 2, 2022
2241f6d
ci 37
loriab Feb 2, 2022
7eec4e3
ci 38
loriab Feb 2, 2022
7254bb6
ci 39
loriab Feb 2, 2022
6ea4694
ci 40
loriab Feb 3, 2022
308da04
ci 41
loriab Feb 3, 2022
72a0cfe
ci 42
loriab Feb 3, 2022
5e45bfb
ci 43
loriab Feb 3, 2022
99aea66
ci 44
loriab Feb 3, 2022
c6abf4c
ci 45
loriab Feb 3, 2022
c1e8fa6
ci 46
loriab Feb 3, 2022
cf044af
ci 47
loriab Feb 3, 2022
03f6721
ci 48
loriab Feb 3, 2022
6b8f3b9
ci 49
loriab Feb 3, 2022
1479e39
ci 50
loriab Feb 4, 2022
8c4ca00
ci 51
loriab Feb 4, 2022
2d26750
ci 52
loriab Feb 4, 2022
38a38eb
ci 53
loriab Feb 4, 2022
fb61ab1
ci 54
loriab Feb 4, 2022
33931be
ci 55
loriab Feb 4, 2022
aee79c9
ci 56
loriab Feb 4, 2022
dd91e6b
ci 57
loriab Feb 4, 2022
46a6f08
ci 58
loriab Feb 4, 2022
f3ddba1
ci 59
loriab Feb 4, 2022
75797b4
correct desparate edits
loriab Feb 7, 2022
9709f7f
bump version even with master
loriab Feb 7, 2022
8b44d3e
add t1g12 option
loriab Feb 8, 2022
f68fd0d
enable g12
loriab Feb 8, 2022
bd7eac0
ci 60
loriab Feb 8, 2022
394fe0c
ci 61
loriab Feb 8, 2022
116e1cd
ci 62
loriab Feb 8, 2022
1207ed7
ci 63
loriab Feb 8, 2022
4470c09
ci 64
loriab Feb 9, 2022
2732e7f
ci 65
loriab Feb 9, 2022
d0cc586
ci 66
loriab Feb 9, 2022
7938b6b
ci 67
loriab Feb 9, 2022
9dd660c
ci 68
loriab Feb 9, 2022
3785a52
ci 69
loriab Feb 9, 2022
5e0e093
ci 70
loriab Feb 9, 2022
7fb0118
ci 71
loriab Feb 9, 2022
32d83e8
ci 72
loriab Feb 9, 2022
7d7b2c7
ci 73
loriab Feb 9, 2022
932cd95
ci 74
loriab Feb 9, 2022
a6d6cc8
ci 75
loriab Feb 9, 2022
c3d7e28
ci 76
loriab Feb 9, 2022
fb51a57
ci 77
loriab Feb 9, 2022
3961e04
ci 78
loriab Feb 9, 2022
f2a1066
ci 79
loriab Feb 9, 2022
0d75fc4
ci 80
loriab Feb 9, 2022
79297a8
ci 81
loriab Feb 9, 2022
bbfb0c2
ci 82
loriab Feb 9, 2022
c148b95
ci 83
loriab Feb 9, 2022
46eb92b
ci 84
loriab Feb 9, 2022
49441da
ci 85
loriab Feb 9, 2022
a440625
ci 86
loriab Feb 9, 2022
8242221
ci 87
loriab Feb 9, 2022
cb23115
ci 88
loriab Feb 9, 2022
960d6ec
ci 89
loriab Feb 9, 2022
14ad7ae
ci 90
loriab Feb 9, 2022
875ce05
ci 91
loriab Feb 10, 2022
6156ff9
ci 92
loriab Feb 10, 2022
b7ba107
ci 93
loriab Feb 11, 2022
216cfa8
ci 94
loriab Feb 11, 2022
60ce87b
rename targets, consolidate exports, remove windows no cmpld cxx
loriab Feb 11, 2022
a151d88
ci 95
loriab Feb 11, 2022
c644550
ci 96
loriab Feb 11, 2022
839cd5f
ci 97
loriab Feb 11, 2022
71ea119
ci 98
loriab Feb 11, 2022
bb993a8
ci 99
loriab Feb 11, 2022
a3046d3
ci 100
loriab Feb 11, 2022
4ce76a1
cmake back to 3.16
loriab Feb 11, 2022
52af246
allow handing eigen3 btwn l2 library build and consumer build
loriab Feb 12, 2022
79345b2
ci 101
loriab Feb 12, 2022
43a8475
ci 102 xfail
loriab Feb 12, 2022
8d949e9
ci 103 xfail
loriab Feb 12, 2022
55b3503
ci 104 xfail
loriab Feb 12, 2022
e5155f8
ci 105
loriab Feb 12, 2022
1604b95
ci 106
loriab Feb 12, 2022
af6febc
cleanup
loriab Feb 13, 2022
f395222
Update INSTALL.md
loriab Feb 14, 2022
3b3c7a2
work on install
loriab Feb 15, 2022
d85a0ec
docs
loriab Feb 15, 2022
28428b1
more docs, xhost, libint2_realtype
loriab Feb 16, 2022
3be4f6f
more docs
loriab Feb 16, 2022
0768dbb
more docs and eigen
loriab Feb 17, 2022
57f86ca
typo
evaleev Feb 17, 2022
9f12ee6
docs edits
loriab Feb 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
320 changes: 269 additions & 51 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,68 @@
name: Linux/MacOS Build
name: CI

on: [push, pull_request]

#env:

jobs:
build:
build_repo:
strategy:
fail-fast: false
matrix:
build_type : [ Release, Debug ]
os : [ macos-latest, ubuntu-20.04 ]
include:
- os: ubuntu-20.04
cxx: /usr/bin/g++-9
- os: macos-latest
cfg:
- runs-on: ubuntu-latest
build_type: Release
cxx: g++-9
cc: gcc-9
fc: gfortran-9
args: >
-DENABLE_FORTRAN=ON

- runs-on: macos-latest
build_type: Release
cxx: clang++
cc: clang
args: >
-DENABLE_FORTRAN=ON
-DCMAKE_Fortran_COMPILER=gfortran-10

- runs-on: windows-2022
build_type: Release
cxx: clang-cl
cc: clang-cl
args: ""

- runs-on: ubuntu-20.04
build_type: Debug
cxx: g++-9
cc: gcc-9
fc: gfortran-9
args: >
-DENABLE_FORTRAN=ON

name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}"
runs-on: ${{ matrix.os }}
- runs-on: macos-latest
build_type: Debug
cxx: clang++
cc: clang
args: >
-DENABLE_FORTRAN=ON
-DCMAKE_Fortran_COMPILER=gfortran-10

name: "Repo • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}"
runs-on: ${{ matrix.cfg.runs-on }}
env:
CXX : ${{ matrix.cxx }}
CXX : ${{ matrix.cfg.cxx }}
CC : ${{ matrix.cfg.cc }}
CCACHE_DIR : ${{github.workspace}}/build/.ccache
CCACHE_COMPRESS : true
CCACHE_COMPRESSLEVEL : 6
BUILD_CONFIG : >
-G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison
-DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }}
-DBUILD_SHARED_LIBS=OFF
-DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root'
-DENABLE_FORTRAN=ON
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed
-DWITH_MAX_AM=2;2
-DERI_MAX_AM_LIST=2,2
-DERI3_MAX_AM_LIST=3,2
-DWITH_MAX_AM=3;2
-DWITH_ERI_MAX_AM=2;2
-DWITH_ERI3_MAX_AM=3;2
-DENABLE_ERI=1
-DENABLE_ERI3=1
-DENABLE_ONEBODY=1
Expand Down Expand Up @@ -62,20 +90,43 @@ jobs:
cmake -E make_directory ${{github.workspace}}/test_installed_library
cmake -E make_directory ${{github.workspace}}/installed

- name: Install prerequisite MacOS packages
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'macos-latest' }}
- name: Install MacOS prerequisites
if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'macOS' }}
run: |
brew install ninja gcc@10 boost eigen bison ccache
echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV
echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV
brew install ninja gcc@10 boost eigen ccache

- name: Install prerequisites Ubuntu packages
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'ubuntu-20.04' }}
- name: Install Ubuntu prerequisites
if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install ninja-build g++-9 gfortran-9 liblapack-dev libmpfr-dev libboost-dev libeigen3-dev ccache
echo "FC=/usr/bin/gfortran-9" >> $GITHUB_ENV
echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV
sudo apt-get install ninja-build ${{ matrix.cfg.cxx }} ${{ matrix.cfg.fc }} liblapack-dev libmpfr-dev libboost-dev libeigen3-dev ccache

- name: Install Windows prerequisites, part 1, Create Conda Environment
if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ""
add-pip-as-python-dependency: true
auto-activate-base: true
conda-build-version: "*"
show-channel-urls: true

# Note: `shell: bash -l {0}` makes Miniconda created above for Windows available to
# subsequent steps. see https://github.com/conda-incubator/setup-miniconda#usage-examples

- name: Install Windows prerequisites, part 2, Environment Information
if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }}
shell: bash -l {0}
run: |
conda info
conda install ninja cmake=3.16 python mpir boost eigen ccache -c conda-forge --yes
conda list

- name: Prepare compiler environment for Windows
if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Prepare ccache timestamp
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
Expand All @@ -94,42 +145,209 @@ jobs:
restore-keys: |
${{ matrix.config.name }}-ccache-

- name: Generate+build Libint library (ExternalProject)
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Debug'}}
shell: bash
- name: Generate & Build Libint Library (ExternalProject, cplr tests)
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}}
shell: bash -l {0}
working-directory: ${{github.workspace}}
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG
cmake --build build
cmake --build build --target check-libint2compiler
cmake --build build --target install
#cd src/bin/test_eri && ./stdtests.pl && cd ../../..
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }}
#cmake --build build --target export # toggle for quick tarball to debug `build_export`
cmake --build build --target library check-libint2compiler install
cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV

- name: Generate+build Libint library (FetchContent)
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type != 'Debug'}}
shell: bash
- name: Generate & Build Libint Library (FetchContent, full tests)
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}}
shell: bash -l {0}
working-directory: ${{github.workspace}}
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG
cmake --build build --target libint-library-export
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG ${{ matrix.cfg.args }}
cmake --build build --target export
cmake --build build --target check-libint2compiler
cmake --build build --target check-libint2
cmake --build build --target install
#cd src/bin/test_eri && ./stdtests.pl && cd ../../..

- name: Test installed Libint library
- name: Archive Library Tarball
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Release'}}
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: ${{ runner.os }}-${{ matrix.cfg.cxx }}
path: build/${{ env.ARTIFACT }}
retention-days: 1

- name: Test Installed Libint Library
#if: false # toggle for quick tarball to debug `build_export`
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
shell: bash
shell: bash -l {0}
working-directory: ${{github.workspace}}/test_installed_library
run: |
cat > CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.16)
project(hf++)
find_package(Libint2 2.7.1 REQUIRED)
message("CMAKE_PREFIX_PATH \${CMAKE_PREFIX_PATH}")
find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho)
find_package(Threads) # clang does not autolink threads even though we are using std::thread
add_executable(hf++ EXCLUDE_FROM_ALL ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock++.cc)
add_executable(hf++ EXCLUDE_FROM_ALL "../src/lib/libint/tests/hartree-fock/hartree-fock++.cc")
target_link_libraries(hf++ Libint2::cxx Threads::Threads)
EOF
cmake . -DCMAKE_PREFIX_PATH=${{github.workspace}}/installed -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build . --target hf++
./hf++ ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ${{github.workspace}}/build/libint-2*/features
cat CMakeLists.txt
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed"
cmake --build build --target hf++
if [[ "${{ runner.os }}" != "Windows" ]]; then
# xfail for Windows. SCF is wrong (see below), but we ensure that L2@Win builds, exports, packages ok.
./build/hf++ ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features
fi

# Notes on Windows:
# * Windows with BUILD_SHARED_LIBS=ON compiles just fine but can't link against. See https://github.com/evaleev/libint/issues/237
#
# * Windows with Release and ExternalProject compiles just fine, but its hf++ SCF answer is -1115 E_h. See https://github.com/evaleev/libint/issues/235
#
# * Windows with CMAKE_BUILD_TYPE=Debug gives errors like:
# ```
# In file included from D:\a\libint\libint\installed\include\libint2/diis.h:368:
# D:\a\libint\libint\installed\include\libint2/./engine.h(471,3): error: constructor for 'libint2::Engine' must explicitly initialize the member 'targets_' which does not have a default constructor
# ```
# * Windows+Ninja with FetchContent sequence gives errors like:
# ```
# "ninja: error: failed recompaction: Permission denied"
# ```
# This is known issue https://gitlab.kitware.com/cmake/cmake/-/issues/20274
# that should be ok with CMake 3.20+ and Ninja 1.10.2+ (which we have) but broken c. Feb 2022
#

# for efficient debug of `build_export` job, in `build_repo` job above:
# * comment out all but a single Linux/Release in matrix.cfg
# * toggle to "export" target rather than "library" target in EP step
# * comment out the "hf++" step
build_export:
needs: build_repo
strategy:
fail-fast: false
matrix:
cfg:
- runs-on: ubuntu-latest
libargs: >
-DBUILD_SHARED_LIBS=ON
-DLIBINT_LOCAL_Eigen3_INSTALL=ON
-DEigen3_ROOT="/usr/share/miniconda/envs/onlyeigen/"
testargs: >
-DLIBINT_LOCAL_Eigen3_FIND=ON

- runs-on: macos-latest
libargs: >
-DBUILD_SHARED_LIBS=ON
testargs: ""

- runs-on: windows-latest
libargs: >
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
testargs: >
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl

name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.libargs }}"
runs-on: ${{ matrix.cfg.runs-on }}

steps:
# Note we're not checking out the repo. All src from Linux tarball generated above.

- name: Write a Conda Env File
shell: bash -l {0}
run: |
cat > export.yaml <<EOF
name: test
channels:
- conda-forge
dependencies:
- cmake >=3.16
- ninja
- cxx-compiler
- python 3.9
- boost
- eigen
EOF
if [[ "${{ runner.os }}" == "Windows" ]]; then
sed -i "s/- cxx/#- cxx/g" export.yaml
fi
cat export.yaml

- name: Create Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
activate-environment: test
channels: conda-forge
environment-file: export.yaml
show-channel-urls: true

# Step is unnecessary; remove for debugging.
- name: Confound Environment - test bundled Boost
if: ${{ runner.os == 'macOS' }}
shell: bash -l {0}
run: conda remove boost

# Step is unnecessary; remove for debugging.
- name: Confound Environment - test non-cmake-installed Eigen
if: ${{ runner.os == 'Windows' }}
shell: bash -l {0}
run: rm -rf "${CONDA_PREFIX}/Library/share/eigen3/cmake/"

# Step is unnecessary; remove step and 3 "*Eigen3*" options in matrix for debugging.
- name: Confound Environment - test handed-off Eigen
if: ${{ runner.os == 'Linux' }}
shell: bash -l {0}
run: |
conda remove eigen
conda create -n onlyeigen eigen -c conda-forge

- name: Environment Information
shell: bash -l {0}
run: |
conda info
conda list

- name: Prepare compiler environment for Windows
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- uses: actions/download-artifact@master
with:
name: Linux-g++-9

- name: Extract, Build, Install Libint Library
shell: bash -l {0}
run: |
tar -zxf libint*tgz
mkdir libint && mv libint-2*/* libint/ && cd libint/
cmake \
-S. \
-Bbuild \
-G"Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \
${{ matrix.cfg.libargs }}
cmake --build build --target install

- name: Test Installed Libint library
shell: bash -l {0}
run: |
mkdir test_installed_library && cd test_installed_library
cat > CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 3.16)
project(hf++)
find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho)
find_package(Threads) # clang does not autolink threads even though we are using std::thread
add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc")
target_link_libraries(hf++ Libint2::cxx Threads::Threads)
EOF
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.testargs }}
cmake --build build --target hf++
./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features

Loading