Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10.0)
cmake_minimum_required(VERSION 3.12)
project(icemon VERSION 3.3)

find_package(ECM REQUIRED NO_MODULE)
Expand Down Expand Up @@ -72,18 +72,25 @@ include_directories(
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

if (Icecream_FOUND)
set(CMAKE_REQUIRED_LIBRARIES Icecream)

check_include_file_cxx(icecc/logging.h ICECC_HAVE_LOGGING_H)

check_cxx_source_compiles("
#include <icecc/comm.h>

int main() { Msg msg(M_MON_GET_CS); (void)msg.type; }
" ICECC_TEST_USE_OLD_MSG_API)

# Check whether icecc was compiled against old CXXABI
# Work-around for: https://github.com/icecc/icemon/issues/24
# See: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
set(USE_OLDCXXABI_DEFINE -D_GLIBCXX_USE_CXX11_ABI=0)
set(CMAKE_REQUIRED_LIBRARIES Icecream)
set(CMAKE_REQUIRED_DEFINITIONS ${USE_OLDCXXABI_DEFINE})
check_cxx_source_compiles("
#include <icecc/comm.h>
#include <icecc/comm.h>

int main() { DiscoverSched sched(\"foo\"); }
int main() { DiscoverSched sched(\"foo\"); }
" ICECC_TEST_USE_OLDABI)

if (ICECC_TEST_USE_OLDABI)
Expand Down
3 changes: 2 additions & 1 deletion config-icemon.h.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define ICEMON_VERSION_STRING "@ICEMON_VERSION_STRING@"
#cmakedefine ICECC_HAVE_LOGGING_H 1

#cmakedefine01 ICECC_HAVE_LOGGING_H
#cmakedefine01 ICECC_TEST_USE_OLD_MSG_API
42 changes: 24 additions & 18 deletions src/icecreammonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <config-icemon.h>

#include <icecc/comm.h>
#ifdef ICECC_HAVE_LOGGING_H
#if ICECC_HAVE_LOGGING_H
#include <icecc/logging.h>
#endif

Expand All @@ -38,10 +38,17 @@
#include <qtimer.h>
#include <QRandomGenerator>

#include <memory>
#include <list>
#include <iostream>
#include <string>

#if ICECC_TEST_USE_OLD_MSG_API
#define ICECC_MSG_API_COMPAT(old, new) old
#else
#define ICECC_MSG_API_COMPAT(old, new) new
#endif

using namespace std;

IcecreamMonitor::IcecreamMonitor(HostInfoManager *manager, QObject *parent)
Expand Down Expand Up @@ -175,41 +182,40 @@ void IcecreamMonitor::msgReceived()

bool IcecreamMonitor::handle_activity()
{
Msg *m = m_scheduler->get_msg();
std::unique_ptr<Msg> m(m_scheduler->get_msg());
if (!m) {
checkScheduler(true);
setSchedulerState(Offline);
return false;
}

switch (m->type) {
case M_MON_GET_CS:
handle_getcs(m);
switch (ICECC_MSG_API_COMPAT(m->type, *m)) {
case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::GET_CS):
handle_getcs(m.get());
break;
case M_MON_JOB_BEGIN:
handle_job_begin(m);
case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::JOB_BEGIN):
handle_job_begin(m.get());
break;
case M_MON_JOB_DONE:
handle_job_done(m);
case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::JOB_DONE):
handle_job_done(m.get());
break;
case M_END:
case ICECC_MSG_API_COMPAT(M_END, Msg::END):
std::cout << "END" << endl;
checkScheduler(true);
break;
case M_MON_STATS:
handle_stats(m);
case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::STATS):
handle_stats(m.get());
break;
case M_MON_LOCAL_JOB_BEGIN:
handle_local_begin(m);
case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::JOB_LOCAL_BEGIN):
handle_local_begin(m.get());
break;
case M_JOB_LOCAL_DONE:
handle_local_done(m);
case ICECC_MSG_API_COMPAT(M_JOB_LOCAL_DONE, Msg::JOB_LOCAL_DONE):
handle_local_done(m.get());
break;
default:
cout << "UNKNOWN" << endl;
break;
}
delete m;
return true;
}

Expand Down Expand Up @@ -355,7 +361,7 @@ void IcecreamMonitor::handle_job_done(Msg *_m)

void IcecreamMonitor::setupDebug()
{
#ifdef ICECC_HAVE_LOGGING_H
#if ICECC_HAVE_LOGGING_H
char *env = getenv("ICECC_DEBUG");
int debug_level = Error;

Expand Down