CMakeLists.txt 4.74 KB
Newer Older
Kirill Terekhov's avatar
Kirill Terekhov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cmake_minimum_required (VERSION 2.6)
project (INMOST)
set(SOURCE solver.cpp 
           solver_ani.cpp 
           solver_petsc.cpp 
           partitioner.cpp 
           algorithm.cpp 
           geometry.cpp 
           iterator.cpp
           storage.cpp
           eset.cpp
           mesh_file.cpp
           timer.cpp
           face.cpp
           edge.cpp
           mesh.cpp
           node.cpp
           cell.cpp
           tag.cpp
           element.cpp
           mesh_parallel.cpp
           modify.cpp
Kirill Terekhov's avatar
Kirill Terekhov committed
23
24
25
           earray.cpp
           comparator.cpp
           autodiff.cpp)
Kirill Terekhov's avatar
Kirill Terekhov committed
26
27
28
29
30
31
32
33
34
35
set(HEADER inmost.h
           inmost_options_cmake.h
           inmost_common.h
           inmost_mesh.h
           inmost_solver.h
           inmost_partitioner.h
           inmost_autodiff.h
           container.hpp
           io.hpp
           solver_ilu2.hpp
Kirill Terekhov's avatar
Kirill Terekhov committed
36
           solver_ddpqiluc2.hpp
Kirill Terekhov's avatar
Kirill Terekhov committed
37
38
39
40
41
42
43
44
45
           solver_bcgsl.hpp
           solver_prototypes.hpp)




add_library(inmost STATIC ${SOURCE} ${HEADER})

option(USE_MPI "Compile with MPI support" ON)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
46
47
option(USE_MPI_P2P "Use MPI point to point functionality, may be faster with hardware support" ON)
option(USE_MPI_FILE "Use MPI extension to work with files, may save a lot of memory" ON)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
48
option(USE_MPI2 "Use MPI-2 extensions, useful if your MPI library warns you to use new functions" ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
option(USE_OMP "Compile with OpenMP support (experimental)" OFF)

option(USE_MESH "Compile mesh capabilities" ON)
option(USE_SOLVER "Compile solver capabilities" ON)
option(USE_PARTITIONER "Compile partitioner capabilities" ON)
option(USE_AUTODIFF "Compile automatic differentiation capabilities" ON)
option(TEST_FORTRAN_ANI3D "Test for fortran availibility to compile ANI3D lib" OFF)
option(COMPILE_EXAMPLES "Compile examples" OFF)
option(COMPILE_PROJECTS "Compile projects" OFF)
option(COMPILE_TESTS "Compile some tests" OFF)

option(USE_PARTITIONER_PARMETIS "Use ParMetis partitioner" OFF)
option(USE_PARTITIONER_ZOLTAN "Use Zoltan partitioner" OFF)
option(USE_SOLVER_PETSC "Use PETSc solver" OFF)
option(USE_AUTODIFF_OPENCL "Use OpenCL for automatic differentiation (under work)" OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
64
option(USE_AUTODIFF_ASMJIT "Use AsmJit for automatic differentiation" OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
option(USE_AUTODIFF_EXPRESSION_TEMPLATES "Use c++ expression templates for automatic differentiation" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_find/")


if(TEST_FORTRAN_ANI3D)
	add_subdirectory(ILU2)
	if(ANI3D_AVAILIBLE)
		option(USE_SOLVER_ANI "Compile with ANI3D sequential solvers" OFF)
	else()
		option(USE_SOLVER_ANI "Compile with ANI3D sequential solvers" ON)
	endif()
endif()


if(USE_MPI)
	find_package(MPI)
	if(NOT MPI_FOUND)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
83
		set(USE_MPI OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
84
85
86
		message("MPI NOT FOUND")
	else()
		include_directories(${MPI_INCLUDE_PATH})
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
87
		set(USE_MPI ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
88
89
90
91
92
93
94
95
96
97
98
		set_target_properties(inmost PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
		message("MPI FOUND")
	endif()
endif()

if(USE_OMP)
	find_package(OpenMP)
	if (OPENMP_FOUND)
		set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
		set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
	else()
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
99
		set(USE_OMP OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
100
101
102
103
104
105
	endif()
endif()

if(USE_PARTITIONER_PARMETIS)
	find_package(ParMETIS)
	if(NOT PARMETIS_FOUND)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
106
		set(USE_PARTITIONER_PARMETIS OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
107
108
109
		message("PARMETIS NOT FOUND")
	else()
		include_directories(${PARMETIS_INCLUDE_DIR})
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
110
		set(USE_PARTITIONER_PARMETIS ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
111
112
113
114
115
116
117
118
		message("PARMETIS FOUND")
	endif()
endif()


if(USE_PARTITIONER_ZOLTAN)
	find_package(ZOLTAN)
	if(NOT ZOLTAN_FOUND)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
119
		set(USE_PARTITIONER_ZOLTAN OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
120
121
122
		message("ZOLTAN NOT FOUND")
	else()
		include_directories(${ZOLTAN_INCLUDE_DIRS})
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
123
		set(USE_PARTITIONER_ZOLTAN ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
124
125
126
127
128
129
130
		message("ZOLTAN FOUND")
	endif()
endif()

if(USE_SOLVER_PETSC)
	find_package(PETSc)
	if(NOT PETSC_FOUND)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
131
		set(USE_SOLVER_PETSC OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
132
133
134
		message("PETSC NOT FOUND")
	else()
		include_directories(${PETSC_INCLUDES})
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
135
		set(USE_SOLVER_PETSC ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
136
137
138
139
140
141
142
143
144
145
		message("PETSC FOUND")
		add_definitions(${PETSC_DEFINITIONS})
		#message(${PETSC_LIBRARIES})
	endif()
endif()


if(USE_AUTODIFF_OPENCL)
	find_package(OpenCL)
	if(OPENCL_FOUND)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
146
		set(USE_AUTODIFF_OPENCL ON)
Kirill Terekhov's avatar
Kirill Terekhov committed
147
148
		include_directories(${OPENCL_INCLUDE_DIRS})
	else()
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
149
		set(USE_AUTODIFF_OPENCL OFF)
Kirill Terekhov's avatar
Kirill Terekhov committed
150
151
152
153
154
		message("OpenCL not found")
	endif()
endif()

if(USE_AUTODIFF_ASMJIT)
Kirill Terekhov's avatar
Fixes    
Kirill Terekhov committed
155
	set(ASMJIT_STATIC TRUE)
Kirill Terekhov's avatar
Kirill Terekhov committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	include("AsmJit/CMakeLists.txt")	
	include_directories("${ASMJIT_INC_DIR}/asmjit")
	target_link_libraries(inmost asmjit)
endif()

if(USE_AUTODIFF_EXPRESSION_TEMPLATES)
	if(MSVC)
		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
	endif()
endif()


configure_file("inmost_options_cmake.h" "${PROJECT_BINARY_DIR}/inmost_options.h")
include_directories("${PROJECT_BINARY_DIR}")

if(COMPILE_EXAMPLES)
add_subdirectory(examples)
endif(COMPILE_EXAMPLES)

if(COMPILE_PROJECTS)
add_subdirectory(projects)
endif(COMPILE_PROJECTS)

if(COMPILE_TESTS)
add_subdirectory(tests)
endif(COMPILE_TESTS)