Fixed Windows build
This commit is contained in:
parent
fd842111dc
commit
4baab9b207
|
@ -16,6 +16,11 @@ if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
|||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
# Use static run-time
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
add_compile_options(/MT$<$<CONFIG:Debug>:d>)
|
||||
endif()
|
||||
|
||||
# Set output directories
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
|
@ -46,13 +51,13 @@ add_library(cppFormat ${cppFormatFiles})
|
|||
target_compile_options(cppFormat PRIVATE ${disableWarningsFlags})
|
||||
|
||||
# ... sphinxbase
|
||||
include_directories(SYSTEM "lib/sphinxbase-5prealpha-2015-08-05/include")
|
||||
include_directories(SYSTEM "lib/sphinxbase-redefine/include" "lib/sphinxbase-5prealpha-2015-08-05/include")
|
||||
FILE(GLOB_RECURSE sphinxbaseFiles "lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/*.c")
|
||||
add_library(sphinxbase ${sphinxbaseFiles})
|
||||
target_compile_options(sphinxbase PRIVATE ${disableWarningsFlags})
|
||||
|
||||
# ... PocketSphinx
|
||||
include_directories(SYSTEM "lib/pocketsphinx-5prealpha-2015-08-05/include")
|
||||
include_directories(SYSTEM "lib/pocketsphinx-redefine/include" "lib/pocketsphinx-5prealpha-2015-08-05/include")
|
||||
FILE(GLOB pocketSphinxFiles "lib/pocketsphinx-5prealpha-2015-08-05/src/libpocketsphinx/*.c")
|
||||
add_library(pocketSphinx ${pocketSphinxFiles})
|
||||
target_link_libraries(pocketSphinx sphinxbase)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __POCKETSPHINX_EXPORT_H__
|
||||
#define __POCKETSPHINX_EXPORT_H__
|
||||
|
||||
// We're creating a static library. No __declspec!
|
||||
#define POCKETSPHINX_EXPORT
|
||||
|
||||
#endif /* __POCKETSPHINX_EXPORT_H__ */
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __SPHINXBASE_EXPORT_H__
|
||||
#define __SPHINXBASE_EXPORT_H__
|
||||
|
||||
// We're creating a static library. No __declspec!
|
||||
#define SPHINXBASE_EXPORT
|
||||
|
||||
#endif /* __SPHINXBASE_EXPORT_H__ */
|
|
@ -1,14 +1,17 @@
|
|||
#include <pocketsphinx.h>
|
||||
#include <iostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <sphinxbase/err.h>
|
||||
#include "phone_extraction.h"
|
||||
#include "audio_input/SampleRateConverter.h"
|
||||
#include "audio_input/ChannelDownmixer.h"
|
||||
#include "platform_tools.h"
|
||||
#include "tools.h"
|
||||
|
||||
extern "C" {
|
||||
#include <pocketsphinx.h>
|
||||
#include <sphinxbase/err.h>
|
||||
}
|
||||
|
||||
using std::runtime_error;
|
||||
using std::unique_ptr;
|
||||
using std::shared_ptr;
|
||||
|
@ -174,7 +177,8 @@ map<centiseconds, Phone> detectPhones(unique_ptr<AudioStream> audioStream) {
|
|||
|
||||
// Collect results into map
|
||||
return getPhones(*recognizer.get());
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
std::throw_with_nested(runtime_error("Error detecting phones via Pocketsphinx. " + errorMessage));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue