# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT

# Subdirectory load order here is carefully balanced - see usage from the root
# CMakeLists.txt. Notably this file does *not* include the sysdeps subdirectory,
# which is expected to be included *first*. This allows for bootstrapping
# compiler/, so other projects in this directory can use the amd-llvm compiler
# toolchain if they so wish (most should eventually).

add_custom_target(therock-third-party)

# googletest is declared before compiler/ (see the root CMakeLists.txt); attach
# it to the aggregate here, where therock-third-party exists.
add_dependencies(therock-third-party therock-googletest)

# No-dep third party libraries (alphabetical)
add_subdirectory(Catch2)
add_subdirectory(eigen)
add_subdirectory(fftw3)
add_subdirectory(flatbuffers)
add_subdirectory(fmt)
add_subdirectory(FunctionalPlus)
add_subdirectory(libdivide)
add_subdirectory(msgpack-cxx)
add_subdirectory(nlohmann-json)
add_subdirectory(simde)
add_subdirectory(yaml-cpp)

# frugally-deep depends on eigen, FunctionalPlus and nlohmann-json
add_subdirectory(frugally-deep)

# spdlog depends on fmt and amd-llvm toolchain.
if(THEROCK_ENABLE_SPDLOG)
  add_subdirectory(spdlog)
endif()

# elfio depends on amd-llvm toolchain.
if(THEROCK_ENABLE_ELFIO)
  add_subdirectory(elfio)
endif()

# Host math libraries.
if(THEROCK_ENABLE_HOST_BLAS)
  add_subdirectory(host-blas)
endif()
if(THEROCK_ENABLE_HOST_SUITE_SPARSE)
  add_subdirectory(SuiteSparse)
endif()

# OpenMPI implementation of MPI
if(THEROCK_ENABLE_MPI)
  add_subdirectory(openmpi)
endif()

# gRPC: Static library for RDC (built on-demand when depended upon)
# See: docs/rfcs/RFC0007-rdc-therock-integration.md
add_subdirectory(grpc)
