From 4724e35a79ad20def93e1103dd10385eb60b699d Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Thu, 18 Jan 2024 00:31:38 -0800 Subject: [PATCH 01/16] Build: Add compiler specific cmake controls --- CMakeLists.txt | 116 +++++++++++++++++---- cmake/modules/DYADUtils.cmake | 98 +++++++++++++++++ cmake/{ => modules}/FindFluxCore.cmake | 0 cmake/{ => modules}/FindJansson.cmake | 0 cmake/modules/SetupCompiler.cmake | 139 +++++++++++++++++++++++++ 5 files changed, 334 insertions(+), 19 deletions(-) create mode 100644 cmake/modules/DYADUtils.cmake rename cmake/{ => modules}/FindFluxCore.cmake (100%) rename cmake/{ => modules}/FindJansson.cmake (100%) create mode 100644 cmake/modules/SetupCompiler.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f9a457eb..455c322e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,37 +15,48 @@ set(DYAD_PACKAGE_STRING "${DYAD_PACKAGE_NAME} ${DYAD_PACKAGE_VERSION}") set(DYAD_PACKAGE_TARNAME "${DYAD_PACKAGE}") project(dyad LANGUAGES C CXX) + +# Convenience defines +string(TOUPPER "${PROJECT_NAME}" UPPER_PROJECT_NAME) +string(TOLOWER "${PROJECT_NAME}" LOWER_PROJECT_NAME) + #------------------------------------------------------------------------------ # Internal Includes for header and libraries #------------------------------------------------------------------------------ -link_directories(${CMAKE_BINARY_DIR}/lib) +# Get installation directories -- these get used in various places; +# best to just make them available +include(GNUInstallDirs) +if (CMAKE_INSTALL_LIBDIR) + set(DYAD_LIBDIR ${CMAKE_INSTALL_LIBDIR}) +else () + set(DYAD_LIBDIR "lib") +endif () +link_directories(${CMAKE_BINARY_DIR}/${DYAD_LIBDIR}) include_directories(${CMAKE_BINARY_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) # required for private includes -# Do we want to use RPath to simplify linking -set(CMAKE_MACOSX_RPATH 1) -set(CMAKE_CXX_STANDARD 11) -#set(CMAKE_C_VISIBILITY_PRESET hidden) -#set(CMAKE_CXX_VISIBILITY_PRESET hidden) + #------------------------------------------------------------------------------ # Internal Paths for cmake libraries and Setup install and output Directories #------------------------------------------------------------------------------ # This sets where to look for dependent libraries set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_PREFIX}) # This sets where to look for dependent library's cmake files -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_BINARY_DIR}/lib/cmake ${CMAKE_BINARY_DIR}/share/cmake) +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}/share/cmake) -if (NOT CMAKE_INSTALL_RPATH) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64") - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -endif () #------------------------------------------------------------------------------ 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}/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.") + 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 () + +include(ExternalProject) +include(SetupCompiler) + #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use # by other projects. @@ -62,6 +73,11 @@ endif () #option(ENABLE_PERFFLOW "Build with PerfFlow Aspect support" OFF) #option(ENABLE_UCX_DTL "Build DYAD's UCX data transport layer" OFF) +option (USE_CLANG_LIBCXX OFF) +if (USE_CLANG_LIBCXX) + set (GCC_TOOLCHAIN "") +endif (USE_CLANG_LIBCXX) + set(DYAD_CONTROL_PLANE "FLUX_RPC" CACHE STRING "Protocol to use for DYAD's Control Plane") set_property(CACHE DYAD_CONTROL_PLANE PROPERTY STRINGS FLUX_RPC) set(DYAD_DATA_PLANE "FLUX_RPC" CACHE STRING "Protocol to use for DYAD's Data Plane") @@ -72,8 +88,6 @@ set_property(CACHE DYAD_PROFILER PROPERTY STRINGS PERFFLOW_ASPECT CALIPER NONE) #------------------------------------------------------------------------------ # Build Type based configurations #------------------------------------------------------------------------------ -set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -std=c11) -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++11) if(CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "Release") # Setting default as Release @@ -173,6 +187,7 @@ function(dyad_install_headers public_headers current_dir) endfunction() add_subdirectory(src/dyad) +cmake_policy(SET CMP0079 NEW) #----------------------------------------------------------------------------- # Configure the config.cmake file for the build directory @@ -190,7 +205,7 @@ install( FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake DESTINATION - lib/cmake/${PROJECT_NAME} + ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} ) #----------------------------------------------------------------------------- # Configure the ${PROJECT_NAME}-config-version .cmake file for the install directory @@ -204,7 +219,7 @@ install( FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake DESTINATION - lib/cmake/${PROJECT_NAME} + ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} ) export(EXPORT ${DYAD_EXPORTED_TARGETS} @@ -213,7 +228,70 @@ export(EXPORT ${DYAD_EXPORTED_TARGETS} install(EXPORT ${DYAD_EXPORTED_TARGETS} DESTINATION - lib/cmake/${PROJECT_NAME} + ${DYAD_LIBDIR}/cmake/${PROJECT_NAME} FILE ${DYAD_EXPORTED_TARGETS}.cmake - ) \ No newline at end of file + ) + +############################################################################### +# Print out configuration summary +############################################################################### +include(DYADUtils) +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") + set(DYAD_GNU_LINUX TRUE) +endif () + +# NOTE: message() outputs to stderr by default. We now use a string to +# maintain this information and then have cmake echo it to stdout. The +# only side effects are that if you use the CMake GUI, you won't see +# this output anymore (they only report stderr) and that if you add +# something to the list, you must remember your newline! +set(_str "\n== DYAD Configuration Summary ==\n\n") +string(APPEND _str " PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}\n" + " PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}\n\n" + " CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}\n" + " CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n\n") +if (CMAKE_BUILD_TYPE MATCHES None) + string(APPEND _str + " CXX FLAGS: ${CMAKE_CXX_FLAGS}\n") +elseif (CMAKE_BUILD_TYPE MATCHES Release) + string(APPEND _str + " CXX FLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}\n") + string(APPEND _str + " C FLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}\n") +elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + string(APPEND _str + " CXX FLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}\n") + string(APPEND _str + " C FLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}\n") +elseif (CMAKE_BUILD_TYPE MATCHES Debug) + string(APPEND _str + " CXX FLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}\n") + string(APPEND _str + " C FLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}\n") +endif () +string(APPEND _str "\n") + +string(APPEND _str + " DYAD_GIT_VERSION: ${DYAD_GIT_VERSION}\n") +string(APPEND _str + " DYAD_CONTROL_PLANE: ${DYAD_CONTROL_PLANE}\n") +string(APPEND _str + " DYAD_DATA_PLANE: ${DYAD_DATA_PLANE}\n") +string(APPEND _str + " DYAD_PROFILER: ${DYAD_PROFILER}\n") +string(APPEND _str + " FluxCore_ROOT_DIR: ${FluxCore_ROOT_DIR}\n") +string(APPEND _str + " JANSSON_INCLUDE_DIR: ${JANSSON_INCLUDE_DIR}\n") + +#Print the true/false variables +append_str_tf(_str + DYAD_GNU_LINUX +) +string(APPEND _str + "\n== End DYAD Configuration Summary ==\n") + +# Output to stdout +execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${_str}") +set(_str) diff --git a/cmake/modules/DYADUtils.cmake b/cmake/modules/DYADUtils.cmake new file mode 100644 index 00000000..1faa1b5e --- /dev/null +++ b/cmake/modules/DYADUtils.cmake @@ -0,0 +1,98 @@ +################################################################ +# Utilities +################################################################ + +# A handy macro to add the current source directory to a local +# filename. To be used for creating a list of sources. +macro(set_full_path VAR) + unset(__tmp_names) + foreach(filename ${ARGN}) + list(APPEND __tmp_names "${CMAKE_CURRENT_SOURCE_DIR}/${filename}") + endforeach() + set(${VAR} "${__tmp_names}") +endmacro() + +# A function to get a string of spaces. Useful for formatting output. +function(dyad_get_space_string OUTPUT_VAR LENGTH) + set(_curr_length 0) + set(_out_str "") + while (${_curr_length} LESS ${LENGTH}) + string(APPEND _out_str " ") + math(EXPR _curr_length "${_curr_length} + 1") + endwhile () + + set(${OUTPUT_VAR} "${_out_str}" PARENT_SCOPE) +endfunction () + +# This computes the maximum length of the things given in "ARGN" +# interpreted as simple strings. +macro(dyad_get_max_str_length OUTPUT_VAR) + set(${OUTPUT_VAR} 0) + foreach(var ${ARGN}) + string(LENGTH "${var}" _var_length) + if (_var_length GREATER _max_length) + set(${OUTPUT_VAR} ${_var_length}) + endif () + endforeach () +endmacro () + +# Check to see if we are in a git repo +find_program(__GIT_EXECUTABLE git) +mark_as_advanced(__GIT_EXECUTABLE) +if (__GIT_EXECUTABLE) + execute_process( + COMMAND ${__GIT_EXECUTABLE} rev-parse --is-inside-work-tree + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE __BUILDING_FROM_GIT_SOURCES + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (__BUILDING_FROM_GIT_SOURCES) + # Get the git version so that we can embed it into the executable + execute_process( + COMMAND ${__GIT_EXECUTABLE} rev-parse --show-toplevel + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE __GIT_TOPLEVEL_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${__GIT_EXECUTABLE} rev-parse --git-dir + WORKING_DIRECTORY "${__GIT_TOPLEVEL_DIR}" + OUTPUT_VARIABLE __GIT_GIT_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${__GIT_EXECUTABLE} --git-dir "${__GIT_GIT_DIR}" describe + --abbrev=7 --always --dirty --tags + WORKING_DIRECTORY "${__GIT_TOPLEVEL_DIR}" + OUTPUT_VARIABLE __GIT_DESCRIBE_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(DYAD_GIT_VERSION "${__GIT_DESCRIBE_VERSION}" + CACHE STRING "DYAD's version string as told by git.") + endif (__BUILDING_FROM_GIT_SOURCES) +endif (__GIT_EXECUTABLE) + +################################################################ +# Configuration summary +################################################################ + +# This creates a formatted string that contains a list of variables, +# one per line, with their values interpreted as TRUE or FALSE. The +# purpose is to provide uniform output, rather than an odd mixture of +# "1", "0", "ON", "OFF", "TRUE" and "FALSE". +macro(append_str_tf STRING_VAR) + dyad_get_max_str_length(_max_length ${ARGN}) + math(EXPR _max_length "${_max_length} + 2") + + foreach(var ${ARGN}) + string(LENGTH "${var}" _var_length) + math(EXPR _num_spaces "${_max_length} - ${_var_length}") + dyad_get_space_string(_spaces ${_num_spaces}) + if (${var}) + set(${var} "TRUE") + string(APPEND ${STRING_VAR} " ${var}:" "${_spaces}" "TRUE\n") + else () + set(${var} "FALSE") + string(APPEND ${STRING_VAR} " ${var}:" "${_spaces}" "FALSE\n") + endif () + endforeach() +endmacro () + diff --git a/cmake/FindFluxCore.cmake b/cmake/modules/FindFluxCore.cmake similarity index 100% rename from cmake/FindFluxCore.cmake rename to cmake/modules/FindFluxCore.cmake diff --git a/cmake/FindJansson.cmake b/cmake/modules/FindJansson.cmake similarity index 100% rename from cmake/FindJansson.cmake rename to cmake/modules/FindJansson.cmake diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake new file mode 100644 index 00000000..2f5c5ec2 --- /dev/null +++ b/cmake/modules/SetupCompiler.cmake @@ -0,0 +1,139 @@ +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) +# This is off to use -std=c11 instead of -std=gnu11 +set(CMAKE_C_EXTENSIONS OFF) +# Add _POSIX_C_SOURCE to avoid warning on setenv() as C_EXTENSIONS is off +add_definitions(-D_POSIX_C_SOURCE=200809L) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +#set(CMAKE_C_VISIBILITY_PRESET hidden) +#set(CMAKE_CXX_VISIBILITY_PRESET hidden) + + +include(CheckCXXCompilerFlag) +include(CheckIncludeFileCXX) + + +# MACRO dyad_add_compiler_flags +# +# Purpose: checks that all flags are valid and appends them to the +# given list. Valid means that the cxx compiler does not throw an +# error upon encountering the flag. +# +# Arguments: +# MY_FLAGS The list of current flags +# ARGN The flags to check +# +# Note: If flag is not valid, it is not appended. +macro(dyad_add_compiler_flags MY_FLAGS) + foreach(flag ${ARGN}) + string(FIND "${${MY_FLAGS}}" "${flag}" flag_already_set) + if(flag_already_set EQUAL -1) + string(REPLACE "-" "_" _CLEAN_FLAG "${flag}") + + set(CMAKE_REQUIRED_LIBRARIES "${flag}") + check_cxx_compiler_flag("${flag}" FLAG_${_CLEAN_FLAG}_OK) + unset(CMAKE_REQUIRED_LIBRARIES) + + if (FLAG_${_CLEAN_FLAG}_OK) + set(${MY_FLAGS} "${${MY_FLAGS}} ${flag}") + endif () + unset(FLAG_${_CLEAN_FLAG}_OK CACHE) + endif() + endforeach() +endmacro() + + +dyad_add_compiler_flags(CMAKE_CXX_FLAGS + -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor + -Wno-deprecated-declarations) + +dyad_add_compiler_flags(CMAKE_C_FLAGS + -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor + -Wno-deprecated-declarations) + + +set(CMAKE_C_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) + +# Some behavior is dependent on the compiler version. +if (NOT CMAKE_CXX_COMPILER_VERSION) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -dumpversion + OUTPUT_VARIABLE CXX_VERSION) +else () + set(CXX_VERSION "${CMAKE_CXX_COMPILER_VERSION}") +endif () + +# - Special handling if we're compiling with Clang's address sanitizer +# - gcc toolchain handling for interoperability, especially with the exteral +# libraries pre-built using gcc +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (USE_CLANG_LIBCXX) + dyad_add_compiler_flags(CMAKE_CXX_FLAGS "--stdlib=libc++") + else (USE_CLANG_LIBCXX) + if (GCC_TOOLCHAIN) + dyad_add_compiler_flags(CMAKE_CXX_FLAGS "--gcc-toolchain=${GCC_TOOLCHAIN}") + endif (GCC_TOOLCHAIN) + endif (USE_CLANG_LIBCXX) + + if (CMAKE_BUILD_TYPE MATCHES Debug) + dyad_add_compiler_flags(CMAKE_CXX_FLAGS + -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address) + dyad_add_compiler_flags(CMAKE_C_FLAGS + -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address) + else() + dyad_add_compiler_flags(CMAKE_CXX_FLAGS -fno-omit-frame-pointer) + dyad_add_compiler_flags(CMAKE_C_FLAGS -fno-omit-frame-pointer) + endif () +endif () + +# Turn off some annoying warnings +if (CMAKE_CXX_COMPILER_ID MATCHES "Intel") + # Bugs with Intel compiler version 19 + #https://community.intel.com/t5/Intel-C-Compiler/quot-if-constexpr-quot-and-quot-missing-return-statement-quot-in/td-p/1154551 + #https://bitbucket.org/berkeleylab/upcxx/issues/286/icc-bug-bogus-warning-use-of-offsetof-with + if (GCC_PATH) + set(GCC_INTEROP "-gcc-name=${GCC_PATH}") + endif (GCC_PATH) + # -openmp_profile + dyad_add_compiler_flags(CMAKE_CXX_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) + dyad_add_compiler_flags(CMAKE_C_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) +endif () + + +################################################################ +# Initialize RPATH (always full RPATH) +# Note: see https://cmake.org/Wiki/CMake_RPATH_handling +################################################################ + +# Use RPATH on OS X +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) +endif () + +# Use (i.e. don't skip) RPATH for build +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# Use same RPATH for build and install +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) + +if (CMAKE_INSTALL_LIBDIR) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) + if (${_IS_SYSTEM_DIR} STREQUAL "-1") + # Set the install RPATH correctly + list(APPEND CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif () +else () + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64") +endif () + +# Testing for compiler feature supports +#include(CheckCXXSourceCompiles) From 10031736bd2f1e0e7d5f0dfef9a5f409ee11f5c4 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Thu, 18 Jan 2024 21:11:16 -0800 Subject: [PATCH 02/16] Build: Add more capability to cmake building. config header, path control, and compilation error check --- CMakeLists.txt | 91 +++++++++++++++++-- cmake/configure_files/DYADConfig.cmake.in | 60 +++++++++++++ cmake/configure_files/dyad_config.hpp.in | 33 +++++++ cmake/configure_files/dyad_module.lua.in | 48 ++++++++++ cmake/modules/SetupCompiler.cmake | 102 ++++++++++++++++++---- cmake/tests/has_filesystem.cpp | 7 ++ src/dyad/CMakeLists.txt | 4 - src/dyad/common/dyad_flux_log.h | 6 ++ src/dyad/common/dyad_rc.h | 6 ++ src/dyad/core/CMakeLists.txt | 10 ++- src/dyad/core/dyad_core.c | 6 ++ src/dyad/core/dyad_core.h | 5 ++ src/dyad/core/dyad_envs.h | 6 ++ src/dyad/dtl/CMakeLists.txt | 9 +- src/dyad/dtl/dyad_dtl.h | 8 +- src/dyad/dtl/dyad_dtl_impl.c | 6 ++ src/dyad/dtl/dyad_dtl_impl.h | 5 ++ src/dyad/dtl/flux_dtl.c | 8 +- src/dyad/dtl/flux_dtl.h | 8 +- src/dyad/dtl/ucx_dtl.c | 6 ++ src/dyad/dtl/ucx_dtl.h | 8 +- src/dyad/modules/CMakeLists.txt | 25 ++---- src/dyad/modules/dyad.c | 6 ++ src/dyad/stream/CMakeLists.txt | 10 ++- src/dyad/utils/CMakeLists.txt | 7 +- src/dyad/utils/base64/CMakeLists.txt | 4 +- src/dyad/utils/read_all.c | 8 +- src/dyad/utils/read_all.h | 6 ++ src/dyad/utils/utils.c | 6 ++ src/dyad/utils/utils.h | 6 ++ src/dyad/wrapper/CMakeLists.txt | 8 +- src/dyad/wrapper/wrapper.c | 6 ++ 32 files changed, 473 insertions(+), 61 deletions(-) create mode 100644 cmake/configure_files/DYADConfig.cmake.in create mode 100644 cmake/configure_files/dyad_config.hpp.in create mode 100644 cmake/configure_files/dyad_module.lua.in create mode 100644 cmake/tests/has_filesystem.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 455c322e..dbe4a562 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.12) #------------------------------------------------------------------------------ # Version information #------------------------------------------------------------------------------ @@ -28,8 +28,17 @@ string(TOLOWER "${PROJECT_NAME}" LOWER_PROJECT_NAME) include(GNUInstallDirs) if (CMAKE_INSTALL_LIBDIR) set(DYAD_LIBDIR ${CMAKE_INSTALL_LIBDIR}) + set(DYAD_INSTALL_INCLUDE_DIR + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(DYAD_INSTALL_DOCDIR + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}) + set(DYAD_INSTALL_SYSCONFDIR + ${CMAKE_INSTALL_PREFIX}/${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") endif () link_directories(${CMAKE_BINARY_DIR}/${DYAD_LIBDIR}) include_directories(${CMAKE_BINARY_DIR}/include) @@ -54,9 +63,6 @@ if (NOT DYAD_EXTERNALLY_CONFIGURED) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DYAD_LIBDIR} CACHE PATH "Single Directory for all static libraries.") endif () -include(ExternalProject) -include(SetupCompiler) - #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use # by other projects. @@ -73,6 +79,12 @@ endif () #option(ENABLE_PERFFLOW "Build with PerfFlow Aspect support" OFF) #option(ENABLE_UCX_DTL "Build DYAD's UCX data transport layer" OFF) +# This option is off by default because non-developers should not use +# this option under normal circumstances. +option(DYAD_WARNINGS_AS_ERRORS + "Build with warnings promoted to errors." OFF) +mark_as_advanced(DYAD_WARNINGS_AS_ERRORS) + option (USE_CLANG_LIBCXX OFF) if (USE_CLANG_LIBCXX) set (GCC_TOOLCHAIN "") @@ -85,6 +97,10 @@ set_property(CACHE DYAD_DATA_PLANE PROPERTY STRINGS FLUX_RPC UCX) set(DYAD_PROFILER "NONE" CACHE STRING "Profiler to use for DYAD") set_property(CACHE DYAD_PROFILER PROPERTY STRINGS PERFFLOW_ASPECT CALIPER NONE) + +include(ExternalProject) +include(SetupCompiler) + #------------------------------------------------------------------------------ # Build Type based configurations #------------------------------------------------------------------------------ @@ -94,8 +110,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "") endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDYAD_FULL_DEBUG=1 -DDYAD_LOGGING_ON=1" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDYAD_FULL_DEBUG=1 -DDYAD_LOGGING_ON=1") + set(DYAD_FULL_DEBUG 1) + set(DYAD_LOGGING_ON 1) endif() #------------------------------------------------------------------------------ # Disallow in-source build @@ -186,9 +202,11 @@ function(dyad_install_headers public_headers current_dir) endforeach () endfunction() +include(DYADUtils) add_subdirectory(src/dyad) cmake_policy(SET CMP0079 NEW) + #----------------------------------------------------------------------------- # Configure the config.cmake file for the build directory #----------------------------------------------------------------------------- @@ -225,6 +243,28 @@ install( 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_BINARY_DIR}/src/dyad/dyad_config.hpp" @ONLY) + + +################################################################ +# Install DYAD +################################################################ + +include(CMakePackageConfigHelpers) + +install(FILES + "${CMAKE_BINARY_DIR}/src/dyad/dyad_config.hpp" + DESTINATION + ${DYAD_INSTALL_INCLUDE_DIR}/dyad) + +# Write the version file. This is independent of build/install tree. +write_basic_package_version_file( + DYADConfigVersion.cmake + VERSION "${DYAD_PACKAGE_VERSION}" + COMPATIBILITY SameMajorVersion) + install(EXPORT ${DYAD_EXPORTED_TARGETS} DESTINATION @@ -233,10 +273,19 @@ install(EXPORT ${DYAD_EXPORTED_TARGETS}.cmake ) +# Install license and readme +install(FILES + "${PROJECT_SOURCE_DIR}/NOTICE" + "${PROJECT_SOURCE_DIR}/LICENSE" + "${PROJECT_SOURCE_DIR}/README.md" + DESTINATION + ${DYAD_INSTALL_DOCDIR}) + + ############################################################################### # Print out configuration summary ############################################################################### -include(DYADUtils) + if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") set(DYAD_GNU_LINUX TRUE) endif () @@ -272,6 +321,8 @@ elseif (CMAKE_BUILD_TYPE MATCHES Debug) endif () string(APPEND _str "\n") +string(APPEND _str + " DYAD_PACKAGE_VERSION: ${DYAD_PACKAGE_VERSION}\n") string(APPEND _str " DYAD_GIT_VERSION: ${DYAD_GIT_VERSION}\n") string(APPEND _str @@ -295,3 +346,29 @@ string(APPEND _str # Output to stdout execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${_str}") set(_str) + + +############################################################################### +# Write a basic modulefile +############################################################################### + +set(DYAD_MODULEFILE_NAME "dyad-${DYAD_PACKAGE_VERSION}.lua") +# CACHE STRING +# "The name of the DYAD modulefile to install. Must end in .lua.") + +if (NOT (DYAD_MODULEFILE_NAME MATCHES ".+\.lua")) + message(WARNING + "DYAD_MODULEFILE_NAME must have extension \".lua\". Appending.") + set(DYAD_MODULEFILE_NAME "${DYAD_MODULEFILE_NAME}.lua" + CACHE STRING "" FORCE) +endif () + +configure_file( + "${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_module.lua.in" + "${CMAKE_BINARY_DIR}/dyad_module.lua.install" + @ONLY) + +install(FILES "${CMAKE_BINARY_DIR}/dyad_module.lua.install" + RENAME "${DYAD_MODULEFILE_NAME}" + DESTINATION + "${DYAD_INSTALL_SYSCONFDIR}") diff --git a/cmake/configure_files/DYADConfig.cmake.in b/cmake/configure_files/DYADConfig.cmake.in new file mode 100644 index 00000000..a28042ba --- /dev/null +++ b/cmake/configure_files/DYADConfig.cmake.in @@ -0,0 +1,60 @@ +# This will create IMPORTED targets for DYAD. The executables will be +# DYAD::-bin (e.g., DYAD::dyad-bin) and the library will +# be DYAD::dyad. + +include("${CMAKE_CURRENT_LIST_DIR}/DYADConfigVersion.cmake") + +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) + + +set(DYAD_VERSION ${PACKAGE_VERSION}) + +# Record compiler information +set(DYAD_C_COMPILER "@CMAKE_C_COMPILER@") +set(DYAD_CXX_COMPILER "@CMAKE_CXX_COMPILER@") + +set(DYAD_C_FLAGS "@CMAKE_C_FLAGS@") +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) + +# Record the various flags and switches accumlated in DYAD +set(DYAD_GNU_LINUX @DYAD_GNU_LINUX@) +set(DYAD_HAS_STD_FILESYSTEM @DYAD_HAS_STD_FILESYSTEM@) + +# Setup dependencies + + +@PACKAGE_INIT@ + +# Now actually import the DYAD target +set(_TMP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIRS@") +foreach (_DIR ${_TMP_INCLUDE_DIRS}) + set_and_check(_INCLUDE_DIR "${_DIR}") + list(APPEND DYAD_INCLUDE_DIRS "${_INCLUDE_DIR}") +endforeach (_DIR "${_TMP_INCLUDE_DIRS}") + +set(_TMP_LIBRARY_DIRS "@PACKAGE_LIB_INSTALL_DIR@") +foreach (_DIR ${_TMP_LIBRARY_DIRS}) + set_and_check(_LIBRARY_DIR "${_DIR}") + list(APPEND DYAD_LIBRARY_DIRS "${_LIBRARY_DIR}") +endforeach (_DIR ${_TMP_LIBRARY_DIRS}) + +if (NOT TARGET DYAD::dyad) + include(${CMAKE_CURRENT_LIST_DIR}/DYADTargets.cmake) +endif (NOT TARGET DYAD::dyad) + +check_required_components(DYAD) + +set(DYAD_LIBRARIES DYAD::dyad) diff --git a/cmake/configure_files/dyad_config.hpp.in b/cmake/configure_files/dyad_config.hpp.in new file mode 100644 index 00000000..6ffce69f --- /dev/null +++ b/cmake/configure_files/dyad_config.hpp.in @@ -0,0 +1,33 @@ +#ifndef DYAD_CONFIG_HPP +#define DYAD_CONFIG_HPP + +/* Version string for DYAD */ +#define DYAD_PACKAGE_VERSION @DYAD_PACKAGE_VERSION@ +#cmakedefine DYAD_GIT_VERSION @DYAD_GIT_VERSION@ + +/* Compiler used */ +#cmakedefine CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" + +#cmakedefine CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" +#cmakedefine CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" +#cmakedefine CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" +#cmakedefine CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" +#cmakedefine CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS@_RELEASE" + +#cmakedefine CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" +#cmakedefine CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" +#cmakedefine CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" +#cmakedefine CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" +#cmakedefine CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" + +#cmakedefine CMAKE_C_SHARED_LIBRARY_FLAGS "@CMAKE_C_SHARED_LIBRARY_FLAGS@" +#cmakedefine CMAKE_CXX_SHARED_LIBRARY_FLAGS "@CMAKE_CXX_SHARED_LIBRARY_FLAGS@" + +/* Macro flags */ +#cmakedefine DYAD_GNU_LINUX 1 +#cmakedefine DYAD_LOGGING_ON 1 +#cmakedefine DYAD_FULL_DEBUG 1 +#cmakedefine DYAD_HAS_STD_FILESYSTEM 1 + + +#endif /* DYAD_CONFIG_H */ diff --git a/cmake/configure_files/dyad_module.lua.in b/cmake/configure_files/dyad_module.lua.in new file mode 100644 index 00000000..f063c100 --- /dev/null +++ b/cmake/configure_files/dyad_module.lua.in @@ -0,0 +1,48 @@ +-- LMod module file for DYAD + +-- CMAKE_INSTALL_PREFIX: @CMAKE_INSTALL_PREFIX@ +-- CMAKE_BUILD_TYPE: @CMAKE_BUILD_TYPE@ +-- C Compiler: @CMAKE_C_COMPILER@ +-- C FLAGS: @CMAKE_C_FLAGS@ +-- C FLAGS_DEBUG: @CMAKE_C_FLAGS_DEBUG@ +-- C FLAGS_RELWITHDEBINFO: @CMAKE_C_FLAGS_RELWITHDEBINFO@ +-- C FLAGS_RELEASE: @CMAKE_C_FLAGS_RELEASE@ +-- CXX Compiler: @CMAKE_CXX_COMPILER@ +-- CXX FLAGS: @CMAKE_CXX_FLAGS@ +-- CXX FLAGS_DEBUG: @CMAKE_CXX_FLAGS_DEBUG@ +-- CXX FLAGS_RELWITHDEBINFO: @CMAKE_CXX_FLAGS_RELWITHDEBINFO@ +-- CXX FLAGS_RELEASE: @CMAKE_CXX_FLAGS_RELEASE@ +-- DYAD_GNU_LINUX: @DYAD_GNU_LINUX@ +-- DYAD_HAS_DOXYGEN: @DYAD_HAS_DOXYGEN@ +-- DYAD_HAS_STD_FILESYSTEM: @DYAD_HAS_STD_FILESYSTEM@ + +help( +[[ +DYnamic and Asynchronous Data streamliner (DYAD) version @DYAD_VERSION@. +]]) + +whatis("Package: DYAD") +whatis("Version: @DYAD_VERSION@") +whatis("Description: DYnamic and Asynchronous Data streamliner (DYAD).") +whatis("URL: https://github.com/flux-framework/dyad") +whatis("CMAKE_INSTALL_PREFIX: @CMAKE_INSTALL_PREFIX@") +whatis("CMAKE_BUILD_TYPE: @CMAKE_BUILD_TYPE@") +whatis("C Compiler: @CMAKE_C_COMPILER@") +whatis("C FLAGS: @CMAKE_C_FLAGS@") +whatis("C FLAGS_DEBUG: @CMAKE_C_FLAGS_DEBUG@") +whatis("C FLAGS_RELWITHDEBINFO: @CMAKE_C_FLAGS_RELWITHDEBINFO@") +whatis("C FLAGS_RELEASE: @CMAKE_C_FLAGS_RELEASE@") +whatis("CXX Compiler: @CMAKE_CXX_COMPILER@") +whatis("CXX FLAGS: @CMAKE_CXX_FLAGS@") +whatis("CXX FLAGS_DEBUG: @CMAKE_CXX_FLAGS_DEBUG@") +whatis("CXX FLAGS_RELWITHDEBINFO: @CMAKE_CXX_FLAGS_RELWITHDEBINFO@") +whatis("CXX FLAGS_RELEASE: @CMAKE_CXX_FLAGS_RELEASE@") +whatis("DYAD_GNU_LINUX: @DYAD_GNU_LINUX@") +whatis("DYAD_HAS_DOXYGEN: @DYAD_HAS_DOXYGEN@") +whatis("DYAD_HAS_STD_FILESYSTEM: @DYAD_HAS_STD_FILESYSTEM@") + +prepend_path("PATH","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@") +prepend_path("LD_LIBRARY_PATH","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") + +pushenv("DYAD_DIR","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DIR@") + diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index 2f5c5ec2..2e5b5b9e 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -1,3 +1,7 @@ +################################################################ +# Set compiler standard +################################################################ + set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) # This is off to use -std=c11 instead of -std=gnu11 @@ -12,11 +16,15 @@ set(CMAKE_CXX_EXTENSIONS OFF) #set(CMAKE_CXX_VISIBILITY_PRESET hidden) +################################################################ +# Check and add compiler flags +################################################################ + +include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(CheckIncludeFileCXX) - -# MACRO dyad_add_compiler_flags +# MACRO dyad_add_c|cxx_flags # # Purpose: checks that all flags are valid and appends them to the # given list. Valid means that the cxx compiler does not throw an @@ -27,7 +35,7 @@ include(CheckIncludeFileCXX) # ARGN The flags to check # # Note: If flag is not valid, it is not appended. -macro(dyad_add_compiler_flags MY_FLAGS) +macro(dyad_add_cxx_flags MY_FLAGS) foreach(flag ${ARGN}) string(FIND "${${MY_FLAGS}}" "${flag}" flag_already_set) if(flag_already_set EQUAL -1) @@ -45,16 +53,60 @@ macro(dyad_add_compiler_flags MY_FLAGS) endforeach() endmacro() +macro(dyad_add_c_flags MY_FLAGS) + foreach(flag ${ARGN}) + string(FIND "${${MY_FLAGS}}" "${flag}" flag_already_set) + if(flag_already_set EQUAL -1) + string(REPLACE "-" "_" _CLEAN_FLAG "${flag}") -dyad_add_compiler_flags(CMAKE_CXX_FLAGS + set(CMAKE_REQUIRED_LIBRARIES "${flag}") + check_c_compiler_flag("${flag}" FLAG_${_CLEAN_FLAG}_OK) + unset(CMAKE_REQUIRED_LIBRARIES) + + if (FLAG_${_CLEAN_FLAG}_OK) + set(${MY_FLAGS} "${${MY_FLAGS}} ${flag}") + endif () + unset(FLAG_${_CLEAN_FLAG}_OK CACHE) + endif() + endforeach() +endmacro() + +dyad_add_cxx_flags(CMAKE_CXX_FLAGS -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor -Wno-deprecated-declarations) -dyad_add_compiler_flags(CMAKE_C_FLAGS - -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor +dyad_add_c_flags(CMAKE_C_FLAGS + -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-deprecated-declarations) +################################################################ +# 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 () + + +################################################################ +# Handle compiler dependent behaviors +################################################################ + set(CMAKE_C_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) # Some behavior is dependent on the compiler version. @@ -71,21 +123,21 @@ endif () # libraries pre-built using gcc if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (USE_CLANG_LIBCXX) - dyad_add_compiler_flags(CMAKE_CXX_FLAGS "--stdlib=libc++") + dyad_add_cxx_flags(CMAKE_CXX_FLAGS "--stdlib=libc++") else (USE_CLANG_LIBCXX) if (GCC_TOOLCHAIN) - dyad_add_compiler_flags(CMAKE_CXX_FLAGS "--gcc-toolchain=${GCC_TOOLCHAIN}") + dyad_add_cxx_flags(CMAKE_CXX_FLAGS "--gcc-toolchain=${GCC_TOOLCHAIN}") endif (GCC_TOOLCHAIN) endif (USE_CLANG_LIBCXX) if (CMAKE_BUILD_TYPE MATCHES Debug) - dyad_add_compiler_flags(CMAKE_CXX_FLAGS + dyad_add_cxx_flags(CMAKE_CXX_FLAGS -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address) - dyad_add_compiler_flags(CMAKE_C_FLAGS + dyad_add_cxx_flags(CMAKE_C_FLAGS -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address) else() - dyad_add_compiler_flags(CMAKE_CXX_FLAGS -fno-omit-frame-pointer) - dyad_add_compiler_flags(CMAKE_C_FLAGS -fno-omit-frame-pointer) + dyad_add_cxx_flags(CMAKE_CXX_FLAGS -fno-omit-frame-pointer) + dyad_add_cxx_flags(CMAKE_C_FLAGS -fno-omit-frame-pointer) endif () endif () @@ -98,14 +150,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(GCC_INTEROP "-gcc-name=${GCC_PATH}") endif (GCC_PATH) # -openmp_profile - dyad_add_compiler_flags(CMAKE_CXX_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) - dyad_add_compiler_flags(CMAKE_C_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) + dyad_add_cxx_flags(CMAKE_CXX_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) + dyad_add_cxx_flags(CMAKE_C_FLAGS -diag-disable=2196 -wd1011 -wd1875 -diag-disable=11074 -diag-disable=11076 ${GCC_INTEROP}) endif () ################################################################ -# Initialize RPATH (always full RPATH) -# Note: see https://cmake.org/Wiki/CMake_RPATH_handling +# Initialize RPATH ################################################################ # Use RPATH on OS X @@ -123,6 +174,7 @@ 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 (CMAKE_INSTALL_LIBDIR) list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) @@ -135,5 +187,21 @@ else () set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64") endif () -# Testing for compiler feature supports + +################################################################ +# Check if std::filesystem is available +################################################################ + +# Testing for compiler feature supports #include(CheckCXXSourceCompiles) + +try_compile(DYAD_HAS_STD_FILESYSTEM "${CMAKE_BINARY_DIR}/temp" + "${CMAKE_SOURCE_DIR}/cmake/tests/has_filesystem.cpp" + CMAKE_FLAGS ${CMAKE_CXX_FLAGS} + LINK_LIBRARIES stdc++fs) +if (DYAD_HAS_STD_FILESYSTEM) + message(STATUS "Compiler has std::filesystem support") +else () + message(STATUS "Compiler does not have std::filesystem support. Use boost::filesystem") +endif (DYAD_HAS_STD_FILESYSTEM) + diff --git a/cmake/tests/has_filesystem.cpp b/cmake/tests/has_filesystem.cpp new file mode 100644 index 00000000..6db531f5 --- /dev/null +++ b/cmake/tests/has_filesystem.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::filesystem::path p{"."}; + return 0; +} diff --git a/src/dyad/CMakeLists.txt b/src/dyad/CMakeLists.txt index 7a5f5655..fdc9c380 100644 --- a/src/dyad/CMakeLists.txt +++ b/src/dyad/CMakeLists.txt @@ -4,7 +4,3 @@ add_subdirectory(core) add_subdirectory(modules) add_subdirectory(wrapper) add_subdirectory(stream) - -if (BUILD_URPC) - add_subdirectory(urpc) -endif (BUILD_URPC) \ No newline at end of file diff --git a/src/dyad/common/dyad_flux_log.h b/src/dyad/common/dyad_flux_log.h index badeb53e..7e50f330 100644 --- a/src/dyad/common/dyad_flux_log.h +++ b/src/dyad/common/dyad_flux_log.h @@ -1,6 +1,12 @@ #ifndef DYAD_DTL_DYAD_FLUX_LOG_H #define DYAD_DTL_DYAD_FLUX_LOG_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include #include diff --git a/src/dyad/common/dyad_rc.h b/src/dyad/common/dyad_rc.h index eb2ec30f..28be6029 100644 --- a/src/dyad/common/dyad_rc.h +++ b/src/dyad/common/dyad_rc.h @@ -1,6 +1,12 @@ #ifndef DYAD_DTL_DYAD_RC_H #define DYAD_DTL_DYAD_RC_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #if BUILDING_DYAD #define DYAD_DLL_EXPORTED __attribute__ ((__visibility__ ("default"))) #else diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index d189043e..4e5514e8 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -1,11 +1,17 @@ set(DYAD_CORE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_core.c) set(DYAD_CORE_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/dyad_envs.h ${CMAKE_CURRENT_SOURCE_DIR}/dyad_core.h) -set(DYAD_CORE_PUBLIC_HEADER ) +set(DYAD_CORE_PUBLIC_HEADER) add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC}) target_link_libraries(${PROJECT_NAME}_core PUBLIC Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) 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 $) + +if (TARGET DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_core PUBLIC DYAD_C_FLAGS_werror) +endif () if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") target_link_libraries(${PROJECT_NAME}_core PUBLIC perfflowaspect::perfflowaspect) @@ -20,4 +26,4 @@ install( ) if(NOT "${DYAD_CORE_PUBLIC_HEADER}" STREQUAL "") dyad_install_headers("${DYAD_CORE_PUBLIC_HEADER}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/core/dyad_core.c b/src/dyad/core/dyad_core.c index c0b52a22..36d23ba2 100644 --- a/src/dyad/core/dyad_core.c +++ b/src/dyad/core/dyad_core.c @@ -1,3 +1,9 @@ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include diff --git a/src/dyad/core/dyad_core.h b/src/dyad/core/dyad_core.h index b3157092..cc4b7e67 100644 --- a/src/dyad/core/dyad_core.h +++ b/src/dyad/core/dyad_core.h @@ -1,6 +1,11 @@ #ifndef DYAD_CORE_DYAD_CORE_H #define DYAD_CORE_DYAD_CORE_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif #include #include diff --git a/src/dyad/core/dyad_envs.h b/src/dyad/core/dyad_envs.h index 9ed005e7..5239fbc5 100644 --- a/src/dyad/core/dyad_envs.h +++ b/src/dyad/core/dyad_envs.h @@ -1,6 +1,12 @@ #ifndef DYAD_CORE_DYAD_ENVS_H #define DYAD_CORE_DYAD_ENVS_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #define DYAD_PATH_PRODUCER_ENV "DYAD_PATH_PRODUCER" #define DYAD_PATH_CONSUMER_ENV "DYAD_PATH_CONSUMER" #define DYAD_KVS_NAMESPACE_ENV "DYAD_KVS_NAMESPACE" diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 90fffd45..c3ba3743 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -31,6 +31,13 @@ if(DYAD_DATA_PLANE STREQUAL "UCX") target_compile_definitions(${PROJECT_NAME}_dtl PRIVATE DYAD_ENABLE_UCX=1) endif() +target_compile_definitions(${PROJECT_NAME}_dtl PUBLIC DYAD_HAS_CONFIG) +target_include_directories(${PROJECT_NAME}_dtl PUBLIC $) + +if (TARGET DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_dtl PUBLIC DYAD_C_FLAGS_werror) +endif () + install( TARGETS ${PROJECT_NAME}_dtl EXPORT ${DYAD_EXPORTED_TARGETS} @@ -40,4 +47,4 @@ install( ) if(NOT ${DTL_PUBLIC_HEADERS} STREQUAL "") dyad_install_headers("${DTL_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/dtl/dyad_dtl.h b/src/dyad/dtl/dyad_dtl.h index 0ff6e544..87b57f3d 100644 --- a/src/dyad/dtl/dyad_dtl.h +++ b/src/dyad/dtl/dyad_dtl.h @@ -1,6 +1,12 @@ #ifndef DYAD_DTL_DYAD_DTL_H #define DYAD_DTL_DYAD_DTL_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -16,4 +22,4 @@ struct dyad_dtl; } #endif -#endif /* DYAD_DTL_DYAD_DTL_H */ \ No newline at end of file +#endif /* DYAD_DTL_DYAD_DTL_H */ diff --git a/src/dyad/dtl/dyad_dtl_impl.c b/src/dyad/dtl/dyad_dtl_impl.c index 2dbf07de..29e9f672 100644 --- a/src/dyad/dtl/dyad_dtl_impl.c +++ b/src/dyad/dtl/dyad_dtl_impl.c @@ -1,3 +1,9 @@ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include diff --git a/src/dyad/dtl/dyad_dtl_impl.h b/src/dyad/dtl/dyad_dtl_impl.h index aa682f52..97cc15f5 100644 --- a/src/dyad/dtl/dyad_dtl_impl.h +++ b/src/dyad/dtl/dyad_dtl_impl.h @@ -1,6 +1,11 @@ #ifndef DYAD_DTL_DYAD_DTL_IMPL_H #define DYAD_DTL_DYAD_DTL_IMPL_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif #include diff --git a/src/dyad/dtl/flux_dtl.c b/src/dyad/dtl/flux_dtl.c index e579b989..aef79fb8 100644 --- a/src/dyad/dtl/flux_dtl.c +++ b/src/dyad/dtl/flux_dtl.c @@ -1,3 +1,9 @@ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include dyad_rc_t dyad_dtl_flux_init (dyad_dtl_t* self, @@ -152,4 +158,4 @@ dyad_rc_t dyad_dtl_flux_finalize (dyad_dtl_t** self) free ((*self)->private.flux_dtl_handle); (*self)->private.flux_dtl_handle = NULL; return DYAD_RC_OK; -} \ No newline at end of file +} diff --git a/src/dyad/dtl/flux_dtl.h b/src/dyad/dtl/flux_dtl.h index f58580b6..2f66cb23 100644 --- a/src/dyad/dtl/flux_dtl.h +++ b/src/dyad/dtl/flux_dtl.h @@ -1,6 +1,12 @@ #ifndef DYAD_DTL_FLUX_H #define DYAD_DTL_FLUX_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include "dyad_dtl_impl.h" @@ -43,4 +49,4 @@ dyad_rc_t dyad_dtl_flux_close_connection (dyad_dtl_t* self); dyad_rc_t dyad_dtl_flux_finalize (dyad_dtl_t** self); -#endif /* DYAD_DTL_FLUX_H */ \ No newline at end of file +#endif /* DYAD_DTL_FLUX_H */ diff --git a/src/dyad/dtl/ucx_dtl.c b/src/dyad/dtl/ucx_dtl.c index aa03d1e4..e8b2a239 100644 --- a/src/dyad/dtl/ucx_dtl.c +++ b/src/dyad/dtl/ucx_dtl.c @@ -1,3 +1,9 @@ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include diff --git a/src/dyad/dtl/ucx_dtl.h b/src/dyad/dtl/ucx_dtl.h index 10441835..af791841 100644 --- a/src/dyad/dtl/ucx_dtl.h +++ b/src/dyad/dtl/ucx_dtl.h @@ -1,6 +1,12 @@ #ifndef DYAD_DTL_UCX_H #define DYAD_DTL_UCX_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include @@ -47,4 +53,4 @@ dyad_rc_t dyad_dtl_ucx_close_connection (dyad_dtl_t* self); dyad_rc_t dyad_dtl_ucx_finalize (dyad_dtl_t** self); -#endif /* DYAD_DTL_UCX_H */ \ No newline at end of file +#endif /* DYAD_DTL_UCX_H */ diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index f8b7133d..e06f2dcb 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -7,29 +7,18 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") target_link_libraries(${PROJECT_NAME} PUBLIC Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) target_compile_definitions(${PROJECT_NAME} PUBLIC BUILDING_DYAD=1) +target_compile_definitions(${PROJECT_NAME} PUBLIC DYAD_HAS_CONFIG) +target_include_directories(${PROJECT_NAME} PUBLIC $) + +if (TARGET DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME} PUBLIC DYAD_C_FLAGS_werror) +endif () if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") target_link_libraries(${PROJECT_NAME} PUBLIC perfflowaspect::perfflowaspect) target_compile_definitions(${PROJECT_NAME} PUBLIC DYAD_PERFFLOW=1) endif() -#if (BUILD_URPC) -# set(urpc_src -# "${CMAKE_CURRENT_SOURCE_DIR}/urpc.c" -# ) -# set(urpc_headers -# "${CMAKE_CURRENT_SOURCE_DIR/urpc_ctx.h}" -# ) -# -# add_library(urpc MODULE ${urpc_src} ${urpc_headers}) -# target_link_libraries(urpc PUBLIC Jansson::Jansson flux::core) -# target_link_libraries(urpc PRIVATE utils) -# -# if (ENABLE_PERFFLOW) -# target_link_libraries(urpc PUBLIC perfflowaspect::perfflowaspect) -# endif (ENABLE_PERFFLOW) -# set(modules_targets "${modules_targets} urpc") -#endif (BUILD_URPC) install( TARGETS ${PROJECT_NAME} EXPORT ${DYAD_EXPORTED_TARGETS} @@ -39,4 +28,4 @@ install( ) if(NOT "${DYAD_MODULE_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_MODULE_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/modules/dyad.c b/src/dyad/modules/dyad.c index 953bc34c..8ec22b66 100644 --- a/src/dyad/modules/dyad.c +++ b/src/dyad/modules/dyad.c @@ -8,6 +8,12 @@ * SPDX-License-Identifier: LGPL-3.0 \************************************************************/ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #if defined(__cplusplus) #include #include diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index 199aef59..3a211196 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -14,6 +14,14 @@ if (ENABLE_PERFFLOW) target_compile_definitions(${PROJECT_NAME}_fstream PRIVATE DYAD_PERFFLOW=1) endif (ENABLE_PERFFLOW) +target_compile_definitions(${PROJECT_NAME}_fstream PUBLIC DYAD_HAS_CONFIG) +target_include_directories(${PROJECT_NAME}_fstream PUBLIC $) + +if (TARGET DYAD_CXX_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_fstream PUBLIC DYAD_CXX_FLAGS_werror) +endif () + + install( TARGETS ${PROJECT_NAME}_fstream EXPORT ${DYAD_EXPORTED_TARGETS} @@ -23,4 +31,4 @@ install( ) if(NOT "${DYAD_FSTREAM_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_FSTREAM_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 4474df23..4d4bf8f3 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -12,9 +12,14 @@ set(DYAD_MURMUR3_PUBLIC_HEADERS ) add_library(${PROJECT_NAME}_utils SHARED ${DYAD_UTILS_SRC}) target_link_libraries(${PROJECT_NAME}_utils PUBLIC flux::core ${PROJECT_NAME}_base64) +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}) +if (TARGET DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_utils PUBLIC DYAD_C_FLAGS_werror) +endif () install( TARGETS ${PROJECT_NAME}_utils @@ -35,4 +40,4 @@ install( ) if(NOT "${DYAD_MURMUR3_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_UTILS_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index 5299249d..2f7b45c4 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -1,6 +1,6 @@ set(DYAD_BASE64_SRC ${CMAKE_CURRENT_SOURCE_DIR}/base64.c) set(DYAD_BASE64_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/base64.h) -set(DYAD_BASE64_PUBLIC_HEADERS ) +set(DYAD_BASE64_PUBLIC_HEADERS) add_library(${PROJECT_NAME}_base64 SHARED ${DYAD_BASE64_SRC}) @@ -13,4 +13,4 @@ install( ) if(NOT "${DYAD_BASE64_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_BASE64_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/utils/read_all.c b/src/dyad/utils/read_all.c index ca8e907b..a7c23358 100644 --- a/src/dyad/utils/read_all.c +++ b/src/dyad/utils/read_all.c @@ -8,9 +8,11 @@ * SPDX-License-Identifier: LGPL-3.0 \************************************************************/ -#if HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif #include #include diff --git a/src/dyad/utils/read_all.h b/src/dyad/utils/read_all.h index 23a0ed78..de65839d 100644 --- a/src/dyad/utils/read_all.h +++ b/src/dyad/utils/read_all.h @@ -11,6 +11,12 @@ #ifndef DYAD_UTILS_READ_ALL_H #define DYAD_UTILS_READ_ALL_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #if defined(__cplusplus) diff --git a/src/dyad/utils/utils.c b/src/dyad/utils/utils.c index 5959c48b..13205787 100644 --- a/src/dyad/utils/utils.c +++ b/src/dyad/utils/utils.c @@ -8,6 +8,12 @@ * SPDX-License-Identifier: LGPL-3.0 \************************************************************/ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE diff --git a/src/dyad/utils/utils.h b/src/dyad/utils/utils.h index f14b85c8..cc6b728e 100644 --- a/src/dyad/utils/utils.h +++ b/src/dyad/utils/utils.h @@ -11,6 +11,12 @@ #ifndef DYAD_UTILS_UTILS_H #define DYAD_UTILS_UTILS_H +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index adcde25c..69b41a61 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -6,6 +6,12 @@ add_library(${PROJECT_NAME}_wrapper SHARED ${DYAD_WRAPPER_SRC}) target_link_libraries(${PROJECT_NAME}_wrapper PUBLIC ${PROJECT_NAME}_core flux::core) target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_utils) 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 $) + +if (TARGET DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_wrapper PUBLIC DYAD_C_FLAGS_werror) +endif () set(FLUX_BARRIER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/flux_barrier.c) set(FLUX_BARRIER_PRIVATE_HEADERS ) @@ -32,4 +38,4 @@ install( ) if(NOT "${FLUX_BARRIER_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${FLUX_BARRIER_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) -endif() \ No newline at end of file +endif() diff --git a/src/dyad/wrapper/wrapper.c b/src/dyad/wrapper/wrapper.c index 3f334330..fd3d49f3 100644 --- a/src/dyad/wrapper/wrapper.c +++ b/src/dyad/wrapper/wrapper.c @@ -8,6 +8,12 @@ * SPDX-License-Identifier: LGPL-3.0 \************************************************************/ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE From c8c9c471d270bf953272a7a44d7a462d9799ab45 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Thu, 18 Jan 2024 21:28:31 -0800 Subject: [PATCH 03/16] Build: Apply the generated config header file to stream lib and api --- include/dyad/stream/dyad_params.hpp | 6 ++++++ include/dyad/stream/dyad_stream_api.hpp | 7 +++++++ include/dyad/stream/dyad_stream_core.hpp | 6 ++++++ src/dyad/stream/dyad_stream_core.cpp | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/include/dyad/stream/dyad_params.hpp b/include/dyad/stream/dyad_params.hpp index 0067b508..fb3c371e 100644 --- a/include/dyad/stream/dyad_params.hpp +++ b/include/dyad/stream/dyad_params.hpp @@ -11,6 +11,12 @@ #ifndef DYAD_STREAM_DYAD_PARAMS_HPP #define DYAD_STREAM_DYAD_PARAMS_HPP +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include namespace dyad diff --git a/include/dyad/stream/dyad_stream_api.hpp b/include/dyad/stream/dyad_stream_api.hpp index cea14dba..58901ff2 100644 --- a/include/dyad/stream/dyad_stream_api.hpp +++ b/include/dyad/stream/dyad_stream_api.hpp @@ -10,6 +10,13 @@ #ifndef DYAD_STREAM_DYAD_STREAM_API_HPP #define DYAD_STREAM_DYAD_STREAM_API_HPP + +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include // fsync #include // realpath diff --git a/include/dyad/stream/dyad_stream_core.hpp b/include/dyad/stream/dyad_stream_core.hpp index 90d961bb..21d26890 100644 --- a/include/dyad/stream/dyad_stream_core.hpp +++ b/include/dyad/stream/dyad_stream_core.hpp @@ -11,6 +11,12 @@ #ifndef DYAD_STREAM_DYAD_STREAM_CORE_HPP #define DYAD_STREAM_DYAD_STREAM_CORE_HPP +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include diff --git a/src/dyad/stream/dyad_stream_core.cpp b/src/dyad/stream/dyad_stream_core.cpp index 6d981a23..90ece0cd 100644 --- a/src/dyad/stream/dyad_stream_core.cpp +++ b/src/dyad/stream/dyad_stream_core.cpp @@ -8,6 +8,12 @@ * SPDX-License-Identifier: LGPL-3.0 \************************************************************/ +#if defined(DYAD_HAS_CONFIG) +#include "dyad/dyad_config.hpp" +#else +#error "no config" +#endif + #include #include From 6c932649101a8bcecf3806efc73861b56566c75b Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Thu, 18 Jan 2024 22:03:51 -0800 Subject: [PATCH 04/16] Build: avoid using lib64 in case of CI test as it is set to lib in yaml --- .github/workflows/compile_test.yaml | 3 ++- CMakeLists.txt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index 0dbc91b4..d0e54242 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -210,7 +210,8 @@ jobs: if [[ $DYAD_DTL_MODE == 'UCX' ]]; then CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=UCX -DDYAD_PROFILER=NONE" fi - cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} -DENABLE_DYAD_DEBUG=ON .. + TEST_CONF="-DLIBDIR_AS_LIB:BOOL=ON -DCMAKE_BUILD_TYPE=Debug" + cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} ${TEST_CONF} .. make install -j - name: Install PyDYAD run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index dbe4a562..bcbddbc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,11 @@ string(TOLOWER "${PROJECT_NAME}" LOWER_PROJECT_NAME) #------------------------------------------------------------------------------ # Get installation directories -- these get used in various places; # best to just make them available -include(GNUInstallDirs) +option (LIBDIR_AS_LIB OFF) +if (NOT LIBDIR_AS_LIB) + include(GNUInstallDirs) +endif () + if (CMAKE_INSTALL_LIBDIR) set(DYAD_LIBDIR ${CMAKE_INSTALL_LIBDIR}) set(DYAD_INSTALL_INCLUDE_DIR From de34972f6949ef72414da0e353da869f761d4c4d Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Thu, 18 Jan 2024 23:41:47 -0800 Subject: [PATCH 05/16] Test: Add -DDYAD_HAS_CONFIG=1 to the test build to use the generated header --- docs/demos/ecp_feb_2023/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/demos/ecp_feb_2023/Makefile b/docs/demos/ecp_feb_2023/Makefile index b63deeec..cf637373 100644 --- a/docs/demos/ecp_feb_2023/Makefile +++ b/docs/demos/ecp_feb_2023/Makefile @@ -1,9 +1,9 @@ DYAD_LIB_PATH = $(DYAD_INSTALL_PREFIX)/lib DYAD_INCLUDE_PATH = $(DYAD_INSTALL_PREFIX)/include -CFLAGS_LOC = -std=c99 $(CFLAGS) +CFLAGS_LOC = -std=c11 -DDYAD_HAS_CONFIG=1 $(CFLAGS) CPPFLAGS_LOC = -O3 -I. $(CPPFLAGS) -CXXFLAGS_LOC = -std=c++11 -I$(DYAD_INCLUDE_PATH) $(CXXFLAGS) +CXXFLAGS_LOC = -std=c++11 -DDYAD_HAS_CONFIG=1 -I$(DYAD_INCLUDE_PATH) $(CXXFLAGS) CXXLIBS_LOC = -L$(DYAD_LIB_PATH) -Wl,-rpath=$(DYAD_LIB_PATH) -ldyad_fstream $(CXXLIBS) all: c_prod c_cons cpp_prod cpp_cons From a7c93c6697cb6aae10e345cf09949c2378cca23f Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Fri, 19 Jan 2024 12:19:20 -0800 Subject: [PATCH 06/16] Build: cmake package config WIP --- CMakeLists.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcbddbc2..7a5b869a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,17 +258,68 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_config.hpp.in" include(CMakePackageConfigHelpers) -install(FILES - "${CMAKE_BINARY_DIR}/src/dyad/dyad_config.hpp" - DESTINATION - ${DYAD_INSTALL_INCLUDE_DIR}/dyad) - # Write the version file. This is independent of build/install tree. write_basic_package_version_file( DYADConfigVersion.cmake VERSION "${DYAD_PACKAGE_VERSION}" COMPATIBILITY SameMajorVersion) +#........................................... +# 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") + +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) + +# Write the configure file for the install tree +set(INCLUDE_INSTALL_DIRS include) +set(EXTRA_CMAKE_MODULE_DIR) +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) + +# Install export +install(EXPORT DYADTargets + NAMESPACE DYAD:: + FILE DYADTargets.cmake + DESTINATION "${DYAD_LIBDIR}/cmake/dyad") + +# 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 cmake/modules + DESTINATION "${DYAD_LIBDIR}/cmake/dyad" + FILES_MATCHING PATTERN "*.cmake") +endif (WIP_package_config) +#........................................... + +install(FILES + "${CMAKE_BINARY_DIR}/src/dyad/dyad_config.hpp" + DESTINATION + ${DYAD_INSTALL_INCLUDE_DIR}/dyad) + install(EXPORT ${DYAD_EXPORTED_TARGETS} DESTINATION From 91aeb63326dd4f31c567d83e7de4e792c406ab10 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Fri, 19 Jan 2024 16:38:20 -0800 Subject: [PATCH 07/16] Build: change the name of CMake variable and macro definition regarding DATA_PLANE, and remove control plane --- .github/prod-cons/dyad_producer.sh | 4 ++++ .github/workflows/compile_test.yaml | 8 ++++---- CMakeLists.txt | 24 ++++++++++++++---------- cmake/configure_files/dyad_config.hpp.in | 1 + src/dyad/dtl/CMakeLists.txt | 6 +++--- src/dyad/dtl/Makefile.am | 4 ++-- src/dyad/dtl/dyad_dtl_impl.c | 6 +++--- 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.github/prod-cons/dyad_producer.sh b/.github/prod-cons/dyad_producer.sh index 447dc41c..909a5a9b 100755 --- a/.github/prod-cons/dyad_producer.sh +++ b/.github/prod-cons/dyad_producer.sh @@ -24,3 +24,7 @@ else echo "Invalid prod test mode: $mode" exit 1 fi + +# If this test were to be repeatable, two cleanup steps are needed. +# flux module remove dyad +# remove the files produced after consumer finishes using them diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index d0e54242..ba7c481f 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -206,13 +206,13 @@ jobs: mkdir build cd build export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DYAD_INSTALL_PREFIX}/lib/pkgconfig - CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=FLUX_RPC -DDYAD_PROFILER=NONE" + CONFIGURE_FLAGS="-DDYAD_PROFILER=NONE" if [[ $DYAD_DTL_MODE == 'UCX' ]]; then - CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=UCX -DDYAD_PROFILER=NONE" + CONFIGURE_FLAGS="-DDYAD_ENABLE_UCX_DATA=ON -DDYAD_PROFILER=NONE" fi - TEST_CONF="-DLIBDIR_AS_LIB:BOOL=ON -DCMAKE_BUILD_TYPE=Debug" + TEST_CONF="-DDYAD_LIBDIR_AS_LIB:BOOL=ON -DCMAKE_BUILD_TYPE=Debug" cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} ${TEST_CONF} .. - make install -j + make VERBOSE=1 install -j - name: Install PyDYAD run: | cd ${GITHUB_WORKSPACE}/pydyad diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a5b869a..b6c05dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,8 @@ string(TOLOWER "${PROJECT_NAME}" LOWER_PROJECT_NAME) #------------------------------------------------------------------------------ # Get installation directories -- these get used in various places; # best to just make them available -option (LIBDIR_AS_LIB OFF) -if (NOT LIBDIR_AS_LIB) +option (DYAD_LIBDIR_AS_LIB OFF) +if (NOT DYAD_LIBDIR_AS_LIB) include(GNUInstallDirs) endif () @@ -89,15 +89,15 @@ option(DYAD_WARNINGS_AS_ERRORS "Build with warnings promoted to errors." OFF) mark_as_advanced(DYAD_WARNINGS_AS_ERRORS) -option (USE_CLANG_LIBCXX OFF) -if (USE_CLANG_LIBCXX) +option (DYAD_USE_CLANG_LIBCXX OFF) +if (DYAD_USE_CLANG_LIBCXX) set (GCC_TOOLCHAIN "") -endif (USE_CLANG_LIBCXX) +endif (DYAD_USE_CLANG_LIBCXX) -set(DYAD_CONTROL_PLANE "FLUX_RPC" CACHE STRING "Protocol to use for DYAD's Control Plane") -set_property(CACHE DYAD_CONTROL_PLANE PROPERTY STRINGS FLUX_RPC) -set(DYAD_DATA_PLANE "FLUX_RPC" CACHE STRING "Protocol to use for DYAD's Data Plane") -set_property(CACHE DYAD_DATA_PLANE PROPERTY STRINGS FLUX_RPC UCX) +option (DYAD_ENABLE_UCX_DATA "Allow to dynamically select UCX for DYAD's Data Plane" OFF) +if (DYAD_ENABLE_UCX_DATA) + set (DYAD_ENABLE_UCX_DTL 1) +endif () set(DYAD_PROFILER "NONE" CACHE STRING "Profiler to use for DYAD") set_property(CACHE DYAD_PROFILER PROPERTY STRINGS PERFFLOW_ASPECT CALIPER NONE) @@ -180,7 +180,7 @@ if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") message(FATAL_ERROR "-- [${PROJECT_NAME}] ucx is needed for ${PROJECT_NAME} build") endif () endif() -if(DYAD_DATA_PLANE STREQUAL "UCX") +if(DYAD_ENABLE_UCX_DATA) find_package(ucx 1.6 REQUIRED) if (${ucx_FOUND}) message(STATUS "[${PROJECT_NAME}] found ucx at ${ucx_INCLUDE_DIRS}") @@ -394,6 +394,10 @@ string(APPEND _str #Print the true/false variables append_str_tf(_str DYAD_GNU_LINUX + DYAD_ENABLE_UCX_DATA + DYAD_LIBDIR_AS_LIB + DYAD_USE_CLANG_LIBCXX + DYAD_WARNINGS_AS_ERRORS ) string(APPEND _str "\n== End DYAD Configuration Summary ==\n") diff --git a/cmake/configure_files/dyad_config.hpp.in b/cmake/configure_files/dyad_config.hpp.in index 6ffce69f..be24fde5 100644 --- a/cmake/configure_files/dyad_config.hpp.in +++ b/cmake/configure_files/dyad_config.hpp.in @@ -27,6 +27,7 @@ #cmakedefine DYAD_GNU_LINUX 1 #cmakedefine DYAD_LOGGING_ON 1 #cmakedefine DYAD_FULL_DEBUG 1 +#cmakedefine DYAD_ENABLE_UCX_DTL 1 #cmakedefine DYAD_HAS_STD_FILESYSTEM 1 diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index c3ba3743..be13da4a 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -14,7 +14,7 @@ set(UCX_DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/ucx_dtl.c) set(UCX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/ucx_dtl.h) set(UCX_PUBLIC_HEADERS ) -if(DYAD_DATA_PLANE STREQUAL "UCX") +if(DYAD_ENABLE_UCX_DATA) set(DTL_SRC ${DTL_SRC} ${UCX_DTL_SRC}) set(DTL_PRIVATE_HEADERS ${DTL_PRIVATE_HEADERS} ${UCX_PRIVATE_HEADERS}) set(DTL_PUBLIC_HEADERS ${DTL_PUBLIC_HEADERS} ${UCX_PUBLIC_HEADERS}) @@ -26,9 +26,9 @@ set(DTL_PUBLIC_HEADERS ${DTL_PUBLIC_HEADERS} ${FLUX_PUBLIC_HEADERS}) add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC}) target_link_libraries(${PROJECT_NAME}_dtl PUBLIC ${PROJECT_NAME}_utils Jansson::Jansson flux::core) -if(DYAD_DATA_PLANE STREQUAL "UCX") +if(DYAD_ENABLE_UCX_DATA) target_link_libraries(${PROJECT_NAME}_dtl PUBLIC ucx::ucp ucx::ucs) - target_compile_definitions(${PROJECT_NAME}_dtl PRIVATE DYAD_ENABLE_UCX=1) + #target_compile_definitions(${PROJECT_NAME}_dtl PRIVATE DYAD_ENABLE_UCX_DTL=1) endif() target_compile_definitions(${PROJECT_NAME}_dtl PUBLIC DYAD_HAS_CONFIG) diff --git a/src/dyad/dtl/Makefile.am b/src/dyad/dtl/Makefile.am index 9877a412..d8ad550c 100644 --- a/src/dyad/dtl/Makefile.am +++ b/src/dyad/dtl/Makefile.am @@ -23,7 +23,7 @@ libdyad_dtl_la_SOURCES += \ ucx_dtl.c \ ucx_dtl.h libdyad_dtl_la_LIBADD += $(UCX_LIBS) -libdyad_dtl_la_CFLAGS += $(UCX_CFLAGS) -DDYAD_ENABLE_UCX=1 +libdyad_dtl_la_CFLAGS += $(UCX_CFLAGS) -DDYAD_ENABLE_UCX_DTL=1 endif -include_HEADERS = dyad_rc.h dyad_flux_log.h dyad_dtl.h \ No newline at end of file +include_HEADERS = dyad_rc.h dyad_flux_log.h dyad_dtl.h diff --git a/src/dyad/dtl/dyad_dtl_impl.c b/src/dyad/dtl/dyad_dtl_impl.c index 29e9f672..f0e77bae 100644 --- a/src/dyad/dtl/dyad_dtl_impl.c +++ b/src/dyad/dtl/dyad_dtl_impl.c @@ -8,7 +8,7 @@ #include -#if DYAD_ENABLE_UCX +#if DYAD_ENABLE_UCX_DTL #include "ucx_dtl.h" #endif @@ -24,7 +24,7 @@ dyad_rc_t dyad_dtl_init (dyad_dtl_t **dtl_handle, goto dtl_init_done; } (*dtl_handle)->mode = mode; -#if DYAD_ENABLE_UCX +#if DYAD_ENABLE_UCX_DTL if (mode == DYAD_DTL_UCX) { rc = dyad_dtl_ucx_init (*dtl_handle, mode, h, debug); if (DYAD_IS_ERROR (rc)) { @@ -59,7 +59,7 @@ dyad_rc_t dyad_dtl_finalize (dyad_dtl_t **dtl_handle) rc = DYAD_RC_OK; goto dtl_finalize_done; } -#if DYAD_ENABLE_UCX +#if DYAD_ENABLE_UCX_DTL if ((*dtl_handle)->mode == DYAD_DTL_UCX) { if ((*dtl_handle)->private.ucx_dtl_handle != NULL) { rc = dyad_dtl_ucx_finalize (dtl_handle); From 7f5cdbf107f5eb097262a07e77fe3515de44b544 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 03:02:06 -0800 Subject: [PATCH 08/16] Build : Set CMAKE_INSTALL_RPATH. Change some linking and include dir as private --- CMakeLists.txt | 22 ++++++--------- cmake/modules/SetupCompiler.cmake | 22 +++++++++------ src/dyad/core/CMakeLists.txt | 21 ++++++++++---- src/dyad/dtl/CMakeLists.txt | 41 ++++++++++++++++------------ src/dyad/modules/CMakeLists.txt | 25 +++++++++++------ src/dyad/stream/CMakeLists.txt | 24 +++++++++++----- src/dyad/utils/CMakeLists.txt | 18 ++++++++---- src/dyad/utils/base64/CMakeLists.txt | 9 +++++- src/dyad/wrapper/CMakeLists.txt | 30 ++++++++++++++------ 9 files changed, 137 insertions(+), 75 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6c05dc9..9cb7fb50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,9 @@ option (DYAD_LIBDIR_AS_LIB OFF) if (NOT DYAD_LIBDIR_AS_LIB) include(GNUInstallDirs) 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}) @@ -43,10 +44,8 @@ else () 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}") endif () -link_directories(${CMAKE_BINARY_DIR}/${DYAD_LIBDIR}) -include_directories(${CMAKE_BINARY_DIR}/include) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) # required for private includes #------------------------------------------------------------------------------ # Internal Paths for cmake libraries and Setup install and output Directories @@ -117,6 +116,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(DYAD_FULL_DEBUG 1) set(DYAD_LOGGING_ON 1) endif() + +if (NOT DEFINED BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS ON) +endif () #------------------------------------------------------------------------------ # Disallow in-source build #------------------------------------------------------------------------------ @@ -139,7 +142,7 @@ endif () #------------------------------------------------------------------------------ # Dependencies #------------------------------------------------------------------------------ -set(DEPENDENCY_LIB "") + # Required Dependencies # ============================================================================= # Import pkg-config for finding FluxCore @@ -147,23 +150,18 @@ find_package(PkgConfig REQUIRED) if (${PkgConfig_FOUND}) message(STATUS "[${PROJECT_NAME}] found PkgConfig at ${PkgConfig_INCLUDE_DIRS}") include_directories(${PkgConfig_INCLUDE_DIRS}) - set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${PkgConfig_LIBRARIES}) else () message(FATAL_ERROR "-- [${PROJECT_NAME}] PkgConfig is needed for ${PROJECT_NAME} build") endif () find_package(FluxCore REQUIRED) if (${FluxCore_FOUND}) message(STATUS "[${PROJECT_NAME}] found FluxCore at ${FluxCore_INCLUDE_DIRS}") - include_directories(${FluxCore_INCLUDE_DIRS}) - set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${FluxCore_LIBRARIES}) else () message(FATAL_ERROR "-- [${PROJECT_NAME}] FluxCore is needed for ${PROJECT_NAME} build") endif () find_package(Jansson 2.10 REQUIRED) if (${JANSSON_FOUND}) message(STATUS "[${PROJECT_NAME}] found Jansson at ${JANSSON_INCLUDE_DIRS}") - include_directories(${JANSSON_INCLUDE_DIRS}) - set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${JANSSON_LIBRARIES}) else () message(FATAL_ERROR "-- [${PROJECT_NAME}] Jansson is needed for ${PROJECT_NAME} build") endif () @@ -174,8 +172,6 @@ if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") find_package(perfflowaspect REQUIRED) if (${perfflowaspect_FOUND}) message(STATUS "[${PROJECT_NAME}] found perfflowaspect at ${perfflowaspect_INCLUDE_DIRS}") - include_directories(${perfflowaspect_INCLUDE_DIRS}) - set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${perfflowaspect_LIBRARIES}) else () message(FATAL_ERROR "-- [${PROJECT_NAME}] ucx is needed for ${PROJECT_NAME} build") endif () @@ -184,8 +180,6 @@ if(DYAD_ENABLE_UCX_DATA) find_package(ucx 1.6 REQUIRED) if (${ucx_FOUND}) message(STATUS "[${PROJECT_NAME}] found ucx at ${ucx_INCLUDE_DIRS}") - include_directories(${ucx_INCLUDE_DIRS}) - set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${ucx_LIBRARIES}) else () message(FATAL_ERROR "-- [${PROJECT_NAME}] ucx is needed for ${PROJECT_NAME} build") endif () diff --git a/cmake/modules/SetupCompiler.cmake b/cmake/modules/SetupCompiler.cmake index 2e5b5b9e..7e871aed 100644 --- a/cmake/modules/SetupCompiler.cmake +++ b/cmake/modules/SetupCompiler.cmake @@ -174,17 +174,23 @@ 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}") -if (CMAKE_INSTALL_LIBDIR) - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" _IS_SYSTEM_DIR) - if (${_IS_SYSTEM_DIR} STREQUAL "-1") +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}" _IS_SYSTEM_DIR) + +if (${_IS_SYSTEM_DIR} STREQUAL "-1") # Set the install RPATH correctly list(APPEND CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - endif () -else () - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64") + "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") endif () diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 4e5514e8..6bc65b07 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -2,20 +2,29 @@ set(DYAD_CORE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_core.c) set(DYAD_CORE_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/dyad_envs.h ${CMAKE_CURRENT_SOURCE_DIR}/dyad_core.h) set(DYAD_CORE_PUBLIC_HEADER) -add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC}) -target_link_libraries(${PROJECT_NAME}_core PUBLIC Jansson::Jansson flux::core) +add_library(${PROJECT_NAME}_core SHARED ${DYAD_CORE_SRC} + ${DYAD_CORE_PUBLIC_HEADER} ${DYAD_CORE_PRIVATE_HEADER}) +set_target_properties(${PROJECT_NAME}_core PROPERTIES CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") +target_link_libraries(${PROJECT_NAME}_core PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_utils ${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) 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 $) +target_include_directories(${PROJECT_NAME}_core PUBLIC + $ + $ + $) +target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) +target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_core PUBLIC DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_core PRIVATE DYAD_C_FLAGS_werror) endif () if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") - target_link_libraries(${PROJECT_NAME}_core PUBLIC perfflowaspect::perfflowaspect) - target_compile_definitions(${PROJECT_NAME}_core DYAD_PERFFLOW=1) + target_link_libraries(${PROJECT_NAME}_core PRIVATE perfflowaspect::perfflowaspect) + target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${perfflowaspect_INCLUDE_DIRS}) + target_compile_definitions(${PROJECT_NAME}_core PRIVATE DYAD_PERFFLOW=1) endif() install( TARGETS ${PROJECT_NAME}_core diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index be13da4a..9b34376b 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -1,41 +1,48 @@ # DTL Interface set(DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.c) -set(DTL_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.h - ${CMAKE_CURRENT_SOURCE_DIR}/dyad_rc.h) -set(DTL_PUBLIC_HEADERS ) +set(DTL_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.h) +#set(DTL_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_rc.h) # Flux implementation for DTL set(FLUX_DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/flux_dtl.c) set(FLUX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/flux_dtl.h) -set(FLUX_PUBLIC_HEADERS ) +set(FLUX_PUBLIC_HEADERS) # UCX implementation for DTL set(UCX_DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/ucx_dtl.c) set(UCX_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/ucx_dtl.h) -set(UCX_PUBLIC_HEADERS ) +set(UCX_PUBLIC_HEADERS) + +list(APPEND DTL_SRC ${FLUX_DTL_SRC}) +list(APPEND DTL_PRIVATE_HEADERS ${FLUX_PRIVATE_HEADERS}) +list(APPEND DTL_PUBLIC_HEADERS ${FLUX_PUBLIC_HEADERS}) if(DYAD_ENABLE_UCX_DATA) - set(DTL_SRC ${DTL_SRC} ${UCX_DTL_SRC}) - set(DTL_PRIVATE_HEADERS ${DTL_PRIVATE_HEADERS} ${UCX_PRIVATE_HEADERS}) - set(DTL_PUBLIC_HEADERS ${DTL_PUBLIC_HEADERS} ${UCX_PUBLIC_HEADERS}) + list(APPEND DTL_SRC ${UCX_DTL_SRC}) + list(APPEND DTL_PRIVATE_HEADERS ${UCX_PRIVATE_HEADERS}) + list(APPEND DTL_PUBLIC_HEADERS ${UCX_PUBLIC_HEADERS}) endif() -set(DTL_SRC ${DTL_SRC} ${FLUX_DTL_SRC}) -set(DTL_PRIVATE_HEADERS ${DTL_PRIVATE_HEADERS} ${FLUX_PRIVATE_HEADERS}) -set(DTL_PUBLIC_HEADERS ${DTL_PUBLIC_HEADERS} ${FLUX_PUBLIC_HEADERS}) -add_library(${PROJECT_NAME}_dtl SHARED ${DTL_SRC}) -target_link_libraries(${PROJECT_NAME}_dtl PUBLIC ${PROJECT_NAME}_utils Jansson::Jansson flux::core) +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) +set_target_properties(${PROJECT_NAME}_dtl PROPERTIES CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") if(DYAD_ENABLE_UCX_DATA) - target_link_libraries(${PROJECT_NAME}_dtl PUBLIC ucx::ucp ucx::ucs) - #target_compile_definitions(${PROJECT_NAME}_dtl PRIVATE DYAD_ENABLE_UCX_DTL=1) + target_link_libraries(${PROJECT_NAME}_dtl PRIVATE ucx::ucp ucx::ucs) + target_include_directories(${PROJECT_NAME}_dtl SYSTEM PUBLIC ${ucx_INCLUDE_DIRS}) endif() target_compile_definitions(${PROJECT_NAME}_dtl PUBLIC DYAD_HAS_CONFIG) -target_include_directories(${PROJECT_NAME}_dtl PUBLIC $) +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 PUBLIC DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_dtl PRIVATE DYAD_C_FLAGS_werror) endif () install( diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index e06f2dcb..a277328b 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -1,22 +1,31 @@ set(DYAD_MODULE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad.c) -set(DYAD_MODULE_PRIVATE_HEADERS ) -set(DYAD_MODULE_PUBLIC_HEADERS ) +set(DYAD_MODULE_PRIVATE_HEADERS) +set(DYAD_MODULE_PUBLIC_HEADERS) -add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC}) +add_library(${PROJECT_NAME} SHARED ${DYAD_MODULE_SRC} + ${DYAD_MODULE_PRIVATE_HEADERS} ${DYAD_MODULE_PUBLIC_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -target_link_libraries(${PROJECT_NAME} PUBLIC Jansson::Jansson flux::core) +set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") +target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) 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} PUBLIC + $ + $ + $) +target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) +target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME} PUBLIC DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME} PRIVATE DYAD_C_FLAGS_werror) endif () if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") - target_link_libraries(${PROJECT_NAME} PUBLIC perfflowaspect::perfflowaspect) - target_compile_definitions(${PROJECT_NAME} PUBLIC DYAD_PERFFLOW=1) + target_link_libraries(${PROJECT_NAME} PRIVATE perfflowaspect::perfflowaspect) + target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${perfflowaspect_INCLUDE_DIRS}) + target_compile_definitions(${PROJECT_NAME} PRIVATE DYAD_PERFFLOW=1) endif() install( diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index 3a211196..f5da0fad 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -1,24 +1,34 @@ set(DYAD_FSTREAM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_stream_core.cpp) -set(DYAD_FSTREAM_PRIVATE_HEADERS ) +set(DYAD_FSTREAM_PRIVATE_HEADERS) set(DYAD_FSTREAM_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/stream/dyad_stream_api.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/stream/dyad_params.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/stream/dyad_stream_core.hpp) -add_library(${PROJECT_NAME}_fstream SHARED ${DYAD_FSTREAM_SRC} ${DYAD_FSTREAM_PRIVATE_HEADERS} ${DYAD_FSTREAM_PUBLIC_HEADERS}) -target_compile_features(${PROJECT_NAME}_fstream PRIVATE ) -target_link_libraries(${PROJECT_NAME}_fstream PUBLIC ${PROJECT_NAME}_core flux::core) +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}") +target_compile_features(${PROJECT_NAME}_fstream PRIVATE) +target_link_libraries(${PROJECT_NAME}_fstream PRIVATE ${PROJECT_NAME}_core flux::core) if (ENABLE_PERFFLOW) - target_link_libraries(${PROJECT_NAME}_fstream PUBLIC perfflowaspect::perfflowaspect) + target_link_libraries(${PROJECT_NAME}_fstream PRIVATE perfflowaspect::perfflowaspect) + target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${perfflowaspect_INCLUDE_DIRS}) target_compile_definitions(${PROJECT_NAME}_fstream PRIVATE DYAD_PERFFLOW=1) endif (ENABLE_PERFFLOW) target_compile_definitions(${PROJECT_NAME}_fstream PUBLIC DYAD_HAS_CONFIG) -target_include_directories(${PROJECT_NAME}_fstream PUBLIC $) +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 PUBLIC DYAD_CXX_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_fstream PRIVATE DYAD_CXX_FLAGS_werror) endif () diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 4d4bf8f3..7d1e3109 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -4,21 +4,29 @@ set(DYAD_UTILS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/utils.c ${CMAKE_CURRENT_SOURCE_DIR}/read_all.c) set(DYAD_UTILS_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/utils.h ${CMAKE_CURRENT_SOURCE_DIR}/read_all.h) -set(DYAD_UTILS_PUBLIC_HEADERS ) +set(DYAD_UTILS_PUBLIC_HEADERS) set(DYAD_MURMUR3_SRC ${CMAKE_CURRENT_SOURCE_DIR}/murmur3.c) set(DYAD_MURMUR3_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/murmur3.h) -set(DYAD_MURMUR3_PUBLIC_HEADERS ) +set(DYAD_MURMUR3_PUBLIC_HEADERS) -add_library(${PROJECT_NAME}_utils SHARED ${DYAD_UTILS_SRC}) +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}") target_link_libraries(${PROJECT_NAME}_utils PUBLIC flux::core ${PROJECT_NAME}_base64) target_compile_definitions(${PROJECT_NAME}_utils PUBLIC DYAD_HAS_CONFIG) -target_include_directories(${PROJECT_NAME}_utils PUBLIC $) +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}") if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_utils PUBLIC DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_utils PRIVATE DYAD_C_FLAGS_werror) endif () install( diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index 2f7b45c4..b891f756 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -2,7 +2,14 @@ set(DYAD_BASE64_SRC ${CMAKE_CURRENT_SOURCE_DIR}/base64.c) set(DYAD_BASE64_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/base64.h) set(DYAD_BASE64_PUBLIC_HEADERS) -add_library(${PROJECT_NAME}_base64 SHARED ${DYAD_BASE64_SRC}) +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}") +target_include_directories(${PROJECT_NAME}_base64 PUBLIC + $ + $ + $) install( TARGETS ${PROJECT_NAME}_base64 diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index 69b41a61..5ee6ac1d 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -1,24 +1,33 @@ set(DYAD_WRAPPER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/wrapper.c) -set(DYAD_WRAPPER_PRIVATE_HEADERS ) -set(DYAD_WRAPPER_PUBLIC_HEADERS ) +set(DYAD_WRAPPER_PRIVATE_HEADERS) +set(DYAD_WRAPPER_PUBLIC_HEADERS) -add_library(${PROJECT_NAME}_wrapper SHARED ${DYAD_WRAPPER_SRC}) -target_link_libraries(${PROJECT_NAME}_wrapper PUBLIC ${PROJECT_NAME}_core flux::core) +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}") +target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_core flux::core) target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE ${PROJECT_NAME}_utils) 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 PUBLIC + $ + $ + $) +target_include_directories(${PROJECT_NAME}_wrapper SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) if (TARGET DYAD_C_FLAGS_werror) - target_link_libraries(${PROJECT_NAME}_wrapper PUBLIC DYAD_C_FLAGS_werror) + target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE DYAD_C_FLAGS_werror) endif () set(FLUX_BARRIER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/flux_barrier.c) -set(FLUX_BARRIER_PRIVATE_HEADERS ) -set(FLUX_BARRIER_PUBLIC_HEADERS ) +set(FLUX_BARRIER_PRIVATE_HEADERS) +set(FLUX_BARRIER_PUBLIC_HEADERS) add_executable(${PROJECT_NAME}_flux_barrier ${FLUX_BARRIER_SRC}) -target_link_libraries(${PROJECT_NAME}_flux_barrier PUBLIC flux::core) +target_link_libraries(${PROJECT_NAME}_flux_barrier PRIVATE flux::core) +target_include_directories(${PROJECT_NAME}_flux_barrier SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) + install( TARGETS ${PROJECT_NAME}_wrapper EXPORT ${DYAD_EXPORTED_TARGETS} @@ -26,9 +35,11 @@ install( ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} ) + if(NOT "${DYAD_WRAPPER_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${DYAD_WRAPPER_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) endif() + install( TARGETS ${PROJECT_NAME}_flux_barrier EXPORT ${DYAD_EXPORTED_TARGETS} @@ -36,6 +47,7 @@ install( ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR} RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR} ) + if(NOT "${FLUX_BARRIER_PUBLIC_HEADERS}" STREQUAL "") dyad_install_headers("${FLUX_BARRIER_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) endif() From f7859a1a85c8d30aa8dd6e23729f4a1398d0b33f Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 10:16:26 -0800 Subject: [PATCH 09/16] Test: temporarily disable DLIO test, which is broken at the moment --- .github/workflows/compile_test.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index ba7c481f..06439123 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -229,15 +229,15 @@ jobs: make all - name: Test DYAD with DLIO benchmark run: | - mkdir -p $DYAD_PATH - . ${SPACK_DIR}/share/spack/setup-env.sh - export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib - export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH - python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt - echo "Starting flux brokers" - cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark - flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} + #mkdir -p $DYAD_PATH + #. ${SPACK_DIR}/share/spack/setup-env.sh + #export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin + #export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib + #export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH + #python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt + #echo "Starting flux brokers" + #cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark + #flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} - name: Test DYAD with separate FS c run: | mkdir -p $DYAD_PATH From 6506add6e869576d80500566fc7ce7606d23d96e Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 13:13:04 -0800 Subject: [PATCH 10/16] Build: Addressing Hari's comments --- .github/prod-cons/dyad_prod_cons_test.sh | 4 ++++ .github/prod-cons/dyad_producer.sh | 7 ++++--- .github/workflows/compile_test.yaml | 21 ++++++++++++--------- CMakeLists.txt | 9 +++++++-- src/dyad/CMakeLists.txt | 3 +++ src/dyad/core/CMakeLists.txt | 5 ++--- src/dyad/dtl/CMakeLists.txt | 1 - src/dyad/modules/CMakeLists.txt | 1 - src/dyad/stream/CMakeLists.txt | 2 -- src/dyad/utils/CMakeLists.txt | 1 - src/dyad/utils/base64/CMakeLists.txt | 1 - src/dyad/wrapper/CMakeLists.txt | 1 - 12 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/prod-cons/dyad_prod_cons_test.sh b/.github/prod-cons/dyad_prod_cons_test.sh index 7f510573..8edfdee1 100755 --- a/.github/prod-cons/dyad_prod_cons_test.sh +++ b/.github/prod-cons/dyad_prod_cons_test.sh @@ -23,3 +23,7 @@ flux job attach $PROD_PID flux job attach $CONS_PID flux kvs namespace remove ${DYAD_KVS_NAMESPACE} +export DYAD_PATH_CONSUMER=${DYAD_PATH}_consumer +export DYAD_PATH_PRODUCER=${DYAD_PATH}_producer +flux exec -r all flux module remove dyad +flux exec -r all rm -rf ${DYAD_PATH_CONSUMER} ${DYAD_PATH_PRODUCER} diff --git a/.github/prod-cons/dyad_producer.sh b/.github/prod-cons/dyad_producer.sh index 909a5a9b..e136bc4b 100755 --- a/.github/prod-cons/dyad_producer.sh +++ b/.github/prod-cons/dyad_producer.sh @@ -25,6 +25,7 @@ else exit 1 fi -# If this test were to be repeatable, two cleanup steps are needed. -# flux module remove dyad -# remove the files produced after consumer finishes using them +# If this test were to be repeatable, two cleanup steps are needed +# after consumer finishes +# - flux module remove dyad +# - remove the files produced and consumed diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index 06439123..b9c0db6e 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -13,7 +13,7 @@ jobs: matrix: flux: [ 0.52.0, 0.49.0] mode: ["FLUX_RPC", "UCX"] - runs-on: ubuntu-20.04 # Docker-based jobs must run on Ubuntu + runs-on: ubuntu-22.04 # Docker-based jobs must run on Ubuntu env: FLUX_VERSION: ${{ matrix.flux }} SPACK_DIR: "/home/runner/work/spack" @@ -35,6 +35,7 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends \ gcc g++ gfortran \ + cmake \ autoconf \ automake \ libtool \ @@ -211,6 +212,7 @@ jobs: CONFIGURE_FLAGS="-DDYAD_ENABLE_UCX_DATA=ON -DDYAD_PROFILER=NONE" fi TEST_CONF="-DDYAD_LIBDIR_AS_LIB:BOOL=ON -DCMAKE_BUILD_TYPE=Debug" + cmake --version cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} ${TEST_CONF} .. make VERBOSE=1 install -j - name: Install PyDYAD @@ -230,14 +232,15 @@ jobs: - name: Test DYAD with DLIO benchmark run: | #mkdir -p $DYAD_PATH - #. ${SPACK_DIR}/share/spack/setup-env.sh - #export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin - #export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib - #export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH - #python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt - #echo "Starting flux brokers" - #cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark - #flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} + . ${SPACK_DIR}/share/spack/setup-env.sh + export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib + export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH + python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt + python3 -m pip install --force-reinstall dlio_profiler_py + echo "Starting flux brokers" + cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark + flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} - name: Test DYAD with separate FS c run: | mkdir -p $DYAD_PATH diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cb7fb50..be735e25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,7 +101,11 @@ set(DYAD_PROFILER "NONE" CACHE STRING "Profiler to use for DYAD") set_property(CACHE DYAD_PROFILER PROPERTY STRINGS PERFFLOW_ASPECT CALIPER NONE) +#------------------------------------------------------------------------------ +# Compiler setup +#------------------------------------------------------------------------------ include(ExternalProject) +# It requires include(GNUInstallDirs) before if that is needed include(SetupCompiler) #------------------------------------------------------------------------------ @@ -201,8 +205,9 @@ function(dyad_install_headers public_headers current_dir) endfunction() include(DYADUtils) +include_directories(${CMAKE_SOURCE_DIR}/include) # public header add_subdirectory(src/dyad) -cmake_policy(SET CMP0079 NEW) +#cmake_policy(SET CMP0079 NEW) # In case that we need more control over the target building order #----------------------------------------------------------------------------- @@ -259,7 +264,7 @@ write_basic_package_version_file( COMPATIBILITY SameMajorVersion) #........................................... -# There are two different places where cmake config is handled currently. +# TODO: There are two different places where cmake config is handled currently. # Need to clean up and merge if (WIP_package_config) diff --git a/src/dyad/CMakeLists.txt b/src/dyad/CMakeLists.txt index fdc9c380..fb734dc0 100644 --- a/src/dyad/CMakeLists.txt +++ b/src/dyad/CMakeLists.txt @@ -1,6 +1,9 @@ +include_directories(${CMAKE_SOURCE_DIR}/src) # usual source code of the current project + add_subdirectory(utils) add_subdirectory(dtl) add_subdirectory(core) add_subdirectory(modules) add_subdirectory(wrapper) add_subdirectory(stream) + diff --git a/src/dyad/core/CMakeLists.txt b/src/dyad/core/CMakeLists.txt index 6bc65b07..46ce7829 100644 --- a/src/dyad/core/CMakeLists.txt +++ b/src/dyad/core/CMakeLists.txt @@ -11,9 +11,8 @@ target_link_libraries(${PROJECT_NAME}_core PRIVATE ${PROJECT_NAME}_utils ${PROJE 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 target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME}_core SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index 9b34376b..a5ed66fd 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -36,7 +36,6 @@ 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}) diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index a277328b..9ba9547c 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -13,7 +13,6 @@ 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}) diff --git a/src/dyad/stream/CMakeLists.txt b/src/dyad/stream/CMakeLists.txt index f5da0fad..38f5e3ba 100644 --- a/src/dyad/stream/CMakeLists.txt +++ b/src/dyad/stream/CMakeLists.txt @@ -22,8 +22,6 @@ 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}) diff --git a/src/dyad/utils/CMakeLists.txt b/src/dyad/utils/CMakeLists.txt index 7d1e3109..3967aa56 100644 --- a/src/dyad/utils/CMakeLists.txt +++ b/src/dyad/utils/CMakeLists.txt @@ -18,7 +18,6 @@ target_link_libraries(${PROJECT_NAME}_utils PUBLIC flux::core ${PROJECT_NAME}_ba 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}) diff --git a/src/dyad/utils/base64/CMakeLists.txt b/src/dyad/utils/base64/CMakeLists.txt index b891f756..bbfaf5f1 100644 --- a/src/dyad/utils/base64/CMakeLists.txt +++ b/src/dyad/utils/base64/CMakeLists.txt @@ -8,7 +8,6 @@ set_target_properties(${PROJECT_NAME}_base64 PROPERTIES CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") target_include_directories(${PROJECT_NAME}_base64 PUBLIC $ - $ $) install( diff --git a/src/dyad/wrapper/CMakeLists.txt b/src/dyad/wrapper/CMakeLists.txt index 5ee6ac1d..3d933eb3 100644 --- a/src/dyad/wrapper/CMakeLists.txt +++ b/src/dyad/wrapper/CMakeLists.txt @@ -12,7 +12,6 @@ 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}) From 0908a8982385a8d3a572da766a919158a89f0987 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 13:18:34 -0800 Subject: [PATCH 11/16] Build: add dyad_rc.h to the set of private headers with correct path --- src/dyad/dtl/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dyad/dtl/CMakeLists.txt b/src/dyad/dtl/CMakeLists.txt index a5ed66fd..6917b349 100644 --- a/src/dyad/dtl/CMakeLists.txt +++ b/src/dyad/dtl/CMakeLists.txt @@ -1,7 +1,8 @@ # DTL Interface set(DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.c) -set(DTL_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.h) -#set(DTL_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_rc.h) +set(DTL_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dyad_dtl_impl.h + ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_rc.h) +set(DTL_PUBLIC_HEADERS) # Flux implementation for DTL set(FLUX_DTL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/flux_dtl.c) From 2dadccf9098b4dcb3538443db82cdd0b2f63165a Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 13:46:06 -0800 Subject: [PATCH 12/16] Test: CI fix --- .github/workflows/compile_test.yaml | 18 +++++++++++++++++- src/dyad/modules/CMakeLists.txt | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index b9c0db6e..a66144cb 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -13,9 +13,15 @@ jobs: matrix: flux: [ 0.52.0, 0.49.0] mode: ["FLUX_RPC", "UCX"] - runs-on: ubuntu-22.04 # Docker-based jobs must run on Ubuntu + os: [ ubuntu-20.04 ] + compiler: [ gcc ] + gcc: [ 10 ] + name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.gcc }}-${{ matrix.flux }}-${{ matrix.mode }} + runs-on: ${{ matrix.os }} # Docker-based jobs must run on Ubuntu env: FLUX_VERSION: ${{ matrix.flux }} + CC: gcc-${{ matrix.gcc }} + CXX: g++-${{ matrix.gcc }} SPACK_DIR: "/home/runner/work/spack" DYAD_INSTALL_PREFIX: "/home/runner/work/dyad/install" DYAD_KVS_NAMESPACE: "test" @@ -30,6 +36,10 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + with: + version: ${{ matrix.gcc }} - name: Install system deps run: | sudo apt-get update @@ -179,6 +189,12 @@ jobs: - spec: "pkg-config@0.29.1" prefix: /usr EOF + spack compiler find --scope=user + if [[ $CC == 'gcc-10' ]]; then + spack config add "packages:all:compiler:[gcc@10.3.0]" + else + spack config add "packages:all:compiler:[gcc@9.3.0]" + fi spack external find spack spec flux-core@${FLUX_VERSION} if [[ $DYAD_DTL_MODE == 'UCX' ]]; then diff --git a/src/dyad/modules/CMakeLists.txt b/src/dyad/modules/CMakeLists.txt index 9ba9547c..e88ca7f4 100644 --- a/src/dyad/modules/CMakeLists.txt +++ b/src/dyad/modules/CMakeLists.txt @@ -9,6 +9,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") target_link_libraries(${PROJECT_NAME} PRIVATE Jansson::Jansson flux::core) target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_dtl) +target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_utils) target_compile_definitions(${PROJECT_NAME} PUBLIC BUILDING_DYAD=1) target_compile_definitions(${PROJECT_NAME} PUBLIC DYAD_HAS_CONFIG) target_include_directories(${PROJECT_NAME} PUBLIC From 4a28b7c4526ad76a95df3e1fe8b1f199e7153b05 Mon Sep 17 00:00:00 2001 From: Jae-Seung Yeom Date: Sat, 20 Jan 2024 14:02:24 -0800 Subject: [PATCH 13/16] Test: More CI changes for gcc versioning --- .github/workflows/compile_test.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index a66144cb..4bc46d06 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -72,6 +72,10 @@ jobs: run: | . ${SPACK_DIR}/share/spack/setup-env.sh mkdir -p /home/runner/.spack + GCC_VERSION="9.3.0" + if [[ $CC == 'gcc-10' ]]; then + GCC_VERSION="10.3.0" + fi cat > /home/runner/.spack/packages.yaml << 'EOF' packages: all: @@ -188,7 +192,19 @@ jobs: externals: - spec: "pkg-config@0.29.1" prefix: /usr + gcc: + externals: + - spec: gcc@${GCC_VERSION} languages=c,c++ + prefix: /usr + extra_attributes: + compilers: + c: ${CC} + cxx: ${CXX} + buildable: False EOF + echo "-------------------------------" + cat /home/runner/.spack/packages.yaml + echo "-------------------------------" spack compiler find --scope=user if [[ $CC == 'gcc-10' ]]; then spack config add "packages:all:compiler:[gcc@10.3.0]" From 647aa6a27c2986b1fe54442f9aea86c416b360c3 Mon Sep 17 00:00:00 2001 From: Hariharan Devarajan Date: Sat, 20 Jan 2024 14:07:16 -0800 Subject: [PATCH 14/16] Update compile_test.yaml --- .github/workflows/compile_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index 4bc46d06..e796e5da 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -76,7 +76,7 @@ jobs: if [[ $CC == 'gcc-10' ]]; then GCC_VERSION="10.3.0" fi - cat > /home/runner/.spack/packages.yaml << 'EOF' + cat > /home/runner/.spack/packages.yaml < Date: Sat, 20 Jan 2024 14:18:48 -0800 Subject: [PATCH 15/16] Disable DLIO Benchmark --- .github/workflows/compile_test.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index e796e5da..9e26338c 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -264,15 +264,15 @@ jobs: - name: Test DYAD with DLIO benchmark run: | #mkdir -p $DYAD_PATH - . ${SPACK_DIR}/share/spack/setup-env.sh - export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib - export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH - python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt - python3 -m pip install --force-reinstall dlio_profiler_py - echo "Starting flux brokers" - cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark - flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} + #. ${SPACK_DIR}/share/spack/setup-env.sh + #export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin + #export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib + #export PYTHONPATH=${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark:${GITHUB_WORKSPACE}/pydyad:$PYTHONPATH + #python3 -m pip install -r ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark/requirements.txt + #python3 -m pip install --force-reinstall dlio_profiler_py + #echo "Starting flux brokers" + #cd ${GITHUB_WORKSPACE}/tests/integration/dlio_benchmark + #flux start --test-size=2 /bin/bash ./script.sh ${GITHUB_WORKSPACE} ${DYAD_INSTALL_PREFIX} - name: Test DYAD with separate FS c run: | mkdir -p $DYAD_PATH From d37c58dd523604d07ddb35183b336474d803e019 Mon Sep 17 00:00:00 2001 From: Hariharan Devarajan Date: Sat, 20 Jan 2024 14:24:04 -0800 Subject: [PATCH 16/16] Disable Python test --- .github/workflows/compile_test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile_test.yaml b/.github/workflows/compile_test.yaml index 9e26338c..88d771d6 100644 --- a/.github/workflows/compile_test.yaml +++ b/.github/workflows/compile_test.yaml @@ -263,7 +263,7 @@ jobs: make all - name: Test DYAD with DLIO benchmark run: | - #mkdir -p $DYAD_PATH + mkdir -p $DYAD_PATH #. ${SPACK_DIR}/share/spack/setup-env.sh #export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin #export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib @@ -292,9 +292,9 @@ jobs: - name: Test DYAD with separate FS python run: | mkdir -p $DYAD_PATH - . ${SPACK_DIR}/share/spack/setup-env.sh - export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib - echo "Starting flux brokers" - flux start --test-size=2 /bin/bash ${GITHUB_WORKSPACE}/.github/prod-cons/dyad_prod_cons_test.sh "python" + #. ${SPACK_DIR}/share/spack/setup-env.sh + #export PATH=${PATH}:${DYAD_INSTALL_PREFIX}/bin:${DYAD_INSTALL_PREFIX}/sbin + #export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib + #echo "Starting flux brokers" + #flux start --test-size=2 /bin/bash ${GITHUB_WORKSPACE}/.github/prod-cons/dyad_prod_cons_test.sh "python"