-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
106 lines (80 loc) · 3.6 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.10)
# set the project name and version
project(codes LANGUAGES C CXX VERSION 2.0)
include(CMakePrintHelpers)
cmake_print_variables(CMAKE_CURRENT_SOURCE_DIR)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/")
cmake_print_variables(CMAKE_MODULE_PATH)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}" CACHE PATH "Where to install CODES")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
#prevent cmake from stripping the runtime path (important if shared libraries are imported)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(ROSS_PKG_CONFIG_PATH "" CACHE PATH "Where is ROSS PKG_CONFIG is installed?")
set(SWM_PKG_CONFIG_PATH "" CACHE PATH "Where is the SWM PKG_CONFIG installed?")
set(ARGOBOTS_PKG_CONFIG_PATH "" CACHE PATH "Where is argobots PKG_COPNFIG installed? Necessary for SWM")
set(DAMARIS_PKG_CONFIG_PATH "" CACHE PATH "Where is the damaris PKG_CONFIG installed?")
find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH} "${ROSS_PKG_CONFIG_PATH}:${SWM_PKG_CONFIG_PATH}:${ARGOBOTS_PKG_CONFIG_PATH}")
pkg_check_modules(ROSS REQUIRED IMPORTED_TARGET ross)
# MPI
include(SetupMPI)
if(MPI_C_FOUND)
include_directories(${MPI_C_INCLUDE_PATH})
list(APPEND CODES_EXTERNAL_LIBS ${MPI_C_LIBRARIES})
else(MPI_C_FOUND)
message("WARNING: Could not find MPI!")
message(" Either add an MPI compiler to your path (using modules)")
message(" Or force CMake to build using the correct compiler (`export CC=mpicc`)")
endif(MPI_C_FOUND)
## DUMPI
set(DUMPI_BUILD_PATH "" CACHE PATH "Directory where dumpi include and lib are installed")
find_library(DUMPI_LIB undumpi PATHS ${DUMPI_BUILD_PATH}/lib)
if(NOT DUMPI_LIB)
message(STATUS "Undumpi library not found, DUMPI trace workloads disabled")
unset(USE_DUMPI)
else(DUMPI_LIB)
message(STATUS "Undumpi library found ${DUMPI_LIB}")
set(DUMPI_INCLUDE "${DUMPI_BUILD_PATH}/include" CACHE PATH "Dumpi library include")
set(DUMPI_CFLAGS "-I${DUMPI_INCLUDE}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DUMPI_CFLAGS}")
add_definitions(-DUSE_DUMPI=1)
set(USE_DUMPI true)
endif()
## SWM
pkg_check_modules(SWM IMPORTED_TARGET swm)
if(NOT SWM_FOUND)
message(STATUS "SWM Library Not Found, Online workloads disabled")
else(SWM_FOUND)
message(STATUS "SWM Library Found: ${SWM_LIBRARIES}")
pkg_check_modules(ARGOBOTS REQUIRED IMPORTED_TARGET argobots)
if(NOT ARGOBOTS_FOUND)
message(STATUS "Argobots Library Not Found, Online workloads disabled")
else(ARGOBOTS_FOUND)
message(STATUS "Argobots Library Found: ${ARGOBOTS_LIBRARIES}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGOBOTS_CFLAGS} -I${ARGOBOTS_INCLUDE}")
pkg_get_variable(SWM_DATAROOTDIR swm datarootdir)
cmake_print_variables(SWM_DATAROOTDIR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SWM_CFLAGS} -I${SWM_INCLUDE}")
add_definitions(-DUSE_ONLINE=1)
set(USE_ONLINE true)
endif()
endif()
## RECORDER
option(USE_RECORDER "use recorder io workload" ON)
if(USE_RECORDER)
add_definitions(-DUSE_RECORDER=1)
endif()
## DARSHAN
## DAMARIS
# pkg_check_modules(DAMARIS IMPORTED_TARGET)
# if(NOT DAMARIS_FOUND)
# message(STATUS "DAMARIS Library not found, Damaris disabled")
# else(DAMARIS_FOUND)
# set(USE_DAMARIS true)
# endif()
cmake_print_variables(CMAKE_C_FLAGS)
add_subdirectory(src)
configure_file(codes_config.h.in codes_config.h)