diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-04 21:36:52 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-04 21:36:52 (GMT) |
commit | 30c7264c2ca0f169b099b6ebbf13c5bd71652ebc (patch) | |
tree | 1a92edfa20e5e6dfe467b002227220c7f9d61cfd | |
parent | 6b71d6dc9453e8f94ac82732496ee59ca6495587 (diff) | |
download | hdf5-30c7264c2ca0f169b099b6ebbf13c5bd71652ebc.zip hdf5-30c7264c2ca0f169b099b6ebbf13c5bd71652ebc.tar.gz hdf5-30c7264c2ca0f169b099b6ebbf13c5bd71652ebc.tar.bz2 |
CMake and script changes for clang-format
55 files changed, 1335 insertions, 45 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f19fdef --- /dev/null +++ b/.clang-format @@ -0,0 +1,162 @@ +--- +Language: Cpp +#BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: true +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: AllDefinitions +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Stroustrup +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: true +BreakStringLiterals: true +ColumnLimit: 110 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 3 + SortPriority: 0 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 4 + SortPriority: 0 + - Regex: '.*' + Priority: 0 + SortPriority: 0 + - Regex: '^H5*.*' + Priority: 1 + SortPriority: 0 + - Regex: 'private.*' + Priority: 2 + SortPriority: 0 +IncludeIsMainRegex: '(public)?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: true +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +StatementMacros: + - FUNC_ENTER_API + - FUNC_LEAVE_API + - FUNC_ENTER_NOAPI_NOINIT_NOERR + - FUNC_LEAVE_NOAPI + - H5_BEGIN_TAG + - HGOTO_DONE_TAG + - H5_END_TAG + - HSYS_DONE_ERROR + - HSYS_GOTO_ERROR + - HDONE_ERROR + - HERROR + - H5_LEAVE + - H5E_PRINTF + - H5E_THROW + - HGOTO_DONE + - HGOTO_ERROR + - HMPI_ERROR + - HMPI_DONE_ERROR + - HMPI_GOTO_ERROR + - H5_GCC_DIAG_OFF + - H5_GCC_DIAG_ON +TabWidth: 8 +UseCRLF: false +UseTab: Never +... + diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml new file mode 100644 index 0000000..e18c5b1 --- /dev/null +++ b/.github/workflows/clang-format-check.yml @@ -0,0 +1,16 @@ +name: clang-format Check +on: [push] +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run clang-format style check for C programs. + uses: DoozyX/clang-format-lint-action@v0.8 + with: + source: '.' + extensions: 'c,h,cpp' + clangFormatVersion: 10 + style: file + exclude: './config ./hl/src/H5LTanalyze.c' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60e21c7..936a826 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: strategy: # fail-fast: false matrix: - name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "macOS Latest Clang"] + name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC"] include: - name: "Windows Latest MSVC" artifact: "Windows-MSVC.tar.xz" @@ -27,16 +27,47 @@ jobs: artifact: "Linux.tar.xz" os: ubuntu-latest build_type: "Release" + cpp: ON fortran: OFF + parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" - name: "macOS Latest Clang" artifact: "macOS.tar.xz" os: macos-latest build_type: "Release" + cpp: ON fortran: OFF + parallel: OFF toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" + - name: "Ubuntu Debug GCC" + artifact: "LinuxDBG.tar.xz" + os: ubuntu-latest + build_type: "Debug" + cpp: ON + fortran: OFF + parallel: OFF + toolchain: "config/toolchain/GCC.cmake" + generator: "-G Ninja" + - name: "Ubuntu Autotools GCC" + artifact: "Linux.tar.xz" + os: ubuntu-latest + build_type: "Release" + cpp: enable + fortran: enable + parallel: disable + toolchain: "" + generator: "autogen" +# - name: "Ubuntu Parallel GCC" +# artifact: "LinuxPar.tar.xz" +# os: ubuntu-latest +# build_type: "Release" +# cpp: OFF +# fortran: OFF +# parallel: ON +# toolchain: "config/toolchain/GCC.cmake" +# generator: "-G Ninja" name: ${{ matrix.name }} # The type of runner that the job will run on @@ -47,6 +78,9 @@ jobs: - name: Install Dependencies (Linux) run: sudo apt-get install ninja-build if: matrix.os == 'ubuntu-latest' + - name: Install Autotools Dependencies (Linux) + run: sudo apt-get install automake autoconf libtool libtool-bin + if: matrix.generator == 'autogen' - name: Install Dependencies (Windows) run: choco install ninja if: matrix.os == 'windows-latest' @@ -64,17 +98,39 @@ jobs: - name: Get Sources uses: actions/checkout@v2 + - name: Autotools Configure + if: matrix.generator == 'autogen' + run: | + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure --enable-shared --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --enable-java + shell: bash + - name: Configure + if: matrix.generator != 'autogen' run: | mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=ON $GITHUB_WORKSPACE + cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} -DHDF5_BUILD_CPP_LIB:BOOL=${{ matrix.cpp }} -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=ON $GITHUB_WORKSPACE shell: bash + - name: Autotools Build + if: matrix.generator == 'autogen' + run: make + working-directory: ${{ runner.workspace }}/build + - name: Build + if: matrix.generator != 'autogen' run: cmake --build . --config ${{ matrix.build_type }} working-directory: ${{ runner.workspace }}/build + - name: Autotools Test + if: matrix.generator == 'autogen' + run: make check + working-directory: ${{ runner.workspace }}/build + - name: Test + if: matrix.generator != 'autogen' run: ctest --build . -C ${{ matrix.build_type }} -V working-directory: ${{ runner.workspace }}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b87a4..1d87c03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -497,6 +497,9 @@ endif () if (HDF5_ENABLE_SANITIZERS) include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake) endif () +if (HDF5_ENABLE_FORMATTERS) + include (${HDF5_SOURCE_DIR}/config/sanitizer/formatting.cmake) +endif () #----------------------------------------------------------------------------- # Option to use code coverage @@ -71,6 +71,8 @@ ./bin/deploy ./bin/distdep ./bin/errors _DO_NOT_DISTRIBUTE_ +./bin/format_source +./bin/format_source_patch ./bin/genparser ./bin/gcov_script _DO_NOT_DISTRIBUTE_ ./bin/h5cc.in diff --git a/bin/format_source b/bin/format_source new file mode 100644 index 0000000..b0b695c --- /dev/null +++ b/bin/format_source @@ -0,0 +1,6 @@ +#!/bin/bash +find . -type d \( -path ./config \) -prune \ + -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + | xargs clang-format -style=file -i -fallback-style=none + +exit 0
\ No newline at end of file diff --git a/bin/format_source_patch b/bin/format_source_patch new file mode 100644 index 0000000..4c531ea --- /dev/null +++ b/bin/format_source_patch @@ -0,0 +1,14 @@ +#!/bin/bash +find . -type d \( -path ./config \) -prune \ + -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + | xargs clang-format -style=file -i -fallback-style=none + +git diff > clang_format.patch + +# Delete if 0 size +if [ ! -s clang_format.patch ] +then + rm clang_format.patch +fi + +exit 0
\ No newline at end of file diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index 890d22d..b56014f 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -48,6 +48,13 @@ foreach (example ${examples}) endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_CPP_EXAMPLES_${example}_FORMAT cpp_ex_${example}) + endif () endforeach () foreach (example ${tutr_examples}) @@ -66,6 +73,13 @@ foreach (example ${tutr_examples}) endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_CPP_EXAMPLES_${example}_FORMAT cpp_ex_${example}) + endif () endforeach () if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 058f457..0b4473f 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -129,6 +129,17 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_CPP_SRC_FORMAT ${HDF5_CPP_LIB_TARGET}) + else () + clang_format (HDF5_CPP_SRC_FORMAT ${HDF5_CPP_LIBSH_TARGET}) + endif () +endif () + +#----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- install ( diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index ca2295e..b911424 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -37,7 +37,7 @@ set (CPP_TEST_SOURCES set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) -add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) +add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ${HDF5_CPP_TEST_SOURCE_DIR}/h5cpputil.h) target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(cpp_testhdf5 PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(cpp_testhdf5 @@ -57,6 +57,13 @@ else () endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_CPP_TEST_cpp_testhdf5_FORMAT cpp_testhdf5) +endif () + if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/config/sanitizer/formatting.cmake b/config/sanitizer/formatting.cmake new file mode 100644 index 0000000..677a69a --- /dev/null +++ b/config/sanitizer/formatting.cmake @@ -0,0 +1,144 @@ +# +# Copyright (C) 2019 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +# +# clang-format +# +find_program(CLANG_FORMAT_EXE "clang-format") +mark_as_advanced(FORCE CLANG_FORMAT_EXE) +if(CLANG_FORMAT_EXE) + message(STATUS "clang-format found: ${CLANG_FORMAT_EXE}") +else() + message(STATUS "clang-format not found!") +endif() + +# Generates a 'format' target using a custom name, files, and include +# directories all being parameters. +# +# Do note that in order for sources to be inherited properly, the source paths +# must be reachable from where the macro is called, or otherwise require a full +# path for proper inheritance. +# +# ~~~ +# Required: +# TARGET_NAME - The name of the target to create. +# +# Optional: ARGN - The list of targets OR files to format. Relative and absolute +# paths are accepted. +# ~~~ +function(clang_format TARGET_NAME) + if(CLANG_FORMAT_EXE) + set(FORMAT_FILES) + # Check through the ARGN's, determine existent files + foreach(item IN LISTS ARGN) + if(TARGET ${item}) + # If the item is a target, then we'll attempt to grab the associated + # source files from it. + get_target_property(_TARGET_TYPE ${item} TYPE) + if(NOT + _TARGET_TYPE + STREQUAL + "INTERFACE_LIBRARY") + get_property( + _TEMP + TARGET ${item} + PROPERTY SOURCES) + foreach(iter IN LISTS _TEMP) + if(EXISTS ${iter}) + set(FORMAT_FILES ${FORMAT_FILES} ${iter}) + endif() + endforeach() + endif() + elseif(EXISTS ${item}) + # Check if it's a full file path + set(FORMAT_FILES ${FORMAT_FILES} ${item}) + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${item}) + # Check if it's based on the current source dir + set(FORMAT_FILES ${FORMAT_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/${item}) + endif() + endforeach() + + # Make the target + if(FORMAT_FILES) + if(TARGET ${TARGET_NAME}) + message( + ERROR + "Cannot create clang-format target '${TARGET_NAME}', already exists.") + else() + add_custom_target(${TARGET_NAME} COMMAND ${CLANG_FORMAT_EXE} -i -style=file ${FORMAT_FILES}) + + if(NOT TARGET format) + add_custom_target(format) + endif() + + add_dependencies(format ${TARGET_NAME}) + endif() + endif() + + endif() +endfunction() + +# +# cmake-format +# +find_program(CMAKE_FORMAT_EXE "cmake-format") +mark_as_advanced(FORCE CMAKE_FORMAT_EXE) +if(CMAKE_FORMAT_EXE) + message(STATUS "cmake-format found: ${CMAKE_FORMAT_EXE}") +else() + message(STATUS "cmake-format not found!") +endif() + +# When called, this function will call 'cmake-format' program on all listed +# files (if both the program and the files exist and are found) +# ~~~ +# Required: +# TARGET_NAME - The name of the target to create. +# +# Optional: +# ARGN - Any arguments passed in will be considered as 'files' to perform the +# formatting on. Any items that are not files will be ignored. Both relative and +# absolute paths are accepted. +# ~~~ +function(cmake_format TARGET_NAME) + if(CMAKE_FORMAT_EXE) + set(FORMAT_FILES) + # Determine files that exist + foreach(iter IN LISTS ARGN) + if(EXISTS ${iter}) + set(FORMAT_FILES ${FORMAT_FILES} ${iter}) + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${iter}) + set(FORMAT_FILES ${FORMAT_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/${iter}) + endif() + endforeach() + + # Generate target + if(FORMAT_FILES) + if(TARGET ${TARGET_NAME}) + message( + ERROR + "Cannot create cmake-format target '${TARGET_NAME}', already exists.") + else() + add_custom_target(${TARGET_NAME} COMMAND ${CMAKE_FORMAT_EXE} -i + ${FORMAT_FILES}) + + if(NOT TARGET cmake-format) + add_custom_target(cmake-format) + endif() + add_dependencies(cmake-format ${TARGET_NAME}) + endif() + endif() + endif() +endfunction() diff --git a/config/sanitizer/tools.cmake b/config/sanitizer/tools.cmake index a44022f..2f73cce 100644 --- a/config/sanitizer/tools.cmake +++ b/config/sanitizer/tools.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# Copyright (C) 2018-2020 by George Cave - gcave@stablecoder.ca # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -29,7 +29,7 @@ endmacro() # used as the options set. macro(include_what_you_use) if(IWYU AND IWYU_EXE) - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_EXE};${IWYU_STRING}") + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXE} ${ARGN}) endif() endmacro() @@ -37,11 +37,12 @@ endmacro() # options set. macro(cppcheck) if(CPPCHECK AND CPPCHECK_EXE) - set(CMAKE_CXX_CPPCHECK "${CPPCHECK_EXE};${CPPCHECK_STRING}") + set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXE} ${ARGN}) endif() endmacro() find_program(CLANG_TIDY_EXE NAMES "clang-tidy") +mark_as_advanced(FORCE CLANG_TIDY_EXE) if(CLANG_TIDY_EXE) message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") if(NOT CLANG_TIDY) @@ -63,6 +64,7 @@ else() endif() find_program(IWYU_EXE NAMES "include-what-you-use") +mark_as_advanced(FORCE IWYU_EXE) if(IWYU_EXE) message(STATUS "include-what-you-use found: ${IWYU_EXE}") if(NOT IWYU) @@ -85,6 +87,7 @@ else() endif() find_program(CPPCHECK_EXE NAMES "cppcheck") +mark_as_advanced(FORCE CPPCHECK_EXE) if(CPPCHECK_EXE) message(STATUS "cppcheck found: ${CPPCHECK_EXE}") if(CPPECHECK) @@ -108,4 +111,4 @@ else() set(CMAKE_CXX_CPPCHECK "" CACHE STRING "" FORCE) # delete it -endif() +endif()
\ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 527b11f..b7e7cf0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -53,6 +53,13 @@ foreach (example ${examples}) target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET}) endif () set_target_properties (${example} PROPERTIES FOLDER examples) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_EXAMPLES_${example}_FORMAT ${example}) + endif () endforeach () if (H5_HAVE_PARALLEL) @@ -66,6 +73,13 @@ if (H5_HAVE_PARALLEL) target_link_libraries (ph5example PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) endif () set_target_properties (ph5example PROPERTIES FOLDER examples) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_EXAMPLES_ph5example_FORMAT ph5example) + endif () endif () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index b1add54..481a4d2 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -180,6 +180,29 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_F90_C_SRC_FORMAT + ${HDF5_F90_C_LIB_TARGET} + ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h + ) + else () + clang_format (HDF5_F90_C_SRC_FORMAT + ${HDF5_F90_C_LIBSH_TARGET} + ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h + ) + endif () +endif () + +#----------------------------------------------------------------------------- # Fortran Modules #----------------------------------------------------------------------------- set (f90_F_GEN_SOURCES diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index ff7001b..dadf644 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -42,7 +42,7 @@ endif () # Add Test Lib #----------------------------------------------------------------------------- if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) + add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c t.h) set_source_files_properties (t.c PROPERTIES LANGUAGE C) target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" @@ -60,7 +60,7 @@ if (NOT BUILD_SHARED_LIBS) LINKER_LANGUAGE C ) else () - add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) + add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c t.h) target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" @@ -79,6 +79,17 @@ else () ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT BUILD_SHARED_LIBS) + clang_format (HDF5_FORTRAN_TESTS_FORMAT ${HDF5_F90_C_TEST_LIB_TARGET}) + else () + clang_format (HDF5_FORTRAN_TESTS_FORMAT ${HDF5_F90_C_TEST_LIBSH_TARGET}) + endif () +endif () + if (NOT BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 70c458d..083c60e 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -18,8 +18,6 @@ if (HDF5_BUILD_EXAMPLES) endif () #-- Build the Unit testing if requested -if (NOT HDF5_EXTERNALLY_CONFIGURED) - if (BUILD_TESTING AND HDF5_TEST_SERIAL) - add_subdirectory (test) - endif () +if (BUILD_TESTING AND HDF5_TEST_SERIAL) + add_subdirectory (test) endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 22c9973..037bf8f 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -23,6 +23,13 @@ else () endif () set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_CPP_EXAMPLES_FORMAT ptExampleFL) +endif () + if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index fbabc86..e4678fd 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -9,7 +9,7 @@ set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) if (NOT ONLY_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) + add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES} ${HDF5_HL_CPP_HDRS}) target_include_directories (${HDF5_HL_CPP_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" @@ -40,6 +40,17 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_CPP_SRC_FORMAT ${HDF5_HL_CPP_LIB_TARGET}) + else () + clang_format (HDF5_HL_CPP_SRC_FORMAT ${HDF5_HL_CPP_LIBSH_TARGET}) + endif () +endif () + +#----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- install ( diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 5c224a8..246a670 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -25,6 +25,13 @@ else () endif () set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_CPP_TEST_FORMAT hl_ptableTest) +endif () + if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 1707ae9..9bce861 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -37,6 +37,13 @@ foreach (example ${examples}) target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_EXAMPLES_${example}_FORMAT hl_ex_${example}) + endif () endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index d682d5f..789d2fa 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -15,7 +15,7 @@ endif () # Generate the H5LT and H5TB REAL APIs #----------------------------------------------------------------------------- -add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 ) +add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90) target_include_directories (H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) @@ -54,7 +54,7 @@ set (HDF5_HL_F90_C_SOURCES ) set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) -set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) +set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.h) if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) @@ -93,6 +93,17 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_F90_C_SRC_FORMAT ${HDF5_HL_F90_C_LIB_TARGET}) + else () + clang_format (HDF5_HL_F90_C_SRC_FORMAT ${HDF5_HL_F90_C_LIBSH_TARGET}) + endif () +endif () + +#----------------------------------------------------------------------------- # Fortran Modules #----------------------------------------------------------------------------- set (HDF5_HL_F90_F_BASE_SOURCES diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index c4ddf19..e73c470 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -30,6 +30,14 @@ set (HL_HEADERS set (HL_PRIVATE_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5DSprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5IMprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5PTprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5HLprivate2.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5PTprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5TBprivate.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5LDprivate.h ) if (NOT ONLY_SHARED_LIBS) @@ -64,6 +72,17 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_SRC_FORMAT ${HDF5_HL_LIB_TARGET}) + else () + clang_format (HDF5_HL_SRC_FORMAT ${HDF5_HL_LIBSH_TARGET}) + endif () +endif () + +#----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- install ( diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 6349bb3..2fc0c87 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -37,6 +37,13 @@ macro (HL_ADD_EXE hl_name) ) endif () set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TEST_${hl_name}_FORMAT hl_${hl_name}) + endif () endmacro () HL_ADD_EXE (test_lite) @@ -69,6 +76,13 @@ else () endif () set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TEST_hl_test_packet_FORMAT hl_test_packet) +endif () + # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. # It should only be run during development when new test files are needed @@ -85,6 +99,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) ) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TEST_hl_gen_test_ds_FORMAT hl_gen_test_ds) + endif () + add_executable (hl_gen_test_ld gen_test_ld.c) target_compile_options(hl_gen_test_ld PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -95,6 +116,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) ${HDF5_LIB_TARGET} ) set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TEST_hl_gen_test_ld_FORMAT hl_gen_test_ld) + endif () endif () if (HDF5_TEST_SERIAL) diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 0b895a3..e165b54 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -40,6 +40,17 @@ if (BUILD_SHARED_LIBS) ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_TOOLS_GIF2H5_FORMAT gif2h5) + else () + clang_format (HDF5_HL_TOOLS_GIF2H5_FORMAT gif2h5-shared) + endif () +endif () + #-- Add h52gif program set (hdf2gif_SOURCES ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c @@ -71,6 +82,17 @@ if (BUILD_SHARED_LIBS) ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_TOOLS_H52GIF_FORMAT h52gif) + else () + clang_format (HDF5_HL_TOOLS_H52GIF_FORMAT h52gif-shared) + endif () +endif () + if (BUILD_TESTING AND HDF5_TEST_SERIAL) # -------------------------------------------------------------------- # This executable can generate the actual test files - Currently not @@ -84,6 +106,13 @@ if (BUILD_TESTING AND HDF5_TEST_SERIAL) target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TOOLS_hl_h52gifgentest_FORMAT hl_h52gifgentest) + endif () + # add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_h52gifgentest>) endif () diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index c5ad976..7e04329 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_HL_TOOLS_H5WATCH_FORMAT h5watch) + else () + clang_format (HDF5_HL_TOOLS_H5WATCH_FORMAT h5watch-shared) + endif () +endif () + if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) #-- Add swmr_check_compat_vfd program set (hl_swmr_check_compat_vfd_SOURCES @@ -45,6 +56,13 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) endif () set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TOOLS_H5WATCH_hl_swmr_check_compat_vfd_FORMAT hl_swmr_check_compat_vfd) + endif () + #-- Add extend_dset program set (extend_dset_SOURCES ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c @@ -61,6 +79,13 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) endif () set_target_properties (extend_dset PROPERTIES FOLDER tools/hl) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TOOLS_H5WATCH_extend_dset_FORMAT extend_dset) + endif () + add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) target_compile_options(h5watchgentest PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -73,6 +98,13 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) endif () set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_HL_TOOLS_H5WATCH_h5watchgentest_FORMAT h5watchgentest) + endif () + if (HDF5_TEST_TOOLS) include (CMakeTests.cmake) endif () diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 3f71122..5e21488 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -45,6 +45,7 @@ set (HDF5_JAVA_JNI_CHDRS ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Imp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h @@ -87,6 +88,13 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA") #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JNI_SRC_FORMAT ${HDF5_JAVA_JNI_LIB_TARGET}) +endif () + +#----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index dbf55a9..287bd6e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,16 @@ New Features Configuration: ------------- + + - Added CMake option to format source files + + HDF5_ENABLE_FORMATTERS option will enable creation of targets using the + pattern - HDF5_*_SRC_FORMAT - where * corresponds to the source folder + or tool folder. All sources can be formatted by executing the format target; + make format + + (ADB - 2020/08/24) + - CMake option to link the generated Fortran MOD files into the include directory. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 022e5a3..1458665 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -713,6 +713,44 @@ set (H5Z_HDRS ) IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" ) +set (H5_MODULE_HEADERS + ${HDF5_SRC_DIR}/H5Amodule.h + ${HDF5_SRC_DIR}/H5ACmodule.h + ${HDF5_SRC_DIR}/H5Bmodule.h + ${HDF5_SRC_DIR}/H5B2module.h + ${HDF5_SRC_DIR}/H5Cmodule.h + ${HDF5_SRC_DIR}/H5CXmodule.h + ${HDF5_SRC_DIR}/H5Dmodule.h + ${HDF5_SRC_DIR}/H5Emodule.h + ${HDF5_SRC_DIR}/H5EAmodule.h + ${HDF5_SRC_DIR}/H5Fmodule.h + ${HDF5_SRC_DIR}/H5FAmodule.h + ${HDF5_SRC_DIR}/H5FDdrvr_module.h + ${HDF5_SRC_DIR}/H5FDmodule.h + ${HDF5_SRC_DIR}/H5FLmodule.h + ${HDF5_SRC_DIR}/H5FSmodule.h + ${HDF5_SRC_DIR}/H5Gmodule.h + ${HDF5_SRC_DIR}/H5HFmodule.h + ${HDF5_SRC_DIR}/H5HGmodule.h + ${HDF5_SRC_DIR}/H5HLmodule.h + ${HDF5_SRC_DIR}/H5Imodule.h + ${HDF5_SRC_DIR}/H5Lmodule.h + ${HDF5_SRC_DIR}/H5Mmodule.h + ${HDF5_SRC_DIR}/H5MFmodule.h + ${HDF5_SRC_DIR}/H5MPmodule.h + ${HDF5_SRC_DIR}/H5Omodule.h + ${HDF5_SRC_DIR}/H5Pmodule.h + ${HDF5_SRC_DIR}/H5PBmodule.h + ${HDF5_SRC_DIR}/H5PLmodule.h + ${HDF5_SRC_DIR}/H5Rmodule.h + ${HDF5_SRC_DIR}/H5Smodule.h + ${HDF5_SRC_DIR}/H5SLmodule.h + ${HDF5_SRC_DIR}/H5SMmodule.h + ${HDF5_SRC_DIR}/H5Tmodule.h + ${HDF5_SRC_DIR}/H5VLmodule.h + ${HDF5_SRC_DIR}/H5Zmodule.h +) + set (common_SRCS ${H5_SOURCES} ${H5A_SOURCES} @@ -873,6 +911,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Mpkg.h ${HDF5_SRC_DIR}/H5Mprivate.h + ${HDF5_SRC_DIR}/H5MFpkg.h ${HDF5_SRC_DIR}/H5MFprivate.h ${HDF5_SRC_DIR}/H5MMprivate.h @@ -1092,6 +1131,13 @@ else () endif () endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_SRC_DETECT_FORMAT ${HDF5_SRC_DIR}/H5detect.c) +endif () + add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) @@ -1101,6 +1147,13 @@ target_link_libraries (H5make_libsettings PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0"> ) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_SRC_LIBSETTINGS_FORMAT H5make_libsettings) +endif () + add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c ${HDF5_BINARY_DIR}/gen_SRCS.stamp2 @@ -1137,7 +1190,7 @@ if (NOT ONLY_SHARED_LIBS) set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) - add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_BINARY_DIR}>" @@ -1173,7 +1226,7 @@ if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>" @@ -1204,6 +1257,17 @@ if (BUILD_SHARED_LIBS) endif () #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_SRC_FORMAT ${HDF5_LIB_TARGET}) + else () + clang_format (HDF5_SRC_FORMAT ${HDF5_LIBSH_TARGET}) + endif () +endif () + +#----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- if (NOT HDF5_INSTALL_NO_DEVELOPMENT) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 311d753..92b8ae7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,6 +20,7 @@ set (TEST_LIB_SOURCES set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/h5test.h + ${HDF5_TEST_SOURCE_DIR}/H5srcdir.h ${HDF5_TEST_SOURCE_DIR}/cache_common.h ${HDF5_TEST_SOURCE_DIR}/external_common.h ${HDF5_TEST_SOURCE_DIR}/external_fname.h @@ -65,6 +66,17 @@ if (BUILD_SHARED_LIBS) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_TEST_SRC_FORMAT ${HDF5_TEST_LIB_TARGET}) + else () + clang_format (HDF5_TEST_SRC_FORMAT ${HDF5_TEST_LIBSH_TARGET}) + endif () +endif () + ################################################################################# # If filter and vol plugin tests can be tested ################################################################################# @@ -98,6 +110,13 @@ if (BUILD_SHARED_LIBS) set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${HDF5_TEST_PLUGIN_TARGET}_FORMAT ${HDF5_TEST_PLUGIN_TARGET}) + endif () + + #----------------------------------------------------------------------------- # Copy the filter plugin to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( @@ -123,6 +142,13 @@ if (BUILD_SHARED_LIBS) set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${HDF5_TEST_PLUGIN_TARGET}_FORMAT ${HDF5_TEST_PLUGIN_TARGET}) + endif () + + #----------------------------------------------------------------------------- # Copy the filter plugin to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( @@ -160,6 +186,13 @@ if (BUILD_SHARED_LIBS) set_target_properties (${HDF5_VOL_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${HDF5_VOL_PLUGIN_LIB_TARGET}_FORMAT ${HDF5_VOL_PLUGIN_LIB_TARGET}) + endif () + + #----------------------------------------------------------------------------- # Copy VOL plugin to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( @@ -178,6 +211,7 @@ endif () ################################################################################# set (testhdf5_SOURCES + ${HDF5_TEST_SOURCE_DIR}/testhdf5.h ${HDF5_TEST_SOURCE_DIR}/testhdf5.c ${HDF5_TEST_SOURCE_DIR}/tarray.c ${HDF5_TEST_SOURCE_DIR}/tattr.c @@ -217,6 +251,7 @@ set(mirror_vfd_SOURCES ) set (ttsafe_SOURCES + ${HDF5_TEST_SOURCE_DIR}/ttsafe.h ${HDF5_TEST_SOURCE_DIR}/ttsafe.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_dcreate.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c @@ -311,6 +346,13 @@ macro (ADD_H5_EXE file) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (${file} PROPERTIES FOLDER test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${file}_FORMAT ${file}) + endif () endmacro () set (H5_TESTS_MULTIPLE @@ -346,6 +388,13 @@ else () endif () set_target_properties (chunk_info PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_SRC_chunk_info_FORMAT chunk_info) +endif () + #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) target_compile_options(direct_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -359,6 +408,12 @@ else () endif () set_target_properties (direct_chunk PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_direct_chunk_FORMAT direct_chunk) +endif () ######### Special handling for multiple sources ############# #-- Adding test for testhdf5 @@ -374,6 +429,13 @@ else () endif () set_target_properties (testhdf5 PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_testhdf5_FORMAT testhdf5) +endif () + #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) target_compile_options(cache_image PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -387,6 +449,13 @@ else () endif () set_target_properties (cache_image PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_cache_image_FORMAT cache_image) +endif () + #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) target_compile_options(ttsafe PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -405,6 +474,13 @@ else () endif () set_target_properties (ttsafe PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_ttsafe_FORMAT ttsafe) +endif () + ######### Special handling for extra link lib of threads ############# #-- Adding test for thread_id add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c) @@ -424,6 +500,13 @@ else () endif () set_target_properties (thread_id PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_thread_id_FORMAT thread_id) +endif () + #-- Adding test for mirror_vfd add_executable (mirror_vfd ${mirror_vfd_SOURCES}) target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -436,6 +519,13 @@ else () endif () set_target_properties (mirror_vfd PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd) +endif () + ############################################################################## ### A D D I T I O N A L T E S T S ### ############################################################################## @@ -496,8 +586,29 @@ set (H5_VDS_SWMR_TESTS vds_swmr_writer ) +macro (ADD_H5_VDS_EXE file) + add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c ${HDF5_TEST_SOURCE_DIR}/vds_swmr.h) + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + endif () + set_target_properties (${file} PROPERTIES FOLDER test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${file}_FORMAT ${file}) + endif () +endmacro () + foreach (h5_test ${H5_VDS_SWMR_TESTS}) - ADD_H5_EXE(${h5_test}) + ADD_H5_VDS_EXE(${h5_test}) endforeach () #-- Adding test for accum_swmr_reader @@ -515,6 +626,13 @@ else () endif () set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_accum_swmr_reader_FORMAT accum_swmr_reader) +endif () + #-- Set accum dependencies set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader) @@ -528,17 +646,31 @@ if (BUILD_SHARED_LIBS) target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_filter_plugin_FORMAT filter_plugin) + endif () + add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c) target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (vol_plugin SHARED) target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (vol_plugin PROPERTIES FOLDER test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_vol_plugin_FORMAT vol_plugin) + endif () endif () ############################################################################## ### U S E C A S E S T E S T S ############################################################################## -set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) +set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) target_compile_options(use_append_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -551,7 +683,34 @@ else () endif () set_target_properties (use_append_chunk PROPERTIES FOLDER test) -set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_use_append_chunk_FORMAT use_append_chunk) +endif () + +set (use_append_chunk_mirror_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk_mirror.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) +add_executable (use_append_chunk_mirror ${use_append_chunk_mirror_SOURCES}) +target_compile_options(use_append_chunk_mirror PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (use_append_chunk_mirror PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_chunk_mirror STATIC) + target_link_libraries (use_append_chunk_mirror PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_chunk_mirror SHARED) + target_link_libraries (use_append_chunk_mirror PRIVATE ${HDF5_TEST_LIBSH_TARGET}) +endif () +set_target_properties (use_append_chunk_mirror PROPERTIES FOLDER test) + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_use_append_chunk_mirror_FORMAT use_append_chunk_mirror) +endif () + +set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) target_compile_options(use_append_mchunks PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -564,6 +723,13 @@ else () endif () set_target_properties (use_append_mchunks PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_use_append_mchunks_FORMAT use_append_mchunks) +endif () + set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) target_compile_options(use_disable_mdc_flushes PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -577,6 +743,13 @@ else () endif () set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_use_disable_mdc_flushes_FORMAT use_disable_mdc_flushes) +endif () + if (HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 2371468..8e7a806 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -972,6 +972,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (${genfile} STATIC) target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${genfile}_FORMAT ${genfile}) + endif () endmacro () # generator executables diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index a9f45d5..46bfb37 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -39,7 +39,14 @@ else () endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) -MACRO (ADD_H5P_EXE file) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_PAR_testphdf5_FORMAT testphdf5) +endif () + +macro (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (${file} @@ -59,7 +66,14 @@ MACRO (ADD_H5P_EXE file) ) endif () set_target_properties (${file} PROPERTIES FOLDER test/par) -ENDMACRO (ADD_H5P_EXE file) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_PAR_${file}_FORMAT ${file}) + endif () +endmacro (ADD_H5P_EXE file) set (H5P_TESTS t_mpi diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index ff9ca43..edb5ada 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -26,10 +26,12 @@ set (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.h + ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_error.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h + ${HDF5_TOOLS_LIB_SOURCE_DIR}/io_timer.h ) if (NOT ONLY_SHARED_LIBS) @@ -75,6 +77,17 @@ if (BUILD_SHARED_LIBS) set (install_targets ${install_targets} ${HDF5_TOOLS_LIBSH_TARGET}) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_TOOLS_SRC_FORMAT ${HDF5_TOOLS_LIB_TARGET}) + else () + clang_format (HDF5_TOOLS_SRC_FORMAT ${HDF5_TOOLS_LIBSH_TARGET}) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 3e0f671..d094058 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -16,6 +16,13 @@ else () endif () set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_H5TOOLS_TEST_SRC_FORMAT h5tools_test_utils) +endif () + if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 8f230a0..d73b622 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5copy-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5COPY_SRC_FORMAT h5copy) + else () + clang_format (HDF5_H5COPY_SRC_FORMAT h5copy-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 4087ab4..f18b358 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -8,6 +8,7 @@ if (NOT ONLY_SHARED_LIBS) add_executable (h5diff ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h ) target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -23,6 +24,7 @@ if (BUILD_SHARED_LIBS) add_executable (h5diff-shared ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h ) target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -35,6 +37,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5diff-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff) + else () + clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff-shared) + endif () +endif () + if (H5_HAVE_PARALLEL) if (NOT ONLY_SHARED_LIBS) add_executable (ph5diff diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 0b6c968..1282dde 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -9,6 +9,11 @@ if (NOT ONLY_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h ) target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -25,6 +30,11 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h ) target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -36,6 +46,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5dump-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump) + else () + clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 863ecbe..ffa7c3a 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -27,6 +27,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert) + else () + clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index a52467e..dedefd9 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- if (NOT ONLY_SHARED_LIBS) - add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5import STATIC) target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -17,7 +17,7 @@ if (NOT ONLY_SHARED_LIBS) endif () if (BUILD_SHARED_LIBS) - add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5import-shared SHARED) target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) @@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import) + else () + clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 69d4c4d..36ec10e 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -46,6 +46,19 @@ if (BUILD_SHARED_LIBS) ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5JAM_SRC_FORMAT h5jam) + clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam) + else () + clang_format (HDF5_H5JAM_SRC_FORMAT h5jam-shared) + clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index c1ce006..dfac225 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -30,6 +30,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5ls-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5LS_SRC_FORMAT h5ls) + else () + clang_format (HDF5_H5LS_SRC_FORMAT h5ls-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index a4aa1ef..e776516 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -12,6 +12,7 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_refs.c ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_verify.c ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c + ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.h ) if (NOT ONLY_SHARED_LIBS) @@ -38,6 +39,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repack-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack) + else () + clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index f0722fd..eb10400 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5stat-shared) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5STAT_SRC_FORMAT h5stat) + else () + clang_format (HDF5_H5STAT_SRC_FORMAT h5stat-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 1e9cacc..80669af 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -86,6 +86,23 @@ if (BUILD_SHARED_LIBS) ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug) + clang_format (HDF5_H5REPART_SRC_FORMAT h5repart) + clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp) + clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear) + else () + clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug-shared) + clang_format (HDF5_H5REPART_SRC_FORMAT h5repart-shared) + clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp-shared) + clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index 034c8d3..eff12a2 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -11,6 +11,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5COPY_FORMAT h5copygentest) + endif () + #add_test (NAME h5copygentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copygentest>) endif () @@ -28,8 +35,16 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5COPY_PLUGIN_FORMAT ${H5COPY_TOOL_PLUGIN_LIB_TARGET}) + endif () + # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index e4bfc99..31663e1 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -11,6 +11,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DIFF_FORMAT h5diffgentest) + endif () + #add_test (NAME h5diffgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diffgentest>) endif () @@ -28,6 +35,13 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DIFF_PLUGIN_FORMAT ${H5DIFF_TOOL_PLUGIN_LIB_TARGET}) + endif () + # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") #----------------------------------------------------------------------------- diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 8a83699..a11d084 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -15,6 +15,13 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DUMP_PLUGIN_FORMAT ${H5DUMP_TOOL_PLUGIN_LIB_TARGET}) + endif () + # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") #----------------------------------------------------------------------------- @@ -40,6 +47,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DUMP_FORMAT h5dumpgentest) + endif () + #add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dumpgentest>) endif () diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 99420d8..af4808a 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -15,6 +15,13 @@ else () endif () set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5FC_h5fc_chk_idx_FORMAT h5fc_chk_idx) +endif () + if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -22,6 +29,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5FC_FORMAT h5fc_gentest) + endif () + #add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_gentest>) endif () diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index f3991c5..d8af61f 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -15,6 +15,13 @@ else () endif () set_target_properties (h5importtest PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5IMPORT_FORMAT h5importtest) +endif () + if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 78160d3..67c8c5f 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -11,6 +11,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5JAM_FORMAT h5jamgentest) + endif () + #add_test (NAME h5jamgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jamgentest>) endif () @@ -36,6 +43,14 @@ else () endif () set_target_properties (tellub PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5JAM_getub_FORMAT getub) + clang_format (HDF5_TOOLS_TEST_H5JAM_tellub_FORMAT tellub) +endif () + if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 54cff64..061ed3f 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -17,6 +17,7 @@ else () endif () set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) +# These are the same files used by the h5repack tool set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_copy.c ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_filters.c @@ -62,6 +63,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5REPACK_PLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_TARGET}) + clang_format (HDF5_TOOLS_TEST_H5REPACK_VPLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET}) + endif () + # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") #----------------------------------------------------------------------------- @@ -95,6 +104,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5repackgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repackgentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5REPACK_FORMAT h5repackgentest) + endif () + #add_test (NAME h5repackgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repackgentest>) endif () diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index f50a747..6fc9f00 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -11,6 +11,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5STAT_FORMAT h5stat_gentest) + endif () + #add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat_gentest>) endif () diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 8f13d84..66ba655 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -17,6 +17,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5repart_gentest_FORMAT h5repart_gentest) + endif () + add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) @@ -29,6 +36,13 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5clear_gentest>) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5clear_gentest_FORMAT h5clear_gentest) + endif () + add_subdirectory (vds) endif () @@ -44,6 +58,13 @@ else () endif () set_target_properties (h5repart_test PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5repart_test_FORMAT h5repart_test) +endif () + add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) @@ -55,6 +76,13 @@ else () endif () set_target_properties (clear_open_chk PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_clear_open_chk_FORMAT clear_open_chk) +endif () + if (HDF5_TEST_SERIAL) include (CMakeTestsRepart.cmake) include (CMakeTestsClear.cmake) diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 71261c4..b0d8ab3 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_TOOLS_TEST_MISC_VDS C) -MACRO (ADD_H5_GENERATOR genfile) +macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) @@ -12,7 +12,14 @@ MACRO (ADD_H5_GENERATOR genfile) target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) -ENDMACRO () + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_VDS_${genfile}_FORMAT ${genfile}) + endif () +endmacro () # generator executables set (H5_GENERATORS diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 3c45e85..0b65a70 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -20,6 +20,13 @@ else () endif () set_target_properties (h5perf_serial PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_FORMAT h5perf_serial) +endif () + if (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf_serial_alone - io_timer.c includes set (h5perf_serial_alone_SOURCES @@ -38,9 +45,14 @@ if (HDF5_BUILD_PERFORM_STANDALONE) target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") endif () set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) - set_property (TARGET h5perf_serial_alone - APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE - ) + set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_alone_FORMAT h5perf_serial_alone) + endif () endif () #-- Adding test for chunk @@ -58,6 +70,13 @@ else () endif () set_target_properties (chunk PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_FORMAT chunk) +endif () + #-- Adding test for iopipe set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c @@ -73,6 +92,13 @@ else () endif () set_target_properties (iopipe PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_iopipe_FORMAT iopipe) +endif () + #-- Adding test for chunk_cache set (chunk_cache_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c @@ -88,6 +114,13 @@ else () endif () set_target_properties (chunk_cache PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_cache_FORMAT chunk_cache) +endif () + #-- Adding test for overhead set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c @@ -103,6 +136,13 @@ else () endif () set_target_properties (overhead PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_overhead_FORMAT overhead) +endif () + #-- Adding test for perf_meta set (perf_meta_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c @@ -118,6 +158,13 @@ else () endif () set_target_properties (perf_meta PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_perf_meta_FORMAT perf_meta) +endif () + #-- Adding test for zip_perf set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c @@ -133,22 +180,36 @@ else () endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_zip_perf_FORMAT zip_perf) +endif () + if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) if (UNIX) - #-- Adding test for perf - only on unix systems - set (perf_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c - ) - add_executable (perf ${perf_SOURCES}) - target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - endif () - set_target_properties (perf PROPERTIES FOLDER perform) + #-- Adding test for perf - only on unix systems + set (perf_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c + ) + add_executable (perf ${perf_SOURCES}) + target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (perf PROPERTIES FOLDER perform) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_perf_FORMAT perf) + endif () endif () #-- Adding test for h5perf @@ -167,6 +228,13 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) endif () set_target_properties (h5perf PROPERTIES FOLDER perform) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_FORMAT h5perf) + endif () + if (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf set (h5perf_alone_SOURCES @@ -188,6 +256,13 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) set_property (TARGET h5perf_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE ) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_alone_FORMAT h5perf_alone) + endif () endif () endif () diff --git a/utils/mirror_vfd/CMakeLists.txt b/utils/mirror_vfd/CMakeLists.txt index 6137e82..780300e 100644 --- a/utils/mirror_vfd/CMakeLists.txt +++ b/utils/mirror_vfd/CMakeLists.txt @@ -8,7 +8,9 @@ project (HDF5_UTILS_MIRRORVFD C) set (mirror_server_SOURCES ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_remote.c ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_server.c - ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_writer.c) + ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_writer.c + ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_remote.h +) add_executable (mirror_server ${mirror_server_SOURCES}) target_include_directories (mirror_server PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) @@ -23,6 +25,13 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} mirror_server) #----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_UTILS_MIRRORVFD_SERVER_FORMAT mirror_server) +endif () + +#----------------------------------------------------------------------------- # Add the mirror_server_stop executable #----------------------------------------------------------------------------- @@ -40,6 +49,13 @@ set_target_properties (mirror_server_stop PROPERTIES FOLDER utils) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server_stop") set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} mirror_server_stop) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_UTILS_MIRRORVFD_STOP_FORMAT mirror_server_stop) +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### |