# This cmake script will set up boundary-first-flattening (assuming SuiteSparse
# is available), and output its libraries.
#
# This requires the variable BFF_DIR to be set to the directory of the BFF
# repository.
#
# After this script is run, the following CMake variables will be defined:
#  BFF_LIBRARIES - the libraries to be linked to your executable for BFF to work
#  BFF_INCLUDE_DIRS - the BFF header files to include
#

cmake_minimum_required(VERSION 3.10)

set(BFF_LIBRARIES "")

# Compile the BFF library
set(BFF_INCLUDE_DIRS ${SuiteSparse_INCLUDE_DIRS} "${BFF_DIR}/deps/rectangle-bin-pack/include" "${BFF_DIR}/linear-algebra/include" "${BFF_DIR}/mesh/include" "${BFF_DIR}/project/include")
file(GLOB BFF_SOURCES "${BFF_DIR}/deps/rectangle-bin-pack/src/*.cpp" "${BFF_DIR}/linear-algebra/src/*.cpp" "${BFF_DIR}/mesh/src/*.cpp" "${BFF_DIR}/project/src/*.cpp")
add_library(bff ${BFF_SOURCES})
target_include_directories(bff PUBLIC ${BFF_INCLUDE_DIRS})
target_link_libraries(bff ${SuiteSparse_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})

set(BFF_LIBRARIES bff ${SuiteSparse_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})

find_package_message(cBFF "Found BFF: ${BFF_LIBRARIES}" "${BFF_LIBRARIES}")
