forked from LLNL/Umpire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUmpireMacros.cmake
55 lines (47 loc) · 2.06 KB
/
UmpireMacros.cmake
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
##############################################################################
# Copyright (c) 2016-23, Lawrence Livermore National Security, LLC and Umpire
# project contributors. See the COPYRIGHT file for details.
#
# SPDX-License-Identifier: (MIT)
##############################################################################
macro(umpire_add_code_checks)
set(options)
set(singleValueArgs PREFIX RECURSIVE)
# Parse the arguments to the macro
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
set(_sources)
if (DEFINED arg_RECURSIVE AND arg_RECURSIVE)
file(GLOB_RECURSE _sources
"*.cpp" "*.hpp" "*.inl" "*.c" "*.h" "*.F" "*.f" "*.f90" "*.F90")
else ()
file(GLOB _sources
"*.cpp" "*.hpp" "*.inl" "*.c" "*.h" "*.F" "*.f" "*.f90" "*.F90")
endif ()
blt_add_code_checks(PREFIX ${arg_PREFIX}
SOURCES ${_sources}
CLANGFORMAT_CFG_FILE ${PROJECT_SOURCE_DIR}/.clang-format)
endif()
endmacro(umpire_add_code_checks)
##----------------------------------------------------------------------------
## umpire_add_test_with_mpi( NAME [name]
## COMMAND [command]
## NUM_MPI_TASKS [n])
##----------------------------------------------------------------------------
macro(umpire_add_test_with_mpi)
set(options)
set(singleValueArgs NAME NUM_MPI_TASKS)
set(multiValueArgs COMMAND)
## parse the arguments to the macro
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} )
if (UMPIRE_ENABLE_MPI)
blt_add_test( NAME ${arg_NAME}
COMMAND ${arg_COMMAND}
NUM_MPI_TASKS ${arg_NUM_MPI_TASKS})
else()
blt_add_test( NAME ${arg_NAME}
COMMAND ${arg_COMMAND})
endif()
endmacro(umpire_add_test_with_mpi)