forked from STEllAR-GROUP/octotiger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
154 lines (132 loc) · 4.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Copyright (c) 2015 Thomas Heller
# Copyright (c) 2015 Dominic Marcello
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
project(octotiger CXX Fortran)
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
################################################################################
# options
################################################################################
option(OCTOTIGER_WITH_SILO "Enable support for Silo output" ON)
################################################################################
# Find required packages
################################################################################
find_package(HPX REQUIRED NO_CMAKE_PACKAGE_REGISTRY)
if (OCTOTIGER_WITH_SILO)
find_package(Silo REQUIRED)
endif()
include_directories(${HPX_INCLUDE_DIRS})
link_directories(${HPX_LIBRARY_DIR})
################################################################################
# Silo support
################################################################################
if (OCTOTIGER_WITH_SILO)
add_definitions(-DOCTOTIGER_HAVE_SILO)
else()
set(Silo_LIBRARY "" CACHE STRING "" FORCE)
set(Silo_INCLUDE_DIR "" CACHE STRING "" FORCE)
endif()
if(NOT MSVC)
include_directories(${CMAKE_SOURCE_DIR}/src ~/include ${Silo_INCLUDE_DIR})
set( CMAKE_CXX_FLAGS "-std=c++14 -g3 -O3 -march=native -Wno-attributes -Wno-deprecated-declarations" )
set( CMAKE_C_FLAGS "-g3 -O3 -march=native -Wno-attributes -Wno-deprecated-declarations" )
set( CMAKE_F_FLAGS "-g3 -O3 -march=native -Wno-attributes -Wno-deprecated-declarations" )
else()
# enable solution folders for MSVC
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DNOMINMAX)
include_directories(${CMAKE_SOURCE_DIR}/src)
hpx_add_compile_flag(-wd4244)
hpx_add_compile_flag(-wd4267)
hpx_add_compile_flag(-wd4800)
endif()
set(source_files)
set(dependencies)
enable_language(Fortran)
# We have to compile the Fortran sources into a separate static library as
# cmake does not support generating mixed C++/Fortran modules for MSVC.
if(MSVC)
set(CMAKE_Fortran_FLAGS "-DDOUBLE_PRECISION ${CMAKE_Fortran_FLAGS}")
add_hpx_library(octotiger_fortran
SHARED
SOURCES src/sedov3.f src/sedov3.def
FOLDER "Octotiger/Dependencies")
set_target_properties(octotiger_fortran_lib
PROPERTIES LINKER_LANGUAGE Fortran)
set(dependencies octotiger_fortran_lib)
# Special hackery to make everything work for Windows Intel compiler
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
# Make sure all Fortran symbols are lower case for Windows Intel ifort
# compiler.
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /names:lowercase /assume:underscore")
# Make sure the C++ linker will find the Fortran runtime libraries.
link_directories("$ENV{IFORT_COMPILER16}/compiler/lib/intel64_win")
endif()
else()
set(source_files ${source_files} src/sedov3.f)
set(dependencies ${Silo_LIBRARY})
endif()
# Octotiger executable
set(source_files ${source_files}
src/eos.cpp
src/node_server_actions_1.cpp
src/node_server_actions_2.cpp
src/node_server_actions_3.cpp
src/scf_data.cpp
src/exact_sod.cpp
src/sedov.c
src/profiler.cpp
src/geometry.cpp
src/grid.cpp
src/grid_fmm.cpp
src/grid_output.cpp
src/grid_scf.cpp
src/lane_emden.cpp
src/main.cpp
src/new.cpp
src/node_client.cpp
src/node_location.cpp
src/node_server.cpp
src/options.cpp
src/problem.cpp
src/real.cpp
src/roe.cpp
src/stack_trace.cpp
src/taylor.cpp
src/util.cpp
)
set(header_files
src/diagnostics.hpp
src/channel.hpp
src/defs.hpp
src/eos.hpp
src/future.hpp
src/geometry.hpp
src/grid.hpp
src/lane_emden.hpp
src/node_client.hpp
src/node_location.hpp
src/node_server.hpp
src/options.hpp
src/problem.hpp
src/real.hpp
src/util.hpp
src/roe.hpp
src/simd.hpp
src/space_vector.hpp
src/taylor.hpp
)
add_hpx_executable(
octotiger
DEPENDENCIES
${dependencies}
SOURCES
${source_files}
HEADERS
${header_files}
FOLDER "Octotiger"
)