Skip to content

Commit

Permalink
Last try to fix clang-format
Browse files Browse the repository at this point in the history
Signed-off-by: Vinícius Ferrão <[email protected]>
  • Loading branch information
viniciusferrao committed Jan 13, 2025
1 parent 39ba2c1 commit bb0eae7
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 151 deletions.
118 changes: 59 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ cmake_minimum_required(VERSION 3.26.5)

# Only set the cxx_standard if it is not set by someone else
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 23)
endif()
set(CMAKE_CXX_STANDARD 23)
endif ()

# strongly encouraged to enable this globally to avoid conflicts between
# -Wpedantic being enabled and -std=c++20 and -std=gnu++20 for example
Expand All @@ -18,34 +18,34 @@ set(CMAKE_CXX_EXTENSIONS OFF)

# Enable Conan 2.0 support
option(cloysterhpc_ENABLE_CONAN "Use Conan 2 to manage dependencies" ON)
if(cloysterhpc_ENABLE_CONAN)
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES cmake/conan_provider.cmake)
endif()
if (cloysterhpc_ENABLE_CONAN)
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES cmake/conan_provider.cmake)
endif ()

# Set a default build type if none was specified
# This is required for Conan 2.0 to work properly
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE
Debug
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui, ccmake
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo")
endif()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE
Debug
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui, ccmake
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo")
endif ()

# Set the project name and language
project(
CloysterHPC
VERSION 0.1.1
DESCRIPTION "Cloyster HPC is a turnkey HPC cluster solution with an user-friendly installer"
HOMEPAGE_URL "https://github.com/viniciusferrao/cloysterhpc"
LANGUAGES CXX C)
CloysterHPC
VERSION 0.1.1
DESCRIPTION "Cloyster HPC is a turnkey HPC cluster solution with an user-friendly installer"
HOMEPAGE_URL "https://github.com/viniciusferrao/cloysterhpc"
LANGUAGES CXX C)

include(cmake/PreventInSourceBuilds.cmake)
include(ProjectOptions.cmake)
Expand All @@ -71,16 +71,16 @@ execute_process(
)

# Check if GIT_SHA is empty and set to "Unknown" if it is
if("${GIT_SHA}" STREQUAL "")
set(GIT_SHA "Unknown")
endif()
if ("${GIT_SHA}" STREQUAL "")
set(GIT_SHA "Unknown")
endif ()

# Get the short SHA (first 8 characters) if GIT_SHA is not "Unknown"
if(NOT "${GIT_SHA}" STREQUAL "Unknown")
string(SUBSTRING "${GIT_SHA}" 0 8 GIT_SHORT_SHA)
else()
set(GIT_SHORT_SHA "Unknown")
endif()
if (NOT "${GIT_SHA}" STREQUAL "Unknown")
string(SUBSTRING "${GIT_SHA}" 0 8 GIT_SHORT_SHA)
else ()
set(GIT_SHORT_SHA "Unknown")
endif ()

# Cache the variables for future use
set(GIT_SHA "${GIT_SHA}" CACHE STRING "SHA this build was generated from")
Expand All @@ -105,51 +105,51 @@ add_subdirectory(configured_files)
add_subdirectory(src)

# Don't even look at tests if we're not top level
if(NOT PROJECT_IS_TOP_LEVEL)
return()
endif()
if (NOT PROJECT_IS_TOP_LEVEL)
return()
endif ()

# Adding the tests:
include(CTest)

if(BUILD_TESTING)
add_subdirectory(test)
endif()
if (BUILD_TESTING)
add_subdirectory(test)
endif ()


if(cloysterhpc_BUILD_FUZZ_TESTS)
message(AUTHOR_WARNING "Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html")
if (NOT cloysterhpc_ENABLE_ADDRESS_SANITIZER AND NOT cloysterhpc_ENABLE_THREAD_SANITIZER)
message(WARNING "You need asan or tsan enabled for meaningful fuzz testing")
endif()
add_subdirectory(fuzz_test)
if (cloysterhpc_BUILD_FUZZ_TESTS)
message(AUTHOR_WARNING "Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html")
if (NOT cloysterhpc_ENABLE_ADDRESS_SANITIZER AND NOT cloysterhpc_ENABLE_THREAD_SANITIZER)
message(WARNING "You need asan or tsan enabled for meaningful fuzz testing")
endif ()
add_subdirectory(fuzz_test)

endif()
endif ()

# If MSVC is being used, and ASAN is enabled, we need to set the debugger environment
# so that it behaves well with MSVC's debugger, and we can run the target from visual studio
if(MSVC)
get_all_installable_targets(all_targets)
message("all_targets=${all_targets}")
set_target_properties(${all_targets} PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=$(VC_ExecutablePath_x64);%PATH%")
endif()
if (MSVC)
get_all_installable_targets(all_targets)
message("all_targets=${all_targets}")
set_target_properties(${all_targets} PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=$(VC_ExecutablePath_x64);%PATH%")
endif ()

# set the startup project for the "play" button in MSVC
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${cloysterhpc_BINARY_NAME})

if(CMAKE_SKIP_INSTALL_RULES)
return()
endif()
if (CMAKE_SKIP_INSTALL_RULES)
return()
endif ()

include(cmake/PackageProject.cmake)

# Add other targets that you want installed here, by default we just package the one executable
# we know we want to ship
cloysterhpc_package_project(
TARGETS
${cloysterhpc_BINARY_NAME}
cloysterhpc_options
cloysterhpc_warnings
# FIXME: this does not work! CK
# PRIVATE_DEPENDENCIES_CONFIGURED project_options project_warnings
TARGETS
${cloysterhpc_BINARY_NAME}
cloysterhpc_options
cloysterhpc_warnings
# FIXME: this does not work! CK
# PRIVATE_DEPENDENCIES_CONFIGURED project_options project_warnings
)
4 changes: 3 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"condition": {
"type": "inList",
"string": "${hostSystemName}",
"list": ["Linux"]
"list": [
"Linux"
]
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
Expand Down
16 changes: 8 additions & 8 deletions fuzz_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ find_package(fmt)

add_executable(fuzz_tester fuzz_tester.cpp)
target_link_libraries(
fuzz_tester
PRIVATE cmake_conan2_template_options
cmake_conan2_template_warnings
fmt::fmt
-coverage
-fsanitize=fuzzer)
fuzz_tester
PRIVATE cmake_conan2_template_options
cmake_conan2_template_warnings
fmt::fmt
-coverage
-fsanitize=fuzzer)
target_compile_options(fuzz_tester PRIVATE -fsanitize=fuzzer)

# Allow short runs during automated testing to see if something new breaks
set(FUZZ_RUNTIME
10
CACHE STRING "Number of seconds to run fuzz tests during ctest run") # Default of 10 seconds
10
CACHE STRING "Number of seconds to run fuzz tests during ctest run") # Default of 10 seconds

add_test(NAME fuzz_tester_run COMMAND fuzz_tester -max_total_time=${FUZZ_RUNTIME})
48 changes: 24 additions & 24 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ add_executable(${cloysterhpc_BINARY_NAME} main.cpp)
include(../cmake/CommonLibraries.cmake)

target_link_libraries(
${cloysterhpc_BINARY_NAME}
PRIVATE
cloysterhpc_static
cloysterhpc::cloysterhpc_options
cloysterhpc::cloysterhpc_warnings)
${cloysterhpc_BINARY_NAME}
PRIVATE
cloysterhpc_static
cloysterhpc::cloysterhpc_options
cloysterhpc::cloysterhpc_warnings)

target_link_system_libraries(
${cloysterhpc_BINARY_NAME}
PRIVATE
${COMMON_LIBS})
${cloysterhpc_BINARY_NAME}
PRIVATE
${COMMON_LIBS})

target_link_libraries(
cloysterhpc_object
PRIVATE
cloysterhpc::cloysterhpc_options
cloysterhpc::cloysterhpc_warnings)
cloysterhpc_object
PRIVATE
cloysterhpc::cloysterhpc_options
cloysterhpc::cloysterhpc_warnings)

target_link_system_libraries(
cloysterhpc_object
PRIVATE
${COMMON_LIBS})
cloysterhpc_object
PRIVATE
${COMMON_LIBS})

target_include_directories(cloysterhpc_static PRIVATE
"${CMAKE_BINARY_DIR}/configured_files/include")
"${CMAKE_BINARY_DIR}/configured_files/include")
target_include_directories(cloysterhpc_static ${WARNING_GUARD} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)

target_include_directories(cloysterhpc_object PRIVATE
"${CMAKE_BINARY_DIR}/configured_files/include")
"${CMAKE_BINARY_DIR}/configured_files/include")
target_include_directories(cloysterhpc_object ${WARNING_GUARD} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)

target_include_directories(${cloysterhpc_BINARY_NAME} PRIVATE
"${CMAKE_BINARY_DIR}/configured_files/include")
"${CMAKE_BINARY_DIR}/configured_files/include")
target_include_directories(${cloysterhpc_BINARY_NAME} ${WARNING_GUARD} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)

# Set target locations to the root folder of the project in /bin and /lib.
# WARNING: This will break multiple target compile, disable it if necessary
Expand Down
12 changes: 5 additions & 7 deletions src/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@ void Cluster::fillData(const std::string& answerfilePath)
externalConnection.setAddress(answerfile.external.con_ip_addr.value());

getNetwork(Network::Profile::External)
.setAddress(
getNetwork(Network::Profile::External)
.setAddress(getNetwork(Network::Profile::External)
.calculateAddress(answerfile.external.con_ip_addr.value()));
} else {
auto externalNetworkIpAddress = externalConnection.fetchAddress(
Expand All @@ -561,7 +560,7 @@ void Cluster::fillData(const std::string& answerfilePath)

getNetwork(Network::Profile::External)
.setAddress(getNetwork(Network::Profile::External)
.calculateAddress(externalNetworkIpAddress));
.calculateAddress(externalNetworkIpAddress));
}

if (!answerfile.external.con_mac_addr->empty()) {
Expand Down Expand Up @@ -619,8 +618,7 @@ void Cluster::fillData(const std::string& answerfilePath)
serviceConnection.setAddress(answerfile.service.con_ip_addr.value());

getNetwork(Network::Profile::Service)
.setAddress(
getNetwork(Network::Profile::Service)
.setAddress(getNetwork(Network::Profile::Service)
.calculateAddress(answerfile.service.con_ip_addr.value()));

m_headnode.addConnection(std::move(serviceConnection));
Expand Down Expand Up @@ -674,8 +672,8 @@ void Cluster::fillData(const std::string& answerfilePath)

getNetwork(Network::Profile::Application)
.setAddress(getNetwork(Network::Profile::Application)
.calculateAddress(
answerfile.application.con_ip_addr.value()));
.calculateAddress(
answerfile.application.con_ip_addr.value()));

m_headnode.addConnection(std::move(applicationConnection));
}
Expand Down
2 changes: 1 addition & 1 deletion src/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

OS::OS()
{
struct utsname system { };
struct utsname system {};
uname(&system);

setArch(system.machine);
Expand Down
Loading

0 comments on commit bb0eae7

Please sign in to comment.