Skip to content
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# IDE
.idea/

# Compiled Object files
*.slo
*.lo
Expand Down
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ MSource_ForceOutOfSourceBuild()
MSource_DetermineAddressModel(MSOURCE_ADDRESS_MODEL)
message(STATUS "Detected ${MSOURCE_ADDRESS_MODEL}-bit address model.")

set(MINGW "TRUE" CACHE BOOL "MinGW environment")
set(CMAKE_INSTALL_PREFIX "C:/dev/mct/build/rtm" CACHE FILEPATH "Installation prefix")
set(CMAKE_BUILD_TYPE "Release" CACHE FILEPATH "Build type")
set(MOCCPPLIB_INCLUDES "C:/dev/deps/moccpplib_0_2_0_release32/include/" CACHE FILEPATH "moccpplib includes")
set(MOCCPPLIB_LIBRARIES "C:/dev/deps/moccpplib_0_2_0_release32/lib" CACHE FILEPATH "moccpplib libraries")
set(CPPUNIT_INCLUDES "C:/dev/deps/cppunit_1_13_2_release32/" CACHE FILEPATH "cppunit includes")
set(CPPUNIT_LIBRARY "C:/dev/deps/cppunit_1_13_2_release32/cppunit.lib" CACHE FILEPATH "cppunit library")
set(MOCTEST_LIB "C:/dev/deps/moctest_0_2_0_release32/lib" CACHE FILEPATH "moctest library")
set(MOCTEST_INCLUDES "C:/dev/deps/moctest_0_2_0_release32/include" CACHE FILEPATH "moctest includes")
set(BOOST_PATH "C:/dev/deps/boost_1_58_0_release32/" CACHE FILEPATH "boost path")
set(BOOST_VERSION "1.58.0" CACHE BOOL "boost version")

# Output description of this script
message(
"\n\nThis script builds the mct application.\n"
Expand Down Expand Up @@ -120,10 +132,12 @@ add_definitions( ${Boost_LIB_DIAGNOSTIC_DEFINITIONS} )
add_definitions( -DBOOST_ALL_DYN_LINK )
add_definitions( -DBOOST_FILESYSTEM_NO_DEPRECATED )

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization);
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "/wd4251 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11")
Expand Down
4 changes: 3 additions & 1 deletion libs/Application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctapp)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_APPLICATION_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_APPLICATION_DLL=1 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_APPLICATION_DLL=1")
Expand Down
4 changes: 3 additions & 1 deletion libs/Configuration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctconfig)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_CONFIGURATION_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_CONFIGURATION_DLL=1 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_CONFIGURATION_DLL=1")
Expand Down
4 changes: 3 additions & 1 deletion libs/Logger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctlog)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_LOGGER_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_LOGGER_DLL=1 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_LOGGER_DLL=1")
Expand Down
4 changes: 3 additions & 1 deletion libs/Mode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctmode)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_MODE_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODE_DLL=1 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODE_DLL=1")
Expand Down
4 changes: 3 additions & 1 deletion libs/ModeFactory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctmodefactory)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_MODEFACTORY_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODEFACTORY_DLL=1 -D_WIN32_WINNT=0x0501")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODEFACTORY_DLL=1")
Expand Down
4 changes: 3 additions & 1 deletion libs/ModeProxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

set(LIBRARY_NAME mctmodeproxy)

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
# Boost.Asio needs to know windows version [0x0501 - WinXP minimum]
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-DMCT_MODEPROXY_DLL=1 /wd4251 /wd4275 /GS- -D_WIN32_WINNT=0x0501 -DBOOST_ASIO_HAS_MOVE")
elseif(WIN32 AND MINGW)
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODEPROXY_DLL=1 -D_WIN32_WINNT=0x0501 -DBOOST_ASIO_HAS_MOVE")
else()
# Activate C++11 mode for GNU/GCC
set(LIBRARY_COMPILE_FLAGS ${LIBRARY_COMPILE_FLAGS} "-std=c++11 -DMCT_MODEPROXY_DLL=1")
Expand Down
8 changes: 8 additions & 0 deletions libs/ModeProxy/IPResolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@

#include <ModeProxy/Config.hpp>

namespace boost
{
namespace asio
{
class io_service;
}
}

namespace mct
{

Expand Down
11 changes: 5 additions & 6 deletions libs/ModeProxy/ModeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <memory>
#include <sstream>
#include <cstdlib>
#include <cstddef>
#include <algorithm>

#include <Logger/Logger.hpp>
Expand Down Expand Up @@ -64,10 +63,10 @@ const std::string& ModeProxy::get_name() const
bool ModeProxy::validate_configuration() const
{
if (m_config.get_mode_proxy_local_hosts().size() != m_config.get_mode_proxy_remote_hosts().size() != m_config.get_mode_proxy_local_ports().size() != m_config.get_mode_proxy_remote_ports().size()) {
uint16_t lh = m_config.get_mode_proxy_local_hosts().size();
uint16_t rh = m_config.get_mode_proxy_remote_hosts().size();
uint16_t lp = m_config.get_mode_proxy_local_ports().size();
uint16_t rp = m_config.get_mode_proxy_remote_ports().size();
uint16_t lh = (uint16_t)m_config.get_mode_proxy_local_hosts().size();
uint16_t rh = (uint16_t)m_config.get_mode_proxy_remote_hosts().size();
uint16_t lp = (uint16_t)m_config.get_mode_proxy_local_ports().size();
uint16_t rp = (uint16_t)m_config.get_mode_proxy_remote_ports().size();
uint16_t max = (std::max)({lh, rh, lp, rp});

auto report_conf_problem = [&](const std::string& conf_field, uint16_t expected_val, uint16_t actual_val) {
Expand Down Expand Up @@ -104,7 +103,7 @@ bool ModeProxy::validate_configuration() const

uint16_t ModeProxy::get_num_of_all_proxies() const
{ // since all vectors are equal (checked with validate_configuration()), return the size of the first one
return m_config.get_mode_proxy_local_hosts().size();
return (uint16_t)m_config.get_mode_proxy_local_hosts().size();
}

bool ModeProxy::run()
Expand Down
4 changes: 2 additions & 2 deletions libs/ModeProxy/ModeProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class MCT_MODEPROXY_DLL_PUBLIC ModeProxy : public Mode
ModeProxy(const ModeProxy&) = delete;
ModeProxy& operator=(const ModeProxy&) = delete;

virtual const std::string& get_name() const;
virtual const std::string& get_name() const final;

virtual bool run();
virtual bool run() final;

protected:
uint16_t get_num_of_all_proxies() const;
Expand Down
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ add_definitions( -DBOOST_ALL_DYN_LINK )
add_definitions( -DBOOST_LOG_DYN_LINK )
add_definitions( -DBOOST_FILESYSTEM_NO_DEPRECATED )

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "/wd4251 /wd4275 /wd4351 /GS-")
elseif(WIN32 AND MINGW)
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11")
else()
# Activate C++11 mode for GNU/GCC; set rpath to $ORIGIN so the shared library can be easily found
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11")
Expand Down
4 changes: 3 additions & 1 deletion utils/PortBlocker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ add_definitions( -DBOOST_ALL_DYN_LINK )
add_definitions( -DBOOST_LOG_DYN_LINK )
add_definitions( -DBOOST_FILESYSTEM_NO_DEPRECATED )

if(WIN32)
if(WIN32 AND NOT MINGW)
# Disable dll-external warnings for Visual Studio; [/GS-] disable buffer overflow security checks (optimization)
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "/wd4251 /wd4275 /wd4351 /GS- -D_WIN32_WINNT=0x0501 -DBOOST_ASIO_HAS_MOVE")
elseif(WIN32 AND MINGW)
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11")
else()
# Activate C++11 mode for GNU/GCC; set rpath to $ORIGIN so the shared library can be easily found
set(PROGRAM_COMPILE_FLAGS ${PROGRAM_COMPILE_FLAGS} "-std=c++11")
Expand Down