blob: a3aa1a0b5c49be08ed6cc80315435a844c6cd8a1 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
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
|
if(TNG_BUILD_COMPRESSION_TESTS)
add_subdirectory(compression)
endif()
link_directories(${TNG_IO_BINARY_DIR}/src/lib)
set(EXAMPLE_FILES_DIR ${CMAKE_BINARY_DIR}/example_files/ CACHE STRING "Directory where to find input test files and save output files.")
configure_file(${TNG_IO_SOURCE_DIR}/include/tng_io_testing.h.in ${CMAKE_BINARY_DIR}/generated/tng_io_testing.h)
include_directories(${CMAKE_BINARY_DIR}/generated/)
if(TNG_BUILD_TEST)
add_executable(tng_testing tng_io_testing.c)
target_link_libraries(tng_testing tng_io)
if(UNIX)
target_link_libraries(tng_testing m)
endif()
if(HAVE_INTTYPES_H)
set_target_properties(tng_testing PROPERTIES COMPILE_DEFINITIONS USE_STD_INTTYPES_H=1)
endif()
set_property(TARGET tng_testing PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests)
endif()
if(TNG_BUILD_EXAMPLES)
if(OPENMP_FOUND)
add_executable(md_openmp md_openmp.c)
target_link_libraries(md_openmp tng_io ${OpenMP_LIBS})
if(UNIX)
target_link_libraries(md_openmp m)
endif()
set_property(TARGET md_openmp PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
add_executable(md_openmp_util md_openmp_util.c)
target_link_libraries(md_openmp_util tng_io ${OpenMP_LIBS})
if(UNIX)
target_link_libraries(md_openmp_util m)
endif()
set_property(TARGET md_openmp_util PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
endif()
add_executable(tng_io_read_pos tng_io_read_pos.c)
target_link_libraries(tng_io_read_pos tng_io)
if(UNIX)
target_link_libraries(tng_io_read_pos m)
endif()
set_property(TARGET tng_io_read_pos PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
add_executable(tng_io_read_pos_util tng_io_read_pos_util.c)
target_link_libraries(tng_io_read_pos_util tng_io)
if(UNIX)
target_link_libraries(tng_io_read_pos_util m)
endif()
set_property(TARGET tng_io_read_pos_util PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
add_executable(tng_parallel_read tng_parallel_read.c)
target_link_libraries(tng_parallel_read tng_io)
if(UNIX)
target_link_libraries(tng_parallel_read m)
endif()
set_property(TARGET tng_parallel_read PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
if(TNG_BUILD_FORTRAN)
# This does not work due to a bug in CMake. Remove lines below if no fortran compiler is found.
enable_language(Fortran OPTIONAL)
if(${CMAKE_Fortran_COMPILER_WORKS})
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
if (Fortran_COMPILER_NAME STREQUAL "gfortran")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer ${OpenMP_C_FLAGS} -std=legacy")
endif()
if(OPENMP_FOUND)
add_executable(md_openmp_f md_openmp.f)
target_link_libraries(md_openmp_f tng_io ${OpenMP_LIBS})
endif()
endif()
set_property(TARGET md_openmp_f PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
endif()
endif()
|