Skip to content

Commit

Permalink
Merge pull request evaleev#299 from loriab/extras
Browse files Browse the repository at this point in the history
full cmake 1/N: git and ref in configuration.cc
  • Loading branch information
evaleev authored May 17, 2024
2 parents c43d413 + 507cd3a commit d443cee
Show file tree
Hide file tree
Showing 8 changed files with 670 additions and 5 deletions.
65 changes: 65 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.19) # string(json
cmake_policy(SET CMP0074 NEW)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
cmake_policy(SET CMP0135 NEW)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.25.0")
# needed by DynamicVersion
cmake_policy(SET CMP0140 NEW)
endif()

############################# Version and Metadata #############################

# can't use PROJECT_SOURCE_DIR etc. before project() call
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
include(DynamicVersion)
dynamic_version(
PROJECT_PREFIX Libint2Compiler_
GIT_ARCHIVAL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/.git_archival.txt
OUTPUT_COMMIT LibintRepository_COMMIT
OUTPUT_VERSION LibintRepository_VERSION
OUTPUT_DESCRIBE LibintRepository_DESCRIBE
OUTPUT_DISTANCE LibintRepository_DISTANCE
)

project(
Libint2Compiler
VERSION ${LibintRepository_VERSION}
DESCRIPTION
"A library for the evaluation of molecular integrals of many-body operators over Gaussian functions"
HOMEPAGE_URL "http://libint.valeyev.net"
LANGUAGES CXX
)
# * http://libint.valeyev.net/ redirects to https://github.com/evaleev/libint

set(${PROJECT_NAME}_AUTHORS "Edward F. Valeev")
set(${PROJECT_NAME}_LICENSE "GPL-3.0 for generator; LGPL-3.0 for generated")

# along with project(... VERSION) above scanned by dynamic_version() from `git
# describe`, these are the authoritative version source (formerly in configure.ac)
set(LIBINT_BUILDID "post999")
set(LIBINT_SOVERSION "2:3:0")
set(LIBINT_DOI "10.5281/zenodo.10369117") # 2.8.0

include(int_versions)

set(L2 Libint2) # Namespace
set(pnv libint2) # projectnameversion

################################### Overview ###################################

# CMake build overview:
#
# >>> ls
# cmake/ COPYING src/ tests/ ...
# >>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/install-libint ...
# ...
# -- Generating done
# -- Build files have been written to: /current/dir/build
# >>> cmake --build build --target install

################################## Main Project #################################

# STRICTLY TEMPORARY FOR DEMONSTRATION PURPOSES
configure_file(src/lib/libint/configuration.cc configuration.cc @ONLY)
24 changes: 24 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,27 @@ Eventually, these will be CMake Components, too.
bs - library integrals use ordering bagel + standard = bagel
bo - library integrals use ordering + orca
```

### Interfacing

Eventually (approximately 2.9.0 CMake-based), additional functions will be available to retrive Libint version, commit, and literature citation. Below are outputs at the libtool stage.

```
auto Mmp = libint2::libint_version();
printf("Version: Numeric=%s Sortable=%s Commit=%s\n", libint2::libint_version_string(false).c_str(), libint2::libint_version_string(true).c_str(), libint2::libint_commit().c_str());
printf("Version: Major=%d minor=%d patch=%d\n", std::get<0>(Mmp), std::get<1>(Mmp), std::get<2>(Mmp));
printf("Citation: DOI=%s Ref=%s\n", libint2::libint_reference_doi().c_str(), libint2::libint_reference().c_str());
printf("Citation: BibTeX=%s\n", libint2::libint_bibtex().c_str());
```
```
Version: Numeric=2.8.0 Sortable= Commit=
Version: Major=2 minor=8 patch=0
Citation: DOI= Ref=Libint: , Version Edward F. Valeev, http://libint.valeyev.net/
Citation: BibTeX=@Misc{Libint2,
author = {E.~F.~Valeev},
title = {\textsc{Libint}: },
howpublished = {http://libint.valeyev.net/},
note = {version },
year = {}
}
```
4 changes: 4 additions & 0 deletions cmake/modules/.git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=?[0-9.]*)$
ref-names: $Format:%D$
Loading

0 comments on commit d443cee

Please sign in to comment.