CMakeLists.txt
3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
PROJECT(MacaSwigWrap)
find_package(Toki REQUIRED)
set(TOKI_LIBS ${Toki_LIBRARY})
find_package(Corpus2 1.0.8 REQUIRED)
set(CORPUS2_LIBS ${Corpus2_LIBRARY})
include_directories(${Corpus2_INCLUDE_DIR})
find_package(PwrUtils 1.0.1 REQUIRED)
set(PWRUTILS_LIBS ${PwrUtils_LIBRARY})
set(MACA_LIBS maca)
set(CORPUS2_PWR_MACA_TOKI_LIBS ${CORPUS2_LIBS} ${PWRUTILS_LIBS} ${MACA_LIBS} ${TOKI_LIBS})
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
include_directories(${Libmaca_SOURCE_DIR} "../libmaca")
link_directories(${Libmaca_BINARY_DIR})
find_package(PythonLibs 2)
find_package(PythonInterp)
# idea taken from pyplot build system
execute_process(
COMMAND
${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='${CMAKE_INSTALL_EXEC_PREFIX}')"
OUTPUT_VARIABLE PYTHON_INSTDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "INFO: " "python lib: ${PYTHON_INSTDIR}" )
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
find_package(ICU REQUIRED)
include_directories(${ICU_INCLUDE_DIR})
link_directories(${ICU_LIBRARY_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIR})
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-ansi $ENV{CXXFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DDEBUG -ggdb3 -ansi $ENV{CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -fno-omit-frame-pointer")
endif(CMAKE_COMPILER_IS_GNUCXX)
file(GLOB_RECURSE I_FILES "*.i")
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
SET(CMAKE_SWIG_FLAGS "")
SET(SWIG_SRC_DIR ${SWIG_DIR}/maca)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# maca
SET_SOURCE_FILES_PROPERTIES(maca.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(maca.i PROPERTIES SWIG_FLAGS "-includeall" )
set(SWIG_MODULE_maca_EXTRA_DEPS ${I_FILES})
SWIG_ADD_MODULE(maca python maca.i )
SWIG_LINK_LIBRARIES(maca ${PYTHON_LIBRARIES} ${CORPUS2_PWR_MACA_TOKI_LIBS})
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
set_target_properties(
_maca
PROPERTIES
INSTALL_NAME_DIR "${PYTHON_INSTDIR}"
)
set(PERM_SCRIPTS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
# -----------------------------------------------------------------------------
# Install python modules
# -----------------------------------------------------------------------------
install(
TARGETS _maca
LIBRARY
DESTINATION ${PYTHON_INSTDIR}
PERMISSIONS ${PERM_SCRIPTS}
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/maca.py
DESTINATION ${PYTHON_INSTDIR}
PERMISSIONS ${PERM_SCRIPTS}
)
# -----------------------------------------------------------------------------
# Install SWIG files
# -----------------------------------------------------------------------------
install(
FILES ${I_FILES}
DESTINATION ${SWIG_SRC_DIR}
PERMISSIONS ${PERM_SCRIPTS}
)