Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes the build system to CMake #56

Merged
merged 24 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f697f49
Initial work on converting DYAD from autotools to CMake
ilumsden Nov 12, 2023
8adab39
Updates compile_test.yaml to use CMake instead of Autotools
ilumsden Nov 20, 2023
51194ce
Typo fix
ilumsden Nov 20, 2023
25504e5
Removes "VERSION" from find_package since it's not actually correct
ilumsden Nov 20, 2023
a563f9f
refactored and initial changes to build.
hariharan-devarajan Nov 23, 2023
d166da2
fixes for installation.
hariharan-devarajan Nov 23, 2023
ef5b3e8
fixed streaming apis.
hariharan-devarajan Nov 23, 2023
b77a3b5
fixed installation script.
hariharan-devarajan Nov 23, 2023
987ffd2
fixed CI
hariharan-devarajan Nov 23, 2023
f8bb92e
fixed CI
hariharan-devarajan Nov 23, 2023
b9a5311
fix ucx compile
hariharan-devarajan Nov 23, 2023
06da6ea
fix ci
hariharan-devarajan Nov 23, 2023
1619e2f
separate setup of spack
hariharan-devarajan Dec 1, 2023
7603a03
fix comments
hariharan-devarajan Dec 1, 2023
d0f63d3
fixed spack script
hariharan-devarajan Dec 1, 2023
e373223
fixed python
hariharan-devarajan Dec 1, 2023
46a6179
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
7349c59
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
179e18d
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
c7d739c
Changes to public header and libnames
hariharan-devarajan Dec 15, 2023
6c8b5f5
remove variables which prevent cmakr_install.cmake to use CMAKE_INSTA…
hariharan-devarajan Jan 16, 2024
3fa60de
Merge branch 'main' of github.com:flux-framework/dyad into cmake_refa…
hariharan-devarajan Jan 16, 2024
069b01f
fixed typo
hariharan-devarajan Jan 17, 2024
e0b5d6a
changed c99 to c11
hariharan-devarajan Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/prod-cons/dyad_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export DYAD_PATH_CONSUMER=${DYAD_PATH}_consumer
mkdir -p ${DYAD_PATH_CONSUMER}

if [[ "$mode" == "${valid_modes[0]}" ]]; then
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/dyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_cons 10 $DYAD_PATH_CONSUMER
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/libdyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_cons 10 $DYAD_PATH_CONSUMER
elif [[ "$mode" == "${valid_modes[1]}" ]]; then
${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_cons 10 $DYAD_PATH_CONSUMER
elif [[ "$mode" == "${valid_modes[2]}" ]]; then
python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_CONSUMER 10 50
else
echo "Invalid test mode: $mode"
echo "Invalid cons test mode: $mode"
exit 1
fi
8 changes: 4 additions & 4 deletions .github/prod-cons/dyad_producer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ flux module load ${DYAD_INSTALL_PREFIX}/lib/dyad.so $DYAD_PATH_PRODUCER $DYAD_D

if [[ "$mode" == "${valid_modes[0]}" ]]; then
echo ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/dyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${test_modes[1]}" ]]; then
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/libdyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${valid_modes[1]}" ]]; then
echo ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_prod 10 $DYAD_PATH_PRODUCER
${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${test_modes[2]}" ]]; then
elif [[ "$mode" == "${valid_modes[2]}" ]]; then
echo python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_PRODUCER 10 50
python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_PRODUCER 10 50
else
echo "Invalid test mode: $mode"
echo "Invalid prod test mode: $mode"
exit 1
fi
5 changes: 3 additions & 2 deletions .github/prod-cons/prod_cons_argparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if test "$#" -ne 1; then
fi

mode="$1"

echo "Need mode: $mode"
valid_modes=("c" "cpp" "python")
mode_is_valid=0
for vm in "${valid_modes[@]}"; do
Expand All @@ -18,8 +18,9 @@ for vm in "${valid_modes[@]}"; do
mode_is_valid=0
fi
done
echo "Need valid_modes: $mode_is_valid"

if [[ $mode_is_valid -eq 0 ]]; then
echo "Invalid mode: $mode"
echo "Invalid arg mode: $mode"
exit 2
fi
17 changes: 8 additions & 9 deletions .github/workflows/compile_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
flux: [ 0.52.0, 0.49.0]
mode: ["FLUX_RPC", "UCX"]
test_mode: ["c", "cpp", "python"]
test_mode: ["c", "cpp"] #, "python"]
runs-on: ubuntu-20.04 # Docker-based jobs must run on Ubuntu
env:
FLUX_VERSION: ${{ matrix.flux }}
Expand Down Expand Up @@ -204,16 +204,14 @@ jobs:
cd ${GITHUB_WORKSPACE}
ls
pwd
./autogen.sh
CONFIGURE_FLAGS=""
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"
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
CONFIGURE_FLAGS=" --enable-ucx "
CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=UCX -DDYAD_PROFILER=NONE"
fi
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DYAD_INSTALL_PREFIX}/lib/pkgconfig
./configure --enable-dyad-debug ${CONFIGURE_FLAGS} --prefix=${DYAD_INSTALL_PREFIX} \
CFLAGS="-I${DYAD_INSTALL_PREFIX}/include" \
CXXFLAGS="-I${DYAD_INSTALL_PREFIX}/include" \
LDFLAGS="-L${DYAD_INSTALL_PREFIX}/lib"
cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} -DENABLE_DYAD_DEBUG=ON ..
make install -j
- name: Install PyDYAD
if: ${{ matrix.test_mode == 'python' }}
Expand All @@ -225,6 +223,7 @@ jobs:
if: ${{ matrix.test_mode == 'c' || matrix.test_mode == 'cpp' }}
run: |
. ${SPACK_DIR}/share/spack/setup-env.sh
export LD_LIBRARY_PATH=${DYAD_INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}
export CFLAGS="-I${DYAD_INSTALL_PREFIX}/include"
export CXXFLAGS="-I${DYAD_INSTALL_PREFIX}/include"
export LDFLAGS="-L${DYAD_INSTALL_PREFIX}/lib"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ flux_barrier
**/__pycache__/
**/build
**/*.egg-info
/install/
/dyad-env/
11 changes: 11 additions & 0 deletions CMake/dyad-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#-----------------------------------------------------------------------------
# Version file for install directory
#-----------------------------------------------------------------------------
set(PACKAGE_VERSION @DYAD_PACKAGE_VERSION@)

if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @DYAD_VERSION_MAJOR@)
set(PACKAGE_VERSION_COMPATIBLE 1)
if ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @DYAD_VERSION_PATCH@)
set(PACKAGE_VERSION_EXACT 1)
endif ()
endif ()
18 changes: 18 additions & 0 deletions CMake/dyad-config.cmake.build.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set(DYAD_FOUND TRUE)

# Include directories
set(DYAD_INCLUDE_DIRS "@CMAKE_INCLUDE_OUTPUT_DIRECTORY@")
if (NOT IS_DIRECTORY "${DYAD_INCLUDE_DIRS}")
set(DYAD_FOUND FALSE)
endif ()
#message(STATUS "DYAD_INCLUDE_DIRS: " ${DYAD_INCLUDE_DIRS})
get_filename_component(DYAD_ROOT_DIR ${DYAD_INCLUDE_DIRS}/.. ABSOLUTE)
#message(STATUS "DYAD_ROOT_DIR: " ${DYAD_ROOT_DIR})
set(DYAD_LIBRARY_PATH "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
#message(STATUS "DYAD_LIBRARY_PATH: " ${DYAD_LIBRARY_PATH})
link_directories(${DYAD_LIBRARY_PATH})
set(DYAD_LIBRARIES dlio-profiler)
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
set(DYAD_DEFINITIONS "")
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dlio-profiler
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
REQUIRED_VARS DYAD_FOUND DYAD_INCLUDE_DIRS DYAD_LIBRARY_PATH DYAD_LIBRARIES)
17 changes: 17 additions & 0 deletions CMake/dyad-config.cmake.install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(DYAD_FOUND TRUE)

# Include directories
set(DYAD_INCLUDE_DIRS "@DYAD_INSTALL_INCLUDE_DIR@")
if (NOT IS_DIRECTORY "${DYAD_INCLUDE_DIRS}")
set(DYAD_FOUND FALSE)
endif ()
#message(STATUS "DYAD_INCLUDE_DIRS: " ${DYAD_INCLUDE_DIRS})
get_filename_component(DYAD_ROOT_DIR ${DYAD_INCLUDE_DIRS}/.. ABSOLUTE)
#message(STATUS "DYAD_ROOT_DIR: " ${DYAD_ROOT_DIR})
set(DYAD_LIBRARY_PATH "@DYAD_INSTALL_LIB_DIR@")
link_directories(${DYAD_LIBRARY_PATH})
set(DYAD_LIBRARIES dlio-profiler)
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
set(DYAD_DEFINITIONS "")
Copy link
Collaborator

@hariharan-devarajan hariharan-devarajan Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add alias.
set(DYAD_DEFINITIONS "")
add_library(dyad INTERFACE)
add_library(dyad::dyad ALIAS dyad)
target_include_directories(dyad INTERFACE ${DYAD_INCLUDE_DIRS})
target_link_libraries(dyad INTERFACE ${DYAD_LIBRARIES})
target_compile_options(dyad INTERFACE ${DYAD_DEFINITIONS})

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXED

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dlio-profiler
REQUIRED_VARS DYAD_FOUND DYAD_INCLUDE_DIRS DYAD_LIBRARIES)
231 changes: 231 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
cmake_minimum_required(VERSION 2.8.12)
#------------------------------------------------------------------------------
# Version information
#------------------------------------------------------------------------------

set(DYAD_VERSION_MAJOR "0")
set(DYAD_VERSION_MINOR "2")
set(DYAD_VERSION_PATCH "0")
set(DYAD_PACKAGE ${PROJECT_NAME})
set(DYAD_PACKAGE_NAME ${PROJECT_NAME})
set(DYAD_PACKAGE_VERSION "${DYAD_VERSION_MAJOR}.${DYAD_VERSION_MINOR}.${DYAD_VERSION_PATCH}")
set(DYAD_PACKAGE_VERSION_MAJOR "${DYAD_VERSION_MAJOR}.${DYAD_VERSION_MINOR}")
set(DYAD_PACKAGE_VERSION_MINOR "${DYAD_VERSION_PATCH}")
set(DYAD_PACKAGE_STRING "${DYAD_PACKAGE_NAME} ${DYAD_PACKAGE_VERSION}")
set(DYAD_PACKAGE_TARNAME "${DYAD_PACKAGE}")

project(dyad LANGUAGES C CXX)
#------------------------------------------------------------------------------
# Internal Includes for header and libraries
#------------------------------------------------------------------------------
link_directories(${CMAKE_BINARY_DIR}/lib)
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)

if (NOT DYAD_INSTALL_BIN_DIR)
set(DYAD_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
message("-- " "[${PROJECT_NAME}] DYAD_INSTALL_BIN_DIR " ${DYAD_INSTALL_BIN_DIR})
endif ()
if (NOT DYAD_INSTALL_LIB_DIR)
set(DYAD_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
message("-- " "[${PROJECT_NAME}] DYAD_INSTALL_LIB_DIR " ${DYAD_INSTALL_LIB_DIR})
endif ()
if (NOT DYAD_INSTALL_INCLUDE_DIR)
set(DYAD_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
message("-- " "[${PROJECT_NAME}] DYAD_INSTALL_INCLUDE_DIR " ${DYAD_INSTALL_INCLUDE_DIR})
endif ()
if (NOT DYAD_INSTALL_DATA_DIR)
set(DYAD_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share)
message("-- " "[${PROJECT_NAME}] DYAD_INSTALL_DATA_DIR " ${DYAD_INSTALL_DATA_DIR})
endif ()

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.")
endif ()
#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
# by other projects.
#-----------------------------------------------------------------------------
if (NOT DYAD_EXPORTED_TARGETS)
set(DYAD_EXPORTED_TARGETS "dyad-targets")
endif ()
#------------------------------------------------------------------------------
# Build options
#------------------------------------------------------------------------------
# option(ENABLE_DYAD_DEBUG "Include debugging prints and logging" OFF) # This is not needed as we have CMAKE_BUILD_TYPE
# This is verbose, maybe an alternate might help simplify
#option(BUILD_URPC "Build DYAD's URPC code" OFF)
#option(ENABLE_PERFFLOW "Build with PerfFlow Aspect support" OFF)
#option(ENABLE_UCX_DTL "Build DYAD's UCX data transport layer" OFF)

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)
set(DYAD_PROFILER "NONE" CACHE STRING "Protocol to use for DYAD's Data Plane")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description of the option is irrelevant.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

set_property(CACHE DYAD_PROFILER PROPERTY STRINGS PERFFLOW_ASPECT CALIPER NONE)

#------------------------------------------------------------------------------
# Build Type based configurations
#------------------------------------------------------------------------------
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -std=c99)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just use the consistent standard with c++

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i switch the code to c++ we can move that right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXED

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++11)
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
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)
endif()
#------------------------------------------------------------------------------
# Disallow in-source build
#------------------------------------------------------------------------------
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR
"${PROJECT_NAME} requires an out of source Build. "
"Please create a separate binary directory and run CMake there.")
endif ()
#------------------------------------------------------------------------------
# Set a default build type if none was specified
#------------------------------------------------------------------------------
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif ()
#------------------------------------------------------------------------------
# Dependencies
#------------------------------------------------------------------------------
set(DEPENDENCY_LIB "")
# Required Dependencies
# =============================================================================
# Import pkg-config for finding FluxCore
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 ()

# Optional Dependencies
# =============================================================================
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 ()
endif()
if(DYAD_DATA_PLANE STREQUAL "UCX")
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 ()
endif()

function(dyad_install_headers public_headers current_dir)
message("-- [${PROJECT_NAME}] " "installing headers ${public_headers}")
foreach (header ${public_headers})
file(RELATIVE_PATH header_file_path "${PROJECT_SOURCE_DIR}/src" "${header}")
message("-- [${PROJECT_NAME}] " "installing header ${header_file_path}")
get_filename_component(header_directory_path "${header_file_path}" DIRECTORY)
install(
FILES ${header}
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/${header_directory_path}"
)
file(COPY ${header}
DESTINATION "${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/${header_directory_path}")
endforeach ()
endfunction()

add_subdirectory(src/dyad)

#-----------------------------------------------------------------------------
# Configure the config.cmake file for the build directory
#-----------------------------------------------------------------------------
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.build.in
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake @ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config.cmake.install.in
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake @ONLY
)
install(
FILES
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/install/${PROJECT_NAME}-config.cmake
DESTINATION
${DYAD_INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}
)
#-----------------------------------------------------------------------------
# Configure the ${PROJECT_NAME}-config-version .cmake file for the install directory
#-----------------------------------------------------------------------------
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}-config-version.cmake.in
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake @ONLY
)

install(
FILES
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake
DESTINATION
${DYAD_INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}
)

export(EXPORT ${DYAD_EXPORTED_TARGETS}
FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake")

install(EXPORT
${DYAD_EXPORTED_TARGETS}
DESTINATION
${DYAD_INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}
FILE
${DYAD_EXPORTED_TARGETS}.cmake
)
Loading