-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (53 loc) · 1.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
cmake_minimum_required(VERSION 2.8)
project(GASGD)
set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -pthread -DNDEBUG")
set(struct
struct/Rating.h
struct/MPIStructs.h
struct/Object.h)
set(util
util/Base.h
util/FileUtil.h
util/Conf.h
util/RandomUtil.h
util/Monitor.h)
set(threadpool
boost/threadpool.hpp)
# find boost
find_package(Boost COMPONENTS thread program_options system filesystem)
if(NOT ${Boost_FOUND})
SET(BOOST_ROOT ~/local) # default
SET(Boost_NO_SYSTEM_PATHS ON) # force to use own build
find_package(Boost COMPONENTS thread program_options system filesystem)
endif(NOT ${Boost_FOUND})
if(Boost_FOUND)
message(STATUS "Boost found")
include_directories( ${Boost_INCLUDE_DIR})
link_libraries(${Boost_LIBRARIES})
endif(Boost_FOUND)
# find mpi
find_package(MPI REQUIRED)
if (MPI_FOUND)
message(STATUS "MPI found")
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
link_libraries(${MPI_LIBRARIES})
endif()
# find TBB
# Add FindTBB directory to CMake's module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindTBB/")
find_package(TBB REQUIRED)
if(TBB_FOUND)
message(STATUS "TBB found: " ${TBB_INCLUDE_DIRS})
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ltbb -ltbbmalloc")
include_directories(${TBB_INCLUDE_DIRS})
link_libraries(${TBB_LIBRARIES})
endif(TBB_FOUND)
add_library(lib SHARED ${util} ${struct} ${threadpool})
set_target_properties(lib PROPERTIES LINKER_LANGUAGE CXX)
add_executable(runGASGD GASGD.cpp Partitioner.h Data.h ASGD.h)
target_link_libraries(runGASGD lib)
target_link_libraries(runGASGD ${Boost_LIBRARIES})
target_link_libraries(runGASGD ${MPI_LIBRARIES})
target_link_libraries(runGASGD ${TBB_LIBRARIES})