Skip to content

Commit

Permalink
Adding configuration summary to cmake output and --hpx:info
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jul 15, 2017
1 parent cd00c78 commit 5f977a2
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 88 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Expand Up @@ -672,7 +672,7 @@ endif()
## External libraries/frameworks used by sme of the examples and benchmarks
hpx_option(HPX_WITH_EXAMPLES_OPENMP BOOL
"Enable examples requiring OpenMP support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_OPENMP)
find_package(OpenMP)
if(NOT OPENMP_FOUND)
Expand All @@ -681,7 +681,7 @@ if(HPX_WITH_EXAMPLES_OPENMP)
endif()
hpx_option(HPX_WITH_EXAMPLES_TBB BOOL
"Enable examples requiring TBB support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_TBB)
find_package(TBB)
if(NOT TBB_FOUND)
Expand All @@ -690,7 +690,7 @@ if(HPX_WITH_EXAMPLES_TBB)
endif()
hpx_option(HPX_WITH_EXAMPLES_QTHREADS BOOL
"Enable examples requiring QThreads support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_QTHREADS)
find_package(QThreads)
if(NOT QTHREADS_FOUND)
Expand All @@ -699,7 +699,7 @@ if(HPX_WITH_EXAMPLES_QTHREADS)
endif()
hpx_option(HPX_WITH_EXAMPLES_HDF5 BOOL
"Enable examples requiring HDF5 support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_HDF5)
find_package(HDF5 COMPONENTS CXX)
if(NOT HDF5_FOUND)
Expand All @@ -711,7 +711,7 @@ endif()
if(NOT "${HPX_PLATFORM_UC}" STREQUAL "BLUEGENEQ")
hpx_option(HPX_WITH_EXAMPLES_QT4 BOOL
"Enable examples requiring Qt4 support (default: OFF)." OFF
CATEGORY "Tools" ADVANCED)
CATEGORY "Build Targets" ADVANCED)
if(HPX_WITH_EXAMPLES_QT4)
find_package(Qt4)
if(NOT QT4_FOUND)
Expand Down Expand Up @@ -1900,6 +1900,10 @@ if(HPX_WITH_VIM_YCM)
hpx_info("VIM YouCompleteMe: run 'make configure_ycm' to copy config file to source directory and enable support in YCM. To enable automatic loading of configure file, add to your .vimrc option: \"let g:ycm_extra_conf_globlist = ['${CMAKE_SOURCE_DIR}/*']\"")
endif()

################################################################################
# print overall configuration summary
include(HPX_PrintSummary)

################################################################################
# External build system support (FindHPX.cmake and pkg-config).
################################################################################
Expand Down
3 changes: 1 addition & 2 deletions cmake/HPX_Option.cmake
Expand Up @@ -14,7 +14,6 @@ set(HPX_OPTION_CATEGORIES
"Parcelport"
"Profiling"
"Debugging"
"Tools"
)

function(hpx_option option type description default)
Expand All @@ -32,7 +31,7 @@ function(hpx_option option type description default)
set_property(CACHE "${option}" PROPERTY HELPSTRING "${description}")
set_property(CACHE "${option}" PROPERTY TYPE "${type}")
endif()

if(HPX_OPTION_STRINGS)
if("${type}" STREQUAL "STRING")
set_property(CACHE "${option}" PROPERTY STRINGS "${HPX_OPTION_STRINGS}")
Expand Down
55 changes: 55 additions & 0 deletions cmake/HPX_PrintSummary.cmake
@@ -0,0 +1,55 @@
# Copyright (c) 2017 Hartmut Kaiser
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

get_property(DEFINITIONS_VARS GLOBAL PROPERTY HPX_CONFIG_DEFINITIONS)
if(DEFINED DEFINITIONS_VARS)
list(SORT DEFINITIONS_VARS)
list(REMOVE_DUPLICATES DEFINITIONS_VARS)
endif()

set(hpx_config_information)

message("")
hpx_info("Configuration summary:")
get_cmake_property(_variableNames CACHE_VARIABLES)
foreach (_variableName ${_variableNames})
if(${_variableName}Category)

# handle only opetions which start with HPX_WITH_
string(FIND ${_variableName} "HPX_WITH_" __pos)
if(NOT ${__pos} EQUAL -1)
get_property(_value CACHE "${_variableName}" PROPERTY VALUE)
hpx_info(" ${_variableName}=${_value}")

string(REPLACE "_WITH_" "_HAVE_" __variableName ${_variableName})
list(FIND DEFINITIONS_VARS ${__variableName} __pos)
if(NOT ${__pos} EQUAL -1)
set(hpx_config_information
"${hpx_config_information}"
"\n \"${_variableName}=${_value}\",")
elseif(NOT ${_variableName}Category STREQUAL "Generic" AND NOT ${_variableName}Category STREQUAL "Build Targets")
get_property(_type CACHE "${_variableName}" PROPERTY TYPE)
if(_type STREQUAL "BOOL")
set(hpx_config_information
"${hpx_config_information}"
"\n \"${_variableName}=OFF\",")
endif()
endif()

endif()
endif()
endforeach()

if(hpx_config_information)
string(REPLACE ";" "" hpx_config_information ${hpx_config_information})
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/config_defines_strings.hpp.in"
"${CMAKE_BINARY_DIR}/hpx/config/config_strings.hpp"
@ONLY)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/templates/config_defines_strings.hpp.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hpx/config/config_strings.hpp"
@ONLY)
20 changes: 20 additions & 0 deletions cmake/templates/config_defines_strings.hpp.in
@@ -0,0 +1,20 @@
// Copyright (c) 2017 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// Do not edit this file! It has been generated by the cmake configuration step.

#if !defined(HPX_CONFIG_DEFINES_STRINGS_HPP)
#define HPX_CONFIG_DEFINES_STRINGS_HPP

namespace hpx
{
char const* const config_strings[] =
{@hpx_config_information@
nullptr
};
}

#endif

86 changes: 5 additions & 81 deletions src/version.cpp
Expand Up @@ -7,6 +7,7 @@
////////////////////////////////////////////////////////////////////////////////

#include <hpx/config.hpp>
#include <hpx/config/config_strings.hpp>

#if defined(HPX_HAVE_PARCELPORT_MPI)
// Intel MPI does not like to be included after stdio.h. As such, we include mpi.h
Expand Down Expand Up @@ -145,83 +146,10 @@ namespace hpx
{
std::ostringstream strm;

#if defined(HPX_HAVE_NATIVE_TLS)
strm << " HPX_HAVE_NATIVE_TLS=ON\n";
#else
strm << " HPX_HAVE_NATIVE_TLS=OFF\n";
#endif
#if defined(HPX_HAVE_STACKTRACES)
strm << " HPX_HAVE_STACKTRACES=ON\n";
#else
strm << " HPX_HAVE_STACKTRACES=OFF\n";
#endif
#if defined(HPX_HAVE_COMPRESSION_BZIP2)
strm << " HPX_HAVE_COMPRESSION_BZIP2=ON\n";
#else
strm << " HPX_HAVE_COMPRESSION_BZIP2=OFF\n";
#endif
#if defined(HPX_HAVE_COMPRESSION_SNAPPY)
strm << " HPX_HAVE_COMPRESSION_SNAPPY=ON\n";
#else
strm << " HPX_HAVE_COMPRESSION_SNAPPY=OFF\n";
#endif
#if defined(HPX_HAVE_COMPRESSION_ZLIB)
strm << " HPX_HAVE_COMPRESSION_ZLIB=ON\n";
#else
strm << " HPX_HAVE_COMPRESSION_ZLIB=OFF\n";
#endif
#if defined(HPX_HAVE_PARCEL_COALESCING)
strm << " HPX_HAVE_PARCEL_COALESCING=ON\n";
#else
strm << " HPX_HAVE_PARCEL_COALESCING=OFF\n";
#endif
#if defined(HPX_HAVE_PARCELPORT_TCP)
strm << " HPX_HAVE_PARCELPORT_TCP=ON\n";
#else
strm << " HPX_HAVE_PARCELPORT_TCP=OFF\n";
#endif
#if defined(HPX_HAVE_PARCELPORT_MPI)
strm << " HPX_HAVE_PARCELPORT_MPI=ON (" << mpi_version() << ")\n";
#else
strm << " HPX_HAVE_PARCELPORT_MPI=OFF\n";
#endif
#if defined(HPX_HAVE_PARCELPORT_VERBS)
strm << " HPX_HAVE_PARCELPORT_VERBS=ON\n";
#else
strm << " HPX_HAVE_PARCELPORT_VERBS=OFF\n";
#endif
#if defined(HPX_HAVE_VERIFY_LOCKS)
strm << " HPX_HAVE_VERIFY_LOCKS=ON\n";
#else
strm << " HPX_HAVE_VERIFY_LOCKS=OFF\n";
#endif
#if defined(HPX_HAVE_HWLOC)
strm << " HPX_HAVE_HWLOC=ON\n";
#else
strm << " HPX_HAVE_HWLOC=OFF\n";
#endif
#if HPX_HAVE_ITTNOTIFY != 0
strm << " HPX_HAVE_ITTNOTIFY=ON\n";
#else
strm << " HPX_HAVE_ITTNOTIFY=OFF\n";
#endif
#if defined(HPX_MSVC)
#if defined(HPX_HAVE_FIBER_BASED_COROUTINES)
strm << " HPX_HAVE_FIBER_BASED_COROUTINES=ON\n";
#else
strm << " HPX_HAVE_FIBER_BASED_COROUTINES=OFF\n";
#endif
#if defined(HPX_HAVE_SWAP_CONTEXT_EMULATION)
strm << " HPX_HAVE_SWAP_CONTEXT_EMULATION=ON\n";
#else
strm << " HPX_HAVE_SWAP_CONTEXT_EMULATION=OFF\n";
#endif
#endif
#if defined(HPX_HAVE_RUN_MAIN_EVERYWHERE)
strm << " HPX_HAVE_RUN_MAIN_EVERYWHERE=ON\n";
#else
strm << " HPX_HAVE_RUN_MAIN_EVERYWHERE=OFF\n";
#endif
char const* const* p = hpx::config_strings;
while (*p)
strm << " " << *p++ << "\n";
strm << "\n";

#if defined(HPX_PARCEL_MAX_CONNECTIONS)
strm << " HPX_PARCEL_MAX_CONNECTIONS="
Expand All @@ -235,10 +163,6 @@ namespace hpx
strm << " HPX_AGAS_LOCAL_CACHE_SIZE="
<< HPX_AGAS_LOCAL_CACHE_SIZE << "\n";
#endif
#if defined(HPX_HAVE_PARCELPORT_IPC) && defined(HPX_PARCEL_IPC_DATA_BUFFER_CACHE_SIZE)
strm << " HPX_PARCEL_IPC_DATA_BUFFER_CACHE_SIZE="
<< HPX_PARCEL_IPC_DATA_BUFFER_CACHE_SIZE << "\n";
#endif
#if defined(HPX_HAVE_MALLOC)
strm << " HPX_HAVE_MALLOC=" << HPX_HAVE_MALLOC << "\n";
#endif
Expand Down

0 comments on commit 5f977a2

Please sign in to comment.