diff --git a/.gersemi/definitions.cmake b/.gersemi/definitions.cmake new file mode 100644 index 0000000000..13061629a4 --- /dev/null +++ b/.gersemi/definitions.cmake @@ -0,0 +1,98 @@ +# Custom CMake command definitions for gersemi formatting. +# These stubs teach gersemi the signatures of project-specific commands +# so it can format their invocations correctly. + +function(git_branch branch_val) +endfunction() + +function(isolate_headers target A B scope) +endfunction() + +function(create_symbolic_link target link) +endfunction() + +function(xrpl_add_test name) +endfunction() + +macro(exclude_from_default target_) +endmacro() + +macro(exclude_if_included target_) +endmacro() + +function(target_protobuf_sources target prefix) + set(options APPEND_PATH DESCRIPTORS) + set(oneValueArgs + LANGUAGE + OUT_VAR + EXPORT_MACRO + TARGET + PROTOC_OUT_DIR + PLUGIN + PLUGIN_OPTIONS + PROTOC_EXE + ) + set(multiValueArgs + PROTOS + IMPORT_DIRS + GENERATE_EXTENSIONS + PROTOC_OPTIONS + DEPENDENCIES + ) + cmake_parse_arguments( + THIS_FUNCTION_PREFIX + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN} + ) +endfunction() + +function(add_module parent name) +endfunction() + +function(target_link_modules parent scope) +endfunction() + +function(setup_target_for_coverage_gcovr) + set(options NONE) + set(oneValueArgs BASE_DIRECTORY NAME FORMAT) + set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) + cmake_parse_arguments( + THIS_FUNCTION_PREFIX + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN} + ) +endfunction() + +function(add_code_coverage_to_target name scope) +endfunction() + +function(verbose_find_path variable name) + set(options + NO_CACHE + REQUIRED + OPTIONAL + NO_DEFAULT_PATH + NO_PACKAGE_ROOT_PATH + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_INSTALL_PREFIX + CMAKE_FIND_ROOT_PATH_BOTH + ONLY_CMAKE_FIND_ROOT_PATH + NO_CMAKE_FIND_ROOT_PATH + ) + set(oneValueArgs REGISTRY_VIEW VALIDATOR DOC) + set(multiValueArgs NAMES HINTS PATHS PATH_SUFFIXES) + cmake_parse_arguments( + THIS_FUNCTION_PREFIX + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN} + ) +endfunction() diff --git a/.gersemirc b/.gersemirc new file mode 100644 index 0000000000..5abd52ffd5 --- /dev/null +++ b/.gersemirc @@ -0,0 +1 @@ +definitions: [.gersemi] diff --git a/cmake/XrplAddTest.cmake b/cmake/XrplAddTest.cmake index 0f8f9e2c01..2f1209e03c 100644 --- a/cmake/XrplAddTest.cmake +++ b/cmake/XrplAddTest.cmake @@ -11,7 +11,12 @@ function(xrpl_add_test name) ) add_executable(${target} ${ARGN} ${sources}) - isolate_headers(${target} "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/${name}" PRIVATE) + isolate_headers( + ${target} + "${CMAKE_SOURCE_DIR}" + "${CMAKE_SOURCE_DIR}/tests/${name}" + PRIVATE + ) add_test(NAME ${target} COMMAND ${target}) endfunction() diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 1c8f5e33d6..580c4155eb 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -10,16 +10,25 @@ include(target_protobuf_sources) # so we just build them as a separate library. add_library(xrpl.libpb) set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF) -target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto - PROTOS include/xrpl/proto/xrpl.proto +target_protobuf_sources( + xrpl.libpb + xrpl/proto + LANGUAGE cpp + IMPORT_DIRS include/xrpl/proto + PROTOS include/xrpl/proto/xrpl.proto ) file(GLOB_RECURSE protos "include/xrpl/proto/org/*.proto") -target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto - PROTOS "${protos}" +target_protobuf_sources( + xrpl.libpb + xrpl/proto + LANGUAGE cpp + IMPORT_DIRS include/xrpl/proto + PROTOS "${protos}" ) target_protobuf_sources( - xrpl.libpb xrpl/proto + xrpl.libpb + xrpl/proto LANGUAGE grpc IMPORT_DIRS include/xrpl/proto PROTOS "${protos}" diff --git a/cmake/XrplCov.cmake b/cmake/XrplCov.cmake index 109f5049fd..d81d7e689f 100644 --- a/cmake/XrplCov.cmake +++ b/cmake/XrplCov.cmake @@ -39,19 +39,15 @@ list( ) setup_target_for_coverage_gcovr( - NAME - coverage - FORMAT - ${coverage_format} + NAME coverage + FORMAT ${coverage_format} EXCLUDE - "src/test" - "src/tests" - "include/xrpl/beast/test" - "include/xrpl/beast/unit_test" - "${CMAKE_BINARY_DIR}/pb-xrpl.libpb" - DEPENDENCIES - xrpld - xrpl.tests + "src/test" + "src/tests" + "include/xrpl/beast/test" + "include/xrpl/beast/unit_test" + "${CMAKE_BINARY_DIR}/pb-xrpl.libpb" + DEPENDENCIES xrpld xrpl.tests ) add_code_coverage_to_target(opts INTERFACE) diff --git a/cmake/XrplDocs.cmake b/cmake/XrplDocs.cmake index aefffba81b..7b3e9b3b30 100644 --- a/cmake/XrplDocs.cmake +++ b/cmake/XrplDocs.cmake @@ -42,7 +42,11 @@ function(verbose_find_path variable name) endif() endfunction() -verbose_find_path(doxygen_plantuml_jar_path plantuml.jar PATH_SUFFIXES share/plantuml) +verbose_find_path( + doxygen_plantuml_jar_path + plantuml.jar + PATH_SUFFIXES share/plantuml +) verbose_find_path(doxygen_dot_path dot) # https://en.cppreference.com/w/Cppreference:Archives diff --git a/cmake/add_module.cmake b/cmake/add_module.cmake index 5b1864a0bb..316d6c627b 100644 --- a/cmake/add_module.cmake +++ b/cmake/add_module.cmake @@ -25,10 +25,16 @@ function(add_module parent name) ${target} PUBLIC "$" ) - isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}" PUBLIC + isolate_headers( + ${target} + "${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}" + PUBLIC ) - isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}" PRIVATE + isolate_headers( + ${target} + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}" + PRIVATE ) endfunction()