-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b9ac6ab
Showing
42 changed files
with
3,443 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
=========================================== | ||
Contributing to SCINE Development Utilities | ||
=========================================== | ||
|
||
Contribution Process | ||
==================== | ||
|
||
The development for this code is done in a private repository maintained by the | ||
Reiher Research Group. GitHub is only used for the official releases. | ||
|
||
If you would like to contribute a larger change, please write to scine@phys.chem.ethz.ch. | ||
For smaller changes, you can create a pull request on GitHub. If we agree with | ||
the changes, a member of the Reiher Research Group will include them in our | ||
development code. Of course, we will give proper acknowledgment for any external | ||
contribution (see below for a list of all contributors). As soon as these changes | ||
are available in an official release, we will close the corresponding pull requests | ||
and/or issues on GitHub. | ||
|
||
Please note that contributing a small change does in no way mean that you will | ||
be added to the author list of a future paper and/or Zenodo entry! | ||
|
||
Main Contributors | ||
================= | ||
|
||
Almost all contributions to SCINE in general and this repository in specific come | ||
from members of the Reiher research group. | ||
|
||
Further Contributors | ||
==================== | ||
|
||
So far, no one else has contributed to this repository. |
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,26 @@ | ||
Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation and/or | ||
other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
OF THE POSSIBILITY OF SUCH DAMAGE. |
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,15 @@ | ||
============================= | ||
SCINE - Development Utilities | ||
============================= | ||
|
||
Introduction | ||
============ | ||
|
||
This repository contains scripts and other stuff useful in all SCINE projects. | ||
|
||
License and Copyright Information | ||
================================= | ||
|
||
This work is (unless stated otherwise) distributed under the BSD 3-clause "New" | ||
or "Revised" License. For more license and copyright information, see the file | ||
``LICENSE.txt`` in this repository. |
Empty file.
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,103 @@ | ||
# | ||
# This file is licensed under the 3-clause BSD license. | ||
# Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group. | ||
# See LICENSE.txt for details. | ||
# | ||
|
||
# If the target already exists, do nothing | ||
if(NOT TARGET Eigen3::Eigen) | ||
find_package(Eigen3 3.3.2 REQUIRED) | ||
endif() | ||
|
||
option(SCINE_USE_INTEL_MKL "Use the Intel MKL libraries with Eigen" ON) | ||
option(SCINE_USE_LAPACK "Use a LAPACK library with Eigen" ON) | ||
option(SCINE_USE_BLAS "Use a BLAS library with Eigen" ON) | ||
|
||
# Attempt to find external linalg libraries that accelerate basic calls in | ||
# the following order: | ||
# | ||
# 1. Intel MKL | ||
# 2. LAPACK (brings BLAS too) | ||
# 3. BLAS | ||
# | ||
if(NOT ADD_EIGEN_SEARCHED_EXTERNAL_LINALG_LIBRARIES) | ||
if(SCINE_USE_INTEL_MKL) | ||
include(FindMKL) | ||
endif() | ||
|
||
if(MKL_FOUND) | ||
find_package(OpenMP REQUIRED) | ||
message(STATUS "Found MKL for use with Eigen3") | ||
else() | ||
if(SCINE_USE_LAPACK) | ||
include(FindLAPACK) | ||
find_package(LAPACK QUIET) | ||
endif() | ||
|
||
if(LAPACK_FOUND) | ||
message(STATUS "Found LAPACK/BLAS for use with Eigen3") | ||
else() | ||
if(SCINE_USE_BLAS) | ||
include(FindBLAS) | ||
find_package(BLAS QUIET) | ||
endif() | ||
|
||
if(BLAS_FOUND) | ||
message(STATUS "Found BLAS for use with Eigen3") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
set(ADD_EIGEN_SEARCHED_EXTERNAL_LINALG_LIBRARIES TRUE) | ||
endif() | ||
|
||
function(add_eigen target_name mode) | ||
# Everything relating to the special case of object libraries can be | ||
# simplified down to the target_link_libraries command when the minimum cmake | ||
# version is bumped past 3.12.0 | ||
if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.12.0") | ||
set(_CAN_LINK_OBJECT_LIBRARIES TRUE) | ||
endif() | ||
get_target_property(target_type ${target_name} TYPE) | ||
if("${target_type}" STREQUAL "OBJECT_LIBRARY") | ||
set(_IS_OBJECT_LIBRARY TRUE) | ||
endif() | ||
|
||
# Append the required properties to the passed target | ||
if(MKL_FOUND AND SCINE_USE_INTEL_MKL) | ||
# MKL AND EIGEN_USE_MKL_ALL | ||
if(_CAN_LINK_OBJECT_LIBRARIES OR NOT _IS_OBJECT_LIBRARY) | ||
target_link_libraries(${target_name} ${mode} Eigen3::Eigen ${MKL_LIBRARIES} OpenMP::OpenMP_CXX) | ||
else() | ||
target_include_directories(${target_name} ${mode} $<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>) | ||
endif() | ||
target_include_directories(${target_name} ${mode} ${MKL_INCLUDE_DIRS}) | ||
target_compile_definitions(${target_name} ${mode} EIGEN_USE_MKL_ALL) | ||
target_compile_options(${target_name} ${mode} $<$<BOOL:${OpenMP_CXX_FOUND}>:${OpenMP_CXX_FLAGS}>) | ||
else() | ||
if(LAPACK_FOUND AND SCINE_USE_LAPACK) | ||
# LAPACK and EIGEN_USE_LAPACK / EIGEN_USE_BLAS | ||
if(_CAN_LINK_OBJECT_LIBRARIES OR NOT _IS_OBJECT_LIBRARY) | ||
target_link_libraries(${target_name} ${mode} Eigen3::Eigen ${LAPACK_LIBRARIES}) | ||
endif() | ||
target_compile_definitions(${target_name} ${mode} EIGEN_USE_LAPACK EIGEN_USE_BLAS) | ||
else() | ||
if(BLAS_FOUND AND SCINE_USE_BLAS) | ||
# Blas and EIGEN_USE_BLAS | ||
if(_CAN_LINK_OBJECT_LIBRARIES OR NOT _IS_OBJECT_LIBRARY) | ||
target_link_libraries(${target_name} ${mode} Eigen3::Eigen ${BLAS_LIBRARIES}) | ||
else() | ||
target_include_directories(${target_name} ${mode} $<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>) | ||
endif() | ||
target_compile_definitions(${target_name} ${mode} EIGEN_USE_BLAS) | ||
else() | ||
# Just Eigen, no definitions | ||
if(_CAN_LINK_OBJECT_LIBRARIES OR NOT _IS_OBJECT_LIBRARY) | ||
target_link_libraries(${target_name} ${mode} Eigen3::Eigen) | ||
else() | ||
target_include_directories(${target_name} ${mode} $<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>) | ||
endif() | ||
endif() | ||
endif() | ||
endif() | ||
endfunction() |
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,37 @@ | ||
# | ||
# This file is licensed under the 3-clause BSD license. | ||
# Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group. | ||
# See LICENSE.txt for details. | ||
# | ||
|
||
function(list_pop_front listname resultname) | ||
if(${CMAKE_VERSION} VERSION_LESS "3.15.0") | ||
if(${listname}) | ||
list(GET ${listname} 0 firstElement) | ||
set(${resultname} ${firstElement} PARENT_SCOPE) | ||
list(REMOVE_AT ${listname} 0) | ||
set(${listname} ${${listname}} PARENT_SCOPE) | ||
endif() | ||
else() | ||
list(POP_FRONT ${listname} ${resultname}) | ||
set(${resultname} ${${resultname}} PARENT_SCOPE) | ||
set(${listname} ${${listname}} PARENT_SCOPE) | ||
endif() | ||
endfunction() | ||
|
||
function(list_pop_back listname resultname) | ||
if(${CMAKE_VERSION} VERSION_LESS "3.15.0") | ||
if(${listname}) | ||
list(LENGTH ${listname} listlength) | ||
math(EXPR lastElementIndex ${listlength}-1) | ||
list(GET ${listname} ${lastElementIndex} lastElement) | ||
set(${resultname} ${lastElement} PARENT_SCOPE) | ||
list(REMOVE_AT ${listname} ${lastElementIndex}) | ||
set(${listname} ${${listname}} PARENT_SCOPE) | ||
endif() | ||
else() | ||
list(POP_BACK ${listname} ${resultname}) | ||
set(${resultname} ${${resultname}} PARENT_SCOPE) | ||
set(${listname} ${${listname}} PARENT_SCOPE) | ||
endif() | ||
endfunction() |
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,82 @@ | ||
# | ||
# This file is licensed under the 3-clause BSD license. | ||
# Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group. | ||
# See LICENSE.txt for details. | ||
# | ||
include(DoxygenDocumentation) | ||
include(Utils) | ||
|
||
function(scine_setup_component) | ||
# Set a default build type | ||
set(default_build_type "RelWithDebInfo") | ||
if(NOT CMAKE_BUILD_TYPE) | ||
message(STATUS "Setting build type to default '${default_build_type}'") | ||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE | ||
STRING "Choose the type of the build." | ||
FORCE | ||
) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY | ||
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" | ||
) | ||
endif() | ||
|
||
if(COVERAGE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -coverage" PARENT_SCOPE) | ||
endif() | ||
|
||
# Give default value to parameter LANGUAGES | ||
if(NOT SCINE_SETUP_LANGUAGES) | ||
set(SCINE_SETUP_LANGUAGES CXX) | ||
endif() | ||
|
||
if(NOT SCINE_SETUP_VERSION) | ||
set(SCINE_SETUP_VERSION 3.0.0) | ||
endif() | ||
|
||
# Default SCINE values | ||
set(SCINE_CMAKE_PACKAGE_ROOT "lib/cmake") | ||
set(SCINE_CMAKE_PACKAGE_ROOT "lib/cmake" PARENT_SCOPE) | ||
|
||
# Compilation options | ||
set(CMAKE_CXX_STANDARD 14 PARENT_SCOPE) | ||
option(SCINE_EXTRA_WARNINGS "Compile with an increased amount of compiler generated warnigs." ON) | ||
option(SCINE_WARNINGS_TO_ERRORS "Compile with warnings as errors." OFF) | ||
if( | ||
${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" | ||
OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" | ||
OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang" | ||
) | ||
if (SCINE_EXTRA_WARNINGS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-comment") | ||
endif() | ||
if (SCINE_WARNINGS_TO_ERRORS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") | ||
endif() | ||
endif() | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON PARENT_SCOPE) | ||
|
||
# Meta-build options | ||
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
option(SCINE_BUILD_TESTS "Build all test executables." ON) | ||
option(SCINE_BUILD_DOCS "Build the documentation." ON) | ||
option(SCINE_BUILD_PYTHON_BINDINGS "Build all available Python bindings" OFF) | ||
option(SCINE_BUILD_GUI_MODULES "Build all available GUI modules" OFF) | ||
option(SCINE_PARALLELIZE "Parallelize algorithms where available" ON) | ||
set(SCINE_MARCH "native" CACHE STRING "Build all components with the -march=native compiler flag.") | ||
|
||
if(NOT "${SCINE_MARCH_WARNING_PRINTED}" AND NOT "${SCINE_MARCH}" STREQUAL "") | ||
message(WARNING "You are compiling Scine components with an architecture-specific ISA: -march=${SCINE_MARCH}. Linking together libraries with mismatched architecture build flags can cause problems, in particular with Eigen. Watch out!") | ||
set(SCINE_MARCH_WARNING_PRINTED ON) | ||
endif() | ||
|
||
# Tests imports | ||
if(SCINE_BUILD_TESTS) | ||
include(ImportGTest) | ||
import_gtest() | ||
endif() | ||
|
||
# Do not search the installation path in subsequent builds | ||
set(CMAKE_FIND_NO_INSTALL_PREFIX ON CACHE BOOL "" FORCE) | ||
|
||
# Utility functions | ||
endfunction() |
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,17 @@ | ||
# This file is distributed under the OSI-approved MIT License. | ||
# It has been adapted from /~https://github.com/Crascit/DownloadProject . | ||
|
||
cmake_minimum_required(VERSION 3.9) | ||
|
||
project(${DL_ARGS_PROJ}-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(${DL_ARGS_PROJ}-download | ||
${DL_ARGS_UNPARSED_ARGUMENTS} | ||
SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" | ||
BINARY_DIR "${DL_ARGS_BINARY_DIR}" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
Oops, something went wrong.