-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
99 lines (87 loc) · 4.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
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
###########################################################################
###########################################################################
############## CMake Configuration for compute library #################
###########################################################################
###########################################################################
###########################################################################
# CMake BOILER PLATE #
###########################################################################
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
enable_language( C CXX )
###########################################################################
# BUILD TYPES #
###########################################################################
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
option( PEREGRINE_NSCOMPILE "Compile compute with ns known" OFF )
if( PEREGRINE_NSCOMPILE )
add_compile_definitions( NSCOMPILE )
set( numSpecies "x" CACHE STRING "Number of species")
add_compile_definitions(NS=${numSpecies})
else()
remove_definitions( NS )
unset( numSpecies CACHE)
endif()
###########################################################################
# COMPILER OPTIONS #
###########################################################################
## INTEL SPECIFIC
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable=15009" CACHE STRING "" FORCE )
endif()
## GCC SPECIFIC
# if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" )
#
# endif()
## Add warnings
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" CACHE STRING "" FORCE )
###########################################################################
# BUILD PEREGRINE COMPUTE LIBRARY #
###########################################################################
project(compute LANGUAGES C CXX)
#Turn off lto junk
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF )
#Add all da files
file( GLOB compute_src ${PROJECT_SOURCE_DIR}/src/compute/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/advFlux/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/timeIntegration/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/boundaryConditions/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/diffFlux/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/thermo/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/subgrid/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/switches/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/transport/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/chemistry/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/utils/*.cpp
${PROJECT_SOURCE_DIR}/src/compute/pgkokkos/*.cpp)
include_directories(${PROJECT_SOURCE_DIR}/src/compute
${PROJECT_SOURCE_DIR}/src/compute/advFlux
${PROJECT_SOURCE_DIR}/src/compute/boundaryConditions
${PROJECT_SOURCE_DIR}/src/compute/chemistry
${PROJECT_SOURCE_DIR}/src/compute/diffFlux
${PROJECT_SOURCE_DIR}/src/compute/subgrid
${PROJECT_SOURCE_DIR}/src/compute/switches
${PROJECT_SOURCE_DIR}/src/compute/thermo
${PROJECT_SOURCE_DIR}/src/compute/timeIntegration
${PROJECT_SOURCE_DIR}/src/compute/transport
${PROJECT_SOURCE_DIR}/src/compute/utils)
#Make the bindings for python import
add_subdirectory(lib/pybind11)
pybind11_add_module(compute ${compute_src} ${PROJECT_SOURCE_DIR}/src/bindings.cpp)
#Link to Kokkos
Find_Package(Kokkos REQUIRED)
target_link_libraries(compute PUBLIC Kokkos::kokkos)
set_property(TARGET compute PROPERTY CXX_STANDARD 17)
#Set the install path
install(TARGETS compute LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/src/peregrinepy/)