Newer
Older
cmake_minimum_required(VERSION 3.17)
project(futhark_mpi C)
set(CMAKE_C_STANDARD 11)
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(GCC_COMPILE_FLAGS "-Wall -Wextra -Wconversion -pedantic -fsanitize=address -fsanitize=undefined")
elseif (CMAKE_BUILD_TYPE MATCHES Release)
set(GCC_COMPILE_FLAGS "-O3")
endif ()
find_package(MPI REQUIRED)
include_directories(${MPI_C_INCLUDE_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMPILE_FLAGS}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/envelope.h ${CMAKE_CURRENT_SOURCE_DIR}/envelope.c
COMMAND futhark opencl ${CMAKE_CURRENT_SOURCE_DIR}/envelope.fut --library
DEPENDS envelope.fut
)
add_custom_target(futhark_opencl DEPENDS envelope.h envelope.c)
add_executable(futhark_mpi_tests tests/main.c chunk_info.h chunk_info.c dispatch.h dispatch.c envelope.h envelope.c)
add_dependencies(futhark_mpi_tests futhark_opencl)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_link_libraries(futhark_mpi_tests m ${MPI_C_LIBRARIES} "-framework OpenCL")
endif ()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_libraries(futhark_mpi_tests OpenCL m ${MPI_C_LIBRARIES})
endif ()