CMakeLists.txt 3.27 KB
Newer Older
ilor's avatar
ilor committed
1 2
########## libtokenizer ###############

3 4
PROJECT(toki)

ilor's avatar
ilor committed
5
set(ver_major "1")
6
set(ver_minor "1")
ilor's avatar
ilor committed
7
set(ver_patch "0")
8

ilor's avatar
ilor committed
9 10
set(LIBS "")

ilor's avatar
ilor committed
11 12
include_directories( ${CMAKE_SOURCE_DIR} )

13
find_package(ICU REQUIRED)
ilor's avatar
ilor committed
14 15
include_directories(${ICU_INCLUDE_DIR})
link_directories(${ICU_LIBRARY_DIRS})
16 17 18 19 20
if(UNIX)
	set(LIBS ${LIBS} icuuc icuio)
else(UNIX)
	set(LIBS ${LIBS} icuuc icuio icutu icuin)
endif(UNIX)
ilor's avatar
ilor committed
21

22
find_package(PwrUtils REQUIRED)
ilor's avatar
ilor committed
23
set(LIBS ${LIBS} ${PwrUtils_LIBRARY})
unknown's avatar
unknown committed
24
include_directories(${PwrUtils_INCLUDE_DIR})
25

26
find_package(Loki REQUIRED)
ilor's avatar
ilor committed
27 28 29 30 31 32
set(LIBS ${LIBS} loki)

find_package(LibXML++ REQUIRED)
include_directories(${LibXML++_INCLUDE_DIRS})
link_directories(${LibXML++_LIBRARY_DIRS})
set(LIBS ${LIBS} ${LibXML++_LIBRARIES})
33

unknown's avatar
unknown committed
34
include_directories(${Boost_INCLUDE_DIR})
35
link_directories(${Boost_LIBRARY_DIRS})
ilor's avatar
ilor committed
36
set(LIBS ${LIBS} ${Boost_LIBRARIES})
37

ilor's avatar
ilor committed
38
set(LIBTOKI_INSTALL_DATA_DIR share/toki)
ilor's avatar
ilor committed
39 40
set(LIBTOKI_PATH_SEPARATOR ";")
set(LIBTOKI_DATA_DIR ".;${CMAKE_INSTALL_PREFIX}/${LIBTOKI_INSTALL_DATA_DIR}")
41
set(LIBTOKI_VERSION "${ver_major}.${ver_minor}.${ver_patch}")
ilor's avatar
ilor committed
42 43

FIND_PATH(LIBTOKI_SRC_DATA_DIR
ilor's avatar
ilor committed
44 45
	config.ini
	${CMAKE_SOURCE_DIR}/config
ilor's avatar
ilor committed
46 47 48 49
)
MARK_AS_ADVANCED(LIBTOKI_SRC_DATA_DIR)

if(NOT LIBTOKI_SRC_DATA_DIR)
ilor's avatar
ilor committed
50
	message(FATAL_ERROR "There is no data for libtoki")
ilor's avatar
ilor committed
51
endif(NOT LIBTOKI_SRC_DATA_DIR)
52

ilor's avatar
ilor committed
53
configure_file(config_d.in include/libtoki/config_d.h)
54
configure_file(version.in include/libtoki/version.h)
55
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/include/ )
ilor's avatar
ilor committed
56
add_definitions(-DHAVE_CONFIG_D_H)
57
add_definitions(-DHAVE_VERSION_H)
58

59
SET(libtoki_STAT_SRC
ilor's avatar
ilor committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
	exception.cpp
	main.cpp
	sentencesplitter.cpp
	token.cpp
	srx/document.cpp
	srx/rule.cpp
	srx/segmenter.cpp
	srx/srx.cpp
	layers/affixsplit.cpp
	layers/append.cpp
	layers/basicsplit.cpp
	layers/check.cpp
	layers/combine.cpp
	layers/groupaffixsplit.cpp
	layers/groupsplit.cpp
	layers/init.cpp
	layers/inputbuffer.cpp
	layers/lexiconclassify.cpp
	layers/outputqueue.cpp
	layers/regexpclassify.cpp
	layers/regexmatchsplit.cpp
	layers/tokenlayer.cpp
	tokenizer/layertokenizer.cpp
	tokenizer/tokenizer.cpp
	tokenizer/whitespacetokenizer.cpp
	unicode/icustringwrapper.cpp
	unicode/istreamwrapper.cpp
	unicode/nullsource.cpp
	unicode/sink.cpp
	unicode/source.cpp
	util/confignode.cpp
	util/debug.cpp
	util/settings.cpp
	util/xmlutil.cpp
ilor's avatar
ilor committed
94 95
)

96 97 98
file(GLOB_RECURSE INCS "*.h")

add_library(toki SHARED ${libtoki_STAT_SRC} ${INCS})
ilor's avatar
ilor committed
99
target_link_libraries ( toki ${LIBS} )
100
set_target_properties(toki PROPERTIES
ilor's avatar
ilor committed
101 102
	VERSION "${ver_major}.${ver_minor}"
	SOVERSION ${ver_major})
103

104
if(UNIX)
ilor's avatar
ilor committed
105 106
	set_target_properties(toki PROPERTIES
		LINK_FLAGS -Wl,-e,LIBTOKI_entry_)
107
endif(UNIX)
108

ilor's avatar
ilor committed
109

ilor's avatar
ilor committed
110
	install(TARGETS toki
unknown's avatar
unknown committed
111
		RUNTIME DESTINATION bin
ilor's avatar
ilor committed
112
		LIBRARY DESTINATION lib
ilor's avatar
ilor committed
113
		ARCHIVE DESTINATION lib
ilor's avatar
ilor committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
		GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

	install(
		DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
		DESTINATION include
		FILES_MATCHING PATTERN "*.h"
		PATTERN ".svn" EXCLUDE
		PATTERN "bin" EXCLUDE
		PATTERN "build" EXCLUDE
		PATTERN "CMake*" EXCLUDE
	)
	install(
		DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
		DESTINATION include
		FILES_MATCHING PATTERN "version.h"
	)
	install(
		DIRECTORY ${LIBTOKI_SRC_DATA_DIR}/
		DESTINATION ${LIBTOKI_INSTALL_DATA_DIR}
		FILES_MATCHING PATTERN "*.ini"
		PATTERN "*.srx"
		PATTERN "*.lex"
		PATTERN "*.xml"
		PATTERN "*.txt"
		PATTERN ".svn" EXCLUDE
	)
ilor's avatar
ilor committed
141