CMakeLists.txt 4.11 KB
Newer Older
incardon's avatar
incardon committed
1
2
3
4
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

########################### Executables

incardon's avatar
incardon committed
5
6
7
8
9
if (CUDA_FOUND)
	set(CUDA_SOURCES ../../openfpm_devices/src/memory/CudaMemory.cu VCluster/cuda/VCluster_semantic_unit_cuda_tests.cu VCluster/cuda/VCluster_unit_tests.cu )
endif()

add_executable(vcluster_test main.cpp VCluster/VCluster.cpp  ../../openfpm_devices/src/memory/HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp ../../openfpm_devices/src/Memleak_check.cpp VCluster/VCluster_unit_tests.cpp VCluster/VCluster_semantic_unit_tests.cpp ${CUDA_SOURCES})
incardon's avatar
incardon committed
10

incardon's avatar
incardon committed
11
12
if ( CMAKE_COMPILER_IS_GNUCC )
    target_compile_options(vcluster_test PRIVATE "-Wno-deprecated-declarations")
13
    if (TEST_COVERAGE)
incardon's avatar
incardon committed
14
        target_compile_options(vcluster_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -fprofile-arcs -ftest-coverage>)
15
    endif()
incardon's avatar
incardon committed
16
17
endif()

incardon's avatar
incardon committed
18
19
20
21
add_library(vcluster STATIC VCluster/VCluster.cpp)

###########################

incardon's avatar
incardon committed
22
if(CUDA_FOUND)
incardon's avatar
incardon committed
23
	target_compile_options(vcluster_test PUBLIC $<$<COMPILE_LANGUAGE:CUDA>: ${WARNING_SUPPRESSION_AND_OPTION_NVCC} >)
incardon's avatar
incardon committed
24
	target_include_directories (vcluster_test PUBLIC ${MPI_C_INCLUDE_DIRS})
25
        if (TEST_COVERAGE)
incardon's avatar
incardon committed
26
                target_compile_options(vcluster_test PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -Xcompiler "-fprofile-arcs -ftest-coverage" >)
27
        endif()
incardon's avatar
incardon committed
28
endif()
incardon's avatar
incardon committed
29
30
31
32
33
34
35

target_include_directories (vcluster_test PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories (vcluster_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (vcluster_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_devices/src/)
target_include_directories (vcluster_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_vcluster/src/)
target_include_directories (vcluster_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_data/src/)
target_include_directories (vcluster_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
incardon's avatar
incardon committed
36
target_include_directories (vcluster_test PUBLIC ${Boost_INCLUDE_DIRS})
incardon's avatar
incardon committed
37
target_include_directories (vcluster_test PUBLIC ${PETSC_INCLUDES})
incardon's avatar
incardon committed
38

incardon's avatar
incardon committed
39
target_include_directories (vcluster PUBLIC ${CUDA_INCLUDE_DIRS})
incardon's avatar
incardon committed
40
target_include_directories (vcluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
incardon's avatar
incardon committed
41
target_include_directories (vcluster PUBLIC ${PETSC_INCLUDES})
incardon's avatar
incardon committed
42
43
44
target_include_directories (vcluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (vcluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_data/src/)
target_include_directories (vcluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_devices/src/)
incardon's avatar
incardon committed
45
target_include_directories (vcluster PUBLIC ${Boost_INCLUDE_DIRS})
incardon's avatar
incardon committed
46
47

target_link_libraries(vcluster_test ${Boost_LIBRARIES})
incardon's avatar
incardon committed
48
49
target_link_libraries(vcluster_test ${PETSC_LIBRARIES})

50
51
52
if (TEST_COVERAGE)
    target_link_libraries(vcluster_test -lgcov)
endif()
incardon's avatar
incardon committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

# Request that particles be built with -std=c++11
# As this is a public compile feature anything that links to particles
# will also build with -std=c++11
target_compile_features(vcluster_test PUBLIC cxx_std_11)
target_link_libraries(vcluster_test ${MPI_C_LIBRARIES})

install(TARGETS vcluster DESTINATION openfpm_vcluster/lib)
install(FILES MPI_wrapper/MPI_IallreduceW.hpp 
	      MPI_wrapper/MPI_IrecvW.hpp 
	      MPI_wrapper/MPI_IBcastW.hpp  
	      MPI_wrapper/MPI_IsendW.hpp 
	      MPI_wrapper/MPI_util.hpp 
	      MPI_wrapper/MPI_IAllGather.hpp
	      DESTINATION openfpm_vcluster/include/MPI_wrapper)

install(FILES VCluster/VCluster_base.hpp
	      VCluster/VCluster.hpp 
	      VCluster/VCluster_meta_function.hpp
	      DESTINATION openfpm_vcluster/include/VCluster )

install (FILES util/Vcluster_log.hpp
	 DESTINATION openfpm_vcluster/include/util)

#if(BUILD_TESTING)

#  add_executable(particle_test test.cu)

#  set_target_properties(particle_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
#  target_link_libraries(particle_test PRIVATE particles)

#  add_test(NAME particles_10k COMMAND particle_test 10000 )
#  add_test(NAME particles_256k COMMAND particle_test 256000 )

#  if(APPLE)
    # We need to add the default path to the driver (libcuda.dylib) as an rpath,
    # so that the static cuda runtime can find it at runtime.
    #    set_property(TARGET particle_test PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
    #  endif()
    #endif()