-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (41 loc) · 1.58 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
cmake_minimum_required(VERSION 3.5)
project(DistGER)
set(CMAKE_BUILD_TYPE "Release")
set(DGER_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(WITH_TESTS "Build unit test programs" OFF)
include(distger.cmake)
if(NOT TARGET spdlog)
# Stand-alone build
find_package(spdlog REQUIRED)
endif()
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package(MPI REQUIRED)
if(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})
set(MPI_EXECUTABLE_SUFFIX .openmpi)
include_directories(${MPI_INCLUDE_PATH})
endif()
find_package(CUDA REQUIRED)
set(CMAKE_CUDA_COMPILER nvcc)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${MPI_CXX_COMPILE_FLAGS} -arch=sm_35 -ccbin mpic++ -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
# if(WITH_TESTS)
# enable_testing()
# include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/gtest/googletest/include")
# add_subdirectory(ext/gtest)
# link_directories(${CMAKE_BINARY_DIR}/lib)
# set(GTEST_LIBRARIES "gtest" "gtest_main")
# endif()
#use c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++0x -O3 -D USE_MKL -fPIE")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++0x ")
message("${CMAKE_CXX_FLAGS}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DGER_RUNTIME_OUTPUT_DIRECTORY})
include_directories(include)
include_directories(ext)
add_subdirectory(src)