Skip to content

Commit

Permalink
CMakeLists.txt,针对平台使用不同的输出目录
Browse files Browse the repository at this point in the history
SplitSentence 导出
***_create_***函数,load失败后delete wrapper
  • Loading branch information
yajiedesign committed Oct 27, 2014
1 parent 77ce9b4 commit 13bae9c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ if (MINGW)
set(CMAKE_CXX_FLAGS "-std=c++11 -Wno-narrowing -fpermissive")
endif (MINGW)

IF(CMAKE_CL_64)
SET(PLATFORM x64)
ELSE(CMAKE_CL_64)
SET(PLATFORM x86)
ENDIF(CMAKE_CL_64)

# -- config output directories
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${PLATFORM})
set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/${PLATFORM})
set (INCLUDE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/include)

# -- config source directories
Expand Down
1 change: 1 addition & 0 deletions src/ner/ner_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void * ner_create_recognizer(const char * path) {
NERWrapper * wrapper = new NERWrapper();

if (!wrapper->load(path)) {
delete wrapper;
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions src/parser/parser_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void * parser_create_parser(const char * path) {
ParserWrapper * wrapper = new ParserWrapper();

if (!wrapper->load(path)) {
delete wrapper;
return 0;
}
return reinterpret_cast<void *>(wrapper);
Expand Down
1 change: 1 addition & 0 deletions src/postagger/postag_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void * postagger_create_postagger(const char * path, const char * lexicon_file)
PostaggerWrapper * wrapper = new PostaggerWrapper();

if (!wrapper->load(path, lexicon_file)) {
delete wrapper;
return 0;
}
return reinterpret_cast<void *>(wrapper);
Expand Down
1 change: 1 addition & 0 deletions src/segmentor/segment_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void * segmentor_create_segmentor(const char * path, const char * lexicon_file)
SegmentorWrapper * wrapper = new SegmentorWrapper();

if (!wrapper->load(path, lexicon_file)) {
delete wrapper;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/splitsnt/SplitSentence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//using namespace util;

int SplitSentence( const std::string& strPara, std::vector<std::string>& vecSentence ) {
SPLIT_SENTENCE_DLL_API int SplitSentence(const std::string& strPara, std::vector<std::string>& vecSentence) {
ltp::Chinese::split_sentence(strPara, vecSentence);

for (int i = 0; i < vecSentence.size(); ++ i) {
Expand Down
2 changes: 1 addition & 1 deletion src/splitsnt/SplitSentence.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @param[in] paragraph The string to the paragraph
* @param[out] sentences The splited sentences
*/
int SplitSentence(const std::string & paragraph,
SPLIT_SENTENCE_DLL_API int SplitSentence(const std::string & paragraph,
std::vector<std::string> & sentences);

#endif //__SPLIT_SENTENCE_H__
Expand Down

0 comments on commit 13bae9c

Please sign in to comment.