2020-02-22 06:16:06 +08:00
|
|
|
cmake_minimum_required (VERSION 3.12)
|
2018-04-20 23:11:55 +08:00
|
|
|
project (HDF5_EXAMPLES C)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Define Sources
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
set (examples
|
2015-08-28 05:52:15 +08:00
|
|
|
h5_crtdat
|
|
|
|
h5_rdwt
|
|
|
|
h5_crtatt
|
|
|
|
h5_crtgrp
|
|
|
|
h5_crtgrpar
|
|
|
|
h5_crtgrpd
|
|
|
|
h5_cmprss
|
|
|
|
h5_extend
|
|
|
|
h5_subset
|
2010-05-14 00:01:50 +08:00
|
|
|
h5_write
|
|
|
|
h5_read
|
|
|
|
h5_extend_write
|
|
|
|
h5_chunk_read
|
|
|
|
h5_compound
|
|
|
|
h5_group
|
|
|
|
h5_select
|
|
|
|
h5_attribute
|
|
|
|
h5_mount
|
2019-07-17 00:15:43 +08:00
|
|
|
h5_ref_extern
|
|
|
|
h5_ref_compat
|
|
|
|
h5_reference_deprec
|
2010-05-14 00:01:50 +08:00
|
|
|
h5_drivers
|
2019-07-17 00:15:43 +08:00
|
|
|
h5_ref2reg_deprec
|
2010-05-14 00:01:50 +08:00
|
|
|
h5_extlink
|
|
|
|
h5_elink_unix2win
|
|
|
|
h5_shared_mesg
|
2020-06-28 11:14:52 +08:00
|
|
|
h5_debug_trace
|
2015-02-25 12:19:41 +08:00
|
|
|
h5_vds
|
2015-03-11 22:25:20 +08:00
|
|
|
h5_vds-exc
|
|
|
|
h5_vds-exclim
|
|
|
|
h5_vds-eiger
|
|
|
|
h5_vds-simpleIO
|
2015-03-25 06:56:24 +08:00
|
|
|
h5_vds-percival
|
2015-05-06 05:35:10 +08:00
|
|
|
h5_vds-percival-unlim
|
|
|
|
h5_vds-percival-unlim-maxmin
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
|
|
|
|
2022-02-25 00:04:59 +08:00
|
|
|
if (H5_HAVE_PARALLEL)
|
|
|
|
set (parallel_examples
|
|
|
|
ph5example
|
|
|
|
ph5_filtered_writes
|
|
|
|
ph5_filtered_writes_no_sel
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
foreach (example ${examples})
|
|
|
|
add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
|
2020-09-26 05:43:57 +08:00
|
|
|
target_include_directories (${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
2019-06-18 20:46:25 +08:00
|
|
|
if (NOT BUILD_SHARED_LIBS)
|
|
|
|
TARGET_C_PROPERTIES (${example} STATIC)
|
|
|
|
target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET})
|
|
|
|
else ()
|
|
|
|
TARGET_C_PROPERTIES (${example} SHARED)
|
|
|
|
target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2019-06-18 20:46:25 +08:00
|
|
|
set_target_properties (${example} PROPERTIES FOLDER examples)
|
2020-09-05 05:36:52 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add Target to clang-format
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
if (HDF5_ENABLE_FORMATTERS)
|
|
|
|
clang_format (HDF5_EXAMPLES_${example}_FORMAT ${example})
|
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
endforeach ()
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2014-03-21 05:18:30 +08:00
|
|
|
if (H5_HAVE_PARALLEL)
|
2022-02-25 00:04:59 +08:00
|
|
|
foreach (parallel_example ${parallel_examples})
|
|
|
|
add_executable (${parallel_example} ${HDF5_EXAMPLES_SOURCE_DIR}/${parallel_example}.c)
|
|
|
|
target_include_directories (${parallel_example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
|
|
|
if (NOT BUILD_SHARED_LIBS)
|
|
|
|
TARGET_C_PROPERTIES (${parallel_example} STATIC)
|
|
|
|
target_link_libraries (${parallel_example} PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
|
|
|
|
else ()
|
|
|
|
TARGET_C_PROPERTIES (${parallel_example} SHARED)
|
|
|
|
target_link_libraries (${parallel_example} PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
|
|
|
|
endif ()
|
|
|
|
set_target_properties (${parallel_example} PROPERTIES FOLDER examples)
|
2020-09-05 05:36:52 +08:00
|
|
|
|
2022-02-25 00:04:59 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add Target to clang-format
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
if (HDF5_ENABLE_FORMATTERS)
|
|
|
|
clang_format (HDF5_EXAMPLES_${parallel_example}_FORMAT ${parallel_example})
|
|
|
|
endif ()
|
|
|
|
endforeach ()
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2011-03-25 04:22:37 +08:00
|
|
|
|
2020-01-16 01:38:06 +08:00
|
|
|
if (BUILD_TESTING AND HDF5_TEST_EXAMPLES)
|
2014-03-12 05:14:57 +08:00
|
|
|
include (CMakeTests.cmake)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|