Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use c++11 instead of boost #25

Merged
merged 2 commits into from
Dec 18, 2015
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
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ compiler:
env:
- BUILD_TYPE=Debug
- BUILD_TYPE=RelWithDebInfo
install:
- sudo apt-get update -qq
- sudo apt-get install -qq -y libboost-system-dev libboost-thread-dev
script:
- mkdir build
- cd build
Expand Down
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ if (HAS_VISIBILITY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()

find_package(Boost COMPONENTS system thread REQUIRED)
if(NOT WIN32)
# Use c++11 compiler flag, since it's needed for console.cpp
# It isn't in a header file, so it doesn't need to be exported
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
endif()

if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
endif (MSVC OR MSVC90 OR MSVC10)

if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
endif(MSVC)

include_directories(include)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})

if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Build dynamically-linked binaries" ON)
endif()

add_library(${PROJECT_NAME} src/console.cpp)
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION
${CONSOLE_BRIDGE_MAJOR_VERSION}.${CONSOLE_BRIDGE_MINOR_VERSION})

install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
Expand Down
10 changes: 6 additions & 4 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
/* Author: Ryan Luna, Ioan Sucan */

#include "console_bridge/console.h"
#include <boost/thread/mutex.hpp>
#include <iostream>

#include <cstdio>
#include <cstdarg>

#include <iostream>
#include <mutex>

/// @cond IGNORE

struct DefaultOutputHandler
Expand All @@ -55,7 +57,7 @@ struct DefaultOutputHandler
console_bridge::OutputHandler *output_handler_;
console_bridge::OutputHandler *previous_output_handler_;
console_bridge::LogLevel logLevel_;
boost::mutex lock_; // it is likely the outputhandler does some I/O, so we serialize it
std::mutex lock_; // it is likely the outputhandler does some I/O, so we serialize it
};

// we use this function because we want to handle static initialization correctly
Expand All @@ -70,7 +72,7 @@ static DefaultOutputHandler* getDOH(void)

#define USE_DOH \
DefaultOutputHandler *doh = getDOH(); \
boost::mutex::scoped_lock slock(doh->lock_)
std::lock_guard<std::mutex> lock_guard(doh->lock_)

#define MAX_BUFFER_SIZE 1024

Expand Down