diff --git a/iceoryx_platform/cmake/IceoryxPackageHelper.cmake b/iceoryx_platform/cmake/IceoryxPackageHelper.cmake index c5bd38227e..0312433d5d 100644 --- a/iceoryx_platform/cmake/IceoryxPackageHelper.cmake +++ b/iceoryx_platform/cmake/IceoryxPackageHelper.cmake @@ -207,7 +207,7 @@ Macro(iox_add_executable) if ( QNX ) target_link_libraries(${IOX_TARGET} ${IOX_LIBS_QNX}) elseif ( LINUX ) - target_link_libraries(${IOX_TARGET} ${IOX_LIBS_LINUX} systemd) + target_link_libraries(${IOX_TARGET} ${IOX_LIBS_LINUX}) elseif ( APPLE ) target_link_libraries(${IOX_TARGET} ${IOX_LIBS_APPLE}) elseif ( WIN32 ) @@ -340,7 +340,12 @@ Macro(iox_add_library) target_include_directories(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_INCLUDES} PRIVATE ${IOX_PRIVATE_INCLUDES}) if ( LINUX ) - target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LIBS_LINUX} PRIVATE ${IOX_PRIVATE_LIBS_LINUX}) + if(USE_SYSTEMD) + target_compile_definitions(${IOX_TARGET} PRIVATE USE_SYSTEMD=1) + target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LIBS_LINUX} PRIVATE ${IOX_PRIVATE_LIBS_LINUX} systemd) + else() + target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LIBS_LINUX} PRIVATE ${IOX_PRIVATE_LIBS_LINUX}) + endif() elseif ( APPLE ) target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LIBS_APPLE} PRIVATE ${IOX_PRIVATE_LIBS_APPLE}) elseif ( QNX ) diff --git a/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp b/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp index 3c5c94ca90..d9f97e01e1 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp @@ -132,7 +132,9 @@ class RouDi private: std::thread m_monitoringAndDiscoveryThread; std::thread m_handleRuntimeMessageThread; +#ifdef USE_SYSTEMD std::thread listen_thread_watchdog; // 8 +#endif protected: ProcessIntrospectionType m_processIntrospection; diff --git a/iceoryx_posh/source/roudi/roudi.cpp b/iceoryx_posh/source/roudi/roudi.cpp index 08bb26f04f..2dc46c1958 100644 --- a/iceoryx_posh/source/roudi/roudi.cpp +++ b/iceoryx_posh/source/roudi/roudi.cpp @@ -161,6 +161,7 @@ void RouDi::shutdown() noexcept // Postpone the IpcChannelThread in order to receive TERMINATION m_runHandleRuntimeMessageThread = false; +#ifdef USE_SYSTEMD /* * This is necessary to prevent the main thread from exiting before * the 'listen_thread_watchdog' has finished, hence ensuring a @@ -169,6 +170,7 @@ void RouDi::shutdown() noexcept if (listen_thread_watchdog.joinable()) { listen_thread_watchdog.join(); } +#endif if (m_handleRuntimeMessageThread.joinable()) { @@ -263,6 +265,7 @@ void RouDi::processRuntimeMessages(runtime::IpcInterfaceCreator&& roudiIpcInterf IOX_LOG(INFO, "RouDi is ready for clients"); fflush(stdout); // explicitly flush 'stdout' for 'launch_testing' +#ifdef USE_SYSTEMD /* * We get information about how they are running. If as a unit, then we launch * watchdog and send a notification about the launch, otherwise we do nothing @@ -301,6 +304,7 @@ void RouDi::processRuntimeMessages(runtime::IpcInterfaceCreator&& roudiIpcInterf IOX_LOG(ERROR, "Can not set name for thread watchdog: " << std::string(buf.data())); } } +#endif while (m_runHandleRuntimeMessageThread) {