Newer
Older
atuncer @raptor
committed
# Packages are optional: if they are not present, certain code samples are not compiled
Valeriu Codreanu
committed
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
atuncer @raptor
committed
find_package(OpenMP) # Built-in in CMake
find_package(MPI) # Built-in in CMake
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/common.cmake)
# ==================================================================================================
if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_montecarlo)
endif()
Valeriu Codreanu
committed
set(NAME1_OMP ${DWARF_PREFIX}_integral1_omp)
set(NAME1_SERIAL ${DWARF_PREFIX}_integral1_serial)
set(NAME1_MPI ${DWARF_PREFIX}_integral1_mpi)
set(NAME2_OMP ${DWARF_PREFIX}_integral2_omp)
set(NAME2_SERIAL ${DWARF_PREFIX}_integral2_serial)
set(NAME2_MPI ${DWARF_PREFIX}_integral2_mpi)
set(NAME3_OMP ${DWARF_PREFIX}_integral3_omp)
set(NAME3_SERIAL ${DWARF_PREFIX}_integral3_serial)
set(NAME3_MPI ${DWARF_PREFIX}_integral3_mpi)
atuncer @raptor
committed
# C compiler settings
find_package(Common)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
Valeriu Codreanu
committed
add_executable(${NAME1_OMP} integral1_openmp.c)
target_link_libraries(${NAME1_OMP} m)
install(TARGETS ${NAME1_OMP} DESTINATION bin)
message("** Enabling '${NAME1_OMP}': with OpenMP")
Valeriu Codreanu
committed
add_executable(${NAME2_OMP} integral2_openmp.c)
target_link_libraries(${NAME2_OMP} m)
install(TARGETS ${NAME2_OMP} DESTINATION bin)
message("** Enabling '${NAME2_OMP}': with OpenMP")
Valeriu Codreanu
committed
add_executable(${NAME3_OMP} integral3_openmp.c)
target_link_libraries(${NAME3_OMP} m)
install(TARGETS ${NAME3_OMP} DESTINATION bin)
message("** Enabling '${NAME3_OMP}': with OpenMP")
atuncer @raptor
committed
else()
message("## Skipping 'integral 1/2/3 advanced': no OpenMP support found")
Valeriu Codreanu
committed
# dummy_install(${NAME} "OpenMP")
atuncer @raptor
committed
endif()
if (MPI_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
Valeriu Codreanu
committed
add_executable(${NAME1_MPI} integral1_mpi.c)
target_link_libraries(${NAME1_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME1_MPI} DESTINATION bin)
message("** Enabling '${NAME1_MPI}': with MPI")
Valeriu Codreanu
committed
add_executable(${NAME2_MPI} integral2_mpi.c)
target_link_libraries(${NAME2_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME2_MPI} DESTINATION bin)
message("** Enabling '${NAME2_MPI}': with MPI")
Valeriu Codreanu
committed
add_executable(${NAME3_MPI} integral3_mpi.c)
target_link_libraries(${NAME3_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME3_MPI} DESTINATION bin)
message("** Enabling '${NAME3_MPI}': with MPI")
atuncer @raptor
committed
else()
message("## Skipping 'integral 1/2/3 advanced': no MPI support found")
Valeriu Codreanu
committed
# dummy_install(${NAME} "MPI")
atuncer @raptor
committed
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
# ==================================================================================================