-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (55 loc) · 1.93 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(project)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_LIST_DIR}/cmake)
set (CMAKE_CXX_STANDARD 11)
if( ${CMAKE_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
Message( FATAL_ERROR "Source and build directories are the same!")
endif()
# find_package(Doxygen REQUIRED)
find_package(OpenMP REQUIRED)
find_package(MPI REQUIRED)
find_package(BLAS REQUIRED) # Basic Linear Algebra Subprogram
find_package(LAPACK REQUIRED) # Linear Algebra Package
find_package(LAPACKE REQUIRED) # Eigen muss mit der Lineare Algebra umgehen, Schnitstelle
find_package(ZLIB REQUIRED)
set(CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS}
"-Wall -O0 -g -ffast-math -fopenmp"
)
file(GLOB SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
set(PROJECT_SOURCES
${SOURCES}
)
set(PROJECT_INCLUDES
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/lib/
${PROJECT_SOURCE_DIR}/lib/include
${PROJECT_SOURCE_DIR}/lib/Eigen/
${PROJECT_SOURCE_DIR}/lib/cnpy/
${MPI_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS}
${LAPACKE_INCLUDE_DIRS_DEP} # already done in FindLAPACKE.cmake
)
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/cnpy/)
include_directories(${PROJECT_INCLUDES})
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
target_link_libraries(${PROJECT_NAME}
${MPI_LIBRARIES}
${ZLIB_LIBRARIES}
${LAPACKE_LIBRARIES_DEP}
OpenMP::OpenMP_CXX
cnpy
)
set_property(DIRECTORY PROPERTY ADDITIONAL_CLEAN_FILES
"${PROJECT_SOURCE_DIR}/build/CMakeFiles"
"${PROJECT_SOURCE_DIR}/build/CMakeCache.txt"
"${PROJECT_SOURCE_DIR}/build/Makefile"
"${PROJECT_SOURCE_DIR}/build/cmake_install.cmake"
"${PROJECT_SOURCE_DIR}/build/lib"
# "${PROJECT_SOURCE_DIR}/build/compile_commands.json"
)
include(run)
include(gdb)