From a8cf53d80edac469488352291a4cc7490b711b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20Pep=C3=A8=20Sciarria?= Date: Mon, 24 Feb 2025 16:19:26 +0100 Subject: [PATCH] Add cbind build and compilation through cmake --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++++- cbind/CMakeLists.txt | 30 +++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 cbind/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ffbcdc2..6697500d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,8 +147,58 @@ target_link_libraries(amgprec + + + +include(${CMAKE_CURRENT_LIST_DIR}/cbind/CMakeLists.txt) # include amgprec_source_files and amgprec_source_C_files source files + + +foreach(path IN LISTS amgcbind_header_C_files) + # Copy the header file to the include directory + file(COPY "${path}" DESTINATION "${CMAKE_BINARY_DIR}/include") +endforeach() + + +add_library(amgcbind_C OBJECT ${amgprec_source_C_files}) + +target_link_libraries(amgcbind_C + #PUBLIC ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES} ${LAPACK95_LIBRARIES} + #PUBLIC ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES} ${BLAS95_LIBRARIES} + psblas::util psblas::linsolve psblas::prec psblas::ext psblas::cbind psblas::base) #TODO check actual libraries needed + +add_library(amgcbind ${amgprec_source_files} $) + +set_target_properties(amgcbind + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/modules" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME psb_amgcbind + LINKER_LANGUAGE Fortran + ) + +target_include_directories(amgcbind PUBLIC + $ + $) + +message(STATUS "include dir := ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}") + +#target_include_directories(base PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY}) + +target_include_directories(amgcbind PUBLIC ${INCDIR} ${MODDIR}) +target_link_libraries(amgcbind + #PUBLIC ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES} ${LAPACK95_LIBRARIES} + #PUBLIC ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES} ${BLAS95_LIBRARIES} + PUBLIC amgprec psblas::util psblas::linsolve psblas::prec psblas::ext psblas::cbind psblas::base) #TODO check actual libraries needed + + + + + + + + # Install the library -install(TARGETS amgprec +install(TARGETS amgprec amgcbind DESTINATION lib ) diff --git a/cbind/CMakeLists.txt b/cbind/CMakeLists.txt new file mode 100644 index 00000000..8f45dddc --- /dev/null +++ b/cbind/CMakeLists.txt @@ -0,0 +1,30 @@ +set(AMG_amgcbind_source_files + amgprec/amg_zprec_cbind_mod.F90 + amgprec/amg_prec_cbind_mod.F90 + amgprec/amg_dprec_cbind_mod.F90 +) +foreach(file IN LISTS AMG_amgcbind_source_files) + list(APPEND amgcbind_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() + +set(AMG_amgcbind_source_C_files + amgprec/amg_c_zprec.c + amgprec/amg_c_dprec.c +) + + +foreach(file IN LISTS AMG_amgcbind_source_C_files) + list(APPEND amgcbind_source_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() + +set(AMG_amgcbind_header_C_files + amgprec/amg_const.h + amgprec/amg_c_dprec.h + amgprec/amg_cbind.h + amgprec/amg_c_zprec.h +) + + +foreach(file IN LISTS AMG_amgcbind_header_C_files) + list(APPEND amgcbind_header_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach()