-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (52 loc) · 2.19 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
cmake_minimum_required(VERSION 2.8.8)
set(PROJECT_NAME_STR supplesearch)
project(${PROJECT_NAME_STR} CXX)
include(ExternalProject)
set(CXX_CLANG_FLAGS "-Wall -Wextra -Wno-unused-parameter -std=c++11 -stdlib=libc++ -O3")
set(CXX_GNU_FLAGS "-std=c++11 -Wall -O3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_CLANG_FLAGS}")
set(BLAS_LIB_FLAGS "-framework Accelerate")
set(SED "gsed")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_GNU_FLAGS}")
set(BLAS_LIB_FLAGS "-lopenblas -llapack")
set(SED "sed")
endif()
set(EXT_PROJECTS_DIR "${PROJECT_SOURCE_DIR}/ext")
set(SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
set(COMMON_INCLUDES "${SOURCE_DIR}")
set(TEST_DIR "${PROJECT_SOURCE_DIR}/test")
ExternalProject_Add(arma
SVN_REPOSITORY "http://svn.code.sf.net/p/arma/code/branch-6.100"
CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
PREFIX "${EXT_PROJECTS_DIR}/arma"
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
ExternalProject_Get_Property(arma source_dir)
set(ARMA_INCLUDES_DIR "${source_dir}/include")
ExternalProject_Get_Property(arma binary_dir)
set(ARMA_LIBS_DIR "${binary_dir}")
ExternalProject_Add(porter
GIT_REPOSITORY "https://github.com/smassung/porter2_stemmer.git"
PREFIX "${EXT_PROJECTS_DIR}/porter"
CMAKE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -fPIC
INSTALL_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ${SED} -i "s/VERSION 3.0.0/VERSION 2.8.0/g" CMakeLists.txt
)
ExternalProject_Get_Property(porter source_dir)
set(PORTER_INCLUDES_DIR "${source_dir}")
ExternalProject_Get_Property(porter binary_dir)
set(PORTER_LIBS_DIR "${binary_dir}")
add_library(armadillo SHARED IMPORTED)
set_target_properties(armadillo PROPERTIES IMPORT_LOCATION "${ARMA_LIBS_DIR}")
message(STATUS "${ARMA_LIBS_DIR}")
add_library(porter_stemmer STATIC IMPORTED)
set_target_properties(porter_stemmer PROPERTIES IMPORT_LOCATION "${PORTER_LIBS_DIR}")
message(STATUS "${PORTER_LIBS_DIR}")
add_subdirectory("${SOURCE_DIR}/supplesearch")
add_subdirectory("${SOURCE_DIR}/apps")