CMake and Windows and OSX arm64 modernization for the 1.2.x branch. Recommend forward-porting to master bevore the 1.3.1 release.
How Has This Been Tested?
[x] works for conda-forge recipe #202
Todos
Developer Interest
Most of this is a standard checklist. there's pcm specialities at the end.
[x] update old files
[x] ~copy over xhost.cmake that has new compilers. import it instead of one-liner. adapt if C, not CXX.~ no such file
[x] expand safeguards to new build types, RelWithDebInfo, and MinSizeRel
[x] update cmake min version to 3.16
[x] replace SameMajorVersion with now-available SameMinorVersion if appropriate
[x] remove any ${PN} in main project CMake as they tend to get clobbered in/after find_package
[x] ~any new project-specific options, prepend in project-case, like ambit_ENABLE_PYTHON. does not apply to e.g., BUILD_TESTING, BUILD_SHARED_LIBS~ none that I see
[x] Python
[x] if still on old NumPy/pb11 Py detection, switch to approx. find_package(Python 3.7 COMPONENTS Interpreter Development NumPy REQUIRED)
[x] ~update any set(Python_ADDITIONAL_VERSIONS~ none
[x] update cmake_minimum_required(VERSION 3.16) for Py detection
[x] update any PYTHON_EXECUTABLE to Python_EXECUTABLE
[x] ~remove any old FindPythonLibsNew.cmake~ none
[x] ~if any pybind11, check that find_package(Python) before find_package(pybind11)~ no pb11
[x] ~if any pybind11 target, remove PREFIX/SUFFIX from properties~ no pb11
[x] psi4: update the call in external/
[x] editable config.cmake location
[x] add option(<project>_INSTALL_CMAKEDIR) to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.
Initially I didn't do this, but CMAKECONFIG_INSTALL_DIR wasn't editable, so may as well.
[x] ~recipe: specify in bld.bat as -D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^ if CMAKE_INSTALL_PREFIX="%PREFIX%"~ no need since it was LIBRARY_PREFIX in recipe for Win
[x] psi4: add the call in external/ (CMAKE_ARGS and <project>_DIR and any TargetLAPACK, etc.)
[x] modernize target install/export
[x] for install(TARGETS), use full runtime/arch/lib DESTINATIONs so Windows can work
[x] for install(TARGETS), consider a descriptive EXPORT so not repeating targets filename
[x] for install(EXPORT), use descriptive EXPORT and lang or type names to Targets files
[x] make properties target-centered, particularly for FetchContent usage. target and find_package(<package>) should provide same info.
[x] define export_properties variable and append it to all base targets (e.g., static and shared always-built libs)
[ ] set the version on the target. use casing like in the config file, probaly project(CheMPS2) --> CheMPS2_VERSION
I'd really like to get version attached to the target for FetchContent consumption, but b/c computed at config-time, I think it's impossible. Might work with a function call. Not done.
[x] set all other properties that were project-specific vars in the config (like Libint_MAX_AM_ERI) on the target
did PCMSolver_PYMOD
[x] check through find_package() that targets are fully loaded (--log-level verbose and extra stuff in Config.cmake can help)
[x] define aliases matching imported targets, add_library(ambit::ambit ALIAS ambit-shared). Favor shared if both can be built together.
[x] rename any CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR to PROJECT_SOURCE_DIR/PROJECT_BINARY_DIR
[x] check fetch_content works
[x] modernize <project>Config.cmake.in
[x] kill off all PN with something like set(amb ambit) # NameSpace. PN gets overwritten a lot, so let's specialize it.
[x] remove find_header, find_file, find_library find_exe reminicent of Find<project>.cmake rather than <project>Config.cmake
[x] read find_project variables off target, rather than setting from file_header/lib/exe results
[x] check components with check_required_components(<project>) (probably already present)
[x] NEVER load exported <project>Targets.cmake before all components confirmed found and all dependencies confirmed found
[x] run a find_project(<project>) to check that vars match target (same as 4th bullet prev. section)
[x] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
[x] ~add TargetLAPACK if using BLAS/LAPACK~ none
[x] ~copy over new FindTargetLAPACK, FindTargetHDF5 as needed. modify if only use BLAS~ none
[x] ~install the Find files with the Config~ none
[x] ~in config file, add any find_dependency that we were leaving for psi4 before~ still just zlib
[x] handling lib and pylib as separate projects
MOSTLY DELETED SINCE PCMSOLVER PY ISN'T INTF
[x] CHOOSING YES, do have a PCMSolver_PYMOD variable attached to the target and Config
details on separate pylib
[x] for installation positioning, use PYMOD_INSTALL_LIBDIR if var already exists b/c in psi orbit. otherwise emulate libint (LIBINT2_INSTALL_PYMODDIR) or libxc (PYLIBXC_INSTALL_PYMODDIR)
used existing PYMOD_INSTALL_LIBDIR but added prefix / to match other psi-like projects
[x] particular for this project: pcmsolver
[x] as mentioned above, PYMOD_INSTALL_LIBDIR defaults to /python (slash added) to match other projects
[x] boost and eigen detection are a little chattier to facilitate detecting pre-built.
[x] boost doesn't tidy up after itself on Windows.
[x] hid FindEigen since it was interfering with modern installations
[x] promote run_pcm to an exported target (so I could test the c-f package) with install, alias, export, etc.
[x] modernized some Py syntax in getkw.py, pcmparser.py, pyparsing.py
[x] added enormous 3rd-party-licensing file to satisfy c-f packaging requirements. Looks like I standardized versioner.py license back to psi-like in the process, but I don't really care -- change it back if you wish.
[x] expanded c++11 flags testing to Windows format
Description
CMake and Windows and OSX arm64 modernization for the 1.2.x branch. Recommend forward-porting to master bevore the 1.3.1 release.
How Has This Been Tested?
Todos
Most of this is a standard checklist. there's pcm specialities at the end.
[x] update old files
${PN}
in main project CMake as they tend to get clobbered in/afterfind_package
[x] Python
set(Python_ADDITIONAL_VERSIONS
~ nonecmake_minimum_required(VERSION 3.16)
for Py detection[x] editable config.cmake location
option(<project>_INSTALL_CMAKEDIR)
to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.CMAKECONFIG_INSTALL_DIR
wasn't editable, so may as well.-D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^
ifCMAKE_INSTALL_PREFIX="%PREFIX%"
~ no need since it was LIBRARY_PREFIX in recipe for Win<project>_DIR
and any TargetLAPACK, etc.)[x] modernize target install/export
[x] make properties target-centered, particularly for FetchContent usage. target and
find_package(<package>)
should provide same info.project(CheMPS2)
--> CheMPS2_VERSIONadd_library(ambit::ambit ALIAS ambit-shared)
. Favor shared if both can be built together.[x] modernize
<project>Config.cmake.in
set(amb ambit) # NameSpace
. PN gets overwritten a lot, so let's specialize it.Find<project>.cmake
rather than<project>Config.cmake
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
~ nonecheck_required_components(<project>)
(probably already present)<project>Targets.cmake
before all components confirmed found and all dependencies confirmed foundfind_project(<project>)
to check that vars match target (same as 4th bullet prev. section)[x] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
find_dependency
that we were leaving for psi4 before~ still just zlib[x] handling lib and pylib as separate projects
PYMOD_INSTALL_LIBDIR
but added prefix/
to match other psi-like projects[x] particular for this project: pcmsolver
PYMOD_INSTALL_LIBDIR
defaults to/python
(slash added) to match other projectsrun_pcm
to an exported target (so I could test the c-f package) with install, alias, export, etc.User-Facing for Release Notes
Types of changes
Status