mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 12:55:17 +01:00
add missing deps dir after apps4triqs merge
This commit is contained in:
parent
11d394fd5b
commit
8e9fbc5dc0
1
deps/.gitignore
vendored
Normal file
1
deps/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*
|
66
deps/CMakeLists.txt
vendored
Normal file
66
deps/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
include(external_dependency.cmake)
|
||||||
|
|
||||||
|
# Add your dependencies with the function
|
||||||
|
#
|
||||||
|
# external_dependency(name
|
||||||
|
# [VERSION <version-number>]
|
||||||
|
# [GIT_REPO <url>]
|
||||||
|
# [GIT_TAG <tag>]
|
||||||
|
# [BUILD_ALWAYS]
|
||||||
|
# [EXCLUDE_FROM_ALL]
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# Resolve the dependency using the following steps in order.
|
||||||
|
# If a step was successful, skip the remaining ones.
|
||||||
|
#
|
||||||
|
# 1. Use find_package(name [<version-number>])
|
||||||
|
# to locate the package in the system.
|
||||||
|
# Skip this step if Build_Deps option is set.
|
||||||
|
# 2. Try to find a directory containing the sources
|
||||||
|
# at ${PROJECT_SOURCE_DIR}/deps/name. If found
|
||||||
|
# build it as a cmake sub-project.
|
||||||
|
# 3. If GIT_REPO is provided, git clone the sources,
|
||||||
|
# and build them as a cmake sub-project.
|
||||||
|
#
|
||||||
|
# Addtional options:
|
||||||
|
#
|
||||||
|
# GIT_TAG - Use this keyword to specify the git-tag, branch or commit hash
|
||||||
|
#
|
||||||
|
# BUILD_ALWAYS - If set, this dependency will always be built from source
|
||||||
|
# and will never be searched in the system.
|
||||||
|
#
|
||||||
|
# EXCLUDE_FROM_ALL - If set, targets of the dependency cmake subproject
|
||||||
|
# will not be included in the ALL target of the project.
|
||||||
|
# In particular the dependency will not be installed.
|
||||||
|
|
||||||
|
if(NOT DEFINED Build_Deps)
|
||||||
|
set(Build_Deps "Never" CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
|
||||||
|
else()
|
||||||
|
set(Build_Deps_Opts "Never" "Always" "IfNotFound")
|
||||||
|
if(NOT ${Build_Deps} IN_LIST Build_Deps_Opts)
|
||||||
|
message(FATAL_ERROR "Build_Deps option should be either 'Never', 'Always' or 'IfNotFound'")
|
||||||
|
endif()
|
||||||
|
set(Build_Deps ${Build_Deps} CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
|
||||||
|
if(NOT IS_SUBPROJECT AND NOT Build_Deps STREQUAL "Always" AND (ASAN OR UBSAN))
|
||||||
|
message(WARNING "For builds with llvm sanitizers (ASAN/UBSAN) it is recommended to use -DBuild_Deps=Always to avoid false positives.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -- Cpp2Py --
|
||||||
|
if(PythonSupport OR Build_Documentation)
|
||||||
|
external_dependency(Cpp2Py
|
||||||
|
GIT_REPO https://github.com/TRIQS/cpp2py
|
||||||
|
VERSION 2.0
|
||||||
|
GIT_TAG master
|
||||||
|
BUILD_ALWAYS
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -- GTest --
|
||||||
|
external_dependency(GTest
|
||||||
|
GIT_REPO https://github.com/google/googletest
|
||||||
|
GIT_TAG release-1.10.0
|
||||||
|
BUILD_ALWAYS
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
70
deps/external_dependency.cmake
vendored
Normal file
70
deps/external_dependency.cmake
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
###################################################################################
|
||||||
|
#
|
||||||
|
# TRIQS_DFT_TOOLS: a Toolbox for Research in Interacting Quantum Systems
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 Simons Foundation
|
||||||
|
# authors: N. Wentzell
|
||||||
|
#
|
||||||
|
# TRIQS_DFT_TOOLS is free software: you can redistribute it and/or modify it under the
|
||||||
|
# terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# TRIQS_DFT_TOOLS 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 General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# TRIQS_DFT_TOOLS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
function(external_dependency)
|
||||||
|
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;BUILD_ALWAYS" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
|
||||||
|
|
||||||
|
# -- Was dependency already found?
|
||||||
|
get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
|
||||||
|
if(${ARGV0}_FOUND)
|
||||||
|
message(STATUS "Dependency ${ARGV0} was already resolved.")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -- Try to find package in system.
|
||||||
|
if(NOT ARG_BUILD_ALWAYS AND NOT Build_Deps STREQUAL "Always")
|
||||||
|
find_package(${ARGV0} ${ARG_VERSION} QUIET HINTS ${CMAKE_INSTALL_PREFIX})
|
||||||
|
if(${ARGV0}_FOUND)
|
||||||
|
message(STATUS "Found dependency ${ARGV0} in system ${${ARGV0}_ROOT}")
|
||||||
|
return()
|
||||||
|
elseif(Build_Deps STREQUAL "Never")
|
||||||
|
message(FATAL_ERROR "Could not find dependency ${ARGV0} in system. Please install the dependency manually or use -DBuild_Deps=IfNotFound during cmake configuration to automatically build all dependencies that are not found.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -- Build package from source
|
||||||
|
message(STATUS " =============== Configuring Dependency ${ARGV0} =============== ")
|
||||||
|
if(ARG_EXCLUDE_FROM_ALL)
|
||||||
|
set(subdir_opts EXCLUDE_FROM_ALL)
|
||||||
|
set(Build_Tests OFF)
|
||||||
|
set(Build_Documentation OFF)
|
||||||
|
endif()
|
||||||
|
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0})
|
||||||
|
message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
|
||||||
|
add_subdirectory(${ARGV0} ${subdir_opts})
|
||||||
|
elseif(ARG_GIT_REPO)
|
||||||
|
set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0})
|
||||||
|
set(src_dir ${bin_dir}_src)
|
||||||
|
if(NOT IS_DIRECTORY ${src_dir})
|
||||||
|
if(ARG_GIT_TAG)
|
||||||
|
set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false)
|
||||||
|
endif()
|
||||||
|
execute_process(COMMAND git clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir})
|
||||||
|
endif()
|
||||||
|
add_subdirectory(${src_dir} ${bin_dir} ${subdir_opts})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Could not find or build dependency ${ARGV0}")
|
||||||
|
endif()
|
||||||
|
message(STATUS " =============== End ${ARGV0} Configuration =============== ")
|
||||||
|
set_property(GLOBAL PROPERTY ${ARGV0}_FOUND TRUE)
|
||||||
|
|
||||||
|
endfunction()
|
Loading…
Reference in New Issue
Block a user