mirror of https://github.com/Icinga/icinga2.git
Fix build problems with Visual Studio 2017
This commit is contained in:
parent
c7a37090d0
commit
ff0b6ba630
|
@ -96,7 +96,8 @@ endif()
|
|||
if(WIN32)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
add_definitions(/bigobj)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED LOGROTATE_HAS_SU)
|
||||
|
|
|
@ -24,6 +24,6 @@ if(WIN32)
|
|||
add_custom_target(choco-pkg ALL
|
||||
COMMAND choco pack
|
||||
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/icinga2.${SPEC_VERSION}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
|
||||
DEPENDS icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -25,7 +25,8 @@ using namespace icinga;
|
|||
|
||||
static ConsoleType l_ConsoleType = Console_Dumb;
|
||||
|
||||
INITIALIZE_ONCE([]() {
|
||||
static void InitializeConsole(void)
|
||||
{
|
||||
l_ConsoleType = Console_Dumb;
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -34,7 +35,9 @@ INITIALIZE_ONCE([]() {
|
|||
#else /* _WIN32 */
|
||||
l_ConsoleType = Console_Windows;
|
||||
#endif /* _WIN32 */
|
||||
})
|
||||
}
|
||||
|
||||
INITIALIZE_ONCE(InitializeConsole);
|
||||
|
||||
ConsoleColorTag::ConsoleColorTag(int color, ConsoleType consoleType)
|
||||
: m_Color(color), m_ConsoleType(consoleType)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "base/i2-base.hpp"
|
||||
#include "base/value.hpp"
|
||||
#include <vector>
|
||||
#include <boost/function_types/function_arity.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
@ -80,9 +81,9 @@ private:
|
|||
public:
|
||||
template <typename FuncType>
|
||||
auto operator () (FuncType f, const std::vector<Value>& args)
|
||||
-> decltype(call(f, args, BuildIndices<boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity>{}))
|
||||
-> decltype(call(f, args, BuildIndices<boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value>{}))
|
||||
{
|
||||
return call(f, args, BuildIndices<boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity>{});
|
||||
return call(f, args, BuildIndices<boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value>{});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -96,7 +97,7 @@ std::function<Value (const std::vector<Value>&)> WrapFunction(FuncType function,
|
|||
EnableIf<std::is_same<decltype(unpack_caller()(FuncType(), std::vector<Value>())), void>::value>* = 0)
|
||||
{
|
||||
return [function](const std::vector<Value>& arguments) {
|
||||
constexpr int arity = boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity;
|
||||
constexpr int arity = boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value;
|
||||
|
||||
if (arguments.size() < arity)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -113,7 +114,7 @@ std::function<Value (const std::vector<Value>&)> WrapFunction(FuncType function,
|
|||
EnableIf<!std::is_same<decltype(unpack_caller()(FuncType(), std::vector<Value>())), void>::value>* = 0)
|
||||
{
|
||||
return [function](const std::vector<Value>& arguments) {
|
||||
constexpr int arity = boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity;
|
||||
constexpr int arity = boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value;
|
||||
|
||||
if (arity > 0) {
|
||||
if (arguments.size() < arity)
|
||||
|
|
|
@ -141,8 +141,12 @@ set(icinga_checkable_test_SOURCES
|
|||
icinga-checkable-flapping.cpp
|
||||
)
|
||||
|
||||
if(ICINGA2_UNITY_BUILD)
|
||||
mkunity_target(icinga_checkable test icinga_checkable_test_SOURCES)
|
||||
endif()
|
||||
|
||||
add_boost_test(icinga_checkable
|
||||
SOURCES icinga-checkable-test.cpp ${icinga_checkable_test_SOURCES}
|
||||
SOURCES test-runner.cpp icinga-checkable-test.cpp ${icinga_checkable_test_SOURCES}
|
||||
LIBRARIES base config icinga cli
|
||||
TESTS icinga_checkable_flapping/host_not_flapping
|
||||
icinga_checkable_flapping/host_flapping
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <bitset>
|
||||
#include "icinga/host.hpp"
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
#include <BoostTestTargetConfig.h>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -48,7 +48,7 @@ static void LogFlapping(const Checkable::Ptr& obj)
|
|||
int oldestIndex = (obj->GetFlappingBuffer() & 0xFF00000) >> 20;
|
||||
|
||||
std::cout << "Flapping: " << obj->IsFlapping() << "\nHT: " << obj->GetFlappingThresholdHigh() << " LT: " << obj->GetFlappingThresholdLow()
|
||||
<< "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex << " Buf: " << stateChangeBuf << '\n';
|
||||
<< "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex << " Buf: " << stateChangeBuf.to_ulong() << '\n';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
#define BOOST_TEST_MODULE icinga2_test
|
||||
|
||||
#include "cli/daemonutility.hpp"
|
||||
#include "base/application.hpp"
|
||||
#include "base/loader.hpp"
|
||||
|
@ -35,24 +32,6 @@ struct IcingaCheckableFixture
|
|||
BOOST_TEST_MESSAGE("setup running Icinga 2 core");
|
||||
|
||||
Application::InitializeBase();
|
||||
|
||||
/* start the Icinga application and load the configuration */
|
||||
Application::DeclareSysconfDir("etc");
|
||||
Application::DeclareLocalStateDir("var");
|
||||
|
||||
ActivationScope ascope;
|
||||
|
||||
Loader::LoadExtensionLibrary("icinga");
|
||||
Loader::LoadExtensionLibrary("methods"); //loaded by ITL
|
||||
|
||||
std::vector<std::string> configs;
|
||||
std::vector<ConfigItem::Ptr> newItems;
|
||||
|
||||
DaemonUtility::LoadConfigFiles(configs, newItems, "icinga2.debug", "icinga2.vars");
|
||||
|
||||
/* ignore config errors */
|
||||
WorkQueue upq;
|
||||
ConfigItem::ActivateItems(upq, newItems);
|
||||
}
|
||||
|
||||
~IcingaCheckableFixture(void)
|
||||
|
|
Loading…
Reference in New Issue