3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 04:13:47 +01:00

Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable

This commit is contained in:
Nils Wentzell 2021-02-03 11:03:08 -05:00
commit 6dccb363de
5 changed files with 39 additions and 10 deletions

View File

@ -26,6 +26,7 @@ jobs:
- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: >
sudo apt-get update &&
sudo apt-get install
clang-10
g++-10

View File

@ -19,8 +19,8 @@
#
# ##############################################################################
cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR)
cmake_policy(VERSION 3.3.2)
cmake_minimum_required(VERSION 3.9.6 FATAL_ERROR)
cmake_policy(VERSION 3.9.6)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
@ -58,13 +58,12 @@ if(NOT IS_SUBPROJECT)
endif()
set(${PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the ${PROJECT_NAME} Project")
# ############
# Options
# Make additional Find Modules available
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake/Modules)
# ############
# CMake Options
# Default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
@ -88,13 +87,32 @@ if(Build_Tests)
enable_testing()
endif()
# Build static libraries by default
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# ############
# Global Compilation Settings
# Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Global compiler options
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# Disable compiler extensions
set(CMAKE_CXX_EXTENSIONS OFF)
# Provide additional debugging information for Debug builds
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
# Enable Linktime optimizations when available
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported)
if(NOT ipo_supported)
message(STATUS "Linktime optimizations could not be enabled!")
else()
message(STATUS "Linktime optimizations enabled!")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
# Create an Interface target for compiler warnings
add_library(${PROJECT_NAME}_warnings INTERFACE)
target_compile_options(${PROJECT_NAME}_warnings
@ -110,10 +128,12 @@ target_compile_options(${PROJECT_NAME}_warnings
$<$<CXX_COMPILER_ID:Clang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:Clang>:-Wshadow>
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++20-extensions>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-c++20-extensions>
)
# #############

2
deps/CMakeLists.txt vendored
View File

@ -61,7 +61,7 @@ endif()
# -- GTest --
external_dependency(GTest
GIT_REPO https://github.com/google/googletest
GIT_TAG release-1.10.0
GIT_TAG master
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)

View File

@ -20,6 +20,7 @@ foreach(gen ${wrap_generators})
get_filename_component(module_name ${gen} NAME_WE)
get_filename_component(module_dir ${gen} DIRECTORY)
add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir})
add_library(${PROJECT_NAME}::${module_name} ALIAS ${module_name})
target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py)
install(TARGETS ${module_name} DESTINATION ${PYTHON_LIB_DEST}/${module_dir})
endforeach()

View File

@ -12,7 +12,7 @@
#
# You may obtain a copy of the License at
# https://www.gnu.org/licenses/gpl-3.0.txt
# Author: Nils Wentzell
# Recursively fetch all targets that the interface of a target depends upon
macro(get_all_interface_targets name target)
@ -59,6 +59,13 @@ macro(extract_flags)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} ${opt}")
endforeach()
get_property_recursive(cxx_features TARGET ${target} PROPERTY INTERFACE_COMPILE_FEATURES)
if(cxx_std_20 IN_LIST cxx_features)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -std=c++20")
elseif(cxx_std_17 IN_LIST cxx_features)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -std=c++17")
endif()
get_property_recursive(defs TARGET ${target} PROPERTY INTERFACE_COMPILE_DEFINITIONS)
foreach(def ${defs})
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -D${def}")