Skip to content

Commit

Permalink
Cleanup: Delete trailing whitespace from all CMake and C++ files
Browse files Browse the repository at this point in the history
This is useful for MayStreet developers who have their editors
configured to delete trailing whitespace on save. If the existing
files do not contain trailing whitespace, this avoids cluttering
diffs with whitespace changes in unrelated commits.
  • Loading branch information
enolan-maystreet committed Feb 11, 2025
1 parent 7d0e6e5 commit adbe490
Show file tree
Hide file tree
Showing 72 changed files with 680 additions and 680 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(HERMETIC_FETCHCONTENT_BYPASS_PROVIDER_FOR_PACKAGES "Threads;dl;m")

include(HermeticFetchContent)

if(HFC_ENABLE_CMAKE_SBOM)
if(HFC_ENABLE_CMAKE_SBOM)
include(hfc_sbom)

hfc_generate_sbom(
Expand Down
104 changes: 52 additions & 52 deletions cmake/HermeticFetchContent.cmake

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions cmake/modules/hfc_autotools_register_content_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(hfc_get_command_in_cleared_env)
include(hfc_custom_echo_command)

# Register an autotools project in the build graph
#
#
# Usage:
# hfc_autotools_register_content_build(
# content_name <name> # name of the library project
Expand All @@ -24,7 +24,7 @@ function(hfc_autotools_register_content_build content_name)

# arguments parsing
set(options "")
set(oneValueArgs
set(oneValueArgs
ADAPTER_SOURCE_DIR
PROJECT_SOURCE_DIR
PROJECT_BINARY_DIR
Expand Down Expand Up @@ -89,7 +89,7 @@ function(hfc_autotools_register_content_build content_name)
cmake_path(GET FN_ARG_HFC_INSTALL_MARKER_FILE PARENT_PATH installed_marker_parent_path)
file(GLOB install_done_markers "${installed_marker_parent_path}/hfc.*.install.done")

if(install_done_markers)
if(install_done_markers)
set(install_command_done_marker_cleaner "${CMAKE_COMMAND} -E remove ")
foreach(found_marker_file IN LISTS install_done_markers)
string(APPEND install_command_done_marker_cleaner " ${found_marker_file}")
Expand All @@ -100,7 +100,7 @@ function(hfc_autotools_register_content_build content_name)

# this marks this build as installed
string(APPEND install_command " && ${CMAKE_COMMAND} -E touch ${FN_ARG_HFC_INSTALL_MARKER_FILE}")

if (CMAKE_RE_ENABLE)

hfc_get_cmake_re_command_string(
Expand All @@ -110,19 +110,19 @@ function(hfc_autotools_register_content_build content_name)
TOOLCHAIN_FILE "${FN_ARG_TOOLCHAIN_FILE}"
GENERATOR "${CMAKE_GENERATOR}"
INSTALL_PREFIX "${FN_ARG_PROJECT_INSTALL_PREFIX}"

CACHE_OP_POPULATE REVISION "${FN_ARG_REVISION}"
)

set(install_command "${install_command} && ${populate_cache_command}")

endif()


if(HFC_V1_REMOVE_BUILD_DIR_AFTER_INSTALL)
string(APPEND install_command " && ${CMAKE_COMMAND} -E rm -rf ${FN_ARG_PROJECT_BINARY_DIR} ")
endif()

if(HFC_V1_REMOVE_SOURCE_DIR_AFTER_INSTALL)
string(APPEND install_command " && ${CMAKE_COMMAND} -E rm -rf ${FN_ARG_PROJECT_SOURCE_DIR} ")

Expand All @@ -141,13 +141,13 @@ function(hfc_autotools_register_content_build content_name)

hfc_generate_external_project(${content_name}
EP_TARGETS_DIR ${build_externalproject_targets_dir}
TARGET_NAME ${build_externalproject_target_name}
TARGET_NAME ${build_externalproject_target_name}

# We always are in the case BUILD_IN_SOURCE_TREE, so we pass the
# BINARY_DIR as source to build. The fetch function
# _clone_in_build_folder_if_required takes care of putting the
# _clone_in_build_folder_if_required takes care of putting the
# sources in ${FN_ARG_PROJECT_BINARY_DIR}/src. Nesting in /src is
# necessary to have the CMakeLists.txt driving the compilation be
# necessary to have the CMakeLists.txt driving the compilation be
# able to put it's ninja files + CMakeCache in ${FN_ARG_PROJECT_BINARY_DIR}.
SOURCE_DIR ${FN_ARG_PROJECT_BINARY_DIR}/src
BINARY_DIR ${FN_ARG_PROJECT_BINARY_DIR}/src
Expand All @@ -169,34 +169,34 @@ function(hfc_autotools_register_content_build content_name)
hfc_log_debug("Build at configure time project written to: ${build_externalproject_targets_dir}")

if (FN_ARG_REGISTER_BUILD_AT_CONFIGURE_TIME)
# Build now
# Build now
execute_process(
COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DCMAKE_TOOLCHAIN_FILE=${FN_ARG_TOOLCHAIN_FILE} .
WORKING_DIRECTORY "${build_externalproject_targets_dir}"
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
)
execute_process(
COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY "${build_externalproject_targets_dir}"
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
)
else()
# Register to Build later in main project build graph
# Register to Build later in main project build graph
hfc_log_debug("Adding subdirectory ${build_externalproject_targets_dir}")
add_subdirectory(${build_externalproject_targets_dir} ${build_externalproject_targets_dir})

# We have to create the include directories of the imported targets ahead
# of time even if they are empty
# of time even if they are empty
foreach(target IN LISTS FN_ARG_IMPORTED_TARGETS)
hfc_log_debug("Creating INTERFACE_INCLUDE_DIRECTORIES for target '${target}' ahead of time")

get_target_property(include_directories ${target} INTERFACE_INCLUDE_DIRECTORIES)

if(include_directories)
foreach(dir IN LISTS include_directories)
file(MAKE_DIRECTORY ${dir})
file(MAKE_DIRECTORY ${dir})
endforeach()
endif()

Expand Down
60 changes: 30 additions & 30 deletions cmake/modules/hfc_autotools_restore_or_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ function(generate_openssl_cmake_adapter_get_install_target OUT_INSTALL_TARGET)
endfunction()


function(hfc_autootols_configure
function(hfc_autootols_configure
content_name
# The path to the generated adapter for the configuration
cmake_adapter_parent_path
# The install prefix
cmake_adapter_parent_path
# The install prefix
HERMETIC_PROJECT_INSTALL_PREFIX
# The autotools in-source-tree build dir (where ./configure lies)
AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR
# The toolchain file impacting the build
toolchain_file
toolchain_file
# The original project adapted and getting cache entries
origin
# revision
Expand All @@ -61,7 +61,7 @@ function(hfc_autootols_configure

cmake_path(GET already_configured_file PARENT_PATH configured_marker_parent_path)
file(GLOB configure_markers "${configured_marker_parent_path}/hfc.*.configure.done")
if(configure_markers)
if(configure_markers)
hfc_log_debug(" - clearing old configure markers")
file(REMOVE ${configure_markers})
endif()
Expand All @@ -70,7 +70,7 @@ function(hfc_autootols_configure
COMMAND ${cmake_command}
RESULT_VARIABLE CONFIGURE_RESULT
COMMAND_ECHO STDOUT
)
)

if(${CONFIGURE_RESULT} EQUAL 0)
file(TOUCH "${already_configured_file}")
Expand All @@ -82,23 +82,23 @@ function(hfc_autootols_configure
endfunction()

# Prepares the mirror and build tree to ensure that ${AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR} can be used to download + extract the autootools sources.
#
# This is the reason why for autotools we download in an overriden SRC_DIR, namely inside that folder in AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR/src
#
# This is the reason why for autotools we download in an overriden SRC_DIR, namely inside that folder in AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR/src
# (extraction would otherwise delete the mirror symlink)
function(hfc_autootols_prepare_mirror_build_tree_to_host_configure
content_name
# The path to the generated adapter for the configuration
cmake_adapter_parent_path
# The install prefix
cmake_adapter_parent_path
# The install prefix
HERMETIC_PROJECT_INSTALL_PREFIX
# The autotools in-source-tree build dir (where ./configure lies)
AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR
# The toolchain file impacting the build
toolchain_file
toolchain_file
# The original project adapted and getting cache entries
origin)

if (CMAKE_RE_ENABLE)
if (CMAKE_RE_ENABLE)
set(cmake_command ${OVERRIDEN_CMAKE_COMMAND} "--only-mirror" "--host" "-G" "${CMAKE_GENERATOR}" "--install-prefix" "${HERMETIC_PROJECT_INSTALL_PREFIX}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-S" "${cmake_adapter_parent_path}" "-B" "${AUTOTOOLS_IN_SOURCE_TREE_BUILD_DIR}" "-DCMAKE_TOOLCHAIN_FILE=${toolchain_file}")

# --origin
Expand All @@ -108,7 +108,7 @@ function(hfc_autootols_prepare_mirror_build_tree_to_host_configure
COMMAND ${cmake_command}
RESULT_VARIABLE CONFIGURE_RESULT
COMMAND_ECHO STDOUT
)
)

if(NOT ${CONFIGURE_RESULT} EQUAL 0)
message(FATAL_ERROR "Failed to prepare mirror for ${content_name}")
Expand All @@ -128,7 +128,7 @@ hfc_restore_or_configure_autotools
The build dir, will only be used to run the cmake-adapter build which runs autotools configure.
``PROJECT_INSTALL_PREFIX``
Where the `make install` should be done for the autootols library.
Where the `make install` should be done for the autootols library.
Passed to `./configure --prefix=`
``CMAKE_EXPORT_LIBRARY_DECLARATION``
Expand All @@ -139,11 +139,11 @@ hfc_restore_or_configure_autotools
A function respecting the generate_autotools_cmake_adapter or generate_openssl_cmake_adapter calling prototype.
``FETCH_CONTENT_DETAILS_HASH```
The hash of the input parametet to the FetchContent_Declare, this helps creating marker done files to determine
The hash of the input parametet to the FetchContent_Declare, this helps creating marker done files to determine
if work is required for the specific call or if it was already carried by another configure or build invocation.
``ORIGIN``
Cache ID
``ORIGIN``
Cache ID
``REVISION``
Revision to pull from cache
Expand Down Expand Up @@ -233,8 +233,8 @@ function(hfc_autotools_restore_or_configure content_name)
if (dep_need_install)
hfc_cmake_re_restore_install_tree(
${FN_ARG_ORIGIN} ${FN_ARG_REVISION}
${autotools_cmake_adapter_destination} ${FN_ARG_PROJECT_SOURCE_DIR}
${FN_ARG_PROJECT_INSTALL_PREFIX}
${autotools_cmake_adapter_destination} ${FN_ARG_PROJECT_SOURCE_DIR}
${FN_ARG_PROJECT_INSTALL_PREFIX}
"${proxy_toolchain_path}"
cmake_re_restore_command_return_code)
if (cmake_re_restore_command_return_code EQUAL 0)
Expand All @@ -260,26 +260,26 @@ function(hfc_autotools_restore_or_configure content_name)

if (NOT EXISTS "${FN_ARG_PROJECT_SOURCE_DIR}")
# If we are here once again, it's because abi-hash changed for example: then the build tree is empty.
# And as we download autotools sources in the build tree We need to redownload.
# And as we download autotools sources in the build tree We need to redownload.
hfc_invalidate_project_population(${content_name} "${FN_ARG_PROJECT_SOURCE_DIR}")
endif()

if(IS_SYMLINK "${FN_ARG_PROJECT_SOURCE_DIR}")

file(READ_SYMLINK "${FN_ARG_PROJECT_SOURCE_DIR}" symlink_destination)

if(EXISTS "${symlink_destination}")
if(EXISTS "${symlink_destination}")
file(REMOVE_RECURSE "${symlink_destination}")
endif()

file(MAKE_DIRECTORY "${symlink_destination}")
endif()

# then download the sources
hfc_populate_project_invoke(${content_name})
endif()

# If required by build-systems that do not support in-source-tree build,
# If required by build-systems that do not support in-source-tree build,
# Do a secondary invoke to copy sources in build tree and do the actual config there
hfc_populate_project_invoke_clone_in_build_folder_if_required(${content_name})
endif()
Expand All @@ -295,13 +295,13 @@ function(hfc_autotools_restore_or_configure content_name)

hfc_targets_cache_consume(
${content_name}
TARGETS_CACHE_FILE "${target_cache_file}"
TARGETS_CACHE_FILE "${target_cache_file}"
TARGET_INSTALL_PREFIX "${FN_ARG_PROJECT_INSTALL_PREFIX}"
MAKE_EXECUTABLES_FINDABLE "${FN_ARG_MAKE_EXECUTABLES_FINDABLE}"
HERMETIC_SKIP_REGISTER_TARGET_FOR_LISTING "${FN_ARG_HERMETIC_SKIP_REGISTER_TARGET_FOR_LISTING}"
OUT_IMPORTED_LIBRARIES imported_libraries
OUT_LIBRARY_BYPRODUCTS library_byproducts

)

if(dep_need_configure)
Expand All @@ -314,13 +314,13 @@ function(hfc_autotools_restore_or_configure content_name)
if (dep_need_install)
hfc_log_debug(" - need to run install")

# If not restored Configure and register build targets
# If not restored Configure and register build targets
hfc_autotools_register_content_build(${content_name}
ADAPTER_SOURCE_DIR ${autotools_cmake_adapter_destination}
PROJECT_SOURCE_DIR ${FN_ARG_PROJECT_BINARY_DIR}
PROJECT_BINARY_DIR ${FN_ARG_PROJECT_BINARY_DIR}
PROJECT_INSTALL_PREFIX ${FN_ARG_PROJECT_INSTALL_PREFIX}
REGISTER_BUILD_AT_CONFIGURE_TIME ${FN_ARG_BUILD_AT_CONFIGURE_TIME}
REGISTER_BUILD_AT_CONFIGURE_TIME ${FN_ARG_BUILD_AT_CONFIGURE_TIME}
HFC_INSTALL_MARKER_FILE ${FN_ARG_HFC_INSTALL_MARKER_FILE}
INSTALL_BYPRODUCTS "${library_byproducts}"
IMPORTED_TARGETS "${imported_libraries}"
Expand All @@ -333,8 +333,8 @@ function(hfc_autotools_restore_or_configure content_name)
)

# if build a configure time is ON we don't need that dependency that
# is only there to ensure that the ${registered_build_target_name} target
# is run when someone consumes any of the $imported_libraries
# is only there to ensure that the ${registered_build_target_name} target
# is run when someone consumes any of the $imported_libraries
if(NOT ${FN_ARG_BUILD_AT_CONFIGURE_TIME})

foreach(lib IN LISTS imported_libraries)
Expand Down
Loading

0 comments on commit adbe490

Please sign in to comment.