Merge branch 'travis-ci'

This commit is contained in:
Daniel Wolf 2016-09-11 11:41:39 +02:00
commit 46d0c72601
6 changed files with 42 additions and 9 deletions

25
.travis.yml Normal file
View File

@ -0,0 +1,25 @@
language: cpp
sudo: required
dist: trusty
matrix:
include:
- os: linux
compiler: gcc
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -q update
install:
- sudo apt-get -y install g++-5
- sudo apt-get -y install libboost-all-dev
script:
- mkdir build
- cd build
- cmake -DCMAKE_CXX_COMPILER=g++-5 .. && make
- os: osx
osx_image: xcode7.3
script:
- mkdir build
- cd build
- cmake .. && make

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.2)
# Support legacy OS X versions
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Minimum OS X deployment version")
@ -23,7 +23,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
endif()
# Make sure Xcode uses libc++ instead of libstdc++, allowing us to use the C++14 standard library prior to OS X 10.9
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-stdlib=libc++)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
endif()
@ -62,7 +62,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(Boost_USE_STATIC_LIBS ON) # Use static libs
set(Boost_USE_MULTITHREADED ON) # Enable multithreading support
set(Boost_USE_STATIC_RUNTIME ON) # Use static C++ runtime
find_package(Boost 1.58 REQUIRED COMPONENTS filesystem locale system)
find_package(Boost 1.54 REQUIRED COMPONENTS filesystem locale system)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
# ... C++ Format

View File

@ -33,7 +33,7 @@ public:
throw std::invalid_argument(fmt::format("{} is not a valid {} value.", numericValue, typeName));
}
return result.value();
return *result;
}
virtual boost::optional<TEnum> tryParse(const std::string& s) {
@ -51,7 +51,7 @@ public:
throw std::invalid_argument(fmt::format("{} is not a valid {} value.", s, typeName));
}
return result.value();
return *result;
}
std::ostream& write(std::ostream& stream, TEnum value) {

View File

@ -68,7 +68,12 @@ void XMLExporter::exportShapes(const boost::filesystem::path& inputFilePath, con
mouthCueElement.put("<xmlattr>.end", formatDuration(timedShape.getEnd()));
}
write_xml(outputStream, tree, boost::property_tree::xml_writer_settings<string>(' ', 2));
#if BOOST_VERSION < 105600 // Support legacy syntax
using writer_setting = boost::property_tree::xml_writer_settings<char>;
#else
using writer_setting = boost::property_tree::xml_writer_settings<string>;
#endif
write_xml(outputStream, tree, writer_setting(' ', 2));
}
string escapeJSONString(const string& s) {

View File

@ -18,6 +18,7 @@
#include "ContinuousTimeline.h"
#include "audio/processing.h"
#include "parallel.h"
#include <boost/version.hpp>
extern "C" {
#include <pocketsphinx.h>
@ -322,6 +323,9 @@ Timeline<Phone> utteranceToPhones(
if (wordIds.empty()) return Timeline<Phone>();
// Align the words' phones with speech
#if BOOST_VERSION < 105600 // Support legacy syntax
#define value_or get_value_or
#endif
Timeline<Phone> segmentPhones = getPhoneAlignment(wordIds, *clipSegment, decoder, alignmentProgressSink)
.value_or(ContinuousTimeline<Phone>(clipSegment->getTruncatedRange(), Phone::Noise));
segmentPhones.shift(utterance.getStart());

View File

@ -1,6 +1,5 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/predef.h>
#include <format.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
@ -47,7 +46,7 @@ path getTempFilePath() {
std::tm getLocalTime(const time_t& time) {
tm timeInfo;
#if (BOOST_OS_UNIX || BOOST_OS_MACOS)
#if (__unix || __linux || __APPLE__)
localtime_r(&time, &timeInfo);
#else
localtime_s(&timeInfo, &time);
@ -57,7 +56,7 @@ std::tm getLocalTime(const time_t& time) {
std::string errorNumberToString(int errorNumber) {
char message[256];
#if (BOOST_OS_UNIX || BOOST_OS_MACOS)
#if (__unix || __linux || __APPLE__)
strerror_r(errorNumber, message, sizeof message);
#else
strerror_s(message, sizeof message, errorNumber);