forked from meta-toolkit/metapy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (57 loc) · 2.38 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.2.0)
project(metapy)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(METAPY_PYTHON_VERSION "" CACHE STRING
"Python version to use for compiling the extension")
add_subdirectory(deps/meta EXCLUDE_FROM_ALL)
if (NOT PYTHON_INCLUDE_DIRS)
if (NOT ${METAPY_PYTHON_VERSION} STREQUAL "")
list(APPEND Python_ADDITIONAL_VERSIONS ${METAPY_PYTHON_VERSION})
find_package(PythonLibs ${METAPY_PYTHON_VERSION} EXACT)
if (NOT PythonLibs_FOUND)
find_package(PythonLibs ${METAPY_PYTHON_VERSION} REQUIRED)
endif()
else()
find_package(PythonLibs REQUIRED)
endif()
else()
message("-- Using manual Python include dirs: ${PYTHON_INCLUDE_DIRS}")
endif()
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/pybind11/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(metapy SHARED src/metapy_analyzers.cpp
src/metapy_classify.cpp
src/metapy_embeddings.cpp
src/metapy_index.cpp
src/metapy_learn.cpp
src/metapy_sequence.cpp
src/metapy_stats.cpp
src/metapy_parser.cpp
src/metapy_topics.cpp
src/metapy.cpp)
target_link_libraries(metapy meta-index meta-classify meta-ranker
meta-sequence meta-sequence-analyzers meta-greedy-tagger meta-parser
meta-parser-analyzers meta-embeddings meta-topics)
# don't add a "lib" prefix to the metapy shared library
set_target_properties(metapy PROPERTIES PREFIX "")
if (APPLE)
# OS X stupid fixes
# (see http://pybind11.readthedocs.org/en/latest/cmake.html)
set_target_properties(metapy PROPERTIES
MACOSX_RPATH "."
LINK_FLAGS "-undefined dynamic_lookup "
SUFFIX ".so")
endif()
if (WIN32)
set_target_properties(metapy PROPERTIES SUFFIX ".pyd")
target_link_libraries(metapy ${PYTHON_LIBRARY})
target_compile_definitions(metapy PUBLIC -DMS_WIN64)
# fix for std::_hypot has not been declared
target_compile_definitions(metapy PUBLIC -D_hypot=hypot)
endif()
install(TARGETS metapy DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/dist/metapy)