Commit e2f030d2 authored by Dominik Charousset's avatar Dominik Charousset

Store CMake config in new header, close #270

parent 77a021f1
...@@ -16,3 +16,4 @@ manual/manual.html ...@@ -16,3 +16,4 @@ manual/manual.html
manual/variables.tex manual/variables.tex
*.swp *.swp
bii/* bii/*
libcaf_core/caf/detail/build_config.hpp
...@@ -228,22 +228,6 @@ endif() ...@@ -228,22 +228,6 @@ endif()
set(LD_FLAGS ${LD_FLAGS} ${CMAKE_LD_LIBS}) set(LD_FLAGS ${LD_FLAGS} ${CMAKE_LD_LIBS})
################################################################################
# add custom definitions requested via configure script #
################################################################################
if(CAF_LOG_LEVEL)
add_definitions(-DCAF_LOG_LEVEL=${CAF_LOG_LEVEL})
endif()
if(CAF_ENABLE_RUNTIME_CHECKS)
add_definitions(-DCAF_ENABLE_RUNTIME_CHECKS)
endif()
if(CAF_NO_MEM_MANAGEMENT)
add_definitions(-DCAF_NO_MEM_MANAGEMENT)
endif()
################################################################################ ################################################################################
# check for biicode build pipeline # # check for biicode build pipeline #
################################################################################ ################################################################################
...@@ -263,6 +247,32 @@ IF(BIICODE) ...@@ -263,6 +247,32 @@ IF(BIICODE)
RETURN() RETURN()
ENDIF() ENDIF()
################################################################################
# configure build_config.hpp header #
################################################################################
if(CAF_LOG_LEVEL)
set(CAF_LOG_LEVEL_INT ${CAF_LOG_LEVEL})
else()
set(CAF_LOG_LEVEL_INT -1)
endif()
macro(to_int_value name)
if(${name})
set(${name}_INT 1)
else()
set(${name}_INT -1)
endif()
endmacro()
to_int_value(CAF_LOG_LEVEL)
to_int_value(CAF_NO_MEM_MANAGEMENT)
to_int_value(CAF_ENABLE_RUNTIME_CHECKS)
to_int_value(CAF_USE_ASIO)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/build_config.hpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/libcaf_core/caf/detail/build_config.hpp"
IMMEDIATE @ONLY)
################################################################################ ################################################################################
# setup for install target # # setup for install target #
################################################################################ ################################################################################
...@@ -445,15 +455,10 @@ if(NOT CAF_NO_UNIT_TESTS) ...@@ -445,15 +455,10 @@ if(NOT CAF_NO_UNIT_TESTS)
# find boost asio if the asio multiplexer should be used for testing # find boost asio if the asio multiplexer should be used for testing
if(CAF_USE_ASIO) if(CAF_USE_ASIO)
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS system) find_package(Boost COMPONENTS system REQUIRED)
if (Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS})
add_definitions(-DCAF_USE_ASIO) set(LD_DIRS ${LD_DIRS} ${Boost_LIBRARIES})
include_directories(${Boost_INCLUDE_DIRS}) set(LD_FLAGS ${LD_FLAGS} ${Boost_SYSTEM_LIBRARY})
set(LD_DIRS ${LD_DIRS} ${Boost_LIBRARIES})
set(LD_FLAGS ${LD_FLAGS} ${Boost_SYSTEM_LIBRARY})
else()
set(CAF_USE_ASIO no)
endif()
endif() endif()
# setup unit test binary # setup unit test binary
add_executable(caf-test add_executable(caf-test
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_DETAIL_BUILD_CONFIG_HPP
#define CAF_DETAIL_BUILD_CONFIG_HPP
// this header is auto-generated by CMake
#if @CAF_LOG_LEVEL_INT@ != -1
#define CAF_LOG_LEVEL @CAF_LOG_LEVEL@
#endif
#if @CAF_NO_MEM_MANAGEMENT_INT@ != -1
#define CAF_NO_MEM_MANAGEMENT
#endif
#if @CAF_ENABLE_RUNTIME_CHECKS_INT@ != -1
#define CAF_ENABLE_RUNTIME_CHECKS
#endif
#if @CAF_USE_ASIO_INT@ != -1
#define CAF_USE_ASIO
#endif
#endif //CAF_DETAIL_BUILD_CONFIG_HPP
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#ifndef CAF_CONFIG_HPP #ifndef CAF_CONFIG_HPP
#define CAF_CONFIG_HPP #define CAF_CONFIG_HPP
#include "caf/detail/build_config.hpp"
// Config pararameters defined by the build system (usually CMake): // Config pararameters defined by the build system (usually CMake):
// //
// CAF_ENABLE_RUNTIME_CHECKS: // CAF_ENABLE_RUNTIME_CHECKS:
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
// default config is empty (will be overridden by CMake)
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