Add cbind build and compilation through cmake

cmake
Luca Pepè Sciarria 1 year ago
parent 2efe639a19
commit a8cf53d80e

@ -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} $<TARGET_OBJECTS:amgcbind_C>)
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
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:modules>)
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
)

@ -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()
Loading…
Cancel
Save