From 11e18d1c74c026c7cbbaa7ccf1312f6376728123 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Fri, 18 Oct 2024 16:08:41 -0400 Subject: [PATCH 01/10] Adds ReadTheDocs config and pins version of Sphinx in docs/requirements.txt --- .readthedocs.yaml | 32 ++++++++++++++++++++++++++++++++ docs/requirements.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..d1b87eff --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,32 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 6b104fb0..46c59599 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,2 @@ -Sphinx +Sphinx<7.0.0 sphinx-rtd-theme From 594628d533c5274d3365d3f73a5f034aa387ebcc Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 21 May 2024 09:57:24 -0700 Subject: [PATCH 02/10] Removes fPIC from SetupCompiler.cmake since it's already set portably in the top level CMakeLists.txt --- cmake/modules/SetupCompiler.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index 69855d1d..d7c57bea 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -89,11 +89,11 @@ macro(dyad_add_c_flags MY_FLAGS) endmacro() dyad_add_cxx_flags(CMAKE_CXX_FLAGS - -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor + -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor -Wno-deprecated-declarations) dyad_add_c_flags(CMAKE_C_FLAGS - -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter + -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-deprecated-declarations) if (${GLIBC_VERSION} VERSION_GREATER_EQUAL "2.19") From cde50e6a00f1768b5f9acaa027c24f6fa7281598 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 21 May 2024 11:19:51 -0700 Subject: [PATCH 03/10] Creates fully functioning CMake config file on install and unifies some variable names --- CMakeLists.txt | 172 +++++++++++----------- cmake/configure_files/DYADConfig.cmake.in | 15 +- cmake/modules/SetupCompiler.cmake | 14 +- src/dyad/core/CMakeLists.txt | 10 +- src/dyad/dtl/CMakeLists.txt | 10 +- src/dyad/modules/CMakeLists.txt | 12 +- src/dyad/stream/CMakeLists.txt | 10 +- src/dyad/utils/CMakeLists.txt | 18 +-- src/dyad/utils/base64/CMakeLists.txt | 10 +- src/dyad/wrapper/CMakeLists.txt | 16 +- 10 files changed, 145 insertions(+), 142 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e16bf8c..dbc94ecd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,19 +32,21 @@ endif () # if (CMAKE_INSTALL_LIBDIR) message(STATUS "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}") - set(DYAD_LIBDIR ${CMAKE_INSTALL_LIBDIR}) - set(DYAD_INSTALL_INCLUDE_DIR - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(DYAD_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}) + set(DYAD_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) + set(DYAD_INSTALL_INCLUDEDIR + ${CMAKE_INSTALL_INCLUDEDIR}) set(DYAD_INSTALL_DOCDIR - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}) + ${CMAKE_INSTALL_DOCDIR}) set(DYAD_INSTALL_SYSCONFDIR - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/modulefiles) + ${CMAKE_INSTALL_SYSCONFDIR}/modulefiles) else () - set(DYAD_LIBDIR "lib") - set(DYAD_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include") - set(DYAD_INSTALL_DOCDIR "${CMAKE_INSTALL_PREFIX}/doc") - set(DYAD_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc/modulefiles") - message(STATUS "DYAD_LIBDIR set to ${DYAD_LIBDIR}") + set(DYAD_INSTALL_BINDIR "bin") + set(DYAD_INSTALL_LIBDIR "lib") + set(DYAD_INSTALL_INCLUDEDIR "include") + set(DYAD_INSTALL_DOCDIR "doc") + set(DYAD_INSTALL_SYSCONFDIR "etc/modulefiles") + message(STATUS "DYAD_INSTALL_LIBDIR set to ${DYAD_INSTALL_LIBDIR}") endif () #------------------------------------------------------------------------------ @@ -54,17 +56,18 @@ endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_PREFIX}) # This sets where to look for dependent library's cmake files list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/${DYAD_LIBDIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/share/cmake) #------------------------------------------------------------------------------ -if (NOT DYAD_EXTERNALLY_CONFIGURED) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables.") - set(CMAKE_INCLUDE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/include CACHE PATH "Store the headers.") - set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_LIBDIR} CACHE PATH "Single Directory for all Libraries") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_LIBDIR} CACHE PATH "Single Directory for all static libraries.") -endif () +# This doesn't really need to be in an 'if' statement since they're cache variables +# if (NOT DYAD_EXTERNALLY_CONFIGURED) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_BINDIR} CACHE PATH "Single Directory for all Executables.") +set(CMAKE_INCLUDE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_INCLUDEDIR} CACHE PATH "Store the headers.") +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR} CACHE PATH "Single Directory for all Libraries") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR} CACHE PATH "Single Directory for all static libraries.") +# endif () #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use @@ -289,38 +292,38 @@ add_subdirectory(src/dyad) #----------------------------------------------------------------------------- # Configure the config.cmake file for the build directory #----------------------------------------------------------------------------- -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.build.in - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake @ONLY -) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.install.in - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake @ONLY -) -install( - FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake - DESTINATION - ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} -) +# configure_file( +# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.build.in +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake @ONLY +# ) +# +# configure_file( +# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.install.in +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake @ONLY +# ) +# install( +# FILES +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake +# DESTINATION +# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} +# ) #----------------------------------------------------------------------------- # Configure the ${PROJECT_NAME}-config-version .cmake file for the install directory #----------------------------------------------------------------------------- -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config-version.cmake.in - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake @ONLY -) - -install( - FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake - DESTINATION - ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} -) - -export(EXPORT ${DYAD_EXPORTED_TARGETS} - FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake") +# configure_file( +# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config-version.cmake.in +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake @ONLY +# ) +# +# install( +# FILES +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake +# DESTINATION +# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} +# ) +# +# export(EXPORT ${DYAD_EXPORTED_TARGETS} +# FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake") # Write the configure file configure_file("${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_config.hpp.in" @@ -333,17 +336,23 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_config.hpp.in" include(CMakePackageConfigHelpers) +set(DYAD_BUILD_CMAKE_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}") +set(DYAD_INSTALL_CMAKE_DIR "${DYAD_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +set(DYAD_INSTALL_TMP_CMAKE_DIR "${CMAKE_BINARY_DIR}/install_cmake_scripts") + # Write the version file. This is independent of build/install tree. write_basic_package_version_file( - DYADConfigVersion.cmake + ${DYAD_BUILD_CMAKE_DIR}/DYADConfigVersion.cmake VERSION "${DYAD_PACKAGE_VERSION}" COMPATIBILITY SameMajorVersion) +file(COPY ${DYAD_BUILD_CMAKE_DIR}/DYADConfigVersion.cmake + DESTINATION ${DYAD_INSTALL_TMP_CMAKE_DIR}) #........................................... # TODO: There are two different places where cmake config is handled currently. # Need to clean up and merge -if (WIP_package_config) +# if (WIP_package_config) # This is for the build tree #set(INCLUDE_INSTALL_DIRS # "${CMAKE_SOURCE_DIR}/src/dyad/common" @@ -355,53 +364,51 @@ if (WIP_package_config) # "${CMAKE_SOURCE_DIR}/src/dyad/utils/base64") # "${CMAKE_SOURCE_DIR}/include/dyad/stream") set(EXTRA_CMAKE_MODULE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules") - -configure_package_config_file(cmake/configure_files/DYADConfig.cmake.in - "${CMAKE_BINARY_DIR}/DYADConfig.cmake" - INSTALL_DESTINATION "${CMAKE_BINARY_DIR}/src/dyad/${DYAD_LIBDIR}/cmake/dyad" - PATH_VARS CMAKE_BINARY_DIR) - #PATH_VARS INCLUDE_INSTALL_DIRS CMAKE_BINARY_DIR) +set(INCLUDE_INSTALL_DIRS $CMAKE_INCLUDE_OUTPUT_DIRECTORY}) +set(LIB_INSTALL_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure_files/DYADConfig.cmake.in + "${DYAD_BUILD_CMAKE_DIR}/DYADConfig.cmake" + INSTALL_DESTINATION "${DYAD_BUILD_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIRS LIB_INSTALL_DIR) # Write the configure file for the install tree -set(INCLUDE_INSTALL_DIRS include) -set(EXTRA_CMAKE_MODULE_DIR) +set(EXTRA_CMAKE_MODULE_DIR "") +set(INCLUDE_INSTALL_DIRS "${DYAD_INSTALL_INCLUDEDIR}") +set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") configure_package_config_file(cmake/configure_files/DYADConfig.cmake.in - "${CMAKE_BINARY_DIR}/DYADConfig.cmake.install" - INSTALL_DESTINATION "${DYAD_LIBDIR}/cmake/dyad" - PATH_VARS INCLUDE_INSTALL_DIRS DYAD_LIBDIR) + "${DYAD_INSTALL_TMP_CMAKE_DIR}/DYADConfig.cmake" + INSTALL_DESTINATION "${DYAD_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIRS LIB_INSTALL_DIR) # Install export -install(EXPORT DYADTargets +install(EXPORT ${DYAD_EXPORTED_TARGETS} # DYADTargets NAMESPACE DYAD:: FILE DYADTargets.cmake - DESTINATION "${DYAD_LIBDIR}/cmake/dyad") + DESTINATION "${DYAD_INSTALL_CMAKE_DIR}") # Install the cmake stuff -install(FILES "${PROJECT_BINARY_DIR}/DYADConfig.cmake.install" - DESTINATION "${DYAD_LIBDIR}/cmake/dyad" - RENAME "DYADConfig.cmake") - -install(FILES "${PROJECT_BINARY_DIR}/DYADConfigVersion.cmake" - DESTINATION "${DYAD_LIBDIR}/cmake/dyad") +install(DIRECTORY "${DYAD_INSTALL_TMP_CMAKE_DIR}/" # Trailing slash ensures directory structure is not copied + DESTINATION "${DYAD_INSTALL_CMAKE_DIR}" + FILES_MATCHING PATTERN "*.cmake") install(DIRECTORY cmake/modules - DESTINATION "${DYAD_LIBDIR}/cmake/dyad" + DESTINATION "${DYAD_INSTALL_CMAKE_DIR}" FILES_MATCHING PATTERN "*.cmake") -endif (WIP_package_config) +# endif (WIP_package_config) #........................................... install(FILES "${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/dyad/dyad_config.hpp" DESTINATION - ${DYAD_INSTALL_INCLUDE_DIR}/dyad) + ${DYAD_INSTALL_INCLUDEDIR}/dyad) -install(EXPORT - ${DYAD_EXPORTED_TARGETS} - DESTINATION - ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} - FILE - ${DYAD_EXPORTED_TARGETS}.cmake - ) +# install(EXPORT +# ${DYAD_EXPORTED_TARGETS} +# DESTINATION +# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} +# FILE +# ${DYAD_EXPORTED_TARGETS}.cmake +# ) # Install license and readme install(FILES @@ -455,10 +462,11 @@ string(APPEND _str " DYAD_PACKAGE_VERSION: ${DYAD_PACKAGE_VERSION}\n") string(APPEND _str " DYAD_GIT_VERSION: ${DYAD_GIT_VERSION}\n") -string(APPEND _str - " DYAD_ENABLE_UCX_DATA: ${DYAD_ENABLE_UCX_DATA}\n") -string(APPEND _str - " DYAD_ENABLE_UCX_DATA_RMA: ${DYAD_ENABLE_UCX_DATA_RMA}\n") +# Comment out since they'll be printed again below +# string(APPEND _str +# " DYAD_ENABLE_UCX_DATA: ${DYAD_ENABLE_UCX_DATA}\n") +# string(APPEND _str +# " DYAD_ENABLE_UCX_DATA_RMA: ${DYAD_ENABLE_UCX_DATA_RMA}\n") string(APPEND _str " DYAD_ENABLE_TESTS: ${DYAD_ENABLE_TESTS}\n") string(APPEND _str diff --git a/cmake/configure_files/DYADConfig.cmake.in b/cmake/configure_files/DYADConfig.cmake.in index 4e805d32..f9b3c1b1 100644 --- a/cmake/configure_files/DYADConfig.cmake.in +++ b/cmake/configure_files/DYADConfig.cmake.in @@ -8,10 +8,11 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules") list(APPEND CMAKE_MODULE_PATH "@EXTRA_CMAKE_MODULE_DIR@") -#include(GNUInstallDirs) -include(ExternalProject) -include(DYADCMakeUtilities) -include(CMakePackageConfigHelpers) +# None of these are currently needed +# include(GNUInstallDirs) +# include(ExternalProject) +# include(DYADCMakeUtilities) +# include(CMakePackageConfigHelpers) set(DYAD_VERSION ${PACKAGE_VERSION}) @@ -26,8 +27,10 @@ set(DYAD_CXX_FLAGS "@CMAKE_CXX_FLAGS@") set(DYAD_C_STANDARD "@CMAKE_C_STANDARD@") set(DYAD_CXX_STANDARD "@CMAKE_CXX_STANDARD@") -set(CMAKE_C_STANDARD_REQUIRED TRUE) -set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +# Using DYAD-specific versions of these variables so that we don't risk +# polluting user CMake scripts +set(DYAD_C_STANDARD_REQUIRED TRUE) +set(DYAD_CXX_STANDARD_REQUIRED TRUE) # Record the various flags and switches accumlated in DYAD set(DYAD_GNU_LINUX @DYAD_GNU_LINUX@) diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index d7c57bea..7f29e4b5 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -196,23 +196,15 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # which point to directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -if (NOT DYAD_LIBDIR) - if (CMAKE_INSTALL_LIBDIR) - set(DYAD_LIBDIR ${CMAKE_INSTALL_LIBDIR}) - else () - set(DYAD_LIBDIR "lib") - endif () -endif () - -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}" _IS_SYSTEM_DIR) + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) if (${_IS_SYSTEM_DIR} STREQUAL "-1") # Set the install RPATH correctly list(APPEND CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") endif () diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 5c6e6338..6293ad6f 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -22,7 +22,7 @@ set(DYAD_CTX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_ctx.h add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC} ${DYAD_CORE_PUBLIC_HEADERS} ${DYAD_CORE_PRIVATE_HEADERS}) set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_core PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) @@ -31,7 +31,7 @@ target_compile_definitions(${PROJECT_NAME}_core PUBLIC BUILDING_DYAD=1) target_compile_definitions(${PROJECT_NAME}_core PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_core PUBLIC $ # will be used for generated code - $) # wil be used for sub projects + $) # wil be used for sub projects target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) @@ -59,9 +59,9 @@ endif() install( TARGETS ${PROJECT_NAME}_core ${PROJECT_NAME}_ctx EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_CORE_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_CORE_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 528ece78..5316f717 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -29,7 +29,7 @@ endif() add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC} ${DTL_PUBLIC_HEADERS} ${DTL_PRIVATE_HEADERS}) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ${PROJECT_NAME}_utils Jansson::Jansson flux::core flux::optparse) set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") if(DYAD_ENABLE_UCX_DTL OR DYAD_ENABLE_UCX_DATA_RMA) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) @@ -42,7 +42,7 @@ endif() target_compile_definitions(${PROJECT_NAME}_dtl PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_dtl PUBLIC $ - $) + $) target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${FluxCore_INCLUDE_DIRS}) @@ -59,9 +59,9 @@ endif() install( TARGETS ${PROJECT_NAME}_dtl EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT ${DTL_PUBLIC_HEADERS} STREQUAL "") dyad_install_headers("${DTL_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index 2a5105aa..c466c9fd 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC} ${DYAD_MODULE_PRIVATE_HEADERS} ${DYAD_MODULE_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_ctx) @@ -24,7 +24,7 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC BUILDING_DYAD=1) target_compile_definitions(${PROJECT_NAME} PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME} PUBLIC $ - $) + $) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) @@ -37,7 +37,7 @@ add_executable(test_opt_parse test_opt_parse.c target_compile_definitions(test_opt_parse PUBLIC DYAD_HAS_CONFIG) target_include_directories(test_opt_parse PUBLIC $ - $) + $) if (TARGET DYAD_C_FLAGS_werror) target_link_libraries(${PROJECT_NAME} PRIVATE DYAD_C_FLAGS_werror) @@ -56,9 +56,9 @@ endif() install( TARGETS ${PROJECT_NAME} EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_MODULE_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_MODULE_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index 0c226401..d2cc50c2 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -12,7 +12,7 @@ set(DYAD_FSTREAM_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dya add_library(${PROJECT_NAME}_fstream SHARED ${DYAD_FSTREAM_SRC} ${DYAD_FSTREAM_PRIVATE_HEADERS} ${DYAD_FSTREAM_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_fstream PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_compile_features(${PROJECT_NAME}_fstream PRIVATE) target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core ${PROJECT_NAME}_utils flux::core) @@ -27,7 +27,7 @@ target_compile_definitions(${PROJECT_NAME}_fstream PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_fstream PUBLIC $ $ - $) + $) target_include_directories(${PROJECT_NAME}_fstream SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) if (TARGET DYAD_CXX_FLAGS_werror) @@ -40,9 +40,9 @@ endif() install( TARGETS ${PROJECT_NAME}_fstream EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_FSTREAM_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_FSTREAM_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 6596eae4..42c9e283 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -14,7 +14,7 @@ set(DYAD_MURMUR3_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_utils SHARED ${DYAD_UTILS_SRC} ${DYAD_UTILS_PRIVATE_HEADERS} ${DYAD_UTILS_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_utils PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_utils PUBLIC ${PROJECT_NAME}_base64 ${PROJECT_NAME}_murmur3) @@ -29,11 +29,11 @@ endif() target_compile_definitions(${PROJECT_NAME}_utils PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_utils PUBLIC $ - $) + $) add_library(${PROJECT_NAME}_murmur3 SHARED ${DYAD_MURMUR3_SRC}) set_target_properties(${PROJECT_NAME}_murmur3 PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") add_executable(test_cmp_canonical_path_prefix test_cmp_canonical_path_prefix.c ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_structures.h) @@ -62,9 +62,9 @@ endif () install( TARGETS ${PROJECT_NAME}_utils EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_UTILS_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_UTILS_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) @@ -72,9 +72,9 @@ endif() install( TARGETS ${PROJECT_NAME}_murmur3 EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_MURMUR3_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_UTILS_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index bbfaf5f1..d1743259 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -5,17 +5,17 @@ set(DYAD_BASE64_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_base64 SHARED ${DYAD_BASE64_SRC} ${DYAD_BASE64_PRIVATE_HEADERS} ${DYAD_BASE64_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_base64 PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_include_directories(${PROJECT_NAME}_base64 PUBLIC $ - $) + $) install( TARGETS ${PROJECT_NAME}_base64 EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_BASE64_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_BASE64_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index 0978e19e..d4c36186 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -8,14 +8,14 @@ set(DYAD_WRAPPER_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_wrapper SHARED ${DYAD_WRAPPER_SRC} ${DYAD_WRAPPER_PRIVATE_HEADERS} ${DYAD_WRAPPER_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_wrapper PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") + "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core) target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_utils flux::core) target_compile_definitions(${PROJECT_NAME}_wrapper PUBLIC BUILDING_DYAD=1) target_compile_definitions(${PROJECT_NAME}_wrapper PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_wrapper PUBLIC $ - $) + $) target_include_directories(${PROJECT_NAME}_wrapper SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) if (TARGET DYAD_C_FLAGS_werror) @@ -33,9 +33,9 @@ target_include_directories(${PROJECT_NAME}_flux_barrier SYSTEM PRIVATE ${FluxCor install( TARGETS ${PROJECT_NAME}_wrapper EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${DYAD_WRAPPER_PUBLIC_HEADERS}" STREQUAL "") @@ -45,9 +45,9 @@ endif() install( TARGETS ${PROJECT_NAME}_flux_barrier EXPORT ${DYAD_EXPORTED_TARGETS} - LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} - RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${DYAD_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${DYAD_INSTALL_LIBDIR} + RUNTIME DESTINATION ${DYAD_INSTALL_BINDIR} ) if(NOT "${FLUX_BARRIER_PUBLIC_HEADERS}" STREQUAL "") From b2e644b28407cd4e7bc8a075c8428788191688f9 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 21 May 2024 11:29:01 -0700 Subject: [PATCH 04/10] Replaces werror mechanism with a more resilient version that's less likely to interfere with users' code --- cmake/modules/SetupCompiler.cmake | 42 ++++++++++++++++++------------- src/dyad/core/CMakeLists.txt | 6 ++--- src/dyad/dtl/CMakeLists.txt | 7 +----- src/dyad/modules/CMakeLists.txt | 6 ++--- src/dyad/stream/CMakeLists.txt | 4 +-- src/dyad/utils/CMakeLists.txt | 11 +++----- src/dyad/wrapper/CMakeLists.txt | 4 +-- 7 files changed, 36 insertions(+), 44 deletions(-) diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index 7f29e4b5..a8ee1638 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -105,23 +105,31 @@ endif () # Promote a compiler warning as an error for project targets ################################################################ -if (DYAD_WARNINGS_AS_ERRORS) - dyad_add_cxx_flags(_WERROR_FLAGS -Werror) - separate_arguments(_WERROR_FLAGS NATIVE_COMMAND "${_WERROR_FLAGS}") - if (NOT TARGET DYAD_CXX_FLAGS_werror) - add_library(DYAD_CXX_FLAGS_werror INTERFACE) - set_property(TARGET DYAD_CXX_FLAGS_werror PROPERTY - INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) - - add_library(DYAD_C_FLAGS_werror INTERFACE) - set_property(TARGET DYAD_C_FLAGS_werror PROPERTY - INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) - - # Add the "library" to the export - install(TARGETS DYAD_C_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) - install(TARGETS DYAD_CXX_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) - endif () -endif () +macro(dyad_add_werror_if_needed target) + if (DYAD_WARNINGS_AS_ERRORS) + target_compile_options(${target} PRIVATE + $<$:"-Werror"> + $<$:"-Werror">) + endif() +endmacro(dyad_add_werror_if_needed target) + +# if (DYAD_WARNINGS_AS_ERRORS) +# dyad_add_cxx_flags(_WERROR_FLAGS -Werror) +# separate_arguments(_WERROR_FLAGS NATIVE_COMMAND "${_WERROR_FLAGS}") +# if (NOT TARGET DYAD_CXX_FLAGS_werror) +# add_library(DYAD_CXX_FLAGS_werror INTERFACE) +# set_property(TARGET DYAD_CXX_FLAGS_werror PROPERTY +# INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) +# +# add_library(DYAD_C_FLAGS_werror INTERFACE) +# set_property(TARGET DYAD_C_FLAGS_werror PROPERTY +# INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) +# +# # Add the "library" to the export +# install(TARGETS DYAD_C_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) +# install(TARGETS DYAD_CXX_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) +# endif () +# endif () ################################################################ diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 6293ad6f..73577406 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -43,10 +43,8 @@ target_include_directories(${PROJECT_NAME}_ctx SYSTEM PRIVATE ${JANSSON_INCLUDE_ target_include_directories(${PROJECT_NAME}_ctx SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME}_ctx PRIVATE ${PROJECT_NAME}_dtl ${PROJECT_NAME}_utils) -if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_core PRIVATE DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_ctx PRIVATE DYAD_C_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}_core) +dyad_add_werror_if_needed(${PROJECT_NAME}_ctx) if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") target_link_libraries(${PROJECT_NAME}_core PRIVATE perfflowaspect::perfflowaspect) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 5316f717..5b825a12 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -34,9 +34,6 @@ set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH if(DYAD_ENABLE_UCX_DTL OR DYAD_ENABLE_UCX_DATA_RMA) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${ucx_INCLUDE_DIRS}) - if (TARGET DYAD_CXX_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_dtl PRIVATE DYAD_CXX_FLAGS_werror) - endif () endif() target_compile_definitions(${PROJECT_NAME}_dtl PUBLIC DYAD_HAS_CONFIG) @@ -46,9 +43,7 @@ target_include_directories(${PROJECT_NAME}_dtl PUBLIC target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${FluxCore_INCLUDE_DIRS}) -if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_dtl PRIVATE DYAD_C_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}_dtl) if(DYAD_LOGGER STREQUAL "CPP_LOGGER") target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ${CPP_LOGGER_LIBRARIES}) endif() diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index c466c9fd..aca78ff6 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -39,10 +39,8 @@ target_include_directories(test_opt_parse PUBLIC $ $) -if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME} PRIVATE DYAD_C_FLAGS_werror) - target_link_libraries(test_opt_parse PRIVATE DYAD_C_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}) +dyad_add_werror_if_needed(test_opt_parse) if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") target_link_libraries(${PROJECT_NAME} PRIVATE perfflowaspect::perfflowaspect) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index d2cc50c2..fcd24cfe 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -30,9 +30,7 @@ target_include_directories(${PROJECT_NAME}_fstream PUBLIC $) target_include_directories(${PROJECT_NAME}_fstream SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) -if (TARGET DYAD_CXX_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_fstream PRIVATE DYAD_CXX_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}_fstream) if(DYAD_PROFILER STREQUAL "DFTRACER") target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${DFTRACER_LIBRARIES}) endif() diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 42c9e283..c9a7246f 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -51,13 +51,10 @@ if(DYAD_PROFILER STREQUAL "DFTRACER") target_link_libraries(test_cmp_canonical_path_prefix PRIVATE ${DTRACER_LIBRARIES}) endif() - -if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_utils PRIVATE DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_murmur3 PRIVATE DYAD_C_FLAGS_werror) - target_link_libraries(test_murmur3 PRIVATE DYAD_C_FLAGS_werror) - target_link_libraries(test_cmp_canonical_path_prefix PRIVATE DYAD_C_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}_utils) +dyad_add_werror_if_needed(${PROJECT_NAME}_murmur3) +dyad_add_werror_if_needed(test_murmur3) +dyad_add_werror_if_needed(test_cmp_canonical_path_prefix) install( TARGETS ${PROJECT_NAME}_utils diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index d4c36186..38987d36 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -18,9 +18,7 @@ target_include_directories(${PROJECT_NAME}_wrapper PUBLIC $) target_include_directories(${PROJECT_NAME}_wrapper SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) -if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE DYAD_C_FLAGS_werror) -endif () +dyad_add_werror_if_needed(${PROJECT_NAME}_wrapper) set(FLUX_BARRIER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/flux_barrier.c) set(FLUX_BARRIER_PRIVATE_HEADERS) From 9a12cd93e339aaad5f00025a13baf3a52b831140 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 21 May 2024 11:48:05 -0700 Subject: [PATCH 05/10] Replaces the glibc check with a portable version --- cmake/modules/SetupCompiler.cmake | 22 ++++++++++++++-------- cmake/tests/check_glibc_version.c | 8 ++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 cmake/tests/check_glibc_version.c diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index a8ee1638..9855f106 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -26,14 +26,20 @@ include(CheckIncludeFileCXX) MACRO (CHECK_GLIBC_VERSION) EXECUTE_PROCESS ( - COMMAND ${CMAKE_C_COMPILER} -print-file-name=libc.so.6 - OUTPUT_VARIABLE GLIBC - OUTPUT_STRIP_TRAILING_WHITESPACE) - - GET_FILENAME_COMPONENT (GLIBC ${GLIBC} REALPATH) - GET_FILENAME_COMPONENT (GLIBC_VERSION ${GLIBC} NAME) - STRING (REPLACE "libc-" "" GLIBC_VERSION ${GLIBC_VERSION}) - STRING (REPLACE ".so" "" GLIBC_VERSION ${GLIBC_VERSION}) + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_SOURCE_DIR}/cmake/tests/check_glibc_version.c -o ${CMAKE_BINARY_DIR}/check_glibc_version + RESULT_VARIABLE COULD_COMPILE_GLIBC_CHECKER) + if (NOT COULD_COMPILE_GLIBC_CHECKER EQUAL 0) + message(FATAL_ERROR "Could not compile glibc version checker") + endif () + EXECUTE_PROCESS( + COMMAND ${CMAKE_BINARY_DIR}/check_glibc_version + OUTPUT_VARIABLE GLIBC_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE COULD_GET_GLIBC_VERSION) + if (NOT COULD_GET_GLIBC_VERSION EQUAL 0) + message(FATAL_ERROR "Could not get glibc version") + endif () + IF (NOT GLIBC_VERSION MATCHES "^[0-9.]+$") MESSAGE (FATAL_ERROR "Unknown glibc version: ${GLIBC_VERSION}") ENDIF (NOT GLIBC_VERSION MATCHES "^[0-9.]+$") diff --git a/cmake/tests/check_glibc_version.c b/cmake/tests/check_glibc_version.c new file mode 100644 index 00000000..c5a51646 --- /dev/null +++ b/cmake/tests/check_glibc_version.c @@ -0,0 +1,8 @@ +#include +#include + +int main(void) +{ + puts(gnu_get_libc_version()); + return 0; +} \ No newline at end of file From 7d978c57c28ffa53cd7b2da1e2b3c56dafe575f2 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 21 May 2024 16:34:20 -0700 Subject: [PATCH 06/10] Adds some code to set DYAD_KVS_NAMESPACE in broker module to allow dyad_ctx_init to succeed Adds missing curly brace in top level CMake --- CMakeLists.txt | 2 +- src/dyad/modules/dyad.c | 781 +++++++++++++++++++++------------------- 2 files changed, 402 insertions(+), 381 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc94ecd..177fb1d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,7 @@ file(COPY ${DYAD_BUILD_CMAKE_DIR}/DYADConfigVersion.cmake # "${CMAKE_SOURCE_DIR}/src/dyad/utils/base64") # "${CMAKE_SOURCE_DIR}/include/dyad/stream") set(EXTRA_CMAKE_MODULE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules") -set(INCLUDE_INSTALL_DIRS $CMAKE_INCLUDE_OUTPUT_DIRECTORY}) +set(INCLUDE_INSTALL_DIRS ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) set(LIB_INSTALL_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure_files/DYADConfig.cmake.in "${DYAD_BUILD_CMAKE_DIR}/DYADConfig.cmake" diff --git a/src/dyad/modules/dyad.c b/src/dyad/modules/dyad.c index 31dce08a..48c64c47 100644 --- a/src/dyad/modules/dyad.c +++ b/src/dyad/modules/dyad.c @@ -41,7 +41,7 @@ #include #include #include -#endif // defined(__cplusplus) +#endif // defined(__cplusplus) #include #include @@ -49,461 +49,482 @@ #include #include -#define TIME_DIFF(Tstart, Tend) \ - ((double)(1000000000L * ((Tend).tv_sec - (Tstart).tv_sec) + (Tend).tv_nsec - (Tstart).tv_nsec) \ - / 1000000000L) +#define TIME_DIFF(Tstart, Tend) \ + ((double)(1000000000L * ((Tend).tv_sec - (Tstart).tv_sec) + (Tend).tv_nsec - \ + (Tstart).tv_nsec) / \ + 1000000000L) struct dyad_mod_ctx { - flux_msg_handler_t **handlers; - dyad_ctx_t *ctx; + flux_msg_handler_t **handlers; + dyad_ctx_t *ctx; }; const struct dyad_mod_ctx dyad_mod_ctx_default = {NULL, NULL}; typedef struct dyad_mod_ctx dyad_mod_ctx_t; -static void dyad_mod_fini (void) __attribute__ ((destructor)); +static void dyad_mod_fini(void) __attribute__((destructor)); -void dyad_mod_fini (void) -{ - flux_t *h = flux_open (NULL, 0); +void dyad_mod_fini(void) { + flux_t *h = flux_open(NULL, 0); - if (h != NULL) { - } + if (h != NULL) { + } #ifdef DYAD_PROFILER_DFTRACER - DFTRACER_C_FINI (); + DFTRACER_C_FINI(); #endif } -static void freectx (void *arg) -{ - dyad_mod_ctx_t *mod_ctx = (dyad_mod_ctx_t *)arg; - flux_msg_handler_delvec (mod_ctx->handlers); - if (mod_ctx->ctx) { - dyad_ctx_fini (); - mod_ctx->ctx = NULL; - } - free (mod_ctx); +static void freectx(void *arg) { + dyad_mod_ctx_t *mod_ctx = (dyad_mod_ctx_t *)arg; + flux_msg_handler_delvec(mod_ctx->handlers); + if (mod_ctx->ctx) { + dyad_ctx_fini(); + mod_ctx->ctx = NULL; + } + free(mod_ctx); } -static dyad_mod_ctx_t *get_mod_ctx (flux_t *h) -{ - dyad_mod_ctx_t *mod_ctx = (dyad_mod_ctx_t *)flux_aux_get (h, "dyad"); - - if (!mod_ctx) { - mod_ctx = (dyad_mod_ctx_t *)malloc (sizeof (*mod_ctx)); - if (mod_ctx == NULL) { - DYAD_LOG_STDERR ("DYAD_MOD: could not allocate memory for context"); - goto getctx_error; - } - mod_ctx->handlers = NULL; - mod_ctx->ctx = NULL; - - if (flux_aux_set (h, "dyad", mod_ctx, freectx) < 0) { - DYAD_LOG_STDERR ("DYAD_MOD: flux_aux_set() failed!"); - goto getctx_error; - } +static dyad_mod_ctx_t *get_mod_ctx(flux_t *h) { + dyad_mod_ctx_t *mod_ctx = (dyad_mod_ctx_t *)flux_aux_get(h, "dyad"); + + if (!mod_ctx) { + mod_ctx = (dyad_mod_ctx_t *)malloc(sizeof(*mod_ctx)); + if (mod_ctx == NULL) { + DYAD_LOG_STDERR("DYAD_MOD: could not allocate memory for context"); + goto getctx_error; } + mod_ctx->handlers = NULL; + mod_ctx->ctx = NULL; - goto getctx_done; + if (flux_aux_set(h, "dyad", mod_ctx, freectx) < 0) { + DYAD_LOG_STDERR("DYAD_MOD: flux_aux_set() failed!"); + goto getctx_error; + } + } + + goto getctx_done; getctx_error:; - return NULL; + return NULL; getctx_done: - return mod_ctx; + return mod_ctx; } /* request callback called when dyad.fetch request is invoked */ #if DYAD_PERFFLOW -__attribute__ ((annotate ("@critical_path()"))) +__attribute__((annotate("@critical_path()"))) #endif static void -dyad_fetch_request_cb (flux_t *h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) -{ - DYAD_C_FUNCTION_START (); - dyad_mod_ctx_t *mod_ctx = get_mod_ctx (h); - DYAD_LOG_INFO (mod_ctx->ctx, "Launched callback for %s", DYAD_DTL_RPC_NAME); - ssize_t inlen = 0l; - char *inbuf = NULL; - int fd = -1; - uint32_t userid = 0u; - char *upath = NULL; - char fullpath[PATH_MAX + 1] = {'\0'}; - int saved_errno = errno; - ssize_t file_size = 0l; - dyad_rc_t rc = 0; - struct flock shared_lock; - if (!flux_msg_is_streaming (msg)) { - errno = EPROTO; - goto fetch_error_wo_flock; - } - - if (flux_msg_get_userid (msg, &userid) < 0) - goto fetch_error_wo_flock; - - DYAD_LOG_INFO (mod_ctx->ctx, "DYAD_MOD: unpacking RPC message"); - - rc = mod_ctx->ctx->dtl_handle->rpc_unpack (mod_ctx->ctx, msg, &upath); - - if (DYAD_IS_ERROR (rc)) { - DYAD_LOG_ERROR (mod_ctx->ctx, "Could not unpack message from client"); - errno = EPROTO; - goto fetch_error_wo_flock; - } - DYAD_C_FUNCTION_UPDATE_STR ("upath", upath); - DYAD_LOG_DEBUG (mod_ctx->ctx, "DYAD_MOD: requested user_path: %s", upath); - DYAD_LOG_DEBUG (mod_ctx->ctx, "DYAD_MOD: sending initial response to consumer"); - - rc = mod_ctx->ctx->dtl_handle->rpc_respond (mod_ctx->ctx, msg); - if (DYAD_IS_ERROR (rc)) { - DYAD_LOG_ERROR (mod_ctx->ctx, "Could not send primary RPC response to client"); - goto fetch_error_wo_flock; - } - - strncpy (fullpath, mod_ctx->ctx->prod_managed_path, PATH_MAX - 1); - concat_str (fullpath, upath, "/", PATH_MAX); - DYAD_C_FUNCTION_UPDATE_STR ("fullpath", fullpath); +dyad_fetch_request_cb(flux_t *h, flux_msg_handler_t *w, const flux_msg_t *msg, + void *arg) { + DYAD_C_FUNCTION_START(); + dyad_mod_ctx_t *mod_ctx = get_mod_ctx(h); + DYAD_LOG_INFO(mod_ctx->ctx, "Launched callback for %s", DYAD_DTL_RPC_NAME); + ssize_t inlen = 0l; + char *inbuf = NULL; + int fd = -1; + uint32_t userid = 0u; + char *upath = NULL; + char fullpath[PATH_MAX + 1] = {'\0'}; + int saved_errno = errno; + ssize_t file_size = 0l; + dyad_rc_t rc = 0; + struct flock shared_lock; + if (!flux_msg_is_streaming(msg)) { + errno = EPROTO; + goto fetch_error_wo_flock; + } + + if (flux_msg_get_userid(msg, &userid) < 0) + goto fetch_error_wo_flock; + + DYAD_LOG_INFO(mod_ctx->ctx, "DYAD_MOD: unpacking RPC message"); + + rc = mod_ctx->ctx->dtl_handle->rpc_unpack(mod_ctx->ctx, msg, &upath); + + if (DYAD_IS_ERROR(rc)) { + DYAD_LOG_ERROR(mod_ctx->ctx, "Could not unpack message from client"); + errno = EPROTO; + goto fetch_error_wo_flock; + } + DYAD_C_FUNCTION_UPDATE_STR("upath", upath); + DYAD_LOG_DEBUG(mod_ctx->ctx, "DYAD_MOD: requested user_path: %s", upath); + DYAD_LOG_DEBUG(mod_ctx->ctx, + "DYAD_MOD: sending initial response to consumer"); + + rc = mod_ctx->ctx->dtl_handle->rpc_respond(mod_ctx->ctx, msg); + if (DYAD_IS_ERROR(rc)) { + DYAD_LOG_ERROR(mod_ctx->ctx, + "Could not send primary RPC response to client"); + goto fetch_error_wo_flock; + } + + strncpy(fullpath, mod_ctx->ctx->prod_managed_path, PATH_MAX - 1); + concat_str(fullpath, upath, "/", PATH_MAX); + DYAD_C_FUNCTION_UPDATE_STR("fullpath", fullpath); #if DYAD_SPIN_WAIT - if (!get_stat (fullpath, 1000U, 1000L)) { - DYAD_LOG_ERR (mod_ctx->ctx, "DYAD_MOD: Failed to access info on \"%s\".", fullpath); - // goto error; - } -#endif // DYAD_SPIN_WAIT - - DYAD_LOG_INFO (mod_ctx->ctx, "DYAD_MOD: Reading file %s for transfer", fullpath); - fd = open (fullpath, O_RDONLY); - - if (fd < 0) { - DYAD_LOG_ERROR (mod_ctx->ctx, "DYAD_MOD: Failed to open file \"%s\".", fullpath); - goto fetch_error_wo_flock; - } - rc = dyad_shared_flock (mod_ctx->ctx, fd, &shared_lock); - if (DYAD_IS_ERROR (rc)) { - goto fetch_error; - } - file_size = get_file_size (fd); - DYAD_LOG_DEBUG (mod_ctx->ctx, "DYAD_MOD: file %s has size %zd", fullpath, file_size); - rc = mod_ctx->ctx->dtl_handle->get_buffer (mod_ctx->ctx, file_size, (void **)&inbuf); + if (!get_stat(fullpath, 1000U, 1000L)) { + DYAD_LOG_ERR(mod_ctx->ctx, "DYAD_MOD: Failed to access info on \"%s\".", + fullpath); + // goto error; + } +#endif // DYAD_SPIN_WAIT + + DYAD_LOG_INFO(mod_ctx->ctx, "DYAD_MOD: Reading file %s for transfer", + fullpath); + fd = open(fullpath, O_RDONLY); + + if (fd < 0) { + DYAD_LOG_ERROR(mod_ctx->ctx, "DYAD_MOD: Failed to open file \"%s\".", + fullpath); + goto fetch_error_wo_flock; + } + rc = dyad_shared_flock(mod_ctx->ctx, fd, &shared_lock); + if (DYAD_IS_ERROR(rc)) { + goto fetch_error; + } + file_size = get_file_size(fd); + DYAD_LOG_DEBUG(mod_ctx->ctx, "DYAD_MOD: file %s has size %zd", fullpath, + file_size); + rc = mod_ctx->ctx->dtl_handle->get_buffer(mod_ctx->ctx, file_size, + (void **)&inbuf); #ifdef DYAD_ENABLE_UCX_RMA - // To reduce the number of RMA calls, we are encoding file size at the start of the buffer - memcpy (inbuf, &file_size, sizeof (file_size)); + // To reduce the number of RMA calls, we are encoding file size at the start + // of the buffer + memcpy(inbuf, &file_size, sizeof(file_size)); #endif - if (file_size > 0l) { + if (file_size > 0l) { #ifdef DYAD_ENABLE_UCX_RMA - inlen = read (fd, inbuf + sizeof (file_size), file_size); + inlen = read(fd, inbuf + sizeof(file_size), file_size); #else - inlen = read (fd, inbuf, file_size); + inlen = read(fd, inbuf, file_size); #endif - if (inlen != file_size) { - DYAD_LOG_ERROR (mod_ctx->ctx, "DYAD_MOD: Failed to load file \"%s\" only read %zd of %zd.", fullpath, inlen, file_size); - goto fetch_error; - } + if (inlen != file_size) { + DYAD_LOG_ERROR( + mod_ctx->ctx, + "DYAD_MOD: Failed to load file \"%s\" only read %zd of %zd.", + fullpath, inlen, file_size); + goto fetch_error; + } #ifdef DYAD_ENABLE_UCX_RMA - inlen = file_size + sizeof (file_size); + inlen = file_size + sizeof(file_size); #endif - DYAD_C_FUNCTION_UPDATE_INT ("file_size", file_size); - DYAD_LOG_DEBUG (mod_ctx->ctx, "Closing file pointer"); - dyad_release_flock (mod_ctx->ctx, fd, &shared_lock); - close (fd); - DYAD_LOG_DEBUG (mod_ctx->ctx, "Is inbuf NULL? -> %i", (int)(inbuf == NULL)); - DYAD_LOG_DEBUG (mod_ctx->ctx, "Establish DTL connection with consumer"); - rc = mod_ctx->ctx->dtl_handle->establish_connection (mod_ctx->ctx); - if (DYAD_IS_ERROR (rc)) { - DYAD_LOG_ERROR (mod_ctx->ctx, "Could not establish DTL connection with client"); - errno = ECONNREFUSED; - goto fetch_error_wo_flock; - } - DYAD_LOG_DEBUG (mod_ctx->ctx, "Send file to consumer with DTL"); - rc = mod_ctx->ctx->dtl_handle->send (mod_ctx->ctx, inbuf, inlen); - DYAD_LOG_DEBUG (mod_ctx->ctx, "Close DTL connection with consumer"); - mod_ctx->ctx->dtl_handle->close_connection (mod_ctx->ctx); - mod_ctx->ctx->dtl_handle->return_buffer (mod_ctx->ctx, (void **)&inbuf); - if (DYAD_IS_ERROR (rc)) { - DYAD_LOG_ERROR (mod_ctx->ctx, "Could not send data to client via DTL\n"); - errno = ECOMM; - goto fetch_error_wo_flock; - } - } else { - goto fetch_error; + DYAD_C_FUNCTION_UPDATE_INT("file_size", file_size); + DYAD_LOG_DEBUG(mod_ctx->ctx, "Closing file pointer"); + dyad_release_flock(mod_ctx->ctx, fd, &shared_lock); + close(fd); + DYAD_LOG_DEBUG(mod_ctx->ctx, "Is inbuf NULL? -> %i", (int)(inbuf == NULL)); + DYAD_LOG_DEBUG(mod_ctx->ctx, "Establish DTL connection with consumer"); + rc = mod_ctx->ctx->dtl_handle->establish_connection(mod_ctx->ctx); + if (DYAD_IS_ERROR(rc)) { + DYAD_LOG_ERROR(mod_ctx->ctx, + "Could not establish DTL connection with client"); + errno = ECONNREFUSED; + goto fetch_error_wo_flock; } - DYAD_LOG_DEBUG (mod_ctx->ctx, "Close RPC message stream with an ENODATA (%d) message", ENODATA); - if (flux_respond_error (h, msg, ENODATA, NULL) < 0) { - DYAD_LOG_ERROR (mod_ctx->ctx, "DYAD_MOD: %s: flux_respond_error with ENODATA failed\n", __func__); + DYAD_LOG_DEBUG(mod_ctx->ctx, "Send file to consumer with DTL"); + rc = mod_ctx->ctx->dtl_handle->send(mod_ctx->ctx, inbuf, inlen); + DYAD_LOG_DEBUG(mod_ctx->ctx, "Close DTL connection with consumer"); + mod_ctx->ctx->dtl_handle->close_connection(mod_ctx->ctx); + mod_ctx->ctx->dtl_handle->return_buffer(mod_ctx->ctx, (void **)&inbuf); + if (DYAD_IS_ERROR(rc)) { + DYAD_LOG_ERROR(mod_ctx->ctx, "Could not send data to client via DTL\n"); + errno = ECOMM; + goto fetch_error_wo_flock; } - DYAD_LOG_INFO (mod_ctx->ctx, "Finished %s module invocation\n", DYAD_DTL_RPC_NAME); - goto end_fetch_cb; + } else { + goto fetch_error; + } + DYAD_LOG_DEBUG(mod_ctx->ctx, + "Close RPC message stream with an ENODATA (%d) message", + ENODATA); + if (flux_respond_error(h, msg, ENODATA, NULL) < 0) { + DYAD_LOG_ERROR(mod_ctx->ctx, + "DYAD_MOD: %s: flux_respond_error with ENODATA failed\n", + __func__); + } + DYAD_LOG_INFO(mod_ctx->ctx, "Finished %s module invocation\n", + DYAD_DTL_RPC_NAME); + goto end_fetch_cb; fetch_error:; - dyad_release_flock (mod_ctx->ctx, fd, &shared_lock); - close (fd); + dyad_release_flock(mod_ctx->ctx, fd, &shared_lock); + close(fd); fetch_error_wo_flock:; - DYAD_LOG_ERROR (mod_ctx->ctx, "Close RPC message stream with an error (errno = %d)\n", errno); - if (flux_respond_error (h, msg, errno, NULL) < 0) { - DYAD_LOG_ERROR (mod_ctx->ctx, "DYAD_MOD: %s: flux_respond_error", __func__); - } - errno = saved_errno; - DYAD_C_FUNCTION_END (); - return; + DYAD_LOG_ERROR(mod_ctx->ctx, + "Close RPC message stream with an error (errno = %d)\n", + errno); + if (flux_respond_error(h, msg, errno, NULL) < 0) { + DYAD_LOG_ERROR(mod_ctx->ctx, "DYAD_MOD: %s: flux_respond_error", __func__); + } + errno = saved_errno; + DYAD_C_FUNCTION_END(); + return; end_fetch_cb:; - errno = saved_errno; - DYAD_C_FUNCTION_END (); - return; + errno = saved_errno; + DYAD_C_FUNCTION_END(); + return; } -static const struct flux_msg_handler_spec htab[] = - {{FLUX_MSGTYPE_REQUEST, DYAD_DTL_RPC_NAME, dyad_fetch_request_cb, 0}, - FLUX_MSGHANDLER_TABLE_END}; - -static void show_help (void) -{ - DYAD_LOG_STDOUT ("dyad module options and arguments\n"); - DYAD_LOG_STDOUT (" -h, --help: Show help.\n"); - DYAD_LOG_STDOUT (" -d, --debug: Enable debugging log message.\n"); - DYAD_LOG_STDOUT ( - " -m, --mode: DTL mode. Need an argument.\n" - " Either 'FLUX_RPC' (default) or 'UCX'.\n"); - DYAD_LOG_STDOUT ( - " -i, --info_log: Specify the file into which to redirect\n" - " info logging. Does nothing if DYAD was not\n" - " configured with '-DDYAD_LOGGER=PRINTF'.\n" - " Need a filename as an argument.\n"); - DYAD_LOG_STDOUT ( - " -e, --error_log: Specify the file into which to redirect\n" - " error logging. Does nothing if DYAD was\n" - " not configured with '-DDYAD_LOGGER=PRINTF'\n" - " Need a filename as an argument.\n"); +static const struct flux_msg_handler_spec htab[] = { + {FLUX_MSGTYPE_REQUEST, DYAD_DTL_RPC_NAME, dyad_fetch_request_cb, 0}, + FLUX_MSGHANDLER_TABLE_END}; + +static void show_help(void) { + DYAD_LOG_STDOUT("dyad module options and arguments\n"); + DYAD_LOG_STDOUT(" -h, --help: Show help.\n"); + DYAD_LOG_STDOUT(" -d, --debug: Enable debugging log message.\n"); + DYAD_LOG_STDOUT(" -m, --mode: DTL mode. Need an argument.\n" + " Either 'FLUX_RPC' (default) or 'UCX'.\n"); + DYAD_LOG_STDOUT( + " -i, --info_log: Specify the file into which to redirect\n" + " info logging. Does nothing if DYAD was not\n" + " configured with '-DDYAD_LOGGER=PRINTF'.\n" + " Need a filename as an argument.\n"); + DYAD_LOG_STDOUT( + " -e, --error_log: Specify the file into which to redirect\n" + " error logging. Does nothing if DYAD was\n" + " not configured with '-DDYAD_LOGGER=PRINTF'\n" + " Need a filename as an argument.\n"); } struct opt_parse_out { - const char *prod_managed_path; - const char *dtl_mode; - bool debug; + const char *prod_managed_path; + const char *dtl_mode; + bool debug; }; typedef struct opt_parse_out opt_parse_out_t; -static int opt_parse (opt_parse_out_t *restrict opt, - const unsigned broker_rank, - dyad_dtl_mode_t *restrict dtl_mode, - int _argc, - char **restrict _argv) -{ +static int opt_parse(opt_parse_out_t *restrict opt, const unsigned broker_rank, + dyad_dtl_mode_t *restrict dtl_mode, int _argc, + char **restrict _argv) { #ifndef DYAD_LOGGER_NO_LOG - char log_file_name[PATH_MAX + 1] = {'\0'}; - char err_file_name[PATH_MAX + 1] = {'\0'}; - sprintf (log_file_name, "dyad_mod_%u.out", broker_rank); - sprintf (err_file_name, "dyad_mod_%d.err", broker_rank); -#endif // DYAD_LOGGER_NO_LOG - *dtl_mode = DYAD_DTL_END; - - int rc = DYAD_RC_OK; - int argc = 0; - char *argv[PATH_MAX] = {NULL}; - char *prod_managed_path = NULL; - - if (opt == NULL) - return rc; - - if ((argc = _argc + 1) > PATH_MAX) { - DYAD_LOG_STDERR ("DYAD_MOD: too many options.\n"); - return DYAD_RC_SYSFAIL; - } - - for (int i = 1; i < argc; ++i) { - argv[i] = _argv[i - 1]; - // DYAD_LOG_STDERR ("DYAD_MOD: argv[%d] = '%s'\n", i, argv[i]); + char log_file_name[PATH_MAX + 1] = {'\0'}; + char err_file_name[PATH_MAX + 1] = {'\0'}; + sprintf(log_file_name, "dyad_mod_%u.out", broker_rank); + sprintf(err_file_name, "dyad_mod_%d.err", broker_rank); +#endif // DYAD_LOGGER_NO_LOG + *dtl_mode = DYAD_DTL_END; + + int rc = DYAD_RC_OK; + int argc = 0; + char *argv[PATH_MAX] = {NULL}; + char *prod_managed_path = NULL; + + if (opt == NULL) + return rc; + + if ((argc = _argc + 1) > PATH_MAX) { + DYAD_LOG_STDERR("DYAD_MOD: too many options.\n"); + return DYAD_RC_SYSFAIL; + } + + for (int i = 1; i < argc; ++i) { + argv[i] = _argv[i - 1]; + // DYAD_LOG_STDERR ("DYAD_MOD: argv[%d] = '%s'\n", i, argv[i]); + } + + while (1) { + static struct option long_options[] = { + {"help", no_argument, 0, 'h'}, + {"debug", no_argument, 0, 'd'}, + {"mode", required_argument, 0, 'm'}, + {"info_log", required_argument, 0, 'i'}, + {"error_log", required_argument, 0, 'e'}, + {0, 0, 0, 0}}; + /* getopt_long stores the option index here. */ + int option_index = 0; + int c = -1; + + c = getopt_long(argc, argv, "hdm:i:e:", long_options, &option_index); + + /* Detect the end of the options. */ + if (c == -1) { + // DYAD_LOG_STDERR ("DYAD_MOD: no more option.\n"); + break; } - - while (1) { - static struct option long_options[] = {{"help", no_argument, 0, 'h'}, - {"debug", no_argument, 0, 'd'}, - {"mode", required_argument, 0, 'm'}, - {"info_log", required_argument, 0, 'i'}, - {"error_log", required_argument, 0, 'e'}, - {0, 0, 0, 0}}; - /* getopt_long stores the option index here. */ - int option_index = 0; - int c = -1; - - c = getopt_long (argc, argv, "hdm:i:e:", long_options, &option_index); - - /* Detect the end of the options. */ - if (c == -1) { - // DYAD_LOG_STDERR ("DYAD_MOD: no more option.\n"); - break; - } - DYAD_LOG_STDERR ("DYAD_MOD: opt %c, index %d\n", (char)c, optind); - - switch (c) { - case 'h': - show_help (); - break; - case 'd': - DYAD_LOG_STDERR ("DYAD_MOD: 'debug' option -d \n"); - opt->debug = true; - break; - case 'm': - // If the DTL is already initialized and it is set to the same - // mode as the option, then skip reinitializing - DYAD_LOG_STDERR ("DYAD_MOD: DTL 'mode' option -m with value `%s'\n", optarg); - opt->dtl_mode = optarg; - if (strcmp("UCX", optarg) == 0) *dtl_mode = DYAD_DTL_UCX; - else if (strcmp("FLUX_RPC", optarg) == 0) *dtl_mode = DYAD_DTL_FLUX_RPC; - break; - case 'i': + DYAD_LOG_STDERR("DYAD_MOD: opt %c, index %d\n", (char)c, optind); + + switch (c) { + case 'h': + show_help(); + break; + case 'd': + DYAD_LOG_STDERR("DYAD_MOD: 'debug' option -d \n"); + opt->debug = true; + break; + case 'm': + // If the DTL is already initialized and it is set to the same + // mode as the option, then skip reinitializing + DYAD_LOG_STDERR("DYAD_MOD: DTL 'mode' option -m with value `%s'\n", + optarg); + opt->dtl_mode = optarg; + if (strcmp("UCX", optarg) == 0) + *dtl_mode = DYAD_DTL_UCX; + else if (strcmp("FLUX_RPC", optarg) == 0) + *dtl_mode = DYAD_DTL_FLUX_RPC; + break; + case 'i': #ifndef DYAD_LOGGER_NO_LOG - DYAD_LOG_STDERR ("DYAD_MOD: 'info_log' option -i with value `%s'\n", optarg); - sprintf (log_file_name, "%s_%u.out", optarg, broker_rank); -#endif // DYAD_LOGGER_NO_LOG - break; - case 'e': + DYAD_LOG_STDERR("DYAD_MOD: 'info_log' option -i with value `%s'\n", + optarg); + sprintf(log_file_name, "%s_%u.out", optarg, broker_rank); +#endif // DYAD_LOGGER_NO_LOG + break; + case 'e': #ifndef DYAD_LOGGER_NO_LOG - DYAD_LOG_STDERR ("DYAD_MOD: 'error_log' option -e with value `%s'\n", optarg); - sprintf (err_file_name, "%s_%d.err", optarg, broker_rank); -#endif // DYAD_LOGGER_NO_LOG - break; - case '?': - /* getopt_long already printed an error message. */ - break; - default: - DYAD_LOG_STDERR ("DYAD_MOD: option parsing failed %d\n", c); - return DYAD_RC_SYSFAIL; - } + DYAD_LOG_STDERR("DYAD_MOD: 'error_log' option -e with value `%s'\n", + optarg); + sprintf(err_file_name, "%s_%d.err", optarg, broker_rank); +#endif // DYAD_LOGGER_NO_LOG + break; + case '?': + /* getopt_long already printed an error message. */ + break; + default: + DYAD_LOG_STDERR("DYAD_MOD: option parsing failed %d\n", c); + return DYAD_RC_SYSFAIL; } + } #ifndef DYAD_LOGGER_NO_LOG - DYAD_LOG_STDOUT_REDIRECT (log_file_name); - DYAD_LOG_STDERR_REDIRECT (err_file_name); -#endif // DYAD_LOGGER_NO_LOG - - if (*dtl_mode == DYAD_DTL_END) { - opt->dtl_mode = NULL; - } - - /* Print any remaining command line arguments (not options). */ - while (optind < argc) { - DYAD_LOG_STDERR ("DYAD_MOD: positional arguments %s\n", argv[optind]); - prod_managed_path = argv[optind++]; - } - opt->prod_managed_path = prod_managed_path; - - return DYAD_RC_OK; + DYAD_LOG_STDOUT_REDIRECT(log_file_name); + DYAD_LOG_STDERR_REDIRECT(err_file_name); +#endif // DYAD_LOGGER_NO_LOG + + if (*dtl_mode == DYAD_DTL_END) { + opt->dtl_mode = NULL; + } + + /* Print any remaining command line arguments (not options). */ + while (optind < argc) { + DYAD_LOG_STDERR("DYAD_MOD: positional arguments %s\n", argv[optind]); + prod_managed_path = argv[optind++]; + } + opt->prod_managed_path = prod_managed_path; + + return DYAD_RC_OK; } -dyad_rc_t dyad_module_ctx_init (const opt_parse_out_t *opt, flux_t *h) -{ // Initialize DYAD context - dyad_mod_ctx_t *mod_ctx = get_mod_ctx (h); - - if (mod_ctx == NULL || opt == NULL || h == NULL) { - return DYAD_RC_NOCTX; - } - - if (opt->prod_managed_path) { - setenv (DYAD_PATH_PRODUCER_ENV, opt->prod_managed_path, 1); - const mode_t m = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISGID); - mkdir_as_needed (opt->prod_managed_path, m); - DYAD_LOG_STDERR ("DYAD_MOD: Loading DYAD Module with Path %s", opt->prod_managed_path); - } - - if (opt->dtl_mode) { - setenv (DYAD_DTL_MODE_ENV, opt->dtl_mode, 1); - DYAD_LOG_STDERR ( - "DYAD_MOD: DTL 'mode' option set. " - "Setting env %s=%s", - DYAD_DTL_MODE_ENV, - opt->dtl_mode); - } else { - DYAD_LOG_STDERR ( - "DYAD_MOD: Did not find DTL 'mode' option. " - "Using env %s=%s", - DYAD_DTL_MODE_ENV, - getenv (DYAD_DTL_MODE_ENV)); - } - char* kvs = getenv("DYAD_KVS_NAMESPACE"); - if (kvs != NULL) { - DYAD_LOG_STDERR ("DYAD_MOD: DYAD_KVS_NAMESPACE is set to `%s'\n", kvs); - } else { - DYAD_LOG_STDERR ("DYAD_MOD: DYAD_KVS_NAMESPACE is not set\n"); - } - dyad_ctx_init (DYAD_COMM_SEND, h); - mod_ctx->ctx = dyad_ctx_get (); - dyad_ctx_t *ctx = mod_ctx->ctx; - - if (ctx == NULL) { - DYAD_LOG_STDERR ("DYAD_MOD: dyad_ctx_init() failed!"); - return DYAD_RC_NOCTX; - } - ctx->h = h; - ctx->debug = opt->debug; - - if (ctx->dtl_handle == NULL) { - DYAD_LOG_STDERR ("DYAD_MOD: dyad_ctx_init() failed to initialize DTL!"); - return DYAD_RC_NOCTX; - } - - return DYAD_RC_OK; +dyad_rc_t dyad_module_ctx_init(const opt_parse_out_t *opt, + flux_t *h) { // Initialize DYAD context + dyad_mod_ctx_t *mod_ctx = get_mod_ctx(h); + + if (mod_ctx == NULL || opt == NULL || h == NULL) { + return DYAD_RC_NOCTX; + } + + if (opt->prod_managed_path) { + setenv(DYAD_PATH_PRODUCER_ENV, opt->prod_managed_path, 1); + const mode_t m = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISGID); + mkdir_as_needed(opt->prod_managed_path, m); + DYAD_LOG_STDERR("DYAD_MOD: Loading DYAD Module with Path %s", + opt->prod_managed_path); + } + + if (opt->dtl_mode) { + setenv(DYAD_DTL_MODE_ENV, opt->dtl_mode, 1); + DYAD_LOG_STDERR("DYAD_MOD: DTL 'mode' option set. " + "Setting env %s=%s", + DYAD_DTL_MODE_ENV, opt->dtl_mode); + } else { + DYAD_LOG_STDERR("DYAD_MOD: Did not find DTL 'mode' option. " + "Using env %s=%s", + DYAD_DTL_MODE_ENV, getenv(DYAD_DTL_MODE_ENV)); + } + char *kvs = getenv(DYAD_KVS_NAMESPACE_ENV); + if (kvs != NULL) { + DYAD_LOG_STDERR("DYAD_MOD: %s is set to `%s'\n", DYAD_KVS_NAMESPACE_ENV, + kvs); + } else { + DYAD_LOG_STDERR("DYAD_MOD: %s is not set\n", DYAD_KVS_NAMESPACE_ENV); + // Required so that dyad_ctx_init can pass + setenv(DYAD_KVS_NAMESPACE_ENV, "dyad_module_dummy_env", 1); + } + + dyad_ctx_init(DYAD_COMM_SEND, h); + mod_ctx->ctx = dyad_ctx_get(); + dyad_ctx_t *ctx = mod_ctx->ctx; + + if (ctx == NULL) { + DYAD_LOG_STDERR("DYAD_MOD: dyad_ctx_init() failed!"); + return DYAD_RC_NOCTX; + } + ctx->h = h; + ctx->debug = opt->debug; + + if (ctx->dtl_handle == NULL) { + DYAD_LOG_STDERR("DYAD_MOD: dyad_ctx_init() failed to initialize DTL!"); + return DYAD_RC_NOCTX; + } + + return DYAD_RC_OK; } -DYAD_DLL_EXPORTED int mod_main (flux_t *h, int argc, char **argv) -{ - DYAD_LOGGER_INIT (); - DYAD_LOG_STDOUT ("Loading mod_main\n"); - dyad_mod_ctx_t *mod_ctx = NULL; - dyad_dtl_mode_t dtl_mode = DYAD_DTL_DEFAULT; +DYAD_DLL_EXPORTED int mod_main(flux_t *h, int argc, char **argv) { + DYAD_LOGGER_INIT(); + DYAD_LOG_STDOUT("Loading mod_main\n"); + dyad_mod_ctx_t *mod_ctx = NULL; + dyad_dtl_mode_t dtl_mode = DYAD_DTL_DEFAULT; - if (!h) { - DYAD_LOG_STDERR ("Failed to get flux handle\n"); - goto mod_done; - } + if (!h) { + DYAD_LOG_STDERR("Failed to get flux handle\n"); + goto mod_done; + } - mod_ctx = get_mod_ctx (h); + mod_ctx = get_mod_ctx(h); - uint32_t broker_rank; - flux_get_rank (h, &broker_rank); + uint32_t broker_rank; + flux_get_rank(h, &broker_rank); #ifdef DYAD_PROFILER_DFTRACER - int pid = broker_rank; - DFTRACER_C_INIT (NULL, NULL, &pid); + int pid = broker_rank; + DFTRACER_C_INIT(NULL, NULL, &pid); #endif - DYAD_C_FUNCTION_START (); - - opt_parse_out_t opt = {NULL, NULL, false}; - DYAD_LOG_STDERR ("DYAD_MOD: Parsing command line options"); - - if (DYAD_IS_ERROR (opt_parse (&opt, broker_rank, &dtl_mode, argc, argv))) { - DYAD_LOG_STDERR ("DYAD_MOD: Cannot parse command line arguments"); - goto mod_error; - } - - if (DYAD_IS_ERROR (dyad_module_ctx_init (&opt, h))) { - goto mod_error; - } - - if (flux_msg_handler_addvec (mod_ctx->ctx->h, htab, (void *)h, &mod_ctx->handlers) < 0) { - DYAD_LOG_ERROR (mod_ctx->ctx, "DYAD_MOD: flux_msg_handler_addvec: %s\n", strerror (errno)); - goto mod_error; - } - - if (flux_reactor_run (flux_get_reactor (mod_ctx->ctx->h), 0) < 0) { - DYAD_LOG_DEBUG (mod_ctx->ctx, "DYAD_MOD: flux_reactor_run: %s", strerror (errno)); - goto mod_error; - } - DYAD_LOG_DEBUG (mod_ctx->ctx, "DYAD_MOD: Finished"); - goto mod_done; + DYAD_C_FUNCTION_START(); + + opt_parse_out_t opt = {NULL, NULL, false}; + DYAD_LOG_STDERR("DYAD_MOD: Parsing command line options"); + + if (DYAD_IS_ERROR(opt_parse(&opt, broker_rank, &dtl_mode, argc, argv))) { + DYAD_LOG_STDERR("DYAD_MOD: Cannot parse command line arguments"); + goto mod_error; + } + + if (DYAD_IS_ERROR(dyad_module_ctx_init(&opt, h))) { + goto mod_error; + } + + if (flux_msg_handler_addvec(mod_ctx->ctx->h, htab, (void *)h, + &mod_ctx->handlers) < 0) { + DYAD_LOG_ERROR(mod_ctx->ctx, "DYAD_MOD: flux_msg_handler_addvec: %s\n", + strerror(errno)); + goto mod_error; + } + + if (flux_reactor_run(flux_get_reactor(mod_ctx->ctx->h), 0) < 0) { + DYAD_LOG_DEBUG(mod_ctx->ctx, "DYAD_MOD: flux_reactor_run: %s", + strerror(errno)); + goto mod_error; + } + DYAD_LOG_DEBUG(mod_ctx->ctx, "DYAD_MOD: Finished"); + goto mod_done; mod_error:; - DYAD_C_FUNCTION_END (); - return EXIT_FAILURE; + DYAD_C_FUNCTION_END(); + return EXIT_FAILURE; mod_done:; - DYAD_C_FUNCTION_END (); - return EXIT_SUCCESS; + DYAD_C_FUNCTION_END(); + return EXIT_SUCCESS; } -DYAD_DLL_EXPORTED MOD_NAME ("dyad"); +DYAD_DLL_EXPORTED MOD_NAME("dyad"); /* * vi:tabstop=4 shiftwidth=4 expandtab From 5fcb47f162fd227d9197d7d4aa8af81d2a247115 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Tue, 3 Sep 2024 13:46:05 -0400 Subject: [PATCH 07/10] Undoes changes to include the install prefix in DYAD_INSTALL_* variables --- CMakeLists.txt | 32 ++++++++++++++-------------- cmake/modules/SetupCompiler.cmake | 6 +++--- src/dyad/core/CMakeLists.txt | 2 +- src/dyad/dtl/CMakeLists.txt | 2 +- src/dyad/modules/CMakeLists.txt | 2 +- src/dyad/stream/CMakeLists.txt | 2 +- src/dyad/utils/CMakeLists.txt | 4 ++-- src/dyad/utils/base64/CMakeLists.txt | 2 +- src/dyad/wrapper/CMakeLists.txt | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 177fb1d6..623208a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,20 +32,20 @@ endif () # if (CMAKE_INSTALL_LIBDIR) message(STATUS "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}") - set(DYAD_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}) - set(DYAD_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) + set(DYAD_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}) + set(DYAD_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) set(DYAD_INSTALL_INCLUDEDIR - ${CMAKE_INSTALL_INCLUDEDIR}) + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) set(DYAD_INSTALL_DOCDIR - ${CMAKE_INSTALL_DOCDIR}) + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}) set(DYAD_INSTALL_SYSCONFDIR - ${CMAKE_INSTALL_SYSCONFDIR}/modulefiles) + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/modulefiles) else () - set(DYAD_INSTALL_BINDIR "bin") - set(DYAD_INSTALL_LIBDIR "lib") - set(DYAD_INSTALL_INCLUDEDIR "include") - set(DYAD_INSTALL_DOCDIR "doc") - set(DYAD_INSTALL_SYSCONFDIR "etc/modulefiles") + set(DYAD_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin") + set(DYAD_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib") + set(DYAD_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include") + set(DYAD_INSTALL_DOCDIR "${CMAKE_INSTALL_PREFIX}/doc") + set(DYAD_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc/modulefiles") message(STATUS "DYAD_INSTALL_LIBDIR set to ${DYAD_INSTALL_LIBDIR}") endif () @@ -56,17 +56,17 @@ endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_PREFIX}) # This sets where to look for dependent library's cmake files list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/lib/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/share/cmake) #------------------------------------------------------------------------------ # This doesn't really need to be in an 'if' statement since they're cache variables # if (NOT DYAD_EXTERNALLY_CONFIGURED) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_BINDIR} CACHE PATH "Single Directory for all Executables.") -set(CMAKE_INCLUDE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_INCLUDEDIR} CACHE PATH "Store the headers.") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables.") +set(CMAKE_INCLUDE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/include CACHE PATH "Store the headers.") set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR} CACHE PATH "Single Directory for all Libraries") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_INSTALL_LIBDIR} CACHE PATH "Single Directory for all static libraries.") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Single Directory for all Libraries") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Single Directory for all static libraries.") # endif () #----------------------------------------------------------------------------- @@ -374,7 +374,7 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure_files/ # Write the configure file for the install tree set(EXTRA_CMAKE_MODULE_DIR "") set(INCLUDE_INSTALL_DIRS "${DYAD_INSTALL_INCLUDEDIR}") -set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") +set(LIB_INSTALL_DIR "${DYAD_INSTALL_LIBDIR}") configure_package_config_file(cmake/configure_files/DYADConfig.cmake.in "${DYAD_INSTALL_TMP_CMAKE_DIR}/DYADConfig.cmake" INSTALL_DESTINATION "${DYAD_INSTALL_CMAKE_DIR}" diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index 9855f106..a2bceb23 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -210,15 +210,15 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # which point to directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") +set(CMAKE_INSTALL_RPATH "${DYAD_INSTALL_LIBDIR}") list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) + "${DYAD_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) if (${_IS_SYSTEM_DIR} STREQUAL "-1") # Set the install RPATH correctly list(APPEND CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") endif () diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 73577406..649b98a1 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -22,7 +22,7 @@ set(DYAD_CTX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_ctx.h add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC} ${DYAD_CORE_PUBLIC_HEADERS} ${DYAD_CORE_PRIVATE_HEADERS}) set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_core PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 5b825a12..5be46898 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -29,7 +29,7 @@ endif() add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC} ${DTL_PUBLIC_HEADERS} ${DTL_PRIVATE_HEADERS}) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ${PROJECT_NAME}_utils Jansson::Jansson flux::core flux::optparse) set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") if(DYAD_ENABLE_UCX_DTL OR DYAD_ENABLE_UCX_DATA_RMA) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index aca78ff6..fe700534 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC} ${DYAD_MODULE_PRIVATE_HEADERS} ${DYAD_MODULE_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_ctx) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index fcd24cfe..55fb0004 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -12,7 +12,7 @@ set(DYAD_FSTREAM_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dya add_library(${PROJECT_NAME}_fstream SHARED ${DYAD_FSTREAM_SRC} ${DYAD_FSTREAM_PRIVATE_HEADERS} ${DYAD_FSTREAM_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_fstream PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_compile_features(${PROJECT_NAME}_fstream PRIVATE) target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core ${PROJECT_NAME}_utils flux::core) diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index c9a7246f..27e6d9af 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -14,7 +14,7 @@ set(DYAD_MURMUR3_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_utils SHARED ${DYAD_UTILS_SRC} ${DYAD_UTILS_PRIVATE_HEADERS} ${DYAD_UTILS_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_utils PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_utils PUBLIC ${PROJECT_NAME}_base64 ${PROJECT_NAME}_murmur3) @@ -33,7 +33,7 @@ target_include_directories(${PROJECT_NAME}_utils PUBLIC add_library(${PROJECT_NAME}_murmur3 SHARED ${DYAD_MURMUR3_SRC}) set_target_properties(${PROJECT_NAME}_murmur3 PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") add_executable(test_cmp_canonical_path_prefix test_cmp_canonical_path_prefix.c ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_structures.h) diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index d1743259..d6708e5e 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -5,7 +5,7 @@ set(DYAD_BASE64_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_base64 SHARED ${DYAD_BASE64_SRC} ${DYAD_BASE64_PRIVATE_HEADERS} ${DYAD_BASE64_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_base64 PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_include_directories(${PROJECT_NAME}_base64 PUBLIC $ $) diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index 38987d36..3541e784 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -8,7 +8,7 @@ set(DYAD_WRAPPER_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_wrapper SHARED ${DYAD_WRAPPER_SRC} ${DYAD_WRAPPER_PRIVATE_HEADERS} ${DYAD_WRAPPER_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME}_wrapper PROPERTIES CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${DYAD_INSTALL_LIBDIR}") + "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core) target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_utils flux::core) target_compile_definitions(${PROJECT_NAME}_wrapper PUBLIC BUILDING_DYAD=1) From 05f055f2c037c05a9fd30bff5b9df96163edf7a6 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Wed, 4 Sep 2024 13:27:30 -0400 Subject: [PATCH 08/10] Adds lib64 to CMAKE_MODULE_PATH --- CMakeLists.txt | 63 +------------------------------ cmake/modules/SetupCompiler.cmake | 19 ---------- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 623208a8..4b68b793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_P # This sets where to look for dependent library's cmake files list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/lib/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/lib64/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/share/cmake) #------------------------------------------------------------------------------ @@ -288,48 +289,10 @@ include_directories(${CMAKE_SOURCE_DIR}/include) # public header add_subdirectory(src/dyad) #cmake_policy(SET CMP0079 NEW) # In case that we need more control over the target building order - -#----------------------------------------------------------------------------- -# Configure the config.cmake file for the build directory -#----------------------------------------------------------------------------- -# configure_file( -# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.build.in -# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake @ONLY -# ) -# -# configure_file( -# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.install.in -# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake @ONLY -# ) -# install( -# FILES -# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake -# DESTINATION -# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} -# ) -#----------------------------------------------------------------------------- -# Configure the ${PROJECT_NAME}-config-version .cmake file for the install directory -#----------------------------------------------------------------------------- -# configure_file( -# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config-version.cmake.in -# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake @ONLY -# ) -# -# install( -# FILES -# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake -# DESTINATION -# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} -# ) -# -# export(EXPORT ${DYAD_EXPORTED_TARGETS} -# FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake") - # Write the configure file configure_file("${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_config.hpp.in" "${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/dyad/dyad_config.hpp" @ONLY) - ################################################################ # Install DYAD ################################################################ @@ -348,21 +311,7 @@ write_basic_package_version_file( file(COPY ${DYAD_BUILD_CMAKE_DIR}/DYADConfigVersion.cmake DESTINATION ${DYAD_INSTALL_TMP_CMAKE_DIR}) -#........................................... -# TODO: There are two different places where cmake config is handled currently. -# Need to clean up and merge - -# if (WIP_package_config) # This is for the build tree -#set(INCLUDE_INSTALL_DIRS -# "${CMAKE_SOURCE_DIR}/src/dyad/common" -# "${CMAKE_SOURCE_DIR}/src/dyad/core" -# "${CMAKE_SOURCE_DIR}/src/dyad/dtl" -# "${CMAKE_SOURCE_DIR}/src/dyad/module" -# "${CMAKE_SOURCE_DIR}/src/dyad/wrapper" -# "${CMAKE_SOURCE_DIR}/src/dyad/utils" -# "${CMAKE_SOURCE_DIR}/src/dyad/utils/base64") -# "${CMAKE_SOURCE_DIR}/include/dyad/stream") set(EXTRA_CMAKE_MODULE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules") set(INCLUDE_INSTALL_DIRS ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) set(LIB_INSTALL_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) @@ -394,22 +343,12 @@ install(DIRECTORY "${DYAD_INSTALL_TMP_CMAKE_DIR}/" # Trailing slash ensures dire install(DIRECTORY cmake/modules DESTINATION "${DYAD_INSTALL_CMAKE_DIR}" FILES_MATCHING PATTERN "*.cmake") -# endif (WIP_package_config) -#........................................... install(FILES "${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/dyad/dyad_config.hpp" DESTINATION ${DYAD_INSTALL_INCLUDEDIR}/dyad) -# install(EXPORT -# ${DYAD_EXPORTED_TARGETS} -# DESTINATION -# ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} -# FILE -# ${DYAD_EXPORTED_TARGETS}.cmake -# ) - # Install license and readme install(FILES "${PROJECT_SOURCE_DIR}/NOTICE" diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index a2bceb23..a708c40a 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -119,25 +119,6 @@ macro(dyad_add_werror_if_needed target) endif() endmacro(dyad_add_werror_if_needed target) -# if (DYAD_WARNINGS_AS_ERRORS) -# dyad_add_cxx_flags(_WERROR_FLAGS -Werror) -# separate_arguments(_WERROR_FLAGS NATIVE_COMMAND "${_WERROR_FLAGS}") -# if (NOT TARGET DYAD_CXX_FLAGS_werror) -# add_library(DYAD_CXX_FLAGS_werror INTERFACE) -# set_property(TARGET DYAD_CXX_FLAGS_werror PROPERTY -# INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) -# -# add_library(DYAD_C_FLAGS_werror INTERFACE) -# set_property(TARGET DYAD_C_FLAGS_werror PROPERTY -# INTERFACE_COMPILE_OPTIONS $<$:${_WERROR_FLAGS}>) -# -# # Add the "library" to the export -# install(TARGETS DYAD_C_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) -# install(TARGETS DYAD_CXX_FLAGS_werror EXPORT ${DYAD_EXPORTED_TARGETS}) -# endif () -# endif () - - ################################################################ # Handle compiler dependent behaviors ################################################################ From 90b5867a931c869bdb408bb67afd038c0d46c7ce Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Thu, 5 Sep 2024 16:20:41 -0400 Subject: [PATCH 09/10] Removes per-target setting of RPATH --- src/dyad/core/CMakeLists.txt | 6 +++--- src/dyad/dtl/CMakeLists.txt | 4 ++-- src/dyad/modules/CMakeLists.txt | 4 ++-- src/dyad/stream/CMakeLists.txt | 4 ++-- src/dyad/utils/CMakeLists.txt | 8 ++++---- src/dyad/utils/base64/CMakeLists.txt | 4 ++-- src/dyad/wrapper/CMakeLists.txt | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 649b98a1..4dc677f4 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -21,8 +21,8 @@ set(DYAD_CTX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_ctx.h add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC} ${DYAD_CORE_PUBLIC_HEADERS} ${DYAD_CORE_PRIVATE_HEADERS}) -set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_core PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) @@ -41,7 +41,7 @@ target_compile_definitions(${PROJECT_NAME}_ctx PUBLIC BUILDING_DYAD=1) target_compile_definitions(${PROJECT_NAME}_ctx PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME}_ctx SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME}_ctx SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) - target_link_libraries(${PROJECT_NAME}_ctx PRIVATE ${PROJECT_NAME}_dtl ${PROJECT_NAME}_utils) +target_link_libraries(${PROJECT_NAME}_ctx PRIVATE ${PROJECT_NAME}_dtl ${PROJECT_NAME}_utils) dyad_add_werror_if_needed(${PROJECT_NAME}_core) dyad_add_werror_if_needed(${PROJECT_NAME}_ctx) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 5be46898..6533dc77 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -28,8 +28,8 @@ endif() add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC} ${DTL_PUBLIC_HEADERS} ${DTL_PRIVATE_HEADERS}) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ${PROJECT_NAME}_utils Jansson::Jansson flux::core flux::optparse) -set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") if(DYAD_ENABLE_UCX_DTL OR DYAD_ENABLE_UCX_DATA_RMA) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index fe700534..3f6fa9aa 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -14,8 +14,8 @@ set(DYAD_MODULE_PUBLIC_HEADERS) add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC} ${DYAD_MODULE_PRIVATE_HEADERS} ${DYAD_MODULE_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_ctx) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index 55fb0004..16090c08 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -11,8 +11,8 @@ set(DYAD_FSTREAM_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dya add_library(${PROJECT_NAME}_fstream SHARED ${DYAD_FSTREAM_SRC} ${DYAD_FSTREAM_PRIVATE_HEADERS} ${DYAD_FSTREAM_PUBLIC_HEADERS}) -set_target_properties(${PROJECT_NAME}_fstream PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_fstream PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_compile_features(${PROJECT_NAME}_fstream PRIVATE) target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core ${PROJECT_NAME}_utils flux::core) diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 27e6d9af..c7eabe69 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -13,8 +13,8 @@ set(DYAD_MURMUR3_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_utils SHARED ${DYAD_UTILS_SRC} ${DYAD_UTILS_PRIVATE_HEADERS} ${DYAD_UTILS_PUBLIC_HEADERS}) -set_target_properties(${PROJECT_NAME}_utils PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_utils PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_utils PUBLIC ${PROJECT_NAME}_base64 ${PROJECT_NAME}_murmur3) @@ -32,8 +32,8 @@ target_include_directories(${PROJECT_NAME}_utils PUBLIC $) add_library(${PROJECT_NAME}_murmur3 SHARED ${DYAD_MURMUR3_SRC}) -set_target_properties(${PROJECT_NAME}_murmur3 PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_murmur3 PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") add_executable(test_cmp_canonical_path_prefix test_cmp_canonical_path_prefix.c ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_structures.h) diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index d6708e5e..5ebfb20c 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -4,8 +4,8 @@ set(DYAD_BASE64_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_base64 SHARED ${DYAD_BASE64_SRC} ${DYAD_BASE64_PRIVATE_HEADERS} ${DYAD_BASE64_PUBLIC_HEADERS}) -set_target_properties(${PROJECT_NAME}_base64 PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_base64 PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_include_directories(${PROJECT_NAME}_base64 PUBLIC $ $) diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index 3541e784..2ef44536 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -7,8 +7,8 @@ set(DYAD_WRAPPER_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_wrapper SHARED ${DYAD_WRAPPER_SRC} ${DYAD_WRAPPER_PRIVATE_HEADERS} ${DYAD_WRAPPER_PUBLIC_HEADERS}) -set_target_properties(${PROJECT_NAME}_wrapper PROPERTIES CMAKE_INSTALL_RPATH - "${DYAD_INSTALL_LIBDIR}") +# set_target_properties(${PROJECT_NAME}_wrapper PROPERTIES CMAKE_INSTALL_RPATH +# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core) target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_utils flux::core) target_compile_definitions(${PROJECT_NAME}_wrapper PUBLIC BUILDING_DYAD=1) From 22dc5dde998a32dbcc70f85c5ce204a125089695 Mon Sep 17 00:00:00 2001 From: Ian Lumsden Date: Thu, 5 Sep 2024 17:19:17 -0400 Subject: [PATCH 10/10] Makes CMAKE_INSTALL_RPATH_USE_LINK_PATH and CMAKE_INSTALL_RPATH cache variables to improve compatibility with Spack --- cmake/modules/SetupCompiler.cmake | 4 ++-- src/dyad/core/CMakeLists.txt | 2 -- src/dyad/dtl/CMakeLists.txt | 2 -- src/dyad/modules/CMakeLists.txt | 2 -- src/dyad/stream/CMakeLists.txt | 2 -- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index a708c40a..3b196fa2 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -189,9 +189,9 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "") -set(CMAKE_INSTALL_RPATH "${DYAD_INSTALL_LIBDIR}") +set(CMAKE_INSTALL_RPATH "${DYAD_INSTALL_LIBDIR}" CACHE STRING "") list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${DYAD_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 4dc677f4..9adaf774 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -21,8 +21,6 @@ set(DYAD_CTX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_ctx.h add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC} ${DYAD_CORE_PUBLIC_HEADERS} ${DYAD_CORE_PRIVATE_HEADERS}) -# set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH -# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME}_core PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 6533dc77..3a315de2 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -28,8 +28,6 @@ endif() add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC} ${DTL_PUBLIC_HEADERS} ${DTL_PRIVATE_HEADERS}) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ${PROJECT_NAME}_utils Jansson::Jansson flux::core flux::optparse) -# set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH -# "${DYAD_INSTALL_LIBDIR}") if(DYAD_ENABLE_UCX_DTL OR DYAD_ENABLE_UCX_DATA_RMA) target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index 3f6fa9aa..33a5992e 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -14,8 +14,6 @@ set(DYAD_MODULE_PUBLIC_HEADERS) add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC} ${DYAD_MODULE_PRIVATE_HEADERS} ${DYAD_MODULE_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -# set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH -# "${DYAD_INSTALL_LIBDIR}") target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_ctx) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index 16090c08..570b9221 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -11,8 +11,6 @@ set(DYAD_FSTREAM_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dya add_library(${PROJECT_NAME}_fstream SHARED ${DYAD_FSTREAM_SRC} ${DYAD_FSTREAM_PRIVATE_HEADERS} ${DYAD_FSTREAM_PUBLIC_HEADERS}) -# set_target_properties(${PROJECT_NAME}_fstream PROPERTIES CMAKE_INSTALL_RPATH -# "${DYAD_INSTALL_LIBDIR}") target_compile_features(${PROJECT_NAME}_fstream PRIVATE) target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${PROJECT_NAME}_ctx ${PROJECT_NAME}_core ${PROJECT_NAME}_utils flux::core)