Commit d7e32dc0 authored by Matthias Vallentin's avatar Matthias Vallentin

Fix configure and print build summary.

The configure script did not respect the global CMake cache variables.

To give the user a summary of relevant build parameter, the end of a configure
run now displays a small build summary. Here is an example:

    ====================|  Build Summary  |====================

    Libcppa version:  0.2.0

    Source directory: /Users/mavam/code/libcppa
    Build directory:  /Users/mavam/code/libcppa/build
    Executable path:  /Users/mavam/code/libcppa/build/bin
    Library path:     /Users/mavam/code/libcppa/build/lib
    Install prefix:   /usr/local
    Debug mode:       true

    CXX:              /opt/llvm/bin/clang++
    CXXFLAGS:         -std=c++11 -Wextra -Wall -pedantic -DCPPA_DEBUG -stdlib=libc++ -O0 -g

    Boost:            /opt/local/include

    ===========================================================
parent 5d200d40
......@@ -17,7 +17,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O4")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
if (ENABLE_DEBUG)
set(CMAKE_BUILD_TYPE Debug)
add_definitions("-DCPPA_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCPPA_DEBUG")
else ()
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif ()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
......@@ -203,3 +205,24 @@ add_dependencies(mailbox_performance libcppa)
add_dependencies(mixed_case libcppa)
add_dependencies(distributed libcppa)
add_dependencies(matching libcppa)
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
message(
"\n====================| Build Summary |===================="
"\n"
"\nLibcppa version: ${LIBRARY_VERSION}"
"\n"
"\nSource directory: ${CMAKE_SOURCE_DIR}"
"\nBuild directory: ${CMAKE_BINARY_DIR}"
"\nExecutable path: ${EXECUTABLE_OUTPUT_PATH}"
"\nLibrary path: ${LIBRARY_OUTPUT_PATH}"
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}"
"\nDebug mode: ${ENABLE_DEBUG}"
"\n"
"\nCXX: ${CMAKE_CXX_COMPILER}"
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${build_type}}"
"\n"
"\nBoost: ${Boost_INCLUDE_DIR}"
"\n"
"\n===========================================================\n"
)
......@@ -59,15 +59,10 @@ append_cache_entry ()
# $5 is the CMake generator.
configure ()
{
CMakeCacheEntries=""
echo "-------------------------------------------------"
CMakeCacheEntries=$CMakeDefaultCache
if [ -n "$1" ]; then
append_cache_entry CMAKE_CXX_COMPILER FILEPATH $1
echo "compiler: $1"
else
echo "compiler: system default"
fi
if [ -n "$2" ]; then
......@@ -76,26 +71,19 @@ configure ()
workdir=$builddir
fi
workdirs="$workdirs $workdir"
echo "build directory: $workdir"
if [ -n "$3" ]; then
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH $3
echo "executable output directory: $3"
else
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH "$workdir/bin"
echo "executable output directory: $workdir/bin"
fi
if [ -n "$4" ]; then
append_cache_entry LIBRARY_OUTPUT_PATH PATH $4
echo "library output directory: $4"
else
append_cache_entry LIBRARY_OUTPUT_PATH PATH "$workdir/lib"
echo "library output directory: $workdir/lib"
fi
echo "-------------------------------------------------"
if [ -d $workdir ]; then
# If a build directory exists, check if it has a CMake cache.
if [ -f $workdir/CMakeCache.txt ]; then
......@@ -176,6 +164,10 @@ while [ $# -ne 0 ]; do
shift
done
# At this point we save the global CMake variables so that configure() can
# later use them.
CMakeDefaultCache=$CMakeCacheEntries
if [ -n "$dualbuild" ]; then
# Use what we got in $PATH if --with-clang or --with-gcc is not specified.
if [ -z "$clang" ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment