-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
105 lines (84 loc) · 3.85 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
105
#
# This is the top level CMakeLists.txt file
# It should be located within master/NaluSandBox
# But not in the BUILD folder itself
#
###########################################################################################################
cmake_minimum_required (VERSION 2.8.11)
###########################################################################################################
#
# THESE PATHS MAY NEED TO BE CHANGED DEPENDING ON WHERE THEY ARE STORED!!!
#
SET(CMAKE_FIND_LIBRARY_PREFIXES lib)
SET(CMAKE_FIND_LIBRARY_SUFFIXES a)
MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}")
SET(CMAKE_PREFIX_PATH ${Trilinos_DIR} ${CMAKE_PREFIX_PATH})
SET(CMAKE_PREFIX_PATH ${Trilinos_PATH} ${CMAKE_PREFIX_PATH})
find_package(Trilinos REQUIRED)
#include(FindPackageHandleStandardArgs)
include_directories(${Trilinos_INCLUDE_DIRS})
include_directories(${Trilinos_TPL_INCLUDE_DIRS})
####################################### TRILINOS ##################################################
MESSAGE("\nFound Trilinos! Here are the details: ")
# Uncomment lines to view more details about Trilinos
MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}")
MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}")
MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")
MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")
MESSAGE(" Trilinos_BIN_DIRS = ${Trilinos_BIN_DIRS}")
MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")
MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}")
MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")
MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")
MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")
MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}")
MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")
MESSAGE(" Trilinos_CXX_COMPILER_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}")
MESSAGE("End of Trilinos details\n")
# Optional Installation helpers
SET (INSTALL_NALU_SAND_BOX FALSE)
IF (ENABLE_INSTALL)
SET (INSTALL_NALU_SAND_BOX TRUE)
ENDIF()
IF (INSTALL_NALU_SAND_BOX)
set(BINARY_INSTALL_DIR bin)
set(INCLUDE_INSTALL_DIR include)
set(LIB_INSTALL_DIR lib)
include(CMakePackageConfigHelpers)
ENDIF ()
MESSAGE("Setting and checking of compilers:")
SET(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER} )
SET(CMAKE_C_COMPILER ${Trilinos_C_COMPILER} )
SET(CMAKE_Fortran_COMPILER ${Trilinos_Fortran_COMPILER} )
IF (CMAKE_Fortran_COMPILER) # Enable Fortran if it is enabled in Trilinos.
ENABLE_LANGUAGE(Fortran)
ENDIF()
# Build Nalu_Unit as shared libraries if Trilinos was compiled that way
IF(Trilinos_BUILD_SHARED_LIBS)
SET(Nalu_Unit_LIBRARY_TYPE SHARED)
SET(BUILD_SHARED_LIBS ON)
MESSAGE("-- Building Nalu_Unit with shared libraries")
ELSE(Trilinos_BUILD_SHARED_LIBS)
SET(Nalu_Unit_LIBRARY_TYPE STATIC)
ENDIF(Trilinos_BUILD_SHARED_LIBS)
####################################### NALU_SAND_BOX ##########################
PROJECT(Nalu_Unit)
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${Trilinos_CXX_COMPILER_FLAGS})
SET(CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} ${Trilinos_Fortran_COMPILER_FLAGS})
MESSAGE("-- CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
MESSAGE("-- CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
file (GLOB SOURCE src/*.C src/*/*.C src/*/*/*.C src/*/*.F)
file (GLOB HEADER include/*.h include/*/*.h include/*/*/*.h)
include_directories (${CMAKE_SOURCE_DIR}/include)
add_library (nalu_sand_box ${SOURCE} ${HEADER})
target_link_libraries(nalu_sand_box ${Trilinos_LIBRARIES})
set(nalu_sand_box_ex_name "naluSandBoxX")
message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
if (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set (nalu_sand_box_ex_name "naluSandBoxXd")
add_definitions("-Wall -Werror")
message("Debug Build")
endif()
add_executable(${nalu_sand_box_ex_name} naluSandBox.C)
target_link_libraries(${nalu_sand_box_ex_name} nalu_sand_box)
MESSAGE("\nAnd CMake says...:")