-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathCMakeLists.txt
80 lines (64 loc) · 2.33 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
cmake_minimum_required(VERSION 2.8)
project(TIOGA CXX C Fortran)
option(BUILD_SHARED_LIBS "Build shared libraries (default: off)" on)
option(BUILD_TIOGA_EXE "Build tioga driver code (default: off)" on)
option(BUILD_GRIDGEN_EXE "Build grid generator code (default: off)" on)
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)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
# Ensure C++11 standard is enabled
if (CMAKE_VERSION VERSION_LESS "3.1")
set(CMAKE_CXX_FLAGS "-g -rdynamic -std=c++0x ${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS}")
endif()
# Set some default compilation settings for Fortran compiler
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS
"${CMAKE_Fortran_FLAGS} -fbounds-check -fbacktrace -fdefault-real-8 -ffree-line-length-none")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -double_size 128")
endif()
if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
if (BUILD_SHARED_LIBS)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif()
if (TIOGA_HAS_NODEGID)
add_definitions(-DTIOGA_HAS_NODEGID)
endif()
if (TIOGA_ENABLE_TIMERS)
add_definitions(-DTIOGA_ENABLE_TIMERS)
endif()
if (TIOGA_OUTPUT_STATS)
add_definitions(-DTIOGA_OUTPUT_STATS)
endif()
# Always build libtioga
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()
# 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)