-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
104 lines (89 loc) · 3.79 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
104
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(TIOGA CXX)
option(BUILD_SHARED_LIBS "Build shared libraries (default: off)" ON)
option(BUILD_TIOGA_EXE "Build tioga driver code (default: off)" OFF)
option(BUILD_GRIDGEN_EXE "Build grid generator code (default: off)" OFF)
option(TIOGA_HAS_NODEGID "Support node global IDs (default: on)" ON)
option(TIOGA_ENABLE_TIMERS "Track timing information for TIOGA (default: off)" OFF)
option(TIOGA_OUTPUT_STATS "Output statistics for TIOGA holecutting (default: off)" OFF)
option(TIOGA_ENABLE_CUDA "Enable CUDA support (default: off)" OFF)
option(TIOGA_ENABLE_HIP "Enable AMD HIP support (default: off)" OFF)
option(TIOGA_ENABLE_ARBORX "Enable ArborX (default: off)" OFF)
option(TIOGA_ENABLE_CLANG_TIDY "Compile with clang-tidy static analysis" OFF)
# CUDA specific options
#set(TIOGA_CUDA_SM "70" CACHE STRING "CUDA arch option")
#set(TIOGA_HIP_ARCH "gfx906,gfx908" CACHE STRING "HIP arch option")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(MPI REQUIRED)
if (TIOGA_ENABLE_ARBORX)
add_definitions(-DTIOGA_USE_ARBORX)
find_package(ArborX REQUIRED)
endif()
#if (TIOGA_ENABLE_CUDA)
# enable_language(CUDA)
# if (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "9.0")
# message(FATAL_ERROR "Your nvcc version is ${CMAKE_CUDA_COMPILER_VERSION}. "
# "Please use CUDA toolkit version 9.0 or newer")
# endif()
# set(TIOGA_CUDA_FLAGS "--Wno-deprecated-gpu-targets -m64")
# set(TIOGA_CUDA_ARCH_FLAGS "-gencode=arch=compute_${TIOGA_CUDA_SM},code=sm_${TIOGA_CUDA_SM} -expt-extended-lambda")
# set(CMAKE_CUDA_STANDARD 11)
# set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# set(CMAKE_CUDA_EXTENSIONS OFF)
#endif()
#if (TIOGA_ENABLE_HIP)
# if (NOT DEFINED HIP_PATH)
# set(HIP_PATH $ENV{HIP_PATH})
# endif()
# set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" "${CMAKE_MODULE_PATH}")
# find_package(HIP REQUIRED)
# if ("${HIP_COMPILER}" STREQUAL "hcc")
# message(FATAL_ERROR "TIOGA does not support deprecated HCC compiler. Use newer ROCm")
# endif()
# message(STATUS "HIP: ${HIP_VERSION}, platform = ${HIP_PLATFORM}, compiler = ${HIP_COMPILER}")
# set(TIOGA_HIP_ARCH_FLAGS "-m64 --amdgpu-target=${TIOGA_HIP_ARCH}")
#endif()
add_subdirectory(src)
# Optionally build driver exe and gridGen if the user requests it
if (BUILD_TIOGA_EXE)
add_subdirectory(driver)
endif()
if (BUILD_GRIDGEN_EXE)
add_subdirectory(gridGen)
endif()
if(TIOGA_ENABLE_CLANG_TIDY)
set(CLANG_TIDY_EXEC_NAME "clang-tidy" CACHE STRING "Name of the clang-tidy executable")
find_program(CLANG_TIDY_EXE NAMES "${CLANG_TIDY_EXEC_NAME}")
if(CLANG_TIDY_EXE)
message(STATUS "${CLANG_TIDY_EXEC_NAME} found: ${CLANG_TIDY_EXE}")
#find_program (CLANG_TIDY_CACHE_EXE NAMES "clang-tidy-cache")
#if(CLANG_TIDY_CACHE_EXE)
# message(STATUS "clang-tidy-cache found: ${CLANG_TIDY_CACHE_EXE}")
# set(CLANG_TIDY_EXE "${CLANG_TIDY_CACHE_PATH};${CLANG_TIDY_EXE}"
# CACHE STRING "A combined command to run clang-tidy with caching wrapper")
#endif()
else()
message(WARNING "${CLANG_TIDY_EXEC_NAME} not found.")
endif()
endif()
if(CLANG_TIDY_EXE)
set_target_properties(tioga
PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy")
endif()
# CMake installation configuration
install(EXPORT TIOGALibraries
DESTINATION lib/cmake/TIOGA
FILE TIOGALibraries.cmake)
# Create TIOGA config so that other codes can find TIOGA
include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR include/)
set(LIB_INSTALL_DIR lib/)
configure_package_config_file(
cmake/TIOGAConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/TIOGAConfig.cmake
INSTALL_DESTINATION lib/cmake/TIOGA
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TIOGAConfig.cmake
DESTINATION lib/cmake/TIOGA)