Newer
Older
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
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
# Packages are optional: if they are not present, certain code samples are not compiled
find_package(OpenMP) # Built-in in CMake
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/common.cmake)
# ==================================================================================================
if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_STRUCT)
endif()
set(NAME ${DWARF_PREFIX}_test)
# ==================================================================================================
# C++ compiler settings
find_package(Common)
select_compiler_flags(c_flags
GNU "-std=c99 -DUSE_OPENMP"
Intel "-restrict") # "-O3" is controlled by the CMAKE_BUILD_TYPE
set(C_FLAGS ${c_flags})
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(C_FLAGS "${C_FLAGS} -Wall -Wno-comment")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
link_libraries(m)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_executable (${NAME} src/kernels_c.c src/comm_mpi_c.c src/utils_c.c src/jacobi_c.c)
install(TARGETS ${NAME} DESTINATION bin)
else()
message("## Skipping '${NAME}_omp': no OpenMP support found")
dummy_install(${NAME} "OpenMP")
endif()
unset(NAME)
# ==================================================================================================