-
Notifications
You must be signed in to change notification settings - Fork 97
/
CMakeLists.txt
80 lines (70 loc) · 2.86 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
71
72
73
74
75
76
77
78
79
80
# Copyright 2016 Quora, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.8)
project(qmf)
# settings
set(CMAKE_CXX_FLAGS "-std=c++14 -O3 -Wall -Wextra -Wuninitialized")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
set(CMAKE_FILES_DIRECTORY "build/")
# includes
include_directories(SYSTEM ${PROJECT_SOURCE_DIR})
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/qmf/third-party/gtest-1.7.0/fused-src)
# subdirectories
add_subdirectory(${PROJECT_SOURCE_DIR}/qmf/third-party/gtest-1.7.0/fused-src/gtest)
set(SOURCES
${PROJECT_SOURCE_DIR}/qmf/DatasetReader.cpp
${PROJECT_SOURCE_DIR}/qmf/Engine.cpp
${PROJECT_SOURCE_DIR}/qmf/Matrix.cpp
${PROJECT_SOURCE_DIR}/qmf/Vector.cpp
${PROJECT_SOURCE_DIR}/qmf/bpr/BPREngine.cpp
${PROJECT_SOURCE_DIR}/qmf/metrics/Metrics.cpp
${PROJECT_SOURCE_DIR}/qmf/metrics/MetricsEngine.cpp
${PROJECT_SOURCE_DIR}/qmf/metrics/MetricsManager.cpp
${PROJECT_SOURCE_DIR}/qmf/wals/WALSEngine.cpp
${PROJECT_SOURCE_DIR}/qmf/utils/IdIndex.cpp
${PROJECT_SOURCE_DIR}/qmf/utils/ThreadPool.cpp
${PROJECT_SOURCE_DIR}/qmf/utils/Util.cpp
)
add_library(qmf STATIC ${SOURCES})
target_link_libraries(qmf glog gflags lapack)
# binaries
macro(make_binary binary_source binary_name)
add_executable(${binary_name} qmf/${binary_source})
target_link_libraries(${binary_name} qmf pthread)
set_target_properties(${binary_name}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "bin/")
endmacro(make_binary)
make_binary(bpr.cpp bpr)
make_binary(wals.cpp wals)
# unit testing
macro(make_test test_source test_name)
add_executable(${test_name} qmf/test/${test_source})
target_link_libraries(${test_name} qmf gtest gtest_main lapack pthread)
set_target_properties(${test_name}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "test/")
add_test(${test_name} test/${test_name})
endmacro(make_test)
enable_testing()
make_test(BPREngineTest.cpp BPREngineTest)
make_test(DatasetReaderTest.cpp DatasetReaderTest)
make_test(EngineTest.cpp EngineTest)
make_test(FactorDataTest.cpp FactorDataTest)
make_test(MatrixTest.cpp MatrixTest)
make_test(MetricsTest.cpp MetricsTest)
make_test(MetricsManagerTest.cpp MetricsManagerTest)
make_test(ParallelExecutorTest.cpp ParallelExecutorTest)
make_test(ThreadPoolTest.cpp ThreadPoolTest)
make_test(UtilTest.cpp UtilTest)
make_test(VectorTest.cpp VectorTest)
make_test(WALSEngineTest.cpp WALSEngineTest)