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

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

Pietro Incardona's avatar
Pietro Incardona committed
5
6
7
8
if (CUDA_ON_CPU)
	add_definitions(-DCUDA_ON_CPU)
endif()

Pietro Incardona's avatar
Pietro Incardona committed
9
10
11
12
13
14
15
add_executable(io main.cpp 
				  MetaParser/MetaParser_unit_test.cpp 
				  HDF5_wr/HDF5_writer_cuda.cu 
				  ObjReader/ObjReader_unit_test.cpp  
				  ../../openfpm_vcluster/src/VCluster/VCluster.cpp 
				  ../../openfpm_devices/src/memory/CudaMemory.cu 
				  ../../openfpm_devices/src/memory/HeapMemory.cpp 
Pietro Incardona's avatar
Pietro Incardona committed
16
17
				  ../../openfpm_devices/src/memory/PtrMemory.cpp
				  ../../openfpm_devices/src/util/cudify_vars.cpp)
Pietro Incardona's avatar
Pietro Incardona committed
18

Pietro Incardona's avatar
Pietro Incardona committed
19
if ( CMAKE_COMPILER_IS_GNUCC )
Pietro Incardona's avatar
Pietro Incardona committed
20
    target_compile_options(io PRIVATE "-Wno-deprecated-declarations")
Pietro Incardona's avatar
Pietro Incardona committed
21
22
23
    if (TEST_COVERAGE)
        target_compile_options(io PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -fprofile-arcs -ftest-coverage>)
    endif()
Pietro Incardona's avatar
Pietro Incardona committed
24
endif()
Pietro Incardona's avatar
Pietro Incardona committed
25
26
27

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

Pietro Incardona's avatar
Pietro Incardona committed
28
if (CUDA_FOUND)
Pietro Incardona's avatar
Pietro Incardona committed
29
	target_compile_options(io PUBLIC $<$<COMPILE_LANGUAGE:CUDA>: ${WARNING_SUPPRESSION_AND_OPTION_NVCC} >)
30
	target_include_directories (io PUBLIC ${MPI_C_INCLUDE_DIRS})
Pietro Incardona's avatar
Pietro Incardona committed
31
32
33
34
35

   	if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 )
        	add_compile_options( "-fabi-version=6" )
    	endif()

Pietro Incardona's avatar
Pietro Incardona committed
36
        if (TEST_COVERAGE)
Pietro Incardona's avatar
Pietro Incardona committed
37
                target_compile_options(io PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -Xcompiler "-fprofile-arcs -ftest-coverage" >)
Pietro Incardona's avatar
Pietro Incardona committed
38
        endif()
Pietro Incardona's avatar
Pietro Incardona committed
39
endif()
Pietro Incardona's avatar
Pietro Incardona committed
40
41
42
43
44
45
46
47
48
49

target_include_directories (io PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_devices/src/)
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_vcluster/src/)
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_data/src/)
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../src/)
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (io PUBLIC ${HDF5_ROOT}/include)
target_include_directories (io PUBLIC ${TINYOBJLOADER_INCLUDE_DIRS} )
Pietro Incardona's avatar
Pietro Incardona committed
50
target_include_directories (io PUBLIC ${Boost_INCLUDE_DIRS})
Pietro Incardona's avatar
Pietro Incardona committed
51
target_include_directories (io PUBLIC ${OPENFPM_PDATA_DIR}/src)
Pietro Incardona's avatar
Pietro Incardona committed
52
target_include_directories (io PUBLIC ${ALPAKA_ROOT}/include)
Pietro Incardona's avatar
Pietro Incardona committed
53

Pietro Incardona's avatar
Pietro Incardona committed
54
55
56
57
if (PETSC_FOUND)
	target_include_directories(io PUBLIC ${PETSC_INCLUDES})
endif()

Pietro Incardona's avatar
Pietro Incardona committed
58
target_link_libraries(io ${Boost_LIBRARIES})
Pietro Incardona's avatar
Pietro Incardona committed
59
target_link_libraries(io ${HDF5_LIBRARIES})
60
target_link_libraries(io ${TINYOBJLOADER_LIBRARIES} )
Pietro Incardona's avatar
Pietro Incardona committed
61
62
63
if (PETSC_FOUND)
	target_link_libraries(io ${PETSC_LIBRARIES})
endif()
Pietro Incardona's avatar
Pietro Incardona committed
64
65
66
67
68
69
70

# 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(io PUBLIC cxx_std_11)
target_link_libraries(io ${MPI_C_LIBRARIES})

Pietro Incardona's avatar
Pietro Incardona committed
71
72
73
74
if (TEST_COVERAGE)
    target_link_libraries(io -lgcov)
endif()

Pietro Incardona's avatar
Pietro Incardona committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
install(FILES RawReader/RawReader.hpp 
	      RawReader/RawReader_unit_tests.hpp 
	      DESTINATION openfpm_io/include/RawReader )

install(FILES CSVWriter/csv_multiarray.hpp 
	      CSVWriter/CSVWriter.hpp 
	      CSVWriter/is_csv_writable.hpp
	      DESTINATION openfpm_io/include/CSVWriter/ )
      
install(FILES GraphMLWriter/GraphMLWriter.hpp 
	DESTINATION openfpm_io/include/GraphMLWriter )

install(FILES util/util.hpp util/GBoxes.hpp
	DESTINATION openfpm_io/include/util )

install(FILES VTKWriter/VTKWriter.hpp 
	      VTKWriter/byteswap_portable.hpp 
	      VTKWriter/VTKWriter_dist_graph.hpp 
	      VTKWriter/VTKWriter_graph.hpp 
	      VTKWriter/VTKWriter_point_set.hpp  
	      VTKWriter/VTKWriter_grids.hpp 
	      VTKWriter/VTKWriter_grids_st.hpp 
	      VTKWriter/VTKWriter_grids_util.hpp 
	      VTKWriter/VTKWriter_vector_box.hpp 
	      VTKWriter/is_vtk_writable.hpp
	DESTINATION openfpm_io/include/VTKWriter/ )

102
103
104
install(FILES MetaParser/MetaParser.hpp
	DESTINATION openfpm_io/include/MetaParser/ )

Pietro Incardona's avatar
Pietro Incardona committed
105
106
107
108
109
110
111
112
113
install(FILES HDF5_wr/HDF5_wr.hpp
	HDF5_wr/HDF5_writer.hpp 
	HDF5_wr/HDF5_writer_vd.hpp 
	HDF5_wr/HDF5_writer_gd.hpp 
	HDF5_wr/HDF5_reader_gd.hpp  
	HDF5_wr/HDF5_reader.hpp 
	HDF5_wr/HDF5_reader_vd.hpp
	DESTINATION openfpm_io/include/HDF5_wr)

Pietro Incardona's avatar
Pietro Incardona committed
114
install(FILES RawReader/InitGridWithPixel.hpp
Pietro Incardona's avatar
Pietro Incardona committed
115
	DESTINATION openfpm_io/include/RawReader/)
Pietro Incardona's avatar
Pietro Incardona committed
116

Pietro Incardona's avatar
Pietro Incardona committed
117
install(FILES util/PathsAndFiles.hpp
Pietro Incardona's avatar
Pietro Incardona committed
118
119
	DESTINATION openfpm_io/include/util)

Pietro Incardona's avatar
Pietro Incardona committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
install(FILES Plot/GoogleChart.hpp Plot/util.hpp
	DESTINATION openfpm_io/include/Plot )


#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()