diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f4dd67d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +language: cpp + +sudo: required + +os: + - linux + - osx + +compiler: + - gcc + +env: + - BUILD_TYPE=Release + +before_script: + - if [ "`uname`" != "Darwin" ] ; then export MOOS_CXX_FLAGS="-fPIC -Wno-long-long"; fi + - cd .. + - git clone -b wOnlineCI --depth=1 https://github.com/msis/core-moos + - cd core-moos + - mkdir build + - cd build + - cmake -DENABLE_EXPORT=ON -DUSE_ASYNC_COMMS=ON -DTIME_WARP_AGGLOMERATION=0.4 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS=$MOOS_CXX_FLAGS .. + - cmake --build . --config Release + - sudo cmake --build . --config Release --target install + - cd $TRAVIS_BUILD_DIR + - mkdir build/ + + +script: + - cd build/ + - cmake -DBUILD_CONSOLE_TOOLS=ON -DBUILD_GRAPHICAL_TOOLS=ON -DBUILD_UPB=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS=$MOOS_CXX_FLAGS ../ + - cmake --build . --config Release + +after_script: + - sudo cmake --build . --config Release --target install \ No newline at end of file diff --git a/Essentials/CMakeLists.txt b/Essentials/CMakeLists.txt index c424462..889fb5c 100644 --- a/Essentials/CMakeLists.txt +++ b/Essentials/CMakeLists.txt @@ -1,4 +1,6 @@ -add_subdirectory(pMOOSBridge) +IF (NOT WIN32) + add_subdirectory(pMOOSBridge) +ENDIF (NOT WIN32) add_subdirectory(pAntler) add_subdirectory(pLogger) add_subdirectory(pScheduler) diff --git a/Essentials/pAntler/CMakeLists.txt b/Essentials/pAntler/CMakeLists.txt index 624d8cc..12c43cd 100644 --- a/Essentials/pAntler/CMakeLists.txt +++ b/Essentials/pAntler/CMakeLists.txt @@ -6,6 +6,10 @@ find_package(MOOS 10) #what files are needed? SET(SRCS AntlerMain.cpp Antler.cpp) +IF (WIN32) + SET(SRCS ${SRCS} XPCProcess.cpp XPCProcessAttrib.cpp) +ENDIF(WIN32) + include_directories( ${${EXECNAME}_INCLUDE_DIRS} ${MOOS_INCLUDE_DIRS} ${MOOS_DEPEND_INCLUDE_DIRS}) add_executable(${EXECNAME} ${SRCS} ) target_link_libraries(${EXECNAME} ${MOOS_LIBRARIES} ${MOOS_DEPEND_LIBRARIES}) diff --git a/Essentials/pLogger/MOOSLogger.cpp b/Essentials/pLogger/MOOSLogger.cpp index bf3f19c..f9eeb9d 100644 --- a/Essentials/pLogger/MOOSLogger.cpp +++ b/Essentials/pLogger/MOOSLogger.cpp @@ -1032,7 +1032,7 @@ bool CMOOSLogger::CreateDirectory(const std::string & sDirectory) { #if _WIN32 - int bOK = ::CreateDirectory(sDirectory.c_str(),NULL); + int bOK = ::CreateDirectoryA(sDirectory.c_str(),NULL); if(!bOK) { @@ -1042,7 +1042,7 @@ bool CMOOSLogger::CreateDirectory(const std::string & sDirectory) { LPVOID lpMsgBuf; - FormatMessage( + FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, diff --git a/Essentials/pLogger/MOOSLogger.h b/Essentials/pLogger/MOOSLogger.h index 4f07814..f58efd5 100644 --- a/Essentials/pLogger/MOOSLogger.h +++ b/Essentials/pLogger/MOOSLogger.h @@ -39,6 +39,11 @@ #include #include "Zipper.h" +#if _WIN32 + #include + #include +#endif // windows + typedef std::vector STRING_VECTOR; class CMOOSLogger : public CMOOSApp diff --git a/Essentials/pShare/Listener.cpp b/Essentials/pShare/Listener.cpp index a9c2e92..2e2e3ce 100644 --- a/Essentials/pShare/Listener.cpp +++ b/Essentials/pShare/Listener.cpp @@ -7,10 +7,17 @@ #ifndef _WIN32 #include "unistd.h" #endif +#ifdef UNIX + #include + #include + #include +#elif _WIN32 + #define _WIN32_WINNT 0x0600 //will only work with vista and above as XP does not support IPv6 + #include + #include + #include +#endif -#include -#include -#include #include #include #include @@ -52,7 +59,7 @@ bool Listener::ListenLoop() //we want to be able to resuse it (multiple folk are interested) int reuse = 1; - if (setsockopt(socket_fd, SOL_SOCKET,SO_REUSEADDR/* SO_REUSEPORT*/, &reuse, sizeof(reuse)) == -1) + if (setsockopt(socket_fd, SOL_SOCKET,SO_REUSEADDR/* SO_REUSEPORT*/, (char *)&reuse, sizeof(reuse)) == -1) throw std::runtime_error("Listener::ListenLoop::setsockopt::reuse"); /* if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEPORT, @@ -63,7 +70,7 @@ bool Listener::ListenLoop() //give ourselves plenty of receive space //set aside some space for receiving - just a few multiples of 64K int rx_buffer_size = 64*1024*28; - if (setsockopt(socket_fd, SOL_SOCKET, SO_RCVBUF, &rx_buffer_size, sizeof(rx_buffer_size)) == -1) + if (setsockopt(socket_fd, SOL_SOCKET, SO_RCVBUF, (char *)&rx_buffer_size, sizeof(rx_buffer_size)) == -1) throw std::runtime_error("Listener::ListenLoop()::setsockopt::rcvbuf"); @@ -91,7 +98,7 @@ bool Listener::ListenLoop() struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = inet_addr(address_.host().c_str()); mreq.imr_interface.s_addr = INADDR_ANY; - if(setsockopt(socket_fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq))==-1) + if(setsockopt(socket_fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof(mreq))==-1) throw std::runtime_error("Listener::ListenLoop()::setsockopt::ADD_MEMBERSHIP"); } diff --git a/Essentials/pShare/Share.cpp b/Essentials/pShare/Share.cpp index 98ba87a..728b709 100644 --- a/Essentials/pShare/Share.cpp +++ b/Essentials/pShare/Share.cpp @@ -4,9 +4,15 @@ * Created on: Aug 26, 2012 * Author: pnewman */ -#include -#include -#include +#ifdef UNIX + #include + #include + #include +#elif _WIN32 +// #define _WIN32_WINNT 0x0600 //will only work with vista and above as XP does not support IPv6 + #include + #include +#endif #include #include @@ -1091,7 +1097,7 @@ bool Share::Impl::ApplyRoutes(CMOOSMsg & msg) } //send here - if (sendto(relevant_socket.socket_fd, buffer.data(), buffer.size(), 0, + if (sendto(relevant_socket.socket_fd, (const char*)buffer.data(), buffer.size(), 0, (struct sockaddr*) (&relevant_socket.sock_addr), sizeof(relevant_socket.sock_addr)) < 0) { @@ -1138,7 +1144,7 @@ bool Share::Impl::AddOutputRoute(MOOS::IPV4Address address, bool multicast) int reuse = 1; if (setsockopt(new_socket.socket_fd, SOL_SOCKET, SO_REUSEADDR, - &reuse, sizeof(reuse)) == -1) + (char *)&reuse, sizeof(reuse)) == -1) throw std::runtime_error("failed to set resuse socket option"); /* if (setsockopt(new_socket.socket_fd, SOL_SOCKET, SO_REUSEPORT, @@ -1148,7 +1154,7 @@ bool Share::Impl::AddOutputRoute(MOOS::IPV4Address address, bool multicast) int send_buffer_size = 4 * 64 * 1024; if (setsockopt(new_socket.socket_fd, SOL_SOCKET, SO_SNDBUF, - &send_buffer_size, + (char *)&send_buffer_size, sizeof(send_buffer_size)) == -1) { throw std::runtime_error("failed to set size of socket send buffer"); @@ -1173,11 +1179,20 @@ bool Share::Impl::AddOutputRoute(MOOS::IPV4Address address, bool multicast) std::string dotted_ip = MOOS::IPV4Address::GetNumericAddress(new_socket.address.host()); - if(inet_aton(dotted_ip.c_str(), &new_socket.sock_addr.sin_addr)==0) - { - throw std::runtime_error("failed to intepret " - +dotted_ip+" as an ip address"); - } +#ifdef UNIX + if(inet_aton(dotted_ip.c_str(), &new_socket.sock_addr.sin_addr)==0) + { + throw std::runtime_error("failed to intepret " + +dotted_ip+" as an ip address"); + } +#elif _WIN32 + if( inet_pton(AF_INET,dotted_ip.c_str(), &new_socket.sock_addr.sin_addr)==0) + { + throw std::runtime_error("failed to intepret " + +dotted_ip+" as an ip address"); + } +#endif + //new_socket.sock_addr.sin_addr.s_addr = inet_addr(new_socket.address.ip_num.c_str()); new_socket.sock_addr.sin_port = htons(new_socket.address.port()); diff --git a/README.md b/README.md new file mode 100644 index 0000000..99e5bf2 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +Essential-MOOS +============== +Essential-MOOS contains some useful tools for robotics to use with [Core-MOOS](https://github.com/themoos/core-moos) for Robotics purposes. + +# Build Statuses +|OS |Build Status| +|:--------|-----------:| +|Linux/OSX|[![Build Status](https://travis-ci.org/msis/essential-moos.svg?branch=devel)](https://travis-ci.org/msis/essential-moos)| +|Windows |[![Build status](https://ci.appveyor.com/api/projects/status/d3cm6s8l6lko5q6e?svg=true)](https://ci.appveyor.com/project/msis/essential-moos)| + +# Build Instructions +(TODO, for now please refer to `.travis.yml` file for Linux/OSX and `appveyor.yml` for Windows.) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f33481a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,40 @@ +version: devel-{build} + +platform: + - x64 + - x86 + +environment: + matrix: + - BUILD_TYPE: cmake + VS_VERSION: Visual Studio 11 2012 + + - BUILD_TYPE: cmake + VS_VERSION: Visual Studio 12 2013 + + - BUILD_TYPE: cmake + VS_VERSION: Visual Studio 14 2015 + +shallow_clone: true + +init: + - if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64 + - if "%platform%" == "x86" SET VS_FULL=%VS_VERSION% + - cd .. + - git clone -b wOnlineCI --depth=1 https://github.com/msis/core-moos + - cd core-moos + - mkdir build + - cd build + - cmake -G "%VS_FULL%" -DENABLE_EXPORT=ON -DUSE_ASYNC_COMMS=ON -DTIME_WARP_AGGLOMERATION=0.4 -DCMAKE_BUILD_TYPE=$BUILD_TYPE ../ + - cmake --build . --config Release + - cmake --build . --config Release --target install + - cd %APPVEYOR_BUILD_FOLDER% + - mkdir build + +build_script: + - cd build + - cmake -G "%VS_FULL%" -DBUILD_CONSOLE_TOOLS=ON -DBUILD_GRAPHICAL_TOOLS=ON -DBUILD_UPB=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE ../ + - cmake --build . --config Release + +on_success: + - cmake --build . --config Release --target install