diff --git a/CMakeLists.txt b/CMakeLists.txt index 2093dfa7..ac52a8a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,10 +29,10 @@ find_package(Cpp2Py 1.5 REQUIRED) # Default Install directory to TRIQS_ROOT if not given or invalid. if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})) - message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT") + message(STATUS " No install prefix given (or invalid). Defaulting to TRIQS_ROOT") set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE) endif() -message(STATUS "-------- INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") +message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") # Define the app4triqs version numbers and get the git hash set(APP4TRIQS_VERSION_MAJOR 0) @@ -46,11 +46,6 @@ message(STATUS "Git hash: ${APP4TRIQS_GIT_HASH}") # Build and install the app4triqs library add_subdirectory(c++/app4triqs) -# Build and install the app4triqs python module -if(${TRIQS_WITH_PYTHON_SUPPORT}) - add_subdirectory(python/app4triqs) -endif() - # Tests option(Build_Tests "Build tests" ON) if(Build_Tests) @@ -58,19 +53,28 @@ if(Build_Tests) add_subdirectory(test) endif() +if(TRIQS_WITH_PYTHON_SUPPORT) + # Python interface + add_subdirectory(python/app4triqs) + + # Build the documentation + option(Build_Documentation "Build documentation" OFF) + if(Build_Documentation) + if(NOT TRIQS_WITH_DOCUMENTATION) + message(WARNING "TRIQS library has not been compiled with its documentation! Cannot build documentation.") + else() + message(STATUS "Documentation Build enabled") + add_subdirectory(doc) + endif() + endif() +else() + message(WARNING "TRIQS library has been installed without Python support. Cannot build the Python Interface and Documentation.") +endif() + # Additional configuration files add_subdirectory(share) -option(Build_Documentation "Build documentation" OFF) -if(Build_Documentation) - if(NOT TRIQS_WITH_DOCUMENTATION) - message(WARNING "TRIQS library has not been compiled with its documentation! Cannot build documentation.") - else() - message(STATUS "Documentation Build enabled") - add_subdirectory(doc) - endif() -endif() - +# Debian Package option(BUILD_DEBIAN_PACKAGE "Build a deb package" OFF) if(BUILD_DEBIAN_PACKAGE) if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") diff --git a/LICENSE b/COPYING.txt similarity index 100% rename from LICENSE rename to COPYING.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..78c28051 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,16 @@ +TRIQS: a Toolbox for Research in Interacting Quantum Systems + +Copyright (C) 2014 by P. Seth, I. Krivenko, M. Ferrero, O. Parcollet + +TRIQS 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 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 (in the file COPYING.txt in this directory). If not, see +. diff --git a/c++/app4triqs/CMakeLists.txt b/c++/app4triqs/CMakeLists.txt index 477db797..f1c3abe8 100644 --- a/c++/app4triqs/CMakeLists.txt +++ b/c++/app4triqs/CMakeLists.txt @@ -1,22 +1,23 @@ file(GLOB_RECURSE sources *.cpp) add_library(app4triqs_c ${sources}) -# Link against triqs and use headers with SYSTEM flag for better warning messages +# Link against dependencies target_link_libraries(app4triqs_c PUBLIC triqs) -target_include_directories(app4triqs_c SYSTEM PUBLIC ${TRIQS_ROOT}/include) +# Configure compilation target_compile_options(app4triqs_c PUBLIC -std=c++17 -fPIC) target_include_directories(app4triqs_c PUBLIC $) -target_compile_definitions(app4triqs_c PRIVATE +target_compile_definitions(app4triqs_c PUBLIC APP4TRIQS_GIT_HASH=${APP4TRIQS_GIT_HASH} - TRIQS_GIT_HASH=${TRIQS_GIT_HASH} + TRIQS_GIT_HASH=${TRIQS_GIT_HASH} $<$:APP4TRIQS_DEBUG> - $<$:TRIQS_ARRAYS_ENFORCE_BOUNDCHECK> - ) + $<$:TRIQS_DEBUG> + $<$:TRIQS_ARRAYS_ENFORCE_BOUNDCHECK> + ) # Install library and headers install(TARGETS app4triqs_c EXPORT app4triqs-targets DESTINATION lib) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include/app4triqs FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") # ========= Static Analyzer Checks ========== @@ -58,25 +59,32 @@ endif() # ========= Dynamic Analyzer Checks ========== -# Make additional cmake Modules available -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/share/cmake) - +set(sanitizers "") # Address Sanitizer option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer") if(ASAN) - find_package(libasan_rt REQUIRED) - target_compile_options(app4triqs_c PUBLIC -fsanitize=address -fno-omit-frame-pointer) + list(APPEND sanitizers asan) + target_compile_options(app4triqs_c PRIVATE -fsanitize=address -fno-omit-frame-pointer -ggdb3) target_link_libraries(app4triqs_c INTERFACE "-fsanitize=address -fno-omit-frame-pointer") + if(NOT DEFINED ENV{ASAN_OPTIONS}) + message(WARNING "ASAN_OPTIONS is not set. Consider setting ASAN_OPTIONS=symbolize=1:detect_leaks=0 when running tests") + endif() endif() # Undefined Behavior Sanitizer option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer") if(UBSAN) - find_package(libubsan_rt REQUIRED) - target_compile_options(app4triqs_c PUBLIC -fsanitize=undefined -fno-omit-frame-pointer -fno-sanitize=vptr) + list(APPEND sanitizers ubsan) + target_compile_options(app4triqs_c PUBLIC -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer -ggdb3) target_link_libraries(app4triqs_c INTERFACE "-fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer") + if(NOT DEFINED ENV{UBSAN_OPTIONS}) + message(WARNING "UBSAN_OPTIONS is not set. Consider setting UBSAN_OPTIONS=symbolize=1:print_stacktrace=1:halt_on_error=1 when running tests") + endif() endif() -if(ASAN OR UBSAN AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - target_link_libraries(app4triqs_c INTERFACE "-fuse-ld=gold") +if(sanitizers) + find_package(sanitizer REQUIRED ${sanitizers}) + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + target_link_libraries(app4triqs_c INTERFACE "-fuse-ld=gold") + endif() endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 08168908..3b0d75e5 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -4,6 +4,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR # --------------------------------- # Top Sphinx target # --------------------------------- +# Sources file(GLOB_RECURSE sources *.rst) set(sphinx_top ${CMAKE_CURRENT_BINARY_DIR}/html/contents.html) @@ -19,7 +20,7 @@ add_dependencies(docs_sphinx app4triqs_c) # cp_rs is a script in cpp2py/bin, it mimics cp -rs on Linux # and filters the relevant extension # ------------------------------------------------------------------------------------------------ -set(EXT_FOR_DOC "rst png txt css_t conf css js gif jpg py html bib md") +set(EXT_FOR_DOC "rst png txt css_t conf css js gif jpg py html bib h5 md") execute_process(COMMAND cp_rs ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${EXT_FOR_DOC}) # ----------------------------------------------------------------------------- diff --git a/doc/_templates/sideb.html b/doc/_templates/sideb.html index 5b1c7b8e..7df7dffd 100644 --- a/doc/_templates/sideb.html +++ b/doc/_templates/sideb.html @@ -10,5 +10,5 @@


- Visit the project on GitHub + Visit the project on GitHub

diff --git a/doc/conf.py.in b/doc/conf.py.in index 26f1cfe3..1d95c317 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -3,6 +3,7 @@ # TRIQS documentation build configuration file import sys +sys.path.insert(0, "@TRIQS_SPHINXEXT_PATH@/autorun") sys.path.insert(0, "@TRIQS_SPHINXEXT_PATH@/numpydoc") extensions = ['sphinx.ext.autodoc', @@ -13,7 +14,8 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.autosummary', 'plot_directive', - 'numpydoc'] + 'numpydoc', + 'autorun'] source_suffix = '.rst' diff --git a/doc/index.rst b/doc/index.rst index b4cd7805..001e69b4 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -6,7 +6,7 @@ app4triqs .. sidebar:: app4triqs 0.1 This is the homepage app4triqs Version 0.1 - For the changes in 0.1, Cf :ref:`changelog page ` + For changes see, Cf :ref:`changelog page ` An example application using cpp2py and triqs. diff --git a/python/app4triqs/CMakeLists.txt b/python/app4triqs/CMakeLists.txt index f7ec1c0c..3eb11b72 100644 --- a/python/app4triqs/CMakeLists.txt +++ b/python/app4triqs/CMakeLists.txt @@ -1,21 +1,18 @@ # Build the python module add_cpp2py_module(toto_module) - target_link_libraries(toto_module app4triqs_c) -# We need to include the convertes.hxx files -target_include_directories(toto_module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - # Configure the version configure_file(version.py.in version.py) # All Python files. Copy them in the build dir to have a complete package for the tests. -set(PYTHON_SOURCES __init__.py) -foreach(f ${PYTHON_SOURCES}) - configure_file(${f} ${f} COPYONLY) +file(GLOB_RECURSE python_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py) +list(FILTER python_sources EXCLUDE REGEX "_desc.py") +foreach(file ${python_sources}) + configure_file(${file} ${file} COPYONLY) endforeach() # Install python module to proper location -set(PYTHON_LIB_DEST ${CPP2PY_PYTHON_LIB_DEST_ROOT}/app4triqs) +set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/app4triqs) install(TARGETS toto_module DESTINATION ${PYTHON_LIB_DEST}) -install(FILES ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) +install(FILES ${python_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST}) diff --git a/python/app4triqs/__init__.py b/python/app4triqs/__init__.py index d00e4749..591133ee 100644 --- a/python/app4triqs/__init__.py +++ b/python/app4triqs/__init__.py @@ -1,3 +1,26 @@ +################################################################################ +# +# TRIQS: a Toolbox for Research in Interacting Quantum Systems +# +# Copyright (C) 2016-2018, N. Wentzell +# Copyright (C) 2018-2019, The Simons Foundation +# author: N. Wentzell +# +# TRIQS 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 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. If not, see . +# +################################################################################ + r""" DOC diff --git a/python/app4triqs/version.py.in b/python/app4triqs/version.py.in index dfcc5436..d6c83d2d 100644 --- a/python/app4triqs/version.py.in +++ b/python/app4triqs/version.py.in @@ -1,9 +1,32 @@ +################################################################################ +# +# TRIQS: a Toolbox for Research in Interacting Quantum Systems +# +# Copyright (C) 2016-2018, N. Wentzell +# Copyright (C) 2018-2019, Simons Foundation +# author: N. Wentzell +# +# TRIQS 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 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. If not, see . +# +################################################################################ + version = "@APP4TRIQS_VERSION@" triqs_hash = "@TRIQS_GIT_HASH@" app4triqs_hash = "@APP4TRIQS_GIT_HASH@" def show_version(): - print "\nYou are using app4triqs version %s, release %s\n"%(version, release) + print "\nYou are using app4triqs version %s\n"%version def show_git_hash(): print "\nYou are using app4triqs git hash %s based on triqs git hash %s\n"%(app4triqs_hash, triqs_hash) diff --git a/share/cmake/Findlibasan_rt.cmake b/share/cmake/Findlibasan_rt.cmake deleted file mode 100644 index b42f26ae..00000000 --- a/share/cmake/Findlibasan_rt.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Nils Wentzell 2018 -# Distributed under the GNU GENERAL PUBLIC LICENSE Version 3.0. -# See accompanying file LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt -# -# This cmake find module looks for the LLVM Address Sanitizer Runtime Library -# It sets up : ASAN_RT_LIBRARY - -# This module finds the LLVM Address Sanitizer Runtime Library -# latter case skip to the "Boost CMake" section below. For the former -# -# Use this module by invoking find_package with the form:: -# -# find_package(libasan_rt [REQUIRED]) -# -# Results are reported in:: -# -# ASAN_RT_LIBRARY Address Sanitizer Runtime Library - -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(name clang_rt.asan_osx_dynamic) - else() - set(name clang_rt.asan-x86_64) - endif() -elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - set(name asan) -else() - message(FATAL_ERROR "LLVM Address Sanitizer is not available for your compiler") -endif() - -find_library(ASAN_RT_LIBRARY - NAMES ${name} - PATHS - ENV LIBRARY_PATH - ENV LD_LIBRARY_PATH - /usr/lib - /usr/local/lib - /usr/lib/gcc/*/7 - /usr/lib/gcc/*/* - /usr/lib/clang/*/lib/linux - /usr/lib/llvm-*/lib/clang/*/lib/linux - /usr/local/opt/llvm/lib/clang/*/lib/darwin -) - -mark_as_advanced(ASAN_RT_LIBRARY) - -# Imported target -add_library(libasan_rt SHARED IMPORTED) -set_property(TARGET libasan_rt PROPERTY IMPORTED_LOCATION ${ASAN_RT_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args("Address Sanitizer Runtime Library" - REQUIRED_VARS ASAN_RT_LIBRARY - FAIL_MESSAGE "Address Sanitizer Runtime Libraries not found! Consider installing for additional checks!" -) diff --git a/share/cmake/Findlibubsan_rt.cmake b/share/cmake/Findlibubsan_rt.cmake deleted file mode 100644 index 547b4b36..00000000 --- a/share/cmake/Findlibubsan_rt.cmake +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright Nils Wentzell 2018 -# Distributed under the GNU GENERAL PUBLIC LICENSE Version 3.0. -# See accompanying file LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt -# -# This cmake find module looks for the LLVM Undefined Behavior Sanitizer Runtime Library -# It sets up : UBSAN_RT_LIBRARY - -# This module finds the LLVM Undefined Behavior Sanitizer Runtime Library -# latter case skip to the "Boost CMake" section below. For the former -# -# Use this module by invoking find_package with the form:: -# -# find_package(libubsan_rt [REQUIRED]) -# -# Results are reported in:: -# -# UBSAN_RT_LIBRARY Undefined Behavior Sanitizer Runtime Library -# [UBSAN_MINIMAL_RT_LIBRARY] Minimal version of UBSan Runtime, To be used in combination with Asan - -set(TRIAL_PATHS - ENV LIBRARY_PATH - ENV LD_LIBRARY_PATH - /usr/lib - /usr/local/lib - /usr/lib/gcc/7/* - /usr/lib/gcc/*/* - /usr/lib/clang/*/lib/linux - /usr/lib/llvm-*/lib/clang/*/lib/linux - /usr/local/opt/llvm/lib/clang/*/lib/darwin -) - -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(name clang_rt.ubsan_osx_dynamic) - else() - set(name clang_rt.ubsan_standalone-x86_64) - endif() -elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - set(name ubsan) -else() - message(FATAL_ERROR "Undefined Behavior Sanitizer is not available for your compiler") -endif() - -find_library(UBSAN_RT_LIBRARY - NAMES ${name} - PATHS ${TRIAL_PATHS} -) - -mark_as_advanced(UBSAN_RT_LIBRARY) - -# Try to find UBSan Minimal Runtime for Clang -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(name libclang_rt.ubsan_minimal_osx_dynamic) - else() - set(name clang_rt.ubsan_minimal-x86_64) - endif() - - find_library(UBSAN_MINIMAL_RT_LIBRARY - NAMES ${name} - PATHS ${TRIAL_PATHS} - ) - mark_as_advanced(UBSAN_MINIMAL_RT_LIBRARY) -endif() - -# Imported target -add_library(libubsan_rt SHARED IMPORTED) -set_property(TARGET libubsan_rt PROPERTY IMPORTED_LOCATION ${UBSAN_RT_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args("Undefined Behavior Sanitizer Runtime Library" - REQUIRED_VARS UBSAN_RT_LIBRARY - FAIL_MESSAGE "Undefined Behavior Sanitizer Runtime Libraries not found! Consider installing for additional checks!" -) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4e0ce259..51d3086f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(c++) -if (${TRIQS_WITH_PYTHON_SUPPORT}) - add_subdirectory(python) + +if(${TRIQS_WITH_PYTHON_SUPPORT}) + add_subdirectory(python) endif() diff --git a/test/c++/CMakeLists.txt b/test/c++/CMakeLists.txt index 012d07d1..533922e1 100644 --- a/test/c++/CMakeLists.txt +++ b/test/c++/CMakeLists.txt @@ -1,34 +1,32 @@ -# Copy reference h5 files to binary dir -file(GLOB all_h5_files *.h5) -file(COPY ${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +# Copy h5 files to binary dir +file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5) +foreach(file ${all_h5_ref_files}) + configure_file(${file} ${file} COPYONLY) +endforeach() +# List of all tests set(all_tests toto) -foreach(t ${all_tests}) - add_executable(${t} ${CMAKE_CURRENT_SOURCE_DIR}/${t}.cpp) - target_link_libraries(${t} app4triqs_c gtest) - add_test(${t} ${CMAKE_CURRENT_BINARY_DIR}/${t}) +foreach(test ${all_tests}) + get_filename_component(test_name ${test} NAME_WE) + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} app4triqs_c gtest) + add_test(${test_name} ${test_name}) # Run clang-tidy if found if(CLANG_TIDY_EXECUTABLE) - set_target_properties(${t} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}") + set_target_properties(${test_name} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}") endif() # Run cppcheck if found if(CPPCHECK_EXECUTABLE) add_custom_command( - TARGET ${t} + TARGET ${test_name} COMMAND ${CPPCHECK_EXECUTABLE} --enable=warning,style,performance,portability --std=c++14 --template=gcc --verbose --quiet - ${CMAKE_CURRENT_SOURCE_DIR}/${t}.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/${test}.cpp ) endif() endforeach() - -# Set UBSan Options for all tests -set_property(TEST ${all_tests} PROPERTY - ENVIRONMENT - UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1:$ENV{UBSAN_OPTIONS} -) diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt index 0a4ccfb5..813f28c5 100644 --- a/test/python/CMakeLists.txt +++ b/test/python/CMakeLists.txt @@ -1,43 +1,15 @@ # Copy h5 files to binary dir -file(GLOB all_h5_files *.h5) -file(COPY ${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - -set(all_tests Toto chain) - -# Nasty Workaround for Mac Os Homebrew Python to find the proper Sanitizer Compatible Python Executable -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND (ASAN OR UBSAN)) - execute_process(COMMAND bash "-c" "readlink -f $(which python) | xargs dirname" OUTPUT_VARIABLE PYTHON_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE) - set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}/../Resources/Python.app/Contents/MacOS/Python") - if(NOT EXISTS ${PYTHON_EXECUTABLE}) - message(FATAL_ERROR "Could not find the proper Python executable for MacOs") - endif() -else() - set(PYTHON_EXECUTABLE python) -endif() - -message(STATUS "Python Executable: ${PYTHON_EXECUTABLE}") - -foreach(t ${all_tests}) - add_test(NAME ${t} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${t}.py) +file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5) +foreach(file ${all_h5_ref_files}) + configure_file(${file} ${file} COPYONLY) endforeach() -# Set the PythonPath -set_property(TEST ${all_tests} PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH}) +# List of all tests +set(all_tests Toto chain) -# === Preload Sanitizer Libraries === - -# If ASAN=ON use minimal runtime of UBSAN if it exists -if(ASAN AND UBSAN_MINIMAL_RT_LIBRARY) - set(UBSAN_RT_LIBRARY ${UBSAN_MINIMAL_RT_LIBRARY}) -endif() - -# Set the Sanitizer Library Preloads and UBSan Options for all tests -if(ASAN OR UBSAN) - set_property(TEST ${all_tests} PROPERTY - ENVIRONMENT - PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} - LD_PRELOAD=$<$:${ASAN_RT_LIBRARY}>:$<$:${UBSAN_RT_LIBRARY}> - DYLD_INSERT_LIBRARIES=$<$:${ASAN_RT_LIBRARY}>:$<$:${UBSAN_RT_LIBRARY}> - UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1:$ENV{UBSAN_OPTIONS} - ) -endif() +foreach(test ${all_tests}) + get_filename_component(test_name ${test} NAME_WE) + get_filename_component(test_dir ${test} DIRECTORY) + add_test(NAME ${test_name} COMMAND ${TRIQS_PYTHON_INTERPRETER} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY test/python/${test_dir}) + set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD}) +endforeach()