3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 03:53:48 +01:00

add PythonSupport; change Doc build control flow

* change in Build_Documentation control flow
* don’t Build_Documentation of deps if EXCLUDE_FROM_ALL
* export new APP4TRIQS_WITH_PYTHON_SUPPORT variable in config.cmake
This commit is contained in:
Philipp Dumitrescu 2020-05-07 10:41:30 -04:00 committed by Nils Wentzell
parent d2114bd227
commit 055e7519ba
8 changed files with 37 additions and 26 deletions

View File

@ -70,6 +70,15 @@ if(NOT IS_SUBPROJECT)
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
endif()
# Python Support
option(PythonSupport "Build with Python support" ON)
if(PythonSupport AND NOT TRIQS_WITH_PYTHON_SUPPORT)
message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF")
endif()
# Documentation
option(Build_Documentation "Build documentation" OFF)
# Testing
option(Build_Tests "Build tests" ON)
if(Build_Tests)
@ -116,28 +125,19 @@ if(Build_Tests)
add_subdirectory(test)
endif()
if(TRIQS_WITH_PYTHON_SUPPORT)
# Python interface
# Python
if(PythonSupport)
add_subdirectory(python/app4triqs)
endif()
# Build the documentation
option(Build_Documentation "Build documentation" OFF)
if(Build_Documentation AND NOT IS_SUBPROJECT)
if(NOT TRIQS_WITH_DOCUMENTATION)
message(WARNING "TRIQS was installed without documentation! Cannot build documentation.")
else()
message(STATUS "Documentation Build enabled")
# Docs
if(Build_Documentation)
add_subdirectory(doc)
endif()
endif()
else()
message(WARNING "TRIQS was installed without Python support. Cannot build the Python Interface and Documentation.")
endif()
# Additional configuration files
add_subdirectory(share)
# #############
# Debian Package
@ -156,4 +156,3 @@ if(BUILD_DEBIAN_PACKAGE AND NOT IS_SUBPROJECT)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
include(CPack)
endif()

8
deps/CMakeLists.txt vendored
View File

@ -54,10 +54,12 @@ external_dependency(GTest
EXCLUDE_FROM_ALL
)
# -- Cpp2Py --
external_dependency(Cpp2Py
if(PythonSupport OR Build_Documentation)
# -- Cpp2Py --
external_dependency(Cpp2Py
GIT_REPO https://github.com/TRIQS/cpp2py
VERSION 2.0
GIT_TAG master
EXCLUDE_FROM_ALL
)
)
endif()

View File

@ -46,6 +46,7 @@ function(external_dependency)
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}")

View File

@ -2,6 +2,12 @@ add_subdirectory(cmake)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT AND NOT IS_SUBPROJECT)
if(PythonSupport)
set(EXPORT_PYTHON_PATH "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CPP2PY_PYTHON_LIB_DEST_ROOT}:$PYTHONPATH")
set(MODFILE_PYTHON_PATH "prepend-path PYTHONPATH $root/${CPP2PY_PYTHON_LIB_DEST_ROOT}")
endif()
configure_file(app4triqs.modulefile.in app4triqs.modulefile @ONLY)
configure_file(app4triqsvars.sh.in app4triqsvars.sh @ONLY)

View File

@ -35,5 +35,5 @@ prepend-path PATH $root/bin
prepend-path CPLUS_INCLUDE_PATH $root/include
prepend-path LIBRARY_PATH $root/lib
prepend-path LD_LIBRARY_PATH $root/lib
prepend-path PYTHONPATH $root/@TRIQS_PYTHON_LIB_DEST_ROOT@
prepend-path CMAKE_PREFIX_PATH $root/lib/cmake/app4triqs
@MODFILE_PYTHON_PATH@

View File

@ -6,5 +6,5 @@ export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
export LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH
export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@CPP2PY_PYTHON_LIB_DEST_ROOT@:$PYTHONPATH
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@:$CMAKE_PREFIX_PATH
@EXPORT_PYTHON_PATH@

View File

@ -25,4 +25,7 @@ message(STATUS "Found app4triqs-config.cmake with version @PROJECT_VERSION@, has
# Was the Project built with Documentation?
set(APP4TRIQS_WITH_DOCUMENTATION @Build_Documentation@)
# Was the Project built with PythonSupport?
set(APP4TRIQS_WITH_PYTHON_SUPPORT @PythonSupport@)
endif()

View File

@ -1,5 +1,5 @@
add_subdirectory(c++)
if(${TRIQS_WITH_PYTHON_SUPPORT})
if(PythonSupport)
add_subdirectory(python)
endif()