master
parent
57b6dcbdc1
commit
87c323da9c
@ -1,6 +0,0 @@
|
||||
cd sample
|
||||
cd asr && make clean && rm core main *.log
|
||||
cd ..
|
||||
cd asrDemo2/run && make clean
|
||||
cd ../..
|
||||
cd asrDemo-srt && rm -rf run/*
|
@ -1,234 +0,0 @@
|
||||
//
|
||||
// bds_ASRDefines.hpp
|
||||
// SDKTester
|
||||
//
|
||||
// Created by baidu on 16/2/23.
|
||||
// Copyright © 2016年 baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef bds_ASRDefines_h
|
||||
#define bds_ASRDefines_h
|
||||
|
||||
#include <string>
|
||||
//#include "bds_int_types.h"
|
||||
#include <stdint.h>
|
||||
namespace bds {
|
||||
|
||||
#pragma mark - 设定采样率
|
||||
typedef enum TBDVoiceRecognitionRecordSampleRateFlags
|
||||
{
|
||||
EVoiceRecognitionRecordSampleRateAuto = 0,
|
||||
EVoiceRecognitionRecordSampleRate8K,
|
||||
EVoiceRecognitionRecordSampleRate16K,
|
||||
} TBDVoiceRecognitionRecordSampleRateFlags;
|
||||
|
||||
#pragma mark - 语音识别类型
|
||||
typedef enum TBDVoiceRecognitionProperty
|
||||
{
|
||||
EVoiceRecognitionPropertyMusic = 10001, // 音乐
|
||||
EVoiceRecognitionPropertyVideo = 10002, // 视频
|
||||
EVoiceRecognitionPropertyApp = 10003, // 应用
|
||||
EVoiceRecognitionPropertyWeb = 10004, // web
|
||||
EVoiceRecognitionPropertySearch = 10005, // 热词
|
||||
EVoiceRecognitionPropertyEShopping = 10006, // 电商&购物
|
||||
EVoiceRecognitionPropertyHealth = 10007, // 健康&母婴
|
||||
EVoiceRecognitionPropertyCall = 10008, // 打电话
|
||||
EVoiceRecognitionPropertySong = 10009, // 录歌识别
|
||||
EVoiceRecognitionPropertyShake = 10010, // 摇一摇拾台
|
||||
EVoiceRecognitionPropertyMedicalCare = 10052, // 医疗
|
||||
EVoiceRecognitionPropertyCar = 10053, // 汽车
|
||||
EVoiceRecognitionPropertyCatering = 10054, // 娱乐餐饮
|
||||
EVoiceRecognitionPropertyFinanceAndEconomics = 10055, // 财经
|
||||
EVoiceRecognitionPropertyGame = 10056, // 游戏
|
||||
EVoiceRecognitionPropertyCookbook = 10057, // 菜谱
|
||||
EVoiceRecognitionPropertyAssistant = 10058, // 助手
|
||||
EVoiceRecognitionPropertyRecharge = 10059, // 话费充值
|
||||
EVoiceRecognitionPropertyMap = 10060, // 地图
|
||||
EVoiceRecognitionPropertyInput = 20000, // 输入
|
||||
// 离线垂类
|
||||
EVoiceRecognitionPropertyContacts = 100014, // 联系人指令
|
||||
EVoiceRecognitionPropertySetting = 100016, // 手机设置
|
||||
EVoiceRecognitionPropertyTVInstruction = 100018, // 电视指令
|
||||
EVoiceRecognitionPropertyPlayerInstruction = 100019, // 播放器指令
|
||||
EVoiceRecognitionPropertyRadio = 100020, // 收音机
|
||||
} TBDVoiceRecognitionProperty;
|
||||
|
||||
#pragma mark - 设置识别语言
|
||||
typedef enum TBDVoiceRecognitionLanguage
|
||||
{
|
||||
EVoiceRecognitionLanguageChinese = 0,
|
||||
EVoiceRecognitionLanguageCantonese,
|
||||
EVoiceRecognitionLanguageEnglish,
|
||||
EVoiceRecognitionLanguageSichuanDialect,
|
||||
} TBDVoiceRecognitionLanguage;
|
||||
|
||||
#pragma mark - 语音识别请求资源类型
|
||||
typedef enum TBDVoiceRecognitionProtocol
|
||||
{
|
||||
EPROTOCOL_DEFAULT = 0,
|
||||
EPROTOCOL_SEARCH_NBEST = 1,
|
||||
EPROTOCOL_INPUT_NBEST_PROTOCOL = 2,
|
||||
EPROTOCOL_POST_PROTOCOL = 101,
|
||||
EPROTOCOL_WISE_PROTOCOL = 300,
|
||||
EPROTOCOL_WISE_TEXT_PROTOCOL = 301,
|
||||
EPROTOCOL_AUDIO_DA_PROTOCOL = 302,
|
||||
EPROTOCOL_NLU_PROTOCOL = 303,
|
||||
EPROTOCOL_NLU_TEXT_PROTOCOL = 304,
|
||||
EPROTOCOL_WISE_NLU_PROTOCOL = 305,
|
||||
EPROTOCOL_TALK_PROTOCOL = 306,
|
||||
EPROTOCOL_SEARCH_MUSIC_PROTOCOL = 1000,
|
||||
} TBDVoiceRecognitionProtocol;
|
||||
|
||||
#pragma mark - 调试日志级别
|
||||
typedef enum TBDVoiceRecognitionDebugLogLevel
|
||||
{
|
||||
EVRDebugLogLevelOff = 0,
|
||||
EVRDebugLogLevelFatal = 1,
|
||||
EVRDebugLogLevelError = 2,
|
||||
EVRDebugLogLevelWarning = 3,
|
||||
EVRDebugLogLevelInformation = 4,
|
||||
EVRDebugLogLevelDebug = 5,
|
||||
EVRDebugLogLevelTrace = 6
|
||||
} TBDVoiceRecognitionDebugLogLevel;
|
||||
|
||||
#pragma mark - 语音识别状态
|
||||
typedef enum TBDVoiceRecognitionClientWorkStatus
|
||||
{
|
||||
EVoiceRecognitionClientWorkStatusStartWorkIng, // 识别工作开始,开始采集及处理数据
|
||||
EVoiceRecognitionClientWorkStatusStart, // 检测到用户开始说话
|
||||
EVoiceRecognitionClientWorkStatusEnd, // 本地声音采集结束,等待识别结果返回并结束录音
|
||||
EVoiceRecognitionClientWorkStatusNewRecordData, // 录音数据回调
|
||||
EVoiceRecognitionClientWorkStatusFlushData, // 连续上屏
|
||||
EVoiceRecognitionClientWorkStatusFinish, // 语音识别功能完成,服务器返回正确结果
|
||||
EVoiceRecognitionClientWorkStatusMeterLevel, // 当前音量回调
|
||||
EVoiceRecognitionClientWorkStatusCancel, // 用户取消
|
||||
EVoiceRecognitionClientWorkStatusError, // 发生错误
|
||||
/* 离线引擎状态 */
|
||||
EVoiceRecognitionClientWorkStatusLoaded, // 离线引擎加载完成
|
||||
EVoiceRecognitionClientWorkStatusUnLoaded, // 离线引擎卸载完成
|
||||
/* CHUNK状态 */
|
||||
EVoiceRecognitionClientWorkStatusChunkThirdData, // CHUNK: 识别结果中的第三方数据
|
||||
EVoiceRecognitionClientWorkStatusChunkVPRes, // CHUNK: 声纹会议返回信息 vp_res
|
||||
EVoiceRecognitionClientWorkStatusChunkNlu, // CHUNK: 识别结果中的语义结果
|
||||
EVoiceRecognitionClientWorkStatusChunkEnd, // CHUNK: 识别过程结束
|
||||
/* LOG */
|
||||
EVoiceRecognitionClientWorkStatusFeedback, // Feedback: 识别过程反馈的打点数据
|
||||
/* Only for iOS */
|
||||
EVoiceRecognitionClientWorkStatusRecorderEnd, // 录音机关闭,页面跳转需检测此时间,规避状态条 (iOS)
|
||||
/* LONG SPEECH END */
|
||||
EVoiceRecognitionClientWorkStatusLongSpeechEnd // 长语音结束状态
|
||||
} TBDVoiceRecognitionClientWorkStatus;
|
||||
|
||||
#pragma mark - 语音识别策略
|
||||
typedef enum TBDVoiceRecognitionStrategy
|
||||
{
|
||||
EVR_STRATEGY_ONLINE = 0, // 在线识别
|
||||
EVR_STRATEGY_OFFLINE, // 离线识别
|
||||
EVR_STRATEGY_ONLINE_PRI, // 在线优先
|
||||
EVR_STRATEGY_OFFLINE_PRI, // 离线优先
|
||||
EVR_STRATEGY_BOTH, // 并行模式
|
||||
} TBDVoiceRecognitionStrategy;
|
||||
|
||||
#pragma mark - 语音识别离线引擎类型
|
||||
typedef enum TBDVoiceRecognitionOfflineEngineType
|
||||
{
|
||||
EVR_OFFLINE_ENGINE_INPUT = 0, // 离线引擎输入法模式
|
||||
EVR_OFFLINE_ENGINE_NAVI, // 离线引擎导航模式
|
||||
EVR_OFFLINE_ENGINE_GRAMMER, // 离线引擎语法模式
|
||||
} TBDVoiceRecognitionOfflineEngineType;
|
||||
|
||||
#pragma mark - 识别结果类型
|
||||
typedef enum TBDVoiceRecognitionResultType
|
||||
{
|
||||
EVR_RESULT_TYPE_ERROR = -1, // Error code
|
||||
EVR_RESULT_TYPE_EMPTY = 0, // Empty reply
|
||||
EVR_RESULT_TYPE_PARTIAL = 1, // Partial result
|
||||
EVR_RESULT_TYPE_NBEST = 2, // Nbest result
|
||||
EVR_RESULT_TYPE_CN = 3, // CN result
|
||||
EVR_RESULT_TYPE_RESOURCE = 4, // NLU & resource result
|
||||
EVR_RESULT_TYPE_THIRD = 5, // CHUNK: Third party data
|
||||
EVR_RESULT_TYPE_FINISH = 6, // CHUNK: Finish
|
||||
EVR_RESULT_TYPE_END = 7, // CHUNK: End
|
||||
EVR_RESULT_TYPE_VP_RES = 8, // vp_res
|
||||
} TBDVoiceRecognitionResultType;
|
||||
|
||||
#pragma mark - 网络类型
|
||||
typedef enum TBDVoiceRecognitionNetworkType
|
||||
{
|
||||
EVR_NETWORK_TYPE_NO = 0,
|
||||
EVR_NETWORK_TYPE_2G,
|
||||
EVR_NETWORK_TYPE_3G,
|
||||
EVR_NETWORK_TYPE_4G,
|
||||
EVR_NETWORK_TYPE_WIFI,
|
||||
} TBDVoiceRecognitionNetworkType;
|
||||
|
||||
#pragma mark - 语音压缩类型
|
||||
typedef enum TBDVoiceRecognitionAudioCompressionType
|
||||
{
|
||||
EVR_AUDIO_COMPRESSION_MIN = 0,
|
||||
EVR_AUDIO_COMPRESSION_PCM = 1,
|
||||
EVR_AUDIO_COMPRESSION_BV32 = 2,
|
||||
EVR_AUDIO_COMPRESSION_AMR = 3,
|
||||
EVR_AUDIO_COMPRESSION_MAX = 4,
|
||||
} TBDVoiceRecognitionAudioCompressionType;
|
||||
|
||||
#pragma mark - 语音识别错误通知状态分类
|
||||
typedef enum TVoiceRecognitionClientErrorDomain
|
||||
{
|
||||
EVRClientErrorDomainRecord = 10, // 录音设备出错
|
||||
EVRClientErrorDomainVAD = 20, // 语音数据处理过程出错
|
||||
EVRClientErrorDomainOnline = 30, // 在线识别引擎出错
|
||||
EVRClientErrorDomainLocalNetwork = 31, // 本地网络联接出错
|
||||
EVRClientErrorDomainHTTP = 32, // HTTP协议错误
|
||||
EVRClientErrorDomainServer = 33, // 服务器返回错误
|
||||
EVRClientErrorDomainOffline = 34, // 离线引擎返回错误
|
||||
EVRClientErrorDomainCommon = 40, // 其他错误
|
||||
} TVoiceRecognitionClientErrorDomain;
|
||||
|
||||
#pragma mark - 语音识别错误通知状态
|
||||
typedef enum TVoiceRecognitionClientErrorCode
|
||||
{
|
||||
EVRClientErrorCodeRecoderException = (EVRClientErrorDomainRecord << 16) | (0x0000FFFF & 1), // 录音设备异常
|
||||
EVRClientErrorCodeRecoderNoPermission = (EVRClientErrorDomainRecord << 16) | (0x0000FFFF & 2), // 无录音权限
|
||||
EVRClientErrorCodeRecoderUnAvailable = (EVRClientErrorDomainRecord << 16) | (0x0000FFFF & 3), // 录音设备不可用
|
||||
EVRClientErrorCodeInterruption = (EVRClientErrorDomainRecord << 16) | (0x0000FFFF & 4), // 录音中断
|
||||
|
||||
EVRClientErrorCodeVADException = (EVRClientErrorDomainVAD << 16) | (0x0000FFFF & 1), // 前端库异常
|
||||
EVRClientErrorCodeNoSpeech = (EVRClientErrorDomainVAD << 16) | (0x0000FFFF & 2), // 用户未说话
|
||||
EVRClientErrorCodeShort = (EVRClientErrorDomainVAD << 16) | (0x0000FFFF & 3), // 用户说话声音太短
|
||||
|
||||
EVRClientErrorCodeOnlineExceptioin = (EVRClientErrorDomainOnline << 16) | (0x0000FFFF & 1), // 在线识别引擎异常
|
||||
EVRClientErrorCodeOnlineNetworkUnavailable = (EVRClientErrorDomainOnline << 16) | (0x0000FFFF & 2), // 网络不可用
|
||||
EVRClientErrorCodeOnlineTokenFailed = (EVRClientErrorDomainOnline << 16) | (0x0000FFFF & 3), // 获取token失败
|
||||
EVRClientErrorCodeOnlineResolveUrlFailed = (EVRClientErrorDomainOnline << 16) | (0x0000FFFF & 4), // 解析url失败
|
||||
EVRClientErrorCodeLocalTimeout = (EVRClientErrorDomainLocalNetwork << 16) | (0x0000FFFF & 1), // 请求超时
|
||||
|
||||
EVRClientErrorCodeServerParamError = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3001), // 协议参数错误
|
||||
EVRClientErrorCodeServerRecognError = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3002), // 识别过程出错
|
||||
EVRClientErrorCodeServerNoFindResult = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3003), // 没有找到匹配结果
|
||||
EVRClientErrorCodeServerAppNameUnknownError = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3004), // AppnameUnkown错误
|
||||
EVRClientErrorCodeServerSpeechQualityProblem = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3005), // 声音不符合识别要求
|
||||
EVRClientErrorCodeServerSpeechTooLong = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3006), // 语音过长
|
||||
EVRClientErrorCodeServerSpeechParamsUnknow = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3008), // 上行参数未知,(可能是gzip解压失败)
|
||||
EVRClientErrorCodeServerSpeechNoUploadLink = (EVRClientErrorDomainServer << 16) | (0x0000FFFF & -3011), // 只有下行链接没有上行链接
|
||||
|
||||
EVRClientErrorCodeCommonBusy = (EVRClientErrorDomainCommon << 16) | (0x0000FFFF & 4095), // 识别器忙
|
||||
EVRClientErrorCodeCommonPropertyListInvalid = (EVRClientErrorDomainCommon << 16) | (0x0000FFFF & 2), // 垂类设置有误
|
||||
EVRClientErrorCodeCommonEnqueueError = (EVRClientErrorDomainCommon << 16) | (0x0000FFFF & 3) // 语音数据enqueue失败
|
||||
} TVoiceRecognitionClientErrorCode;
|
||||
|
||||
#pragma mark -- INTERNAL DEFINES
|
||||
|
||||
|
||||
#pragma mark - 语音识别模式
|
||||
typedef enum TBDVoiceRecognitionMode {
|
||||
EVR_MODE_MULTI_SENTENCE = 0,
|
||||
EVR_MODE_SINGLE_SENTENCE,
|
||||
EVR_MODE_MUSIC,
|
||||
EVR_MODE_SHAKE,
|
||||
} TBDVoiceRecognitionMode;
|
||||
|
||||
}
|
||||
|
||||
#endif /* bds_ASRDefines_h */
|
||||
|
@ -1,54 +0,0 @@
|
||||
//
|
||||
// bds_WakeupDefines.hpp
|
||||
// BDASRCore
|
||||
//
|
||||
// Created by baidu on 16/5/20.
|
||||
// Copyright © 2016年 baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef bds_WakeupDefines_hpp
|
||||
#define bds_WakeupDefines_hpp
|
||||
|
||||
namespace bds {
|
||||
|
||||
#pragma mark - 唤醒引擎状态
|
||||
typedef enum TWakeupEngineWorkStatus
|
||||
{
|
||||
EWakeupEngineWorkStatusStarted, // 引擎开始工作
|
||||
EWakeupEngineWorkStatusStopped, // 引擎关闭完成
|
||||
EWakeupEngineWorkStatusLoaded, // 唤醒引擎加载完成
|
||||
EWakeupEngineWorkStatusUnLoaded, // 唤醒引擎卸载完成
|
||||
EWakeupEngineWorkStatusTriggered, // 命中唤醒词
|
||||
EWakeupEngineWorkStatusError, // 引擎发生错误
|
||||
} TWakeupEngineWorkStatus;
|
||||
|
||||
#pragma mark - 唤醒引擎错误分类
|
||||
typedef enum TWakeupEngineErrorDomain
|
||||
{
|
||||
EWakeupEngineErrorDomainRecord = 10, // 录音设备出错
|
||||
EWakeupEngineErrorDomainEngine = 38, // 录音设备出错
|
||||
} TWakeupEngineErrorDomain;
|
||||
|
||||
#pragma mark - 唤醒引擎错误状态
|
||||
typedef enum TWakeupEngineErrorCode
|
||||
{
|
||||
EWakeupEngineRecoderException = (EWakeupEngineErrorDomainRecord << 16) | (0x0000FFFF & 1), // 录音设备异常
|
||||
EWakeupEngineRecoderNoPermission = (EWakeupEngineErrorDomainRecord << 16) | (0x0000FFFF & 2), // 无录音权限
|
||||
EWakeupEngineRecoderUnAvailable = (EWakeupEngineErrorDomainRecord << 16) | (0x0000FFFF & 3), // 录音设备不可用
|
||||
EWakeupEngineRecoderInterruption = (EWakeupEngineErrorDomainRecord << 16) | (0x0000FFFF & 4), // 录音中断
|
||||
|
||||
EWakeupEngineExceptioin = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 1), // 唤醒引擎异常
|
||||
EWakeupEngineNoLicense = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 2), // 无授权文件
|
||||
EWakeupEngineLicenseInvalid = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 3), // 授权文件异常
|
||||
EWakeupEngineWakeupWordsInvalid = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 4), // 唤醒次异常
|
||||
EWakeupEngineDatFileInvalid = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 5), // 模型文件异常
|
||||
EWakeupEngineInitializeFailed = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 6), // 引擎初始化失败
|
||||
EWakeupEngineAllocMemFailed = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 7), // 内存分配失败
|
||||
EWakeupEngineResetFailed = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 8), // 引擎重置失败
|
||||
EWakeupEngineFreeFailed = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 9), // 引擎释放失败
|
||||
EWakeupEngineArchiNotSupportted = (EWakeupEngineErrorDomainEngine << 16) | (0x0000FFFF & 10), // 引擎不支持该架构
|
||||
} TWakeupEngineErrorCode;
|
||||
|
||||
}
|
||||
|
||||
#endif /* bds_WakeupDefines_hpp */
|
@ -1,66 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* @file BDSSDKMessage.hpp
|
||||
* @author Vaino(lappivaeinoe@baidu.com)
|
||||
* @date 2016/10/26 17:51:32
|
||||
* @brief Message container to pass commands to SDK and receive events/callbacks from the SDK
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef _BDS_SDK_MESSAGE_HPP_
|
||||
#define _BDS_SDK_MESSAGE_HPP_
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace bds {
|
||||
|
||||
extern const std::string DATA_CHUNK;
|
||||
|
||||
class BDSSDKMessageImpl;
|
||||
class BDSSDKMessage{
|
||||
public:
|
||||
BDSSDKMessage(const std::string &p_name);
|
||||
BDSSDKMessage();
|
||||
BDSSDKMessage(const BDSSDKMessage &m);
|
||||
virtual BDSSDKMessage& operator=(const BDSSDKMessage &m);
|
||||
|
||||
std::string name;
|
||||
/*
|
||||
char* data;
|
||||
unsigned int length;
|
||||
*/
|
||||
virtual ~BDSSDKMessage();
|
||||
|
||||
/* Set parameters to message */
|
||||
void set_parameter(const std::string &key, const std::string &value);
|
||||
void set_parameter(const std::string &key, int value);
|
||||
void set_parameter(const std::string &key, float value);
|
||||
void set_parameter(const std::string &key, const char* value, int valueLen);
|
||||
void set_parameter(const std::string &key, const std::vector<std::string> &value);
|
||||
|
||||
/* Get keys for parameters set to message */
|
||||
std::vector<std::string> string_param_keys();
|
||||
std::vector<std::string> int_param_keys();
|
||||
std::vector<std::string> float_param_keys();
|
||||
std::vector<std::string> char_param_keys();
|
||||
std::vector<std::string> vector_param_keys();
|
||||
|
||||
/* Get parameters from message */
|
||||
bool get_parameter(const std::string &key, std::string &outValue);
|
||||
bool get_parameter(const std::string &key, int &outValue);
|
||||
bool get_parameter(const std::string &key, float &outValue);
|
||||
bool get_parameter(const std::string &key, const char* &outValue, int &outValueLen);
|
||||
bool get_parameter(const std::string &key, std::vector<std::string> &outValue);
|
||||
private:
|
||||
BDSSDKMessageImpl* _impl;
|
||||
friend class BDSSDKMessageImpl;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* @file BDSpeechSDK.hpp
|
||||
* @author Vaino(lappivaeinoe@baidu.com)
|
||||
* @date 2016/10/26 17:52:07
|
||||
* @brief Main interface for speech SDK for Linux.
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef _BDS_SPEECH_SDK_HPP_
|
||||
#define _BDS_SPEECH_SDK_HPP_
|
||||
|
||||
#include <string>
|
||||
#include "BDSSDKMessage.hpp"
|
||||
|
||||
namespace bds {
|
||||
class BDSpeechSDK{
|
||||
public:
|
||||
static BDSpeechSDK* get_instance(const std::string &SDKType, std::string &outErrorDescription);
|
||||
virtual void set_event_listener(void(*listener)(BDSSDKMessage&,void*), void* userParam) = 0;
|
||||
static void release_instance(BDSpeechSDK* instance);
|
||||
|
||||
virtual bool post(BDSSDKMessage &message, std::string &outErrorDescription) = 0;
|
||||
/*
|
||||
* Cleanup for closing the program.
|
||||
* This function will clean up some globals and makes sure that
|
||||
* everything has been stopped before returning.
|
||||
* Call is needed only when the whole program is about to shut down
|
||||
* Not calling this function before returning from main() function of the program may lead to a crash due to async nature of release_instance() functions.
|
||||
*/
|
||||
static void do_cleanup();
|
||||
|
||||
static void open_log_file(const char *logFileName, int fileSize = 0);
|
||||
static void close_log_file();
|
||||
static std::string get_sdk_version();
|
||||
|
||||
static int set_global_param(const std::string& param_type, void* value, std::string &outErrorDescription);
|
||||
protected:
|
||||
BDSpeechSDK();
|
||||
virtual ~BDSpeechSDK();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,54 +0,0 @@
|
||||
vec 26
|
||||
1.485246e+01
|
||||
1.579741e+01
|
||||
1.663629e+01
|
||||
1.698390e+01
|
||||
1.708107e+01
|
||||
1.745045e+01
|
||||
1.752832e+01
|
||||
1.758490e+01
|
||||
1.746364e+01
|
||||
1.743286e+01
|
||||
1.744198e+01
|
||||
1.735617e+01
|
||||
1.735499e+01
|
||||
1.730315e+01
|
||||
1.726894e+01
|
||||
1.729055e+01
|
||||
1.728198e+01
|
||||
1.718504e+01
|
||||
1.712417e+01
|
||||
1.710584e+01
|
||||
1.715915e+01
|
||||
1.723995e+01
|
||||
1.730050e+01
|
||||
1.728485e+01
|
||||
1.728487e+01
|
||||
1.729697e+01
|
||||
vec 26
|
||||
2.764144e-01
|
||||
2.703758e-01
|
||||
2.584008e-01
|
||||
2.514187e-01
|
||||
2.496835e-01
|
||||
2.436650e-01
|
||||
2.391809e-01
|
||||
2.393867e-01
|
||||
2.416821e-01
|
||||
2.443231e-01
|
||||
2.473226e-01
|
||||
2.507182e-01
|
||||
2.540205e-01
|
||||
2.566869e-01
|
||||
2.590701e-01
|
||||
2.611003e-01
|
||||
2.630226e-01
|
||||
2.658522e-01
|
||||
2.699072e-01
|
||||
2.724641e-01
|
||||
2.723619e-01
|
||||
2.699174e-01
|
||||
2.670183e-01
|
||||
2.660550e-01
|
||||
2.658852e-01
|
||||
2.637595e-01
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
66af2eef7a9e6cf37646e6a0c9c0abcbb2149789b4a8c5532796731a694e7254b2f9c4815e0dd162633078eec0e09d31d88485feb9c9980c7d47bd98b0cb413e749e35f7751fa6dc05efe64003bbf8e1c145e4c9b1a625e268cb9bca9b123f7c13992c4a751a85bf356019726c17197279b637d6868a5fe93a59b54cedf4d60d844782908589335de28e5fe6eeba404ee827431a2ee60edaf013c2ca14ba062a2e8e3ee99ec7664a48e646e216a1e7267971fdad4d14f14dda1912723e87408cb244ac92321f6abf04df4a6bf6c2a05a0aecd4d307ed10c461a109315a7bf0b8dd2870d59c4e8ea1b5395fa15da2a4f3f7081cc6bb8543b8f4e240838eb41290
|
Binary file not shown.
Binary file not shown.
@ -1,54 +0,0 @@
|
||||
vec 26
|
||||
1.485246e+01
|
||||
1.579741e+01
|
||||
1.663629e+01
|
||||
1.698390e+01
|
||||
1.708107e+01
|
||||
1.745045e+01
|
||||
1.752832e+01
|
||||
1.758490e+01
|
||||
1.746364e+01
|
||||
1.743286e+01
|
||||
1.744198e+01
|
||||
1.735617e+01
|
||||
1.735499e+01
|
||||
1.730315e+01
|
||||
1.726894e+01
|
||||
1.729055e+01
|
||||
1.728198e+01
|
||||
1.718504e+01
|
||||
1.712417e+01
|
||||
1.710584e+01
|
||||
1.715915e+01
|
||||
1.723995e+01
|
||||
1.730050e+01
|
||||
1.728485e+01
|
||||
1.728487e+01
|
||||
1.729697e+01
|
||||
vec 26
|
||||
2.764144e-01
|
||||
2.703758e-01
|
||||
2.584008e-01
|
||||
2.514187e-01
|
||||
2.496835e-01
|
||||
2.436650e-01
|
||||
2.391809e-01
|
||||
2.393867e-01
|
||||
2.416821e-01
|
||||
2.443231e-01
|
||||
2.473226e-01
|
||||
2.507182e-01
|
||||
2.540205e-01
|
||||
2.566869e-01
|
||||
2.590701e-01
|
||||
2.611003e-01
|
||||
2.630226e-01
|
||||
2.658522e-01
|
||||
2.699072e-01
|
||||
2.724641e-01
|
||||
2.723619e-01
|
||||
2.699174e-01
|
||||
2.670183e-01
|
||||
2.660550e-01
|
||||
2.658852e-01
|
||||
2.637595e-01
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
79bb1333ee01a55a5e1f51286d7c4bc4
|
@ -1,39 +0,0 @@
|
||||
## asr Makefile ##
|
||||
CC=g++
|
||||
#AR=ar
|
||||
|
||||
#FILE_NAME=$(src)
|
||||
FILE_NAME=src/main.cpp
|
||||
INC_PATH= -I../../include\
|
||||
-I../../include/ASR\
|
||||
|
||||
SRC_PATH=./src
|
||||
OBJ_PATH=.
|
||||
TARGET=$(basename $(FILE_NAME))
|
||||
LIB_PATH=../../lib
|
||||
EXTERN_PATH=../../extern/lib
|
||||
TARGET_PATH=./
|
||||
|
||||
CPPFLAGS1=-Wall -O0 -fPIC -g -D__LINUX__ -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
|
||||
CPPFLAGS= $(CPPFLAGS1) $(LIB_PATH)/libBDSpeechSDK.a $(EXTERN_PATH)/libcurl.a $(EXTERN_PATH)/libiconv.a $(EXTERN_PATH)/libz.a $(EXTERN_PATH)/libssl.a $(EXTERN_PATH)/libcrypto.a $(EXTERN_PATH)/libuuid.a -lrt -ldl -lpthread
|
||||
SRC_FILE=$(shell cd $(SRC_PATH)&&echo *.cpp)
|
||||
SRC:=$(foreach n,$(SRC_FILE),$(SRC_PATH)/$(n))
|
||||
|
||||
OBJ_FILE=$(SRC_FILE:.cpp=.o)
|
||||
OBJ:=$(foreach n,$(OBJ_FILE),$(OBJ_PATH)/$(n))
|
||||
|
||||
DEP_FILE=$(SRC_FILE:.cpp=.d)
|
||||
DEP:=$(foreach n,$(DEP_FILE),$(OBJ_PATH)/$(n))
|
||||
|
||||
$(TARGET):$(SRC)
|
||||
$(CC) -o $(TARGET) ./$(FILE_NAME) $(INC_PATH) $(CPPFLAGS)
|
||||
-mv $@ $(TARGET_PATH)
|
||||
clean:
|
||||
-rm -f $(OBJ)
|
||||
-rm -f $(TARGET)
|
||||
|
||||
cleanall:
|
||||
-rm -f $(OBJ)
|
||||
-rm -f $(TARGET)
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
make && echo && echo "build success, wait 3s to run" && sleep 3 && ./main
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
#~/bin/sh
|
||||
valgrind
|
@ -1 +0,0 @@
|
||||
asrDemo_srt
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
@ -1,29 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/asrDemo-srt.iml" filepath="$PROJECT_DIR$/.idea/asrDemo-srt.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,543 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
|
||||
<generated>
|
||||
<config projectName="asrDemo_srt" targetName="asrDemo_srt" />
|
||||
</generated>
|
||||
</component>
|
||||
<component name="CMakeSettings" AUTO_RELOAD="true">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="05b03179-2043-4d08-b60a-10a98acab567" name="Default" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-342">
|
||||
<caret line="23" selection-start-line="23" selection-end-line="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="srt_file_listener.cpp" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="456">
|
||||
<caret line="84" column="35" lean-forward="true" selection-start-line="84" selection-start-column="35" selection-end-line="84" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>eof</find>
|
||||
<find>sleep</find>
|
||||
<find>asr_resource</find>
|
||||
<find>SECRT</find>
|
||||
<find>_controller</find>
|
||||
<find>waiting_to</find>
|
||||
<find>std::endl</find>
|
||||
<find>RETURN_RECOG_FINISH_OK</find>
|
||||
<find>_Predicate</find>
|
||||
<find>_is_finished</find>
|
||||
<find>mutex</find>
|
||||
</findStrings>
|
||||
<dirStrings>
|
||||
<dir>$PROJECT_DIR$</dir>
|
||||
<dir>$PROJECT_DIR$/src</dir>
|
||||
</dirStrings>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/srt_file_listener.hpp" />
|
||||
<option value="$PROJECT_DIR$/build-env.sh" />
|
||||
<option value="$PROJECT_DIR$/src/common.h" />
|
||||
<option value="$PROJECT_DIR$/src/srt_file_listener.cpp" />
|
||||
<option value="$PROJECT_DIR$/scripts/valgrind.sh" />
|
||||
<option value="$PROJECT_DIR$/scripts/srt.supp" />
|
||||
<option value="$PROJECT_DIR$/src/common.cpp" />
|
||||
<option value="$PROJECT_DIR$/CMakeLists.txt" />
|
||||
<option value="$PROJECT_DIR$/src/recognizer.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/recognizer.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/main.cpp" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsGulpfileManager">
|
||||
<detection-done>true</detection-done>
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="OCFindUsagesOptions" text="true" ivars="false" properties="true" derivedClasses="false" />
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="98" />
|
||||
<option name="y" value="24" />
|
||||
<option name="width" value="1067" />
|
||||
<option name="height" value="796" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="asrDemo_srt" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo-srt" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo_srt" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo-srt" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="scripts" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo_srt" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo-srt" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../asrDel" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/scripts" />
|
||||
<recent name="$PROJECT_DIR$/data" />
|
||||
<recent name="$PROJECT_DIR$/lib-src" />
|
||||
<recent name="$PROJECT_DIR$" />
|
||||
<recent name="$PROJECT_DIR$/include" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/data/video" />
|
||||
<recent name="$PROJECT_DIR$/include/asr" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.asrDemo_srt">
|
||||
<configuration name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="asrDemo_srt" RUN_TARGET_NAME="asrDemo_srt" EXPLICIT_BUILD_TARGET_NAME="all" />
|
||||
<configuration name="asrDemo_srt" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="asrDemo_srt" TARGET_NAME="asrDemo_srt" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="asrDemo_srt" RUN_TARGET_NAME="asrDemo_srt" />
|
||||
<list>
|
||||
<item itemvalue="Application.Build All" />
|
||||
<item itemvalue="Application.asrDemo_srt" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="05b03179-2043-4d08-b60a-10a98acab567" name="Default" comment="" />
|
||||
<created>1521256837740</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1521256837740</updated>
|
||||
<workItem from="1521256839183" duration="21022000" />
|
||||
<workItem from="1521337067588" duration="2967000" />
|
||||
<workItem from="1521382560407" duration="16026000" />
|
||||
<workItem from="1522110433794" duration="9000" />
|
||||
<workItem from="1522237067969" duration="5433000" />
|
||||
<workItem from="1522397180377" duration="22000" />
|
||||
<workItem from="1523165787080" duration="742000" />
|
||||
<workItem from="1523166818846" duration="11876000" />
|
||||
<workItem from="1523251318540" duration="9913000" />
|
||||
<workItem from="1523269952071" duration="1579000" />
|
||||
<workItem from="1523325976016" duration="2157000" />
|
||||
<workItem from="1523331190424" duration="3696000" />
|
||||
<workItem from="1523347939099" duration="3697000" />
|
||||
<workItem from="1531102653299" duration="797000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="79936000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="65" y="-4" width="1855" height="1084" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.16484717" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="CMake" order="11" sideWeight="0.49704143" visible="true" weight="0.32795697" />
|
||||
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.5049127" side_tool="true" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Version Control" order="10" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.328" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Terminal" order="8" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39866668" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32939914" />
|
||||
<window_info anchor="bottom" id="Messages" order="7" sideWeight="0.49508733" weight="0.33066666" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/src/recognizer.cpp</url>
|
||||
<line>39</line>
|
||||
<option name="timeStamp" value="27" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/src/recognizer.cpp</url>
|
||||
<line>16</line>
|
||||
<option name="timeStamp" value="28" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
<option name="time" value="29" />
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/common.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="114">
|
||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
||||
<folding>
|
||||
<element signature="e#95#114#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="13" column="71" selection-start-line="13" selection-start-column="71" selection-end-line="13" selection-end-column="71" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1805">
|
||||
<caret line="95" column="69" selection-start-line="95" selection-start-column="69" selection-end-line="95" selection-end-column="69" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1273">
|
||||
<caret line="67" column="36" selection-start-line="67" selection-start-column="36" selection-end-line="67" selection-end-column="36" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1083">
|
||||
<caret line="57" column="37" selection-start-line="57" selection-start-column="37" selection-end-line="57" selection-end-column="37" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asrdemo/ResultListener.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="17" column="6" selection-start-line="17" selection-start-column="6" selection-end-line="17" selection-end-column="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1692">
|
||||
<caret line="94" column="13" lean-forward="true" selection-start-line="94" selection-start-column="13" selection-end-line="94" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="648">
|
||||
<caret line="36" column="32" selection-start-line="36" selection-start-column="32" selection-end-line="36" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="576">
|
||||
<caret line="32" column="60" selection-start-line="32" selection-start-column="60" selection-end-line="32" selection-end-column="60" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1620">
|
||||
<caret line="90" selection-start-line="90" selection-end-line="90" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="918">
|
||||
<caret line="51" column="35" selection-start-line="51" selection-start-column="17" selection-end-line="51" selection-end-column="35" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="414">
|
||||
<caret line="23" column="1" selection-start-line="23" selection-start-column="1" selection-end-line="23" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asr/ASR/bds_asr_key_definitions.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4572">
|
||||
<caret line="254" column="53" selection-start-line="254" selection-start-column="29" selection-end-line="254" selection-end-column="53" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="774">
|
||||
<caret line="43" selection-start-line="43" selection-end-line="43" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="414">
|
||||
<caret line="23" column="1" selection-start-line="23" selection-start-column="1" selection-end-line="23" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asr/ASR/bds_asr_key_definitions.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4572">
|
||||
<caret line="254" column="53" selection-start-line="254" selection-start-column="29" selection-end-line="254" selection-end-column="53" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../asrDemo2/src/asrdemo/AsrdemoController.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="972">
|
||||
<caret line="54" selection-start-line="54" selection-end-line="54" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="612">
|
||||
<caret line="34" column="38" selection-start-line="34" selection-start-column="17" selection-end-line="34" selection-end-column="38" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="198">
|
||||
<caret line="11" column="27" selection-start-line="11" selection-start-column="27" selection-end-line="11" selection-end-column="27" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.cpp" />
|
||||
<entry file="file://$PROJECT_DIR$/yours_main.cpp" />
|
||||
<entry file="file://$PROJECT_DIR$/../../include/BDSSDKMessage.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-112">
|
||||
<caret line="25" column="10" selection-start-line="25" selection-start-column="10" selection-end-line="25" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/yours_main.cpp.bak" />
|
||||
<entry file="file://$PROJECT_DIR$/include/asr/ASR/bds_ASRDefines.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-3623">
|
||||
<caret line="14" column="15" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file:///usr/include/c++/4.8/iosfwd" />
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp.bak" />
|
||||
<entry file="file:///usr/include/c++/4.8/bits/basic_ios.h" />
|
||||
<entry file="file://$PROJECT_DIR$/include/asr/ASR/bds_asr_key_definitions.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="528">
|
||||
<caret line="254" column="53" selection-start-line="254" selection-start-column="29" selection-end-line="254" selection-end-column="53" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file:///usr/include/c++/4.8/bits/stl_vector.h" />
|
||||
<entry file="file:///usr/include/c++/4.8/bits/atomic_base.h" />
|
||||
<entry file="file:///usr/include/c++/4.8/condition_variable" />
|
||||
<entry file="file://$PROJECT_DIR$/include/asrdemo/StatusListener.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="234">
|
||||
<caret line="14" column="44" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="44" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asrdemo/ResultListener.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="17" column="6" selection-start-line="17" selection-start-column="6" selection-end-line="17" selection-end-column="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/log/asrDemo_srt.ubuntu.fu.log.INFO.20180328-195659.68660" />
|
||||
<entry file="file://$PROJECT_DIR$/build-env.sh" />
|
||||
<entry file="file://$PROJECT_DIR$/include/extern/glog/logging.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1754">
|
||||
<caret line="361" column="23" selection-start-line="361" selection-start-column="23" selection-end-line="361" selection-end-column="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asrdemo/Util.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="18">
|
||||
<caret line="28" column="20" selection-start-line="28" selection-start-column="20" selection-end-line="28" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/data/long6.srt" />
|
||||
<entry file="file://$PROJECT_DIR$/scripts/valgrind.sh">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="19">
|
||||
<caret line="1" column="31" selection-start-line="1" selection-start-column="31" selection-end-line="1" selection-end-column="31" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/scripts/srt.supp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="209">
|
||||
<caret line="11" column="68" selection-start-line="11" selection-start-column="68" selection-end-line="11" selection-end-column="68" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/common.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="114">
|
||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
||||
<folding>
|
||||
<element signature="e#95#114#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/common.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="13" column="33" selection-start-line="13" selection-start-column="33" selection-end-line="13" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../asrDemo2/src/asrdemo/AsrdemoController.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="54">
|
||||
<caret line="40" column="5" lean-forward="true" selection-start-line="40" selection-start-column="5" selection-end-line="40" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/asrdemo/AsrdemoController.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="222">
|
||||
<caret line="50" column="9" selection-start-line="50" selection-start-column="9" selection-end-line="50" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="17" column="20" selection-start-line="17" selection-start-column="20" selection-end-line="17" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="219">
|
||||
<caret line="63" column="30" selection-start-line="63" selection-start-column="30" selection-end-line="63" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/recognizer.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="491">
|
||||
<caret line="43" column="55" selection-start-line="43" selection-start-column="55" selection-end-line="43" selection-end-column="55" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-342">
|
||||
<caret line="23" selection-start-line="23" selection-end-line="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/srt_file_listener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="456">
|
||||
<caret line="84" column="35" lean-forward="true" selection-start-line="84" selection-start-column="35" selection-end-line="84" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="e#36#54#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
@ -1,14 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
project(asrDemo_srt)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/log)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
include_directories(include/asr/ASR include/asr/ include include/extern)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O0 -fPIC -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=0")
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
||||
file(GLOB SOURCE_FILES src/*.c* src/*.h*)
|
||||
add_executable(asrDemo_srt ${SOURCE_FILES})
|
||||
target_link_libraries(asrDemo_srt asrdemoall jsoncpp glog rt dl pthread)
|
@ -1,54 +0,0 @@
|
||||
vec 26
|
||||
1.485246e+01
|
||||
1.579741e+01
|
||||
1.663629e+01
|
||||
1.698390e+01
|
||||
1.708107e+01
|
||||
1.745045e+01
|
||||
1.752832e+01
|
||||
1.758490e+01
|
||||
1.746364e+01
|
||||
1.743286e+01
|
||||
1.744198e+01
|
||||
1.735617e+01
|
||||
1.735499e+01
|
||||
1.730315e+01
|
||||
1.726894e+01
|
||||
1.729055e+01
|
||||
1.728198e+01
|
||||
1.718504e+01
|
||||
1.712417e+01
|
||||
1.710584e+01
|
||||
1.715915e+01
|
||||
1.723995e+01
|
||||
1.730050e+01
|
||||
1.728485e+01
|
||||
1.728487e+01
|
||||
1.729697e+01
|
||||
vec 26
|
||||
2.764144e-01
|
||||
2.703758e-01
|
||||
2.584008e-01
|
||||
2.514187e-01
|
||||
2.496835e-01
|
||||
2.436650e-01
|
||||
2.391809e-01
|
||||
2.393867e-01
|
||||
2.416821e-01
|
||||
2.443231e-01
|
||||
2.473226e-01
|
||||
2.507182e-01
|
||||
2.540205e-01
|
||||
2.566869e-01
|
||||
2.590701e-01
|
||||
2.611003e-01
|
||||
2.630226e-01
|
||||
2.658522e-01
|
||||
2.699072e-01
|
||||
2.724641e-01
|
||||
2.723619e-01
|
||||
2.699174e-01
|
||||
2.670183e-01
|
||||
2.660550e-01
|
||||
2.658852e-01
|
||||
2.637595e-01
|
Binary file not shown.
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
#依赖:
|
||||
#ffmpeg
|
||||
#cmake 3.1 以上
|
||||
|
||||
|
||||
cd scripts
|
||||
#编译依赖库。运行成功一次后,该脚本可以删除。
|
||||
sh build-env.sh && \
|
||||
\
|
||||
#提取视频内的音频文件。运行成功一次后,该脚本可以删除。
|
||||
sh convert-audio.sh wmv && \
|
||||
\
|
||||
cd ..
|
||||
\
|
||||
echo " begin to build " && \
|
||||
rm -rf run/* && \
|
||||
mkdir -p run && \
|
||||
sleep 2 && \
|
||||
cd run && \
|
||||
cmake .. && make -j4 && \
|
||||
echo "build success, begin to run " && \
|
||||
sleep 2 && \
|
||||
./asrDemo_srt
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,702 +0,0 @@
|
||||
## CMake configuration file of gflags project
|
||||
##
|
||||
## This CMakeLists.txt defines some gflags specific configuration variables
|
||||
## using the "gflags_define" utility macro. The default values of these variables
|
||||
## can be overridden either on the CMake command-line using the -D option of
|
||||
## the cmake command or in a super-project which includes the gflags source
|
||||
## tree by setting the GFLAGS_<varname> CMake variables before adding the
|
||||
## gflags source directory via CMake's "add_subdirectory" command. Only when
|
||||
## the non-cached variable GFLAGS_IS_SUBPROJECT has a value equivalent to FALSE,
|
||||
## these configuration variables are added to the CMake cache so they can be
|
||||
## edited in the CMake GUI. By default, GFLAGS_IS_SUBPROJECT is set to TRUE when
|
||||
## the CMAKE_SOURCE_DIR is not identical to the directory of this CMakeLists.txt
|
||||
## file, i.e., the top-level directory of the gflags project source tree.
|
||||
##
|
||||
## When this project is a subproject (GFLAGS_IS_SUBPROJECT is TRUE), the default
|
||||
## settings are such that only the static single-threaded library is built without
|
||||
## installation of the gflags files. The "gflags" target is in this case an ALIAS
|
||||
## library target for the "gflags_nothreads_static" library target. Targets which
|
||||
## depend on the gflags library should link to the "gflags" library target.
|
||||
##
|
||||
## Example CMakeLists.txt of user project which requires separate gflags installation:
|
||||
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
##
|
||||
## project(Foo)
|
||||
##
|
||||
## find_package(gflags REQUIRED)
|
||||
##
|
||||
## add_executable(foo src/foo.cc)
|
||||
## target_link_libraries(foo gflags)
|
||||
##
|
||||
## Example CMakeLists.txt of user project which requires separate single-threaded static gflags installation:
|
||||
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
##
|
||||
## project(Foo)
|
||||
##
|
||||
## find_package(gflags COMPONENTS nothreads_static)
|
||||
##
|
||||
## add_executable(foo src/foo.cc)
|
||||
## target_link_libraries(foo gflags)
|
||||
##
|
||||
## Example CMakeLists.txt of super-project which contains gflags source tree:
|
||||
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
##
|
||||
## project(Foo)
|
||||
##
|
||||
## add_subdirectory(gflags)
|
||||
##
|
||||
## add_executable(foo src/foo.cc)
|
||||
## target_link_libraries(foo gflags)
|
||||
##
|
||||
## Variables to configure the source files:
|
||||
## - GFLAGS_IS_A_DLL
|
||||
## - GFLAGS_NAMESPACE
|
||||
## - GFLAGS_ATTRIBUTE_UNUSED
|
||||
## - GFLAGS_INTTYPES_FORMAT
|
||||
##
|
||||
## Variables to configure the build:
|
||||
## - GFLAGS_SOVERSION
|
||||
## - GFLAGS_BUILD_SHARED_LIBS
|
||||
## - GFLAGS_BUILD_STATIC_LIBS
|
||||
## - GFLAGS_BUILD_gflags_LIB
|
||||
## - GFLAGS_BUILD_gflags_nothreads_LIB
|
||||
## - GFLAGS_BUILD_TESTING
|
||||
## - GFLAGS_BUILD_PACKAGING
|
||||
##
|
||||
## Variables to configure the installation:
|
||||
## - GFLAGS_INCLUDE_DIR
|
||||
## - GFLAGS_LIBRARY_INSTALL_DIR or LIB_INSTALL_DIR or LIB_SUFFIX
|
||||
## - GFLAGS_INSTALL_HEADERS
|
||||
## - GFLAGS_INSTALL_SHARED_LIBS
|
||||
## - GFLAGS_INSTALL_STATIC_LIBS
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy (SET CMP0042 NEW)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# includes
|
||||
include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# package information
|
||||
set (PACKAGE_NAME "gflags")
|
||||
set (PACKAGE_VERSION "2.2.1")
|
||||
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set (PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
|
||||
set (PACKAGE_BUGREPORT "https://github.com/gflags/gflags/issues")
|
||||
set (PACKAGE_DESCRIPTION "A commandline flags library that allows for distributed flags.")
|
||||
set (PACKAGE_URL "http://gflags.github.io/gflags")
|
||||
|
||||
project (${PACKAGE_NAME} CXX)
|
||||
if (CMAKE_VERSION VERSION_LESS 3.4)
|
||||
# C language still needed because the following required CMake modules
|
||||
# (or their dependencies, respectively) are not correctly handling
|
||||
# the case where only CXX is enabled
|
||||
# - CheckTypeSize.cmake (fixed in CMake 3.1, cf. https://cmake.org/Bug/view.php?id=14056)
|
||||
# - FindThreads.cmake (fixed in CMake 3.4, cf. https://cmake.org/Bug/view.php?id=14905)
|
||||
enable_language (C)
|
||||
endif ()
|
||||
|
||||
version_numbers (
|
||||
${PACKAGE_VERSION}
|
||||
PACKAGE_VERSION_MAJOR
|
||||
PACKAGE_VERSION_MINOR
|
||||
PACKAGE_VERSION_PATCH
|
||||
)
|
||||
|
||||
# shared library ABI version number, can be overridden by package maintainers
|
||||
# using -DGFLAGS_SOVERSION=XXX on the command-line
|
||||
if (GFLAGS_SOVERSION)
|
||||
set (PACKAGE_SOVERSION "${GFLAGS_SOVERSION}")
|
||||
else ()
|
||||
# TODO: Change default SOVERSION back to PACKAGE_VERSION_MAJOR with the
|
||||
# next increase of major version number (i.e., 3.0.0 -> SOVERSION 3)
|
||||
# The <major>.<minor> SOVERSION should be used for the 2.x releases
|
||||
# versions only which temporarily broke the API by changing the default
|
||||
# namespace from "google" to "gflags".
|
||||
set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
|
||||
endif ()
|
||||
|
||||
# when gflags is included as subproject (e.g., as Git submodule/subtree) in the source
|
||||
# tree of a project that uses it, no variables should be added to the CMake cache;
|
||||
# users may set the non-cached variable GFLAGS_IS_SUBPROJECT before add_subdirectory(gflags)
|
||||
if (NOT DEFINED GFLAGS_IS_SUBPROJECT)
|
||||
if ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$")
|
||||
set (GFLAGS_IS_SUBPROJECT FALSE)
|
||||
else ()
|
||||
set (GFLAGS_IS_SUBPROJECT TRUE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# prefix for package variables in CMake configuration file
|
||||
string (TOUPPER "${PACKAGE_NAME}" PACKAGE_PREFIX)
|
||||
|
||||
# convert file path on Windows with back slashes to path with forward slashes
|
||||
# otherwise this causes an issue with the cmake_install.cmake script
|
||||
file (TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# options
|
||||
|
||||
# maintain binary backwards compatibility with gflags library version <= 2.0,
|
||||
# but at the same time enable the use of the preferred new "gflags" namespace
|
||||
gflags_define (STRING NAMESPACE "Name(s) of library namespace (separate multiple options by semicolon)" "google;${PACKAGE_NAME}" "${PACKAGE_NAME}")
|
||||
gflags_property (NAMESPACE ADVANCED TRUE)
|
||||
set (GFLAGS_NAMESPACE_SECONDARY "${NAMESPACE}")
|
||||
list (REMOVE_DUPLICATES GFLAGS_NAMESPACE_SECONDARY)
|
||||
if (NOT GFLAGS_NAMESPACE_SECONDARY)
|
||||
message (FATAL_ERROR "GFLAGS_NAMESPACE must be set to one (or more) valid C++ namespace identifier(s separated by semicolon \";\").")
|
||||
endif ()
|
||||
foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY)
|
||||
if (NOT ns MATCHES "^[a-zA-Z][a-zA-Z0-9_]*$")
|
||||
message (FATAL_ERROR "GFLAGS_NAMESPACE contains invalid namespace identifier: ${ns}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
list (GET GFLAGS_NAMESPACE_SECONDARY 0 GFLAGS_NAMESPACE)
|
||||
list (REMOVE_AT GFLAGS_NAMESPACE_SECONDARY 0)
|
||||
|
||||
# cached build options when gflags is not a subproject, otherwise non-cached CMake variables
|
||||
# usage: gflags_define(BOOL <name> <doc> <default> [<subproject default>])
|
||||
gflags_define (BOOL BUILD_SHARED_LIBS "Request build of shared libraries." ON ON)
|
||||
gflags_define (BOOL BUILD_STATIC_LIBS "Request build of static libraries (default if BUILD_SHARED_LIBS is OFF)." OFF ON)
|
||||
gflags_define (BOOL BUILD_gflags_LIB "Request build of the multi-threaded gflags library." ON OFF)
|
||||
gflags_define (BOOL BUILD_gflags_nothreads_LIB "Request build of the single-threaded gflags library." ON ON)
|
||||
gflags_define (BOOL BUILD_PACKAGING "Enable build of distribution packages using CPack." OFF OFF)
|
||||
gflags_define (BOOL BUILD_TESTING "Enable build of the unit tests and their execution using CTest." OFF OFF)
|
||||
gflags_define (BOOL INSTALL_HEADERS "Request installation of headers and other development files." ON OFF)
|
||||
gflags_define (BOOL INSTALL_SHARED_LIBS "Request installation of shared libraries." ON ON)
|
||||
gflags_define (BOOL INSTALL_STATIC_LIBS "Request installation of static libraries." ON OFF)
|
||||
gflags_define (BOOL REGISTER_BUILD_DIR "Request entry of build directory in CMake's package registry." OFF OFF)
|
||||
gflags_define (BOOL REGISTER_INSTALL_PREFIX "Request entry of installed package in CMake's package registry." ON OFF)
|
||||
|
||||
gflags_property (BUILD_STATIC_LIBS ADVANCED TRUE)
|
||||
gflags_property (INSTALL_HEADERS ADVANCED TRUE)
|
||||
gflags_property (INSTALL_SHARED_LIBS ADVANCED TRUE)
|
||||
gflags_property (INSTALL_STATIC_LIBS ADVANCED TRUE)
|
||||
|
||||
if (NOT GFLAGS_IS_SUBPROJECT)
|
||||
foreach (varname IN ITEMS CMAKE_INSTALL_PREFIX)
|
||||
gflags_property (${varname} ADVANCED FALSE)
|
||||
endforeach ()
|
||||
foreach (varname IN ITEMS CMAKE_CONFIGURATION_TYPES CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
|
||||
gflags_property (${varname} ADVANCED TRUE)
|
||||
endforeach ()
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
|
||||
gflags_set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
gflags_property (CMAKE_BUILD_TYPE STRINGS "${CMAKE_CONFIGURATION_TYPES}")
|
||||
endif ()
|
||||
endif () # NOT GFLAGS_IS_SUBPROJECT
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
||||
set (BUILD_STATIC_LIBS ON)
|
||||
endif ()
|
||||
if (NOT BUILD_gflags_LIB AND NOT BUILD_gflags_nothreads_LIB)
|
||||
message (FATAL_ERROR "At least one of [GFLAGS_]BUILD_gflags_LIB and [GFLAGS_]BUILD_gflags_nothreads_LIB must be ON.")
|
||||
endif ()
|
||||
|
||||
gflags_define (STRING INCLUDE_DIR "Name of include directory of installed header files relative to CMAKE_INSTALL_PREFIX/include/" "${PACKAGE_NAME}")
|
||||
gflags_property (INCLUDE_DIR ADVANCED TRUE)
|
||||
file (TO_CMAKE_PATH "${INCLUDE_DIR}" INCLUDE_DIR)
|
||||
if (IS_ABSOLUTE INCLUDE_DIR)
|
||||
message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must be a path relative to CMAKE_INSTALL_PREFIX/include/")
|
||||
endif ()
|
||||
if (INCLUDE_DIR MATCHES "^\\.\\.[/\\]")
|
||||
message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must not start with parent directory reference (../)")
|
||||
endif ()
|
||||
set (GFLAGS_INCLUDE_DIR "${INCLUDE_DIR}")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# system checks
|
||||
include (CheckTypeSize)
|
||||
include (CheckIncludeFileCXX)
|
||||
include (CheckCXXSymbolExists)
|
||||
|
||||
if (WIN32 AND NOT CYGWIN)
|
||||
set (OS_WINDOWS 1)
|
||||
else ()
|
||||
set (OS_WINDOWS 0)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
set (HAVE_SYS_TYPES_H 1)
|
||||
set (HAVE_STDDEF_H 1) # used by CheckTypeSize module
|
||||
set (HAVE_UNISTD_H 0)
|
||||
set (HAVE_SYS_STAT_H 1)
|
||||
set (HAVE_SHLWAPI_H 1)
|
||||
if (MSVC_VERSION VERSION_LESS 1600)
|
||||
check_include_file_cxx ("stdint.h" HAVE_STDINT_H)
|
||||
bool_to_int (HAVE_STDINT_H) # used in #if directive
|
||||
else ()
|
||||
set (HAVE_STDINT_H 1)
|
||||
endif ()
|
||||
if (MSVC_VERSION VERSION_LESS 1800)
|
||||
check_include_file_cxx ("inttypes.h" HAVE_INTTYPES_H)
|
||||
bool_to_int (HAVE_INTTYPES_H) # used in #if directive
|
||||
else ()
|
||||
set (HAVE_INTTYPES_H 1)
|
||||
endif ()
|
||||
else ()
|
||||
foreach (fname IN ITEMS unistd stdint inttypes sys/types sys/stat fnmatch)
|
||||
string (TOUPPER "${fname}" FNAME)
|
||||
string (REPLACE "/" "_" FNAME "${FNAME}")
|
||||
if (NOT HAVE_${FNAME}_H)
|
||||
check_include_file_cxx ("${fname}.h" HAVE_${FNAME}_H)
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (NOT HAVE_FNMATCH_H AND OS_WINDOWS)
|
||||
check_include_file_cxx ("shlwapi.h" HAVE_SHLWAPI_H)
|
||||
endif ()
|
||||
# the following are used in #if directives not #ifdef
|
||||
bool_to_int (HAVE_STDINT_H)
|
||||
bool_to_int (HAVE_SYS_TYPES_H)
|
||||
bool_to_int (HAVE_INTTYPES_H)
|
||||
endif ()
|
||||
|
||||
gflags_define (STRING INTTYPES_FORMAT "Format of integer types: \"C99\" (uint32_t), \"BSD\" (u_int32_t), \"VC7\" (__int32)" "")
|
||||
gflags_property (INTTYPES_FORMAT STRINGS "C99;BSD;VC7")
|
||||
gflags_property (INTTYPES_FORMAT ADVANCED TRUE)
|
||||
if (NOT INTTYPES_FORMAT)
|
||||
set (TYPES uint32_t u_int32_t)
|
||||
if (MSVC)
|
||||
list (INSERT TYPES 0 __int32)
|
||||
endif ()
|
||||
foreach (type IN LISTS TYPES)
|
||||
check_type_size (${type} ${type} LANGUAGE CXX)
|
||||
if (HAVE_${type})
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (HAVE_uint32_t)
|
||||
gflags_set (INTTYPES_FORMAT C99)
|
||||
elseif (HAVE_u_int32_t)
|
||||
gflags_set (INTTYPES_FORMAT BSD)
|
||||
elseif (HAVE___int32)
|
||||
gflags_set (INTTYPES_FORMAT VC7)
|
||||
else ()
|
||||
gflags_property (INTTYPES_FORMAT ADVANCED FALSE)
|
||||
message (FATAL_ERROR "Do not know how to define a 32-bit integer quantity on your system!"
|
||||
" Neither uint32_t, u_int32_t, nor __int32 seem to be available."
|
||||
" Set [GFLAGS_]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.")
|
||||
endif ()
|
||||
endif ()
|
||||
# use of special characters in strings to circumvent bug #0008226
|
||||
if ("^${INTTYPES_FORMAT}$" STREQUAL "^WIN$")
|
||||
gflags_set (INTTYPES_FORMAT VC7)
|
||||
endif ()
|
||||
if (NOT INTTYPES_FORMAT MATCHES "^(C99|BSD|VC7)$")
|
||||
message (FATAL_ERROR "Invalid value for [GFLAGS_]INTTYPES_FORMAT! Choose one of \"C99\", \"BSD\", or \"VC7\"")
|
||||
endif ()
|
||||
set (GFLAGS_INTTYPES_FORMAT "${INTTYPES_FORMAT}")
|
||||
set (GFLAGS_INTTYPES_FORMAT_C99 0)
|
||||
set (GFLAGS_INTTYPES_FORMAT_BSD 0)
|
||||
set (GFLAGS_INTTYPES_FORMAT_VC7 0)
|
||||
set ("GFLAGS_INTTYPES_FORMAT_${INTTYPES_FORMAT}" 1)
|
||||
|
||||
if (MSVC)
|
||||
set (HAVE_strtoll 0)
|
||||
set (HAVE_strtoq 0)
|
||||
else ()
|
||||
check_cxx_symbol_exists (strtoll stdlib.h HAVE_STRTOLL)
|
||||
if (NOT HAVE_STRTOLL)
|
||||
check_cxx_symbol_exists (strtoq stdlib.h HAVE_STRTOQ)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BUILD_gflags_LIB)
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package (Threads)
|
||||
if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
|
||||
set (HAVE_PTHREAD 1)
|
||||
check_type_size (pthread_rwlock_t RWLOCK LANGUAGE CXX)
|
||||
else ()
|
||||
set (HAVE_PTHREAD 0)
|
||||
endif ()
|
||||
if (UNIX AND NOT HAVE_PTHREAD)
|
||||
if (CMAKE_HAVE_PTHREAD_H)
|
||||
set (what "library")
|
||||
else ()
|
||||
set (what ".h file")
|
||||
endif ()
|
||||
message (FATAL_ERROR "Could not find pthread${what}. Check the log file"
|
||||
"\n\t${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
||||
"\nor disable the build of the multi-threaded gflags library (BUILD_gflags_LIB=OFF).")
|
||||
endif ()
|
||||
else ()
|
||||
set (HAVE_PTHREAD 0)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# source files - excluding root subdirectory and/or .in suffix
|
||||
set (PUBLIC_HDRS
|
||||
"gflags.h"
|
||||
"gflags_declare.h"
|
||||
"gflags_completions.h"
|
||||
)
|
||||
|
||||
if (GFLAGS_NAMESPACE_SECONDARY)
|
||||
set (INCLUDE_GFLAGS_NS_H "// Import gflags library symbols into alternative/deprecated namespace(s)")
|
||||
foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY)
|
||||
string (TOUPPER "${ns}" NS)
|
||||
set (gflags_ns_h "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/gflags_${ns}.h")
|
||||
configure_file ("${PROJECT_SOURCE_DIR}/src/gflags_ns.h.in" "${gflags_ns_h}" @ONLY)
|
||||
list (APPEND PUBLIC_HDRS "${gflags_ns_h}")
|
||||
set (INCLUDE_GFLAGS_NS_H "${INCLUDE_GFLAGS_NS_H}\n#include \"gflags_${ns}.h\"")
|
||||
endforeach ()
|
||||
else ()
|
||||
set (INCLUDE_GFLAGS_NS_H)
|
||||
endif ()
|
||||
|
||||
set (PRIVATE_HDRS
|
||||
"config.h"
|
||||
"util.h"
|
||||
"mutex.h"
|
||||
)
|
||||
|
||||
set (GFLAGS_SRCS
|
||||
"gflags.cc"
|
||||
"gflags_reporting.cc"
|
||||
"gflags_completions.cc"
|
||||
)
|
||||
|
||||
if (OS_WINDOWS)
|
||||
list (APPEND PRIVATE_HDRS "windows_port.h")
|
||||
list (APPEND GFLAGS_SRCS "windows_port.cc")
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# configure source files
|
||||
if (NOT DEFINED GFLAGS_ATTRIBUTE_UNUSED)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (GFLAGS_ATTRIBUTE_UNUSED "__attribute((unused))")
|
||||
else ()
|
||||
set (GFLAGS_ATTRIBUTE_UNUSED)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# whenever we build a shared library (DLL on Windows), configure the public
|
||||
# headers of the API for use of this shared library rather than the optionally
|
||||
# also build statically linked library; users can override GFLAGS_DLL_DECL
|
||||
# in particular, this done by setting the INTERFACE_COMPILE_DEFINITIONS of
|
||||
# static libraries to include an empty definition for GFLAGS_DLL_DECL
|
||||
if (NOT DEFINED GFLAGS_IS_A_DLL)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (GFLAGS_IS_A_DLL 1)
|
||||
else ()
|
||||
set (GFLAGS_IS_A_DLL 0)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
configure_headers (PUBLIC_HDRS ${PUBLIC_HDRS})
|
||||
configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS})
|
||||
configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS})
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# output directories
|
||||
if (NOT GFLAGS_IS_SUBPROJECT)
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib")
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# installation directories
|
||||
if (OS_WINDOWS)
|
||||
set (RUNTIME_INSTALL_DIR "bin")
|
||||
set (LIBRARY_INSTALL_DIR "lib")
|
||||
set (INCLUDE_INSTALL_DIR "include")
|
||||
set (CONFIG_INSTALL_DIR "lib/cmake/${PACKAGE_NAME}")
|
||||
set (PKGCONFIG_INSTALL_DIR)
|
||||
else ()
|
||||
set (RUNTIME_INSTALL_DIR bin)
|
||||
# The LIB_INSTALL_DIR and LIB_SUFFIX variables are used by the Fedora
|
||||
# package maintainers. Also package maintainers of other distribution
|
||||
# packages need to be able to specify the name of the library directory.
|
||||
if (NOT GFLAGS_LIBRARY_INSTALL_DIR AND LIB_INSTALL_DIR)
|
||||
set (GFLAGS_LIBRARY_INSTALL_DIR "${LIB_INSTALL_DIR}")
|
||||
endif ()
|
||||
gflags_define (PATH LIBRARY_INSTALL_DIR "Directory of installed libraries, e.g., \"lib64\"" "lib${LIB_SUFFIX}")
|
||||
gflags_property (LIBRARY_INSTALL_DIR ADVANCED TRUE)
|
||||
set (INCLUDE_INSTALL_DIR include)
|
||||
set (CONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/cmake/${PACKAGE_NAME})
|
||||
set (PKGCONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/pkgconfig)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# add library targets
|
||||
set (TARGETS)
|
||||
# static vs. shared
|
||||
foreach (TYPE IN ITEMS STATIC SHARED)
|
||||
if (BUILD_${TYPE}_LIBS)
|
||||
string (TOLOWER "${TYPE}" type)
|
||||
# whether or not targets are a DLL
|
||||
if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^SHARED$")
|
||||
set (GFLAGS_IS_A_DLL 1)
|
||||
else ()
|
||||
set (GFLAGS_IS_A_DLL 0)
|
||||
endif ()
|
||||
# filename suffix for static libraries on Windows
|
||||
if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^STATIC$")
|
||||
set (type_suffix "_${type}")
|
||||
else ()
|
||||
set (type_suffix "")
|
||||
endif ()
|
||||
# multi-threaded vs. single-threaded
|
||||
foreach (opts IN ITEMS "" _nothreads)
|
||||
if (BUILD_gflags${opts}_LIB)
|
||||
set (target_name "gflags${opts}_${type}")
|
||||
add_library (${target_name} ${TYPE} ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS})
|
||||
set_target_properties (${target_name} PROPERTIES
|
||||
OUTPUT_NAME "gflags${opts}${type_suffix}"
|
||||
VERSION "${PACKAGE_VERSION}"
|
||||
SOVERSION "${PACKAGE_SOVERSION}"
|
||||
)
|
||||
set (include_dirs "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>")
|
||||
if (INSTALL_HEADERS)
|
||||
list (APPEND include_dirs "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>")
|
||||
endif ()
|
||||
target_include_directories (${target_name}
|
||||
PUBLIC "${include_dirs}"
|
||||
PRIVATE "${PROJECT_SOURCE_DIR}/src;${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}"
|
||||
)
|
||||
target_compile_definitions (${target_name} PUBLIC GFLAGS_IS_A_DLL=${GFLAGS_IS_A_DLL})
|
||||
if (opts MATCHES "nothreads")
|
||||
target_compile_definitions (${target_name} PRIVATE NO_THREADS)
|
||||
elseif (CMAKE_USE_PTHREADS_INIT)
|
||||
target_link_libraries (${target_name} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif ()
|
||||
if (HAVE_SHLWAPI_H)
|
||||
target_link_libraries (${target_name} shlwapi.lib)
|
||||
endif ()
|
||||
list (APPEND TARGETS ${target_name})
|
||||
# add convenience make target for build of both shared and static libraries
|
||||
if (NOT GFLAGS_IS_SUBPROJECT)
|
||||
if (NOT TARGET gflags${opts})
|
||||
add_custom_target (gflags${opts})
|
||||
endif ()
|
||||
add_dependencies (gflags${opts} ${target_name})
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# add ALIAS target for use in super-project, prefer static over shared, single-threaded over multi-threaded
|
||||
if (GFLAGS_IS_SUBPROJECT)
|
||||
foreach (type IN ITEMS static shared)
|
||||
foreach (opts IN ITEMS "_nothreads" "")
|
||||
if (TARGET gflags${opts}_${type})
|
||||
add_library (gflags ALIAS gflags${opts}_${type})
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (TARGET gflags)
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# installation rules
|
||||
set (EXPORT_NAME ${PACKAGE_NAME}-targets)
|
||||
file (RELATIVE_PATH INSTALL_PREFIX_REL2CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}")
|
||||
configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" @ONLY)
|
||||
configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" @ONLY)
|
||||
|
||||
if (BUILD_SHARED_LIBS AND INSTALL_SHARED_LIBS)
|
||||
foreach (opts IN ITEMS "" _nothreads)
|
||||
if (BUILD_gflags${opts}_LIB)
|
||||
install (TARGETS gflags${opts}_shared
|
||||
EXPORT ${EXPORT_NAME}
|
||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR})
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
if (BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS)
|
||||
foreach (opts IN ITEMS "" _nothreads)
|
||||
if (BUILD_gflags${opts}_LIB)
|
||||
install (TARGETS gflags${opts}_static
|
||||
EXPORT ${EXPORT_NAME}
|
||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR})
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
if (INSTALL_HEADERS)
|
||||
install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_INCLUDE_DIR})
|
||||
install (
|
||||
FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake"
|
||||
RENAME ${PACKAGE_NAME}-config.cmake
|
||||
DESTINATION ${CONFIG_INSTALL_DIR}
|
||||
)
|
||||
install (
|
||||
FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake"
|
||||
DESTINATION ${CONFIG_INSTALL_DIR}
|
||||
)
|
||||
install (EXPORT ${EXPORT_NAME} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
if (UNIX)
|
||||
install (PROGRAMS src/gflags_completions.sh DESTINATION ${RUNTIME_INSTALL_DIR})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (PKGCONFIG_INSTALL_DIR)
|
||||
configure_file ("cmake/package.pc.in" "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" @ONLY)
|
||||
install (FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}")
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# support direct use of build tree
|
||||
set (INSTALL_PREFIX_REL2CONFIG_DIR .)
|
||||
export (TARGETS ${TARGETS} FILE "${PROJECT_BINARY_DIR}/${EXPORT_NAME}.cmake")
|
||||
if (REGISTER_BUILD_DIR)
|
||||
export (PACKAGE ${PACKAGE_NAME})
|
||||
endif ()
|
||||
if (REGISTER_INSTALL_PREFIX)
|
||||
register_gflags_package(${CONFIG_INSTALL_DIR})
|
||||
endif ()
|
||||
configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" @ONLY)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# testing - MUST follow the generation of the build tree config file
|
||||
if (BUILD_TESTING)
|
||||
include (CTest)
|
||||
enable_testing ()
|
||||
add_subdirectory (test)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# packaging
|
||||
if (BUILD_PACKAGING)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS AND NOT INSTALL_HEADERS)
|
||||
message (WARNING "Package will contain static libraries without headers!"
|
||||
"\nRecommended options for generation of runtime package:"
|
||||
"\n BUILD_SHARED_LIBS=ON"
|
||||
"\n BUILD_STATIC_LIBS=OFF"
|
||||
"\n INSTALL_HEADERS=OFF"
|
||||
"\n INSTALL_SHARED_LIBS=ON"
|
||||
"\nRecommended options for generation of development package:"
|
||||
"\n BUILD_SHARED_LIBS=ON"
|
||||
"\n BUILD_STATIC_LIBS=ON"
|
||||
"\n INSTALL_HEADERS=ON"
|
||||
"\n INSTALL_SHARED_LIBS=ON"
|
||||
"\n INSTALL_STATIC_LIBS=ON")
|
||||
endif ()
|
||||
|
||||
# default package generators
|
||||
if (APPLE)
|
||||
set (PACKAGE_GENERATOR "PackageMaker")
|
||||
set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
elseif (UNIX)
|
||||
set (PACKAGE_GENERATOR "DEB;RPM")
|
||||
set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
else ()
|
||||
set (PACKAGE_GENERATOR "ZIP")
|
||||
set (PACKAGE_SOURCE_GENERATOR "ZIP")
|
||||
endif ()
|
||||
|
||||
# used package generators
|
||||
set (CPACK_GENERATOR "${PACKAGE_GENERATOR}" CACHE STRING "List of binary package generators (CPack).")
|
||||
set (CPACK_SOURCE_GENERATOR "${PACKAGE_SOURCE_GENERATOR}" CACHE STRING "List of source package generators (CPack).")
|
||||
mark_as_advanced (CPACK_GENERATOR CPACK_SOURCE_GENERATOR)
|
||||
|
||||
# some package generators (e.g., PackageMaker) do not allow .md extension
|
||||
configure_file ("${CMAKE_CURRENT_LIST_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.txt" COPYONLY)
|
||||
|
||||
# common package information
|
||||
set (CPACK_PACKAGE_VENDOR "Andreas Schuh")
|
||||
set (CPACK_PACKAGE_CONTACT "google-gflags@googlegroups.com")
|
||||
set (CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
|
||||
set (CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION_MAJOR}")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "${PACKAGE_VERSION_MINOR}")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "${PACKAGE_VERSION_PATCH}")
|
||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}")
|
||||
set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
|
||||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/COPYING.txt")
|
||||
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
|
||||
set (CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
set (CPACK_OUTPUT_FILE_PREFIX packages)
|
||||
set (CPACK_PACKAGE_RELOCATABLE TRUE)
|
||||
set (CPACK_MONOLITHIC_INSTALL TRUE)
|
||||
|
||||
# RPM package information -- used in cmake/package.cmake.in also for DEB
|
||||
set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
|
||||
set (CPACK_RPM_PACKAGE_LICENSE "BSD")
|
||||
set (CPACK_RPM_PACKAGE_URL "${PACKAGE_URL}")
|
||||
set (CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_LIST_DIR}/ChangeLog.txt")
|
||||
|
||||
if (INSTALL_HEADERS)
|
||||
set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/doc/index.html")
|
||||
else ()
|
||||
set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/cmake/README_runtime.txt")
|
||||
endif ()
|
||||
|
||||
# system/architecture
|
||||
if (WINDOWS)
|
||||
if (CMAKE_CL_64)
|
||||
set (CPACK_SYSTEM_NAME "win64")
|
||||
else ()
|
||||
set (CPACK_SYSTEM_NAME "win32")
|
||||
endif ()
|
||||
set (CPACK_PACKAGE_ARCHITECTURE)
|
||||
elseif (APPLE)
|
||||
set (CPACK_PACKAGE_ARCHITECTURE darwin)
|
||||
else ()
|
||||
string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME)
|
||||
if (CMAKE_CXX_FLAGS MATCHES "-m32")
|
||||
set (CPACK_PACKAGE_ARCHITECTURE i386)
|
||||
else ()
|
||||
execute_process (
|
||||
COMMAND dpkg --print-architecture
|
||||
RESULT_VARIABLE RV
|
||||
OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE
|
||||
)
|
||||
if (RV EQUAL 0)
|
||||
string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)
|
||||
else ()
|
||||
execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
|
||||
if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64")
|
||||
set (CPACK_PACKAGE_ARCHITECTURE amd64)
|
||||
else ()
|
||||
set (CPACK_PACKAGE_ARCHITECTURE i386)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# source package settings
|
||||
set (CPACK_SOURCE_TOPLEVEL_TAG "source")
|
||||
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/")
|
||||
|
||||
# default binary package settings
|
||||
set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
|
||||
if (CPACK_PACKAGE_ARCHITECTURE)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
endif ()
|
||||
|
||||
# generator specific configuration file
|
||||
#
|
||||
# allow package maintainers to use their own configuration file
|
||||
# $ cmake -DCPACK_PROJECT_CONFIG_FILE:FILE=/path/to/package/config
|
||||
if (NOT CPACK_PROJECT_CONFIG_FILE)
|
||||
configure_file (
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cmake/package.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake" @ONLY
|
||||
)
|
||||
set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake")
|
||||
endif ()
|
||||
|
||||
include (CPack)
|
||||
|
||||
endif () # BUILD_PACKAGING
|
Binary file not shown.
@ -1,587 +0,0 @@
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
|
||||
set(BUILD_SHARED_LIBS 1)
|
||||
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy (SET CMP0042 NEW)
|
||||
endif (POLICY CMP0042)
|
||||
|
||||
if (POLICY CMP0063)
|
||||
cmake_policy (SET CMP0063 NEW)
|
||||
endif (POLICY CMP0063)
|
||||
|
||||
project (google-glog)
|
||||
|
||||
enable_testing ()
|
||||
|
||||
set (GLOG_MAJOR_VERSION 0)
|
||||
set (GLOG_MINOR_VERSION 3)
|
||||
set (GLOG_PATCH_VERSION 5)
|
||||
|
||||
set (GLOG_VERSION
|
||||
${GLOG_MAJOR_VERSION}.${GLOG_MINOR_VERSION}.${GLOG_PATCH_VERSION})
|
||||
|
||||
set (CPACK_PACKAGE_NAME glog)
|
||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "")
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR ${GLOG_MAJOR_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION_MINOR ${GLOG_MINOR_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION_PATCH ${GLOG_PATCH_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION ${GLOG_VERSION})
|
||||
|
||||
option (WITH_GFLAGS "Use gflags" ON)
|
||||
option (WITH_THREADS "Enable multithreading support" ON)
|
||||
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
include (CheckCSourceCompiles)
|
||||
include (CheckCXXCompilerFlag)
|
||||
include (CheckCXXSourceCompiles)
|
||||
include (CheckFunctionExists)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckIncludeFileCXX)
|
||||
include (CheckLibraryExists)
|
||||
include (CheckStructHasMember)
|
||||
include (CheckSymbolExists)
|
||||
include (CheckTypeSize)
|
||||
include (CMakePackageConfigHelpers)
|
||||
include (CPack)
|
||||
include (CTest)
|
||||
include (DetermineGflagsNamespace)
|
||||
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD 1)
|
||||
|
||||
if (WITH_GFLAGS)
|
||||
find_package (gflags)
|
||||
|
||||
if (gflags_FOUND)
|
||||
set (HAVE_LIB_GFLAGS 1)
|
||||
determine_gflags_namespace (gflags_NAMESPACE)
|
||||
endif (gflags_FOUND)
|
||||
endif (WITH_GFLAGS)
|
||||
|
||||
if (WITH_THREADS)
|
||||
find_package (Threads)
|
||||
endif (WITH_THREADS)
|
||||
|
||||
check_include_file (dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_file (execinfo.h HAVE_EXECINFO_H)
|
||||
check_include_file (glob.h HAVE_GLOB_H)
|
||||
check_include_file (inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file (libunwind.h HAVE_LIBUNWIND_H)
|
||||
check_include_file (memory.h HAVE_MEMORY_H)
|
||||
check_include_file (pwd.h HAVE_PWD_H)
|
||||
check_include_file (stdint.h HAVE_STDINT_H)
|
||||
check_include_file (stdlib.h HAVE_STDLIB_H)
|
||||
check_include_file (string.h HAVE_STRING_H)
|
||||
check_include_file (strings.h HAVE_STRINGS_H)
|
||||
check_include_file (sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_file (sys/syscall.h HAVE_SYS_SYSCALL_H)
|
||||
check_include_file (sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file (sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file (sys/utsname.h HAVE_SYS_UTSNAME_H)
|
||||
check_include_file (syscall.h HAVE_SYSCALL_H)
|
||||
check_include_file (syslog.h HAVE_SYSLOG_H)
|
||||
check_include_file (ucontext.h HAVE_UCONTEXT_H)
|
||||
check_include_file (unistd.h HAVE_UNISTD_H)
|
||||
check_include_file (unwind.h HAVE_UNWIND_H)
|
||||
|
||||
check_include_file_cxx ("ext/hash_map" HAVE_EXT_HASH_MAP)
|
||||
check_include_file_cxx ("ext/hash_set" HAVE_EXT_HASH_SET)
|
||||
check_include_file_cxx ("ext/slist" HAVE_EXT_SLIST)
|
||||
check_include_file_cxx ("tr1/unordered_map" HAVE_TR1_UNORDERED_MAP)
|
||||
check_include_file_cxx ("tr1/unordered_set" HAVE_TR1_UNORDERED_SET)
|
||||
check_include_file_cxx ("unordered_map" HAVE_UNORDERED_MAP)
|
||||
check_include_file_cxx ("unordered_set" HAVE_UNORDERED_SET)
|
||||
|
||||
check_type_size ("unsigned __int16" HAVE___UINT16)
|
||||
check_type_size (u_int16_t HAVE_U_INT16_T)
|
||||
check_type_size (uint16_t HAVE_UINT16_T)
|
||||
|
||||
check_function_exists (dladdr HAVE_DLADDR)
|
||||
check_function_exists (fcntl HAVE_FCNTL)
|
||||
check_function_exists (pread HAVE_PREAD)
|
||||
check_function_exists (pwrite HAVE_PWRITE)
|
||||
check_function_exists (sigaction HAVE_SIGACTION)
|
||||
check_function_exists (sigaltstack HAVE_SIGALSTACK)
|
||||
|
||||
# NOTE gcc does not fail if you pass a non-existent -Wno-* option as an
|
||||
# argument. However, it will happily fail if you pass the corresponding -W*
|
||||
# option. So, we check whether options that disable warnings exist by testing
|
||||
# the availability of the corresponding option that enables the warning. This
|
||||
# eliminates the need to check for compiler for several (mainly Clang) options.
|
||||
|
||||
check_cxx_compiler_flag (-Wdeprecated HAVE_NO_DEPRECATED)
|
||||
check_cxx_compiler_flag (-Wunnamed-type-template-args
|
||||
HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS)
|
||||
|
||||
# NOTE: Cannot use check_function_exists here since >=vc-14.0 can define
|
||||
# snprintf as an inline function
|
||||
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
|
||||
|
||||
check_library_exists (unwind get_static_proc_name "" HAVE_LIB_UNWIND)
|
||||
|
||||
find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
|
||||
mark_as_advanced (UNWIND_LIBRARY)
|
||||
|
||||
check_c_source_compiles ("
|
||||
#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((unused));
|
||||
int main(void) { return 0; }
|
||||
" HAVE___ATTRIBUTE__)
|
||||
|
||||
check_c_source_compiles ("
|
||||
#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((visibility(\"default\")));
|
||||
int main(void) { return 0; }
|
||||
" HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
|
||||
|
||||
check_c_source_compiles ("
|
||||
#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((visibility(\"hidden\")));
|
||||
int main(void) { return 0; }
|
||||
" HAVE___ATTRIBUTE__VISIBILITY_HIDDEN)
|
||||
|
||||
check_c_source_compiles ("
|
||||
int main(void) { if (__builtin_expect(0, 0)) return 1; return 0; }
|
||||
" HAVE___BUILTIN_EXPECT)
|
||||
|
||||
check_c_source_compiles ("
|
||||
int main(void)
|
||||
{
|
||||
int a; if (__sync_val_compare_and_swap(&a, 0, 1)) return 1; return 0;
|
||||
}
|
||||
" HAVE___SYNC_VAL_COMPARE_AND_SWAP)
|
||||
|
||||
check_c_source_compiles ("
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <pthread.h>
|
||||
int main(void)
|
||||
{
|
||||
pthread_rwlock_t l;
|
||||
pthread_rwlock_init(&l, NULL);
|
||||
pthread_rwlock_rdlock(&l);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_RWLOCK)
|
||||
|
||||
check_c_source_compiles ("
|
||||
__declspec(selectany) int a;
|
||||
int main(void) { return 0; }
|
||||
" HAVE___DECLSPEC)
|
||||
|
||||
check_cxx_source_compiles ("
|
||||
#include <vector>
|
||||
vector<int> t; int main() { }
|
||||
" STL_NO_NAMESPACE)
|
||||
|
||||
check_cxx_source_compiles ("
|
||||
#include <vector>
|
||||
std::vector<int> t; int main() { }
|
||||
" STL_STD_NAMESPACE)
|
||||
|
||||
check_cxx_source_compiles ("
|
||||
#include <iostream>
|
||||
std::ostream& operator<<(std::ostream&, struct s);
|
||||
using ::operator<<;
|
||||
int main() { }
|
||||
" HAVE_USING_OPERATOR)
|
||||
|
||||
check_cxx_source_compiles ("
|
||||
namespace Outer { namespace Inner { int i = 0; }}
|
||||
using namespace Outer::Inner;;
|
||||
int main() { return i; }
|
||||
" HAVE_NAMESPACES)
|
||||
|
||||
set (_PC_FIELDS
|
||||
"gregs[REG_PC]"
|
||||
"gregs[REG_EIP]"
|
||||
"gregs[REG_RIP]"
|
||||
"sc_ip"
|
||||
"uc_regs->gregs[PT_NIP]"
|
||||
"gregs[R15]"
|
||||
"arm_pc"
|
||||
"mc_eip"
|
||||
"mc_rip"
|
||||
"__gregs[REG_EIP]"
|
||||
"__gregs[REG_RIP]"
|
||||
"ss.eip"
|
||||
"__ss.__eip"
|
||||
"ss.rip"
|
||||
"__ss.__rip"
|
||||
"ss.srr0"
|
||||
"__ss.__srr0"
|
||||
)
|
||||
|
||||
set (_PC_HEADERS ucontext.h signal.h)
|
||||
|
||||
if (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
|
||||
foreach (_PC_FIELD ${_PC_FIELDS})
|
||||
foreach (_PC_HEADER ${_PC_HEADERS})
|
||||
set (_TMP
|
||||
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/uctfield.c)
|
||||
file (WRITE ${_TMP} "
|
||||
#define _GNU_SOURCE 1
|
||||
#include <${_PC_HEADER}>
|
||||
int main(void)
|
||||
{
|
||||
ucontext_t u;
|
||||
return u.${_PC_FIELD} == 0;
|
||||
}
|
||||
")
|
||||
try_compile (HAVE_PC_FROM_UCONTEXT ${CMAKE_CURRENT_BINARY_DIR} ${_TMP}
|
||||
COMPILE_DEFINITIONS _GNU_SOURCE=1)
|
||||
|
||||
if (HAVE_PC_FROM_UCONTEXT)
|
||||
set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE)
|
||||
endif (HAVE_PC_FROM_UCONTEXT)
|
||||
endforeach (_PC_HEADER)
|
||||
endforeach (_PC_FIELD)
|
||||
endif (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
|
||||
|
||||
if (STL_STD_NAMESPACE)
|
||||
set (STL_NAMESPACE std)
|
||||
else (STL_STD_NAMESPACE)
|
||||
set (STL_NAMESPACE "")
|
||||
endif (STL_STD_NAMESPACE)
|
||||
|
||||
set (GOOGLE_NAMESPACE google)
|
||||
set (_START_GOOGLE_NAMESPACE_ "namespace ${GOOGLE_NAMESPACE} {")
|
||||
set (_END_GOOGLE_NAMESPACE_ "}")
|
||||
|
||||
if (HAVE___UINT16)
|
||||
set (ac_cv_have___uint16 1)
|
||||
else (HAVE___UINT16)
|
||||
set (ac_cv_have___uint16 0)
|
||||
endif (HAVE___UINT16)
|
||||
|
||||
if (HAVE_INTTYPES_H)
|
||||
set (ac_cv_have_inttypes_h 1)
|
||||
else (HAVE_INTTYPES_H)
|
||||
set (ac_cv_have_inttypes_h 0)
|
||||
endif (HAVE_INTTYPES_H)
|
||||
|
||||
if (HAVE_LIB_GFLAGS)
|
||||
set (ac_cv_have_libgflags 1)
|
||||
else (HAVE_LIB_GFLAGS)
|
||||
set (ac_cv_have_libgflags 0)
|
||||
endif (HAVE_LIB_GFLAGS)
|
||||
|
||||
if (HAVE_STDINT_H)
|
||||
set (ac_cv_have_stdint_h 1)
|
||||
else (HAVE_STDINT_H)
|
||||
set (ac_cv_have_stdint_h 0)
|
||||
endif (HAVE_STDINT_H)
|
||||
|
||||
if (HAVE_SYS_TYPES_H)
|
||||
set (ac_cv_have_systypes_h 1)
|
||||
else (HAVE_SYS_TYPES_H)
|
||||
set (ac_cv_have_systypes_h 0)
|
||||
endif (HAVE_SYS_TYPES_H)
|
||||
|
||||
if (HAVE_U_INT16_T)
|
||||
set (ac_cv_have_u_int16_t 1)
|
||||
else (HAVE_U_INT16_T)
|
||||
set (ac_cv_have_u_int16_t 0)
|
||||
endif (HAVE_U_INT16_T)
|
||||
|
||||
if (HAVE_UINT16_T)
|
||||
set (ac_cv_have_uint16_t 1)
|
||||
else (HAVE_UINT16_T)
|
||||
set (ac_cv_have_uint16_t 0)
|
||||
endif (HAVE_UINT16_T)
|
||||
|
||||
if (HAVE_UNISTD_H)
|
||||
set (ac_cv_have_unistd_h 1)
|
||||
else (HAVE_UNISTD_H)
|
||||
set (ac_cv_have_unistd_h 0)
|
||||
endif (HAVE_UNISTD_H)
|
||||
|
||||
set (ac_google_namespace ${GOOGLE_NAMESPACE})
|
||||
set (ac_google_end_namespace ${_END_GOOGLE_NAMESPACE_})
|
||||
set (ac_google_start_namespace ${_START_GOOGLE_NAMESPACE_})
|
||||
|
||||
if (HAVE___ATTRIBUTE__)
|
||||
set (ac_cv___attribute___noreturn "__attribute__((noreturn))")
|
||||
set (ac_cv___attribute___noinline "__attribute__((noinline))")
|
||||
elseif (HAVE___DECLSPEC)
|
||||
set (ac_cv___attribute___noreturn "__declspec(noreturn)")
|
||||
#set (ac_cv___attribute___noinline "__declspec(noinline)")
|
||||
endif (HAVE___ATTRIBUTE__)
|
||||
|
||||
if (HAVE___BUILTIN_EXPECT)
|
||||
set (ac_cv_have___builtin_expect 1)
|
||||
else (HAVE___BUILTIN_EXPECT)
|
||||
set (ac_cv_have___builtin_expect 0)
|
||||
endif (HAVE___BUILTIN_EXPECT)
|
||||
|
||||
if (HAVE_USING_OPERATOR)
|
||||
set (ac_cv_cxx_using_operator 1)
|
||||
else (HAVE_USING_OPERATOR)
|
||||
set (ac_cv_cxx_using_operator 0)
|
||||
endif (HAVE_USING_OPERATOR)
|
||||
|
||||
set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
||||
|
||||
if (WITH_THREADS AND Threads_FOUND)
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
set (HAVE_PTHREAD 1)
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
else (WITH_THREADS AND Threads_FOUND)
|
||||
set (NO_THREADS 1)
|
||||
endif (WITH_THREADS AND Threads_FOUND)
|
||||
|
||||
set (TEST_SRC_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\")
|
||||
|
||||
configure_file (src/config.h.cmake.in config.h)
|
||||
configure_file (src/glog/logging.h.in glog/logging.h @ONLY)
|
||||
configure_file (src/glog/raw_logging.h.in glog/raw_logging.h @ONLY)
|
||||
configure_file (src/glog/stl_logging.h.in glog/stl_logging.h @ONLY)
|
||||
configure_file (src/glog/vlog_is_on.h.in glog/vlog_is_on.h @ONLY)
|
||||
|
||||
set (CMAKE_CXX_VISIBILITY_PRESET default)
|
||||
set (CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
|
||||
set (GLOG_PUBLIC_H
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog/logging.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog/raw_logging.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog/stl_logging.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog/vlog_is_on.h
|
||||
src/glog/log_severity.h
|
||||
)
|
||||
|
||||
set (GLOG_SRCS
|
||||
${GLOG_PUBLIC_H}
|
||||
src/base/commandlineflags.h
|
||||
src/base/googleinit.h
|
||||
src/base/mutex.h
|
||||
src/demangle.cc
|
||||
src/demangle.h
|
||||
src/logging.cc
|
||||
src/raw_logging.cc
|
||||
src/symbolize.cc
|
||||
src/symbolize.h
|
||||
src/utilities.cc
|
||||
src/utilities.h
|
||||
src/vlog_is_on.cc
|
||||
)
|
||||
|
||||
if (HAVE_PTHREAD)
|
||||
list (APPEND GLOG_SRCS src/signalhandler.cc)
|
||||
endif (HAVE_PTHREAD)
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND GLOG_SRCS
|
||||
src/windows/port.cc
|
||||
src/windows/port.h
|
||||
)
|
||||
endif (WIN32)
|
||||
|
||||
add_compile_options ($<$<BOOL:${HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS}>:-Wno-unnamed-type-template-args>)
|
||||
|
||||
add_library (glog
|
||||
${GLOG_SRCS}
|
||||
)
|
||||
|
||||
set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if (UNWIND_LIBRARY)
|
||||
target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
|
||||
endif (UNWIND_LIBRARY)
|
||||
|
||||
if (HAVE_PTHREAD)
|
||||
target_link_libraries (glog PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (HAVE_PTHREAD)
|
||||
|
||||
if (WIN32 AND HAVE_SNPRINTF)
|
||||
set_property (SOURCE src/windows/port.cc APPEND PROPERTY COMPILE_DEFINITIONS
|
||||
HAVE_SNPRINTF)
|
||||
endif (WIN32 AND HAVE_SNPRINTF)
|
||||
|
||||
if (gflags_FOUND)
|
||||
target_include_directories (glog PUBLIC $<BUILD_INTERFACE:${gflags_INCLUDE_DIR}>)
|
||||
target_link_libraries (glog PUBLIC ${gflags_LIBRARIES})
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
# Don't use __declspec(dllexport|dllimport) if this is a static build
|
||||
targeT_compile_definitions (glog PUBLIC GFLAGS_DLL_DECLARE_FLAG= GFLAGS_DLL_DEFINE_FLAG=)
|
||||
endif (NOT BUILD_SHARED_LIBS)
|
||||
endif (gflags_FOUND)
|
||||
|
||||
set_target_properties (glog PROPERTIES VERSION ${GLOG_MAJOR_VERSION})
|
||||
set_target_properties (glog PROPERTIES SOVERSION ${GLOG_VERSION})
|
||||
|
||||
if (WIN32)
|
||||
target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
|
||||
endif (WIN32)
|
||||
|
||||
set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")
|
||||
|
||||
target_include_directories (glog BEFORE PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
|
||||
"$<INSTALL_INTERFACE:include>"
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
if (WIN32)
|
||||
target_include_directories (glog PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/windows>"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows)
|
||||
endif (WIN32)
|
||||
|
||||
set_target_properties (glog PROPERTIES DEFINE_SYMBOL LIBGLOG_EXPORTS)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions (glog PUBLIC GOOGLE_GLOG_DLL_DECL=)
|
||||
else (NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions (glog PRIVATE GOOGLE_GLOG_IS_A_DLL=1)
|
||||
|
||||
if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
|
||||
set (_EXPORT "__attribute__((visibility(\"default\")))")
|
||||
set (_IMPORT "")
|
||||
elseif (HAVE___DECLSPEC)
|
||||
set (_EXPORT "__declspec(dllexport)")
|
||||
set (_IMPORT "__declspec(dllimport)")
|
||||
endif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
|
||||
|
||||
target_compile_definitions (glog PRIVATE
|
||||
"GOOGLE_GLOG_DLL_DECL=${_EXPORT}")
|
||||
target_compile_definitions (glog INTERFACE
|
||||
"GOOGLE_GLOG_DLL_DECL=${_IMPORT}")
|
||||
target_compile_definitions (glog INTERFACE
|
||||
"GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS=${_IMPORT}")
|
||||
endif (NOT BUILD_SHARED_LIBS)
|
||||
|
||||
if (HAVE_EXECINFO_H)
|
||||
set (HAVE_STACKTRACE 1)
|
||||
endif (HAVE_EXECINFO_H)
|
||||
|
||||
if (UNIX OR (APPLE AND HAVE_DLADDR))
|
||||
set (HAVE_SYMBOLIZE 1)
|
||||
endif (UNIX OR (APPLE AND HAVE_DLADDR))
|
||||
|
||||
# Unit testing
|
||||
|
||||
if (BUILD_TESTING)
|
||||
add_executable (logging_unittest
|
||||
src/logging_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (logging_unittest PRIVATE glog)
|
||||
|
||||
add_executable (stl_logging_unittest
|
||||
src/stl_logging_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (stl_logging_unittest PRIVATE glog)
|
||||
|
||||
if (HAVE_NO_DEPRECATED)
|
||||
set_property (TARGET stl_logging_unittest APPEND PROPERTY COMPILE_OPTIONS
|
||||
-Wno-deprecated)
|
||||
endif (HAVE_NO_DEPRECATED)
|
||||
|
||||
if (HAVE_UNORDERED_MAP AND HAVE_UNORDERED_SET)
|
||||
target_compile_definitions (stl_logging_unittest PRIVATE
|
||||
GLOG_STL_LOGGING_FOR_UNORDERED)
|
||||
endif (HAVE_UNORDERED_MAP AND HAVE_UNORDERED_SET)
|
||||
|
||||
if (HAVE_TR1_UNORDERED_MAP AND HAVE_TR1_UNORDERED_SET)
|
||||
target_compile_definitions (stl_logging_unittest PRIVATE
|
||||
GLOG_STL_LOGGING_FOR_TR1_UNORDERED)
|
||||
endif (HAVE_TR1_UNORDERED_MAP AND HAVE_TR1_UNORDERED_SET)
|
||||
|
||||
if (HAVE_EXT_HASH_MAP AND HAVE_EXT_HASH_SET)
|
||||
target_compile_definitions (stl_logging_unittest PRIVATE
|
||||
GLOG_STL_LOGGING_FOR_EXT_HASH)
|
||||
endif (HAVE_EXT_HASH_MAP AND HAVE_EXT_HASH_SET)
|
||||
|
||||
if (HAVE_EXT_SLIST)
|
||||
target_compile_definitions (stl_logging_unittest PRIVATE
|
||||
GLOG_STL_LOGGING_FOR_EXT_SLIST)
|
||||
endif (HAVE_EXT_SLIST)
|
||||
|
||||
if (HAVE_SYMBOLIZE)
|
||||
add_executable (symbolize_unittest
|
||||
src/symbolize_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (symbolize_unittest PRIVATE glog)
|
||||
endif (HAVE_SYMBOLIZE)
|
||||
|
||||
add_executable (demangle_unittest
|
||||
src/demangle_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (demangle_unittest PRIVATE glog)
|
||||
|
||||
if (HAVE_STACKTRACE)
|
||||
add_executable (stacktrace_unittest
|
||||
src/stacktrace_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (stacktrace_unittest PRIVATE glog)
|
||||
endif (HAVE_STACKTRACE)
|
||||
|
||||
add_executable (utilities_unittest
|
||||
src/utilities_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (utilities_unittest PRIVATE glog)
|
||||
|
||||
if (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
|
||||
add_executable (signalhandler_unittest
|
||||
src/signalhandler_unittest.cc
|
||||
)
|
||||
|
||||
target_link_libraries (signalhandler_unittest PRIVATE glog)
|
||||
endif (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
|
||||
|
||||
add_test (NAME demangle COMMAND demangle_unittest)
|
||||
add_test (NAME logging COMMAND logging_unittest)
|
||||
|
||||
if (TARGET signalhandler_unittest)
|
||||
add_test (NAME signalhandler COMMAND signalhandler_unittest)
|
||||
endif (TARGET signalhandler_unittest)
|
||||
|
||||
if (TARGET stacktrace_unittest)
|
||||
add_test (NAME stacktrace COMMAND stacktrace_unittest)
|
||||
endif (TARGET stacktrace_unittest)
|
||||
|
||||
add_test (NAME stl_logging COMMAND stl_logging_unittest)
|
||||
|
||||
if (TARGET symbolize_unittest)
|
||||
add_test (NAME symbolize COMMAND symbolize_unittest)
|
||||
endif (TARGET symbolize_unittest)
|
||||
endif (BUILD_TESTING)
|
||||
|
||||
install (TARGETS glog
|
||||
EXPORT glog-targets
|
||||
RUNTIME DESTINATION bin
|
||||
PUBLIC_HEADER DESTINATION include/glog
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
if (gflags_FOUND)
|
||||
set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})")
|
||||
endif (gflags_FOUND)
|
||||
|
||||
configure_package_config_file (glog-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
|
||||
INSTALL_DESTINATION lib/cmake/glog
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
|
||||
write_basic_package_version_file (glog-config-version.cmake VERSION
|
||||
${GLOG_VERSION} COMPATIBILITY SameMajorVersion)
|
||||
|
||||
export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake)
|
||||
export (PACKAGE glog)
|
||||
|
||||
install (FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
|
||||
DESTINATION lib/cmake/glog)
|
||||
|
||||
install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
26927a27b9e74d48a2567ba6e3424b16
|
@ -1,43 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
|
||||
cd .. && \
|
||||
SO_DIR=`pwd`/../asrDemo2/run && \
|
||||
rm -rf lib include asr_resource && \
|
||||
mkdir -p lib include/extern include/asr include/asrdemo asr_resource && \
|
||||
\
|
||||
echo "begin to build libasrdemoall.so" && echo "" && \
|
||||
sleep 3 && \
|
||||
cd $SO_DIR && \
|
||||
make clean && make lib/libasrdemoall.so && \
|
||||
cd - && \
|
||||
ln -s $SO_DIR/lib/libasrdemoall.so lib/libasrdemoall.so && \
|
||||
cp -r $SO_DIR/include/asrdemo/* include/asrdemo && \
|
||||
cp -r ../../include/* include/asr && \
|
||||
cp -r ../../extern/include/* include/extern && \
|
||||
cp -r ../../resources/asr_resource/* asr_resource && \
|
||||
\
|
||||
echo "begin to build glog" && \
|
||||
sleep 3 && \
|
||||
cd lib-src && rm -rf glog-0.3.5 && tar xzf glog-0.3.5.tar.gz && \
|
||||
cp glogCMakeLists.txt glog-0.3.5/CMakeLists.txt &&\
|
||||
cd glog-0.3.5 && cmake . && make -j4 && \
|
||||
pwd && cp -d -f *.so* ../../lib && \
|
||||
cp -r -d -f ./glog ../../include/extern && \
|
||||
cp -r -d -f ./src/glog/*.h ../../include/extern/glog && \
|
||||
cd ../.. && \
|
||||
echo "" && \
|
||||
\
|
||||
echo "begin to build jsoncpp" && \
|
||||
sleep 3 && \
|
||||
cd lib-src && rm -rf jsoncpp-1.8.4 && tar xzf jsoncpp-1.8.4.tar.gz && \
|
||||
cp jsoncppCMakeLists.txt jsoncpp-1.8.4/CMakeLists.txt && cd jsoncpp-1.8.4 && \
|
||||
cmake . && make -j4 && \
|
||||
cp -d src/lib_json/*.so* ../../lib && \
|
||||
cp -r -d include/json ../../include/extern && \
|
||||
cd ../.. && \
|
||||
echo "" && \
|
||||
echo "build env finished"
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
EXT=$1
|
||||
|
||||
#ffmpeg -y -i 16k.wav -acodec pcm_s16le -f s16le -ac 1 -ar 16000 16k.pcm
|
||||
cd .. && \
|
||||
cd data/video && \
|
||||
for file in $(ls *.$EXT);
|
||||
do
|
||||
name=`echo $file|cut -d . -f 1`
|
||||
ffmpeg -y -i $file -acodec pcm_s16le -f s16le -ac 1 -ar 16000 $name.pcm
|
||||
done
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
valgrind --gen-suppressions=all --leak-check=full --show-reachable=yes --suppressions=../scripts/srt.supp ../run/asrDemo_srt
|
||||
|
@ -1,19 +0,0 @@
|
||||
//
|
||||
// Created by fu on 3/17/18.
|
||||
//
|
||||
|
||||
#ifndef ASRDEMO_SRT_COMMON_H
|
||||
#define ASRDEMO_SRT_COMMON_H
|
||||
|
||||
#include <iostream>
|
||||
#include <asrdemo/Util.hpp>
|
||||
#include <glog/logging.h>
|
||||
// #define _LOG_COMMON "[" << asrdemo::Util::get_gmt_time() << "][" << __FILE__ << ":" << __LINE__ << "] "
|
||||
#define ALOG LOG(INFO)
|
||||
#define ELOG LOG(ERROR)
|
||||
namespace asr_srt {
|
||||
void init_log(int argc, char* argv[]);
|
||||
void release_log();
|
||||
}
|
||||
|
||||
#endif //ASRDEMO_SRT_COMMON_H
|
@ -1,108 +0,0 @@
|
||||
//
|
||||
// Created by fu on 3/17/18.
|
||||
//
|
||||
|
||||
#include "recognizer.hpp"
|
||||
#include "common.h"
|
||||
|
||||
#define CHECK_HAS_ERROR() if (_has_error){\
|
||||
error_msg = _error_msg;\
|
||||
ELOG << _error_msg;\
|
||||
return RETURN_ERROR;\
|
||||
}
|
||||
|
||||
namespace asr_srt {
|
||||
Recognizer::Recognizer(
|
||||
const std::string &filename
|
||||
) : _filename(filename), _is(filename, std::ios_base::in | std::ios_base::binary),
|
||||
_listener(get_srt_filename(filename)), _controller(APP_NAME, "../asr_resource/", _listener) {
|
||||
ALOG << _filename << " :Recognizer inited";
|
||||
_error_msg = "";
|
||||
if (!_is || !_is.is_open()) {
|
||||
_has_error = true;
|
||||
_error_msg = "file open failed :" + filename;
|
||||
ELOG << _error_msg;
|
||||
}
|
||||
}
|
||||
|
||||
Recognizer::~Recognizer() {
|
||||
if (_is.is_open()) {
|
||||
_is.close();
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_PROCESS_STATUS Recognizer::config(bds::BDSSDKMessage &config, std::string &error_msg){
|
||||
CHECK_HAS_ERROR();
|
||||
if (!_controller.config(config,_error_msg)){
|
||||
_has_error = true;
|
||||
}
|
||||
CHECK_HAS_ERROR();
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
bool Recognizer::try_waiting_finish(std::string &error_msg) {
|
||||
return _listener.try_waiting_finish(error_msg);
|
||||
}
|
||||
|
||||
RETURN_PROCESS_STATUS Recognizer::process_one_frame(std::string &error_msg) {
|
||||
CHECK_HAS_ERROR();
|
||||
if (_next_process_time > 0 && _next_process_time > asrdemo::Util::current_timestamp()) {
|
||||
return RETURN_SKIP;
|
||||
}
|
||||
|
||||
if (_is_file_end) {
|
||||
return RETURN_WAITING_SDK_END;
|
||||
}
|
||||
RETURN_PROCESS_STATUS status = check_file_status();
|
||||
if (status == RETURN_FILE_END) {
|
||||
_has_error = !_controller.post_data_finish_and_stop(error_msg);
|
||||
}
|
||||
CHECK_HAS_ERROR();
|
||||
if (status != RETURN_OK) {
|
||||
return status;
|
||||
}
|
||||
return read_one_frame(error_msg);
|
||||
|
||||
}
|
||||
|
||||
RETURN_PROCESS_STATUS Recognizer::read_one_frame(std::string &error_msg) {
|
||||
char audio_buf[FRAME_SIZE];
|
||||
int readed_len = 0;
|
||||
|
||||
_is.read(audio_buf, FRAME_SIZE);
|
||||
readed_len = _is.gcount();
|
||||
if (readed_len == 0) {
|
||||
// ELOG << "read file with length = 0 : " << _filename << std::endl;
|
||||
return RETURN_SKIP;
|
||||
}
|
||||
_has_error = !_controller.post_audio_data(audio_buf, readed_len, _error_msg);
|
||||
CHECK_HAS_ERROR();
|
||||
int duration = asrdemo::Util::cal_speech_16k_duration_ms(readed_len); //下次调用需要sleep的时间
|
||||
_next_process_time = asrdemo::Util::current_timestamp() + duration - 1; // 忽略运行1ms
|
||||
return RETURN_PROCESSING;
|
||||
}
|
||||
|
||||
|
||||
RETURN_PROCESS_STATUS Recognizer::check_file_status() {
|
||||
if (_has_error) {
|
||||
return RETURN_ERROR;
|
||||
}
|
||||
if (_is.bad()) {
|
||||
_has_error = true;
|
||||
_error_msg = "file meets error, _is.fail(): " + _filename;
|
||||
ELOG << _error_msg << ":" << _is.bad() << _is.fail();
|
||||
return RETURN_ERROR;
|
||||
}
|
||||
if (_is.eof()) {
|
||||
_is.close();
|
||||
_is_file_end = true;
|
||||
_next_process_time = 0;
|
||||
return RETURN_FILE_END;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
std::string Recognizer::get_srt_filename(const std::string &filename) const {
|
||||
return filename.substr(0, filename.size() - 3) + "srt";
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
//
|
||||
// Created by fu on 3/17/18.
|
||||
//
|
||||
|
||||
#ifndef ASRDEMO_SRT_RECOGNIZER_HPP
|
||||
#define ASRDEMO_SRT_RECOGNIZER_HPP
|
||||
|
||||
|
||||
#include <BDSSDKMessage.hpp>
|
||||
#include <asrdemo/AsrdemoController.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "srt_file_listener.hpp"
|
||||
|
||||
namespace asr_srt {
|
||||
|
||||
enum RETURN_PROCESS_STATUS {
|
||||
RETURN_OK = 0,
|
||||
RETURN_SKIP = 1,
|
||||
RETURN_PROCESSING = 2,
|
||||
RETURN_FILE_END = 3,
|
||||
RETURN_WAITING_SDK_END = 4,
|
||||
RETURN_ERROR = -10
|
||||
|
||||
};
|
||||
|
||||
class Recognizer {
|
||||
public:
|
||||
Recognizer(const std::string &filename);
|
||||
virtual ~Recognizer();
|
||||
RETURN_PROCESS_STATUS process_one_frame(std::string &error_msg);
|
||||
|
||||
RETURN_PROCESS_STATUS config(bds::BDSSDKMessage &config, std::string &error_msg);
|
||||
|
||||
uint64_t get_next_process_time() const{
|
||||
return _next_process_time;
|
||||
}
|
||||
|
||||
bool try_waiting_finish(std::string &message);
|
||||
|
||||
std::string get_filename() const{
|
||||
return _filename;
|
||||
}
|
||||
private:
|
||||
const std::string APP_NAME = "asr_str";
|
||||
|
||||
const int FRAME_SIZE = 320; // 10ms
|
||||
|
||||
bool _has_error = false;
|
||||
std::string _error_msg = "";
|
||||
std::string _filename;
|
||||
std::ifstream _is;
|
||||
SrtFileListener _listener;
|
||||
asrdemo::AsrdemoController _controller;
|
||||
|
||||
|
||||
bool _is_file_end = false;
|
||||
uint64_t _next_process_time = 0;
|
||||
|
||||
std::string get_srt_filename(const std::string &filename) const;
|
||||
|
||||
RETURN_PROCESS_STATUS check_file_status();
|
||||
|
||||
RETURN_PROCESS_STATUS read_one_frame(std::string &error_msg);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif //ASRDEMO_SRT_RECOGNIZER_HPP
|
@ -1,142 +0,0 @@
|
||||
//
|
||||
// Created by fu on 3/17/18.
|
||||
//
|
||||
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include "srt_file_listener.hpp"
|
||||
#include "common.h"
|
||||
|
||||
namespace asr_srt {
|
||||
SrtFileListener::SrtFileListener(const std::string &srt_filename) : _filename(srt_filename) {
|
||||
|
||||
}
|
||||
|
||||
SrtFileListener::~SrtFileListener() {
|
||||
if (_fp) {
|
||||
fclose(_fp);
|
||||
_fp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool SrtFileListener::try_waiting_finish(std::string &error_msg) {
|
||||
ALOG << _filename << " : try_waiting_finish call";
|
||||
if (_has_error) {
|
||||
std::lock_guard<std::mutex> lk(_error_mutex);
|
||||
error_msg = _error_msg;
|
||||
return false;
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> lck(_waiting_mutex);
|
||||
if (_is_finished) {
|
||||
return true;
|
||||
}
|
||||
_cond.wait_for(lck, std::chrono::seconds(TIMEOUT), [this]() { return _is_finished.load(); });
|
||||
ALOG << _filename << " : try_waiting_finish free";
|
||||
if (_has_error) {
|
||||
error_msg = _error_msg;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_is_finished) {
|
||||
error_msg = "sdk not finished";
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void SrtFileListener::on_last_status(int status) {
|
||||
ALOG << _filename << " : on_last_status call" << std::endl;
|
||||
_is_finished = true;
|
||||
fclose(_fp);
|
||||
_fp = nullptr;
|
||||
_cond.notify_all();
|
||||
}
|
||||
|
||||
|
||||
void SrtFileListener::on_start_working() {
|
||||
_fp = fopen(_filename.c_str(), "w");
|
||||
if (_fp == NULL) {
|
||||
write_error("file does not exist");
|
||||
}
|
||||
if (ferror(_fp) != 0) {
|
||||
write_error("ferror(_fp)");
|
||||
}
|
||||
const char bom[] = "\xef\xbb\xbf";
|
||||
if (fwrite(bom, 1, strlen(bom), _fp)!= strlen(bom)) {
|
||||
write_error("write file error");
|
||||
}
|
||||
}
|
||||
|
||||
void SrtFileListener::on_finish(const std::string &json) {
|
||||
if (_has_error) {
|
||||
return;
|
||||
}
|
||||
ALOG << _filename << " : " << json;
|
||||
Json::Value value;
|
||||
std::string error_msg = "";
|
||||
bool is_success;
|
||||
is_success = parse_json(json, value, error_msg);
|
||||
if (is_success) {
|
||||
if (!value.isMember("sn_start_time") || !value.isMember("sn_end_time") ||
|
||||
!value.isMember("results_recognition")) {
|
||||
is_success = false;
|
||||
} else {
|
||||
std::string start_time = value["sn_start_time"].asString();
|
||||
format_srt_time(start_time);
|
||||
std::string end_time = value["sn_end_time"].asString();
|
||||
format_srt_time(end_time);
|
||||
std::string word = "";
|
||||
if (value["results_recognition"].size() > 0) {
|
||||
word = value["results_recognition"][0].asString();
|
||||
}
|
||||
int count = _count.fetch_add(1);
|
||||
count++;
|
||||
std::ostringstream oss;
|
||||
oss << count << "\r\n";
|
||||
oss << start_time << " --> " << end_time << "\r\n\r\n";
|
||||
oss << word << "\r\n";
|
||||
std::string str = oss.str();
|
||||
if (fwrite(str.c_str(), 1, str.size(), _fp) != str.size()) {
|
||||
write_error("write file error");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_success){
|
||||
write_error("json parse error: " + json);
|
||||
}
|
||||
}
|
||||
|
||||
void SrtFileListener::on_error(int err_domain, int err_code, const std::string &err_desc,
|
||||
const std::string &sn) {
|
||||
std::ostringstream os;
|
||||
os << err_domain << "," << err_code << "," << err_desc << "," << sn;
|
||||
write_error(os.str());
|
||||
}
|
||||
|
||||
void SrtFileListener::write_error(const std::string &error_msg) {
|
||||
std::string msg = "[" + _filename + "]" + error_msg;
|
||||
_has_error = true;
|
||||
_is_finished = true;
|
||||
ELOG << _filename << " , " << msg;
|
||||
std::lock_guard<std::mutex> lk(_error_mutex);
|
||||
_error_msg = msg;
|
||||
}
|
||||
|
||||
bool SrtFileListener::parse_json(const std::string &json, Json::Value &root, std::string &error_msg) {
|
||||
Json::CharReaderBuilder rbuilder;
|
||||
const std::unique_ptr<Json::CharReader> reader(rbuilder.newCharReader());
|
||||
const char *str = json.c_str();
|
||||
return reader->parse(str, str + json.size(), &root, &error_msg);
|
||||
}
|
||||
|
||||
void SrtFileListener::format_srt_time(std::string &time) {
|
||||
size_t pos = time.find(".");
|
||||
time = time.replace(pos, 1, 1, ',');
|
||||
if (pos == 5) {
|
||||
time.insert(0, "00:");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
//
|
||||
// Created by fu on 3/17/18.
|
||||
//
|
||||
|
||||
#ifndef ASRDEMO_SRT_SRT_FILE_LISTENER_HPP
|
||||
#define ASRDEMO_SRT_SRT_FILE_LISTENER_HPP
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <asrdemo/StatusListener.hpp>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <json/json.h>
|
||||
|
||||
namespace asr_srt {
|
||||
class SrtFileListener : public asrdemo::ResultListener {
|
||||
public:
|
||||
SrtFileListener(const std::string &srt_filename);
|
||||
|
||||
virtual ~SrtFileListener();
|
||||
|
||||
bool try_waiting_finish(std::string &error_msg);
|
||||
|
||||
protected:
|
||||
virtual void on_start_working();
|
||||
|
||||
virtual void on_finish(const std::string &json);
|
||||
|
||||
virtual void on_error(int err_domain, int err_code, const std::string &err_desc, const std::string &sn);
|
||||
|
||||
virtual void on_last_status(int status);
|
||||
|
||||
private:
|
||||
const int TIMEOUT = 3; // 3s内结束
|
||||
FILE *_fp = nullptr;
|
||||
std::string _filename;
|
||||
std::atomic_bool _has_error = ATOMIC_VAR_INIT(false);
|
||||
std::string _error_msg;
|
||||
std::mutex _error_mutex;
|
||||
std::mutex _waiting_mutex;
|
||||
std::condition_variable _cond;
|
||||
std::atomic_bool _is_finished = ATOMIC_VAR_INIT(false);
|
||||
std::atomic_int _count = ATOMIC_VAR_INIT(0);
|
||||
|
||||
void write_error(const std::string &error_msg);
|
||||
|
||||
bool parse_json(const std::string &json, Json::Value &root, std::string &error_msg);
|
||||
|
||||
void format_srt_time(std::string &time);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //ASRDEMO_SRT_SRT_FILE_LISTENER_HPP
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
@ -1,29 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (2)" />
|
||||
</state>
|
||||
</component>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/asrDemo2.iml" filepath="$PROJECT_DIR$/.idea/asrDemo2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,356 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
|
||||
<generated>
|
||||
<config projectName="asrDemo2" targetName="asrDemo2" />
|
||||
</generated>
|
||||
</component>
|
||||
<component name="CMakeSettings" AUTO_RELOAD="true">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7da795b6-b8f9-4d6c-a6f8-da234294f8fa" name="Default" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="AsrdemoController.hpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2128">
|
||||
<caret line="112" column="28" selection-start-line="112" selection-start-column="15" selection-end-line="112" selection-end-column="28" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="AsrdemoController.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="305">
|
||||
<caret line="138" column="25" selection-start-line="138" selection-start-column="25" selection-end-line="138" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="BDSpeechSDK.hpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/../../include/BDSpeechSDK.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="741">
|
||||
<caret line="39" column="42" selection-start-line="39" selection-start-column="27" selection-end-line="39" selection-end-column="42" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="ResultListener.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/ResultListener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2337">
|
||||
<caret line="123" selection-start-line="123" selection-end-line="123" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="yours_main.cpp" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/yours_main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="133">
|
||||
<caret line="107" column="20" selection-start-line="107" selection-start-column="15" selection-end-line="107" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>SECRET</find>
|
||||
<find>get_sdk_version</find>
|
||||
<find>_post_data</find>
|
||||
<find>output_callback</find>
|
||||
</findStrings>
|
||||
<dirStrings>
|
||||
<dir>$PROJECT_DIR$</dir>
|
||||
</dirStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/asrdemo_BdSpeechControl.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/BdSpeechControl.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/asrdemo.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/BdSpeechControlImpl.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/BdSpeechControlImpl.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/bd_speech_control_impl.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/util.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/result_listener.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/bd_speech_control_impl.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/controller.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/controller.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/asrdemo_controller.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/status_listener.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/status_listener.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/result_listener.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/yours_PrintResultListener.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/yours_PrintResultListener.cpp" />
|
||||
<option value="$PROJECT_DIR$/run/build_and_run.sh" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/Util.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/Util.hpp" />
|
||||
<option value="$PROJECT_DIR$/CMakeLists.txt" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/StatusListener.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/StatusListener.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/ResultListener.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/ResultListener.cpp" />
|
||||
<option value="$PROJECT_DIR$/run/Makefile" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/AsrdemoController.hpp" />
|
||||
<option value="$PROJECT_DIR$/src/asrdemo/AsrdemoController.cpp" />
|
||||
<option value="$PROJECT_DIR$/src/yours_main.cpp" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsGulpfileManager">
|
||||
<detection-done>true</detection-done>
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="OCFindUsagesOptions" text="true" ivars="false" properties="true" derivedClasses="false" />
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="98" />
|
||||
<option name="y" value="24" />
|
||||
<option name="width" value="1067" />
|
||||
<option name="height" value="796" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="1" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="asrDemo2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo2" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="pcm" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="run" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="asrDemo2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="asrDemo2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="asrdemo" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="settings.editor.selected.configurable" value="settings.github" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/pcm" />
|
||||
<recent name="$PROJECT_DIR$" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/asrdemo" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.asrDemo2">
|
||||
<configuration name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="asrDemo2" RUN_TARGET_NAME="asrDemo2" EXPLICIT_BUILD_TARGET_NAME="all" />
|
||||
<configuration name="asrDemo2" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="asrDemo2" TARGET_NAME="asrDemo2" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="asrDemo2" RUN_TARGET_NAME="asrDemo2" />
|
||||
<list>
|
||||
<item itemvalue="Application.Build All" />
|
||||
<item itemvalue="Application.asrDemo2" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="7da795b6-b8f9-4d6c-a6f8-da234294f8fa" name="Default" comment="" />
|
||||
<created>1520928319000</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1520928319000</updated>
|
||||
<workItem from="1520928321546" duration="6077000" />
|
||||
<workItem from="1520934509741" duration="2342000" />
|
||||
<workItem from="1520936886802" duration="650000" />
|
||||
<workItem from="1520995759290" duration="256000" />
|
||||
<workItem from="1521005592224" duration="5501000" />
|
||||
<workItem from="1521077152299" duration="4597000" />
|
||||
<workItem from="1521105819004" duration="2049000" />
|
||||
<workItem from="1521252966168" duration="2325000" />
|
||||
<workItem from="1521257210479" duration="9565000" />
|
||||
<workItem from="1521337066938" duration="601000" />
|
||||
<workItem from="1521382560784" duration="4535000" />
|
||||
<workItem from="1522110434147" duration="9000" />
|
||||
<workItem from="1522223877455" duration="1821000" />
|
||||
<workItem from="1522236798376" duration="266000" />
|
||||
<workItem from="1523169342299" duration="1166000" />
|
||||
<workItem from="1523257990397" duration="208000" />
|
||||
<workItem from="1523330047332" duration="4857000" />
|
||||
<workItem from="1523347938485" duration="2643000" />
|
||||
<workItem from="1526364997321" duration="754000" />
|
||||
<workItem from="1526369050148" duration="111000" />
|
||||
<workItem from="1530869054050" duration="830000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="51163000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="65" y="-4" width="1855" height="1084" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.22925764" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Messages" order="7" weight="0.4090909" />
|
||||
<window_info anchor="bottom" id="CMake" order="7" weight="0.3275401" />
|
||||
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.3265086" />
|
||||
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39973262" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32903227" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="4" />
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2128">
|
||||
<caret line="112" column="28" selection-start-line="112" selection-start-column="15" selection-end-line="112" selection-end-column="28" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../../include/BDSpeechSDK.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="741">
|
||||
<caret line="39" column="42" selection-start-line="39" selection-start-column="27" selection-end-line="39" selection-end-column="42" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/ResultListener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2337">
|
||||
<caret line="123" selection-start-line="123" selection-end-line="123" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/yours_main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4978">
|
||||
<caret line="262" column="12" selection-start-line="262" selection-start-column="12" selection-end-line="262" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2983">
|
||||
<caret line="157" column="21" lean-forward="true" selection-start-line="157" selection-start-column="21" selection-end-line="159" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2128">
|
||||
<caret line="112" column="28" selection-start-line="112" selection-start-column="15" selection-end-line="112" selection-end-column="28" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../../include/BDSpeechSDK.hpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="741">
|
||||
<caret line="39" column="42" selection-start-line="39" selection-start-column="27" selection-end-line="39" selection-end-column="42" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/ResultListener.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2337">
|
||||
<caret line="123" selection-start-line="123" selection-end-line="123" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/asrdemo/AsrdemoController.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="305">
|
||||
<caret line="138" column="25" selection-start-line="138" selection-start-column="25" selection-end-line="138" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/yours_main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="133">
|
||||
<caret line="107" column="20" selection-start-line="107" selection-start-column="15" selection-end-line="107" selection-end-column="20" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
@ -1,12 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
project(asrDemo2)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O0 -fPIC -D__LINUX__ -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-function")
|
||||
file(GLOB SOURCE_FILES "src/*.c*" "src/*/*.cpp")
|
||||
|
||||
include_directories(../../extern/include ../../include ../../include/ASR)
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../lib ${CMAKE_CURRENT_SOURCE_DIR}/../../extern/lib)
|
||||
add_executable(asrDemo2 ${SOURCE_FILES})
|
||||
target_link_libraries(asrDemo2 BDSpeechSDK curl iconv z ssl crypto uuid rt dl pthread)
|
@ -1,5 +0,0 @@
|
||||
# ASR demo 2
|
||||
|
||||
对sdk做出封装示例
|
||||
|
||||
测试成功后,可以修改 yours_main.cpp 内static void set_config(bds::BDSSDKMessage &cfg_params)内的设置参数
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue