-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (61 loc) · 2.38 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
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) # version 3.8 adds cuda as a language, 3.9 has better VS integration
project(las)
set(LAS_MAJOR_VERSION 0)
set(LAS_MINOR_VERSION 1)
set(LAS_PATCH_VERSION 34)
set(LAS_VERSION ${LAS_MAJOR_VERSION}.${LAS_MINOR_VERSION}.${LAS_PATCH_VERSION})
enable_language(CXX)
enable_language(C)
# enable_language(CUDA) re-enable if we need to start compiling .cu kernels
option(BUILD_SPARSKIT "Build sparskit solver library" ON)
if(${BUILD_SPARSKIT})
enable_language(Fortran)
endif()
cmake_host_system_information(RESULT HOST QUERY HOSTNAME)
message(STATUS "Configuring to build on: ${HOST}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(ConfigPackageLocation lib/cmake/las)
if(${BUILD_SPARSKIT})
message(STATUS "Configuring sparskit")
add_subdirectory(sparskit)
endif()
option(WITH_KOKKOS "download an build kokkos las kernal" OFF)
if(${WITH_KOKKOS})
find_package(Git REQUIRED)
set(kokkos_dir ${CMAKE_CURRENT_SOURCE_DIR}/kokkos)
if(EXISTS ${kokkos_dir})
message(STATUS "Existing kokkos directory detected, attempting to `git pull` the newest version.")
execute_process(COMMAND ${GIT_EXECUTABLE} pull WORKING_DIRECTORY ${kokkos_dir})
else()
message(STATUS "No kokkos directory detected, attempting to `git clone` the project.")
execute_process(COMMAND ${GIT_EXECUTABLE} clone [email protected]:kokkos/kokkos.git ${CMAKE_CURRENT_SOURCE_DIR}/kokkos)
endif()
set(KOKKOS_FOUND TRUE)
add_subdirectory(kokkos)
endif()
message(STATUS "Configuring las")
add_subdirectory(src)
option(WITH_PUMI "build with pumi" ON)
if (${WITH_PUMI})
find_package(SCOREC REQUIRED)
message(STATUS "Configure SCOREC/core integration")
add_subdirectory(core)
endif()
option(BUILD_TESTS "Build available tests" ON)
if(BUILD_TESTS)
enable_testing()
message(STATUS "Configuring tests")
add_subdirectory(test)
endif(BUILD_TESTS)
option(WITH_PETSC "build petsc backend" OFF)
option(WITH_MPI "build with MPI" OFF)
option(WITH_CUDA "build with cuda support" OFF)
if (WITH_PETSC)
message(STATUS "Configure PETSc support")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PETSc REQUIRED IMPORTED_TARGET GLOBAL PETSc)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lasConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/lasConfig.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/lasConfig.cmake
DESTINATION ${ConfigPackageLocation})