Skip to content

Commit

Permalink
dependency management enhancements.
Browse files Browse the repository at this point in the history
  • Loading branch information
shahmoradi committed Apr 21, 2024
1 parent aa203b6 commit f10f4f8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,12 @@ if (TRUE)
endif()

if (${csid_is_gnu} OR ${csid_is_intel})
#set(CMAKE_C_FLAGS_INIT "" FORCE)
#set(CMAKE_C_FLAGS_DEBUG_INIT "" FORCE)
#set(CMAKE_C_FLAGS_RELEASE_INIT "" FORCE)
#set(CMAKE_CXX_FLAGS_INIT "" FORCE)
#set(CMAKE_CXX_FLAGS_DEBUG_INIT "" FORCE)
#set(CMAKE_CXX_FLAGS_RELEASE_INIT "" FORCE)
#set(CMAKE_C_FLAGS_INIT "")
#set(CMAKE_C_FLAGS_DEBUG_INIT "")
#set(CMAKE_C_FLAGS_RELEASE_INIT "")
#set(CMAKE_CXX_FLAGS_INIT "")
#set(CMAKE_CXX_FLAGS_DEBUG_INIT "")
#set(CMAKE_CXX_FLAGS_RELEASE_INIT "")
set(CMAKE_Fortran_FLAGS "")
set(CMAKE_Fortran_FLAGS_DEBUG "")
set(CMAKE_Fortran_FLAGS_RELEASE "")
Expand Down
2 changes: 1 addition & 1 deletion cmake/setParaMonteCollection.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ if (EXISTS "${origin}")
string(CONCAT
collection_cmakelists_contents
"${collection_cmakelists_contents}"
"add_custom_target(run COMMAND \"${bincmd}\" DEPENDS binary WORKING_DIRECTORY \"\$\{CMAKE_CURRENT_SOURCE_DIR\}\")\n"
"add_custom_target(run COMMAND ${bincmd} DEPENDS binary WORKING_DIRECTORY \"\$\{CMAKE_CURRENT_SOURCE_DIR\}\")\n"
)
set(collection_cmakelists_bash_name "build.sh") # cmake.sh
set(collection_cmakelists_batch_name "build.bat") # cmake.bat
Expand Down
41 changes: 38 additions & 3 deletions src/fortran/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -970,14 +970,47 @@ set_source_files_properties("${paramonte_src_main_c_paths}" PROPERTIES COMPILE_D
install(TARGETS "${libname}"
CONFIGURATIONS "${CMAKE_BUILD_TYPE}"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
RUNTIME_DEPENDENCY_SET pmdeps
)
#install(RUNTIME_DEPENDENCY_SET pmdeps
# DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
# )

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Recipe for installing the runtime dependencies.
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if (DLL_ENABLED AND DEPS_ENABLED)
install(CODE [[
####
#### For intel compilers, we take an aggressive approach to find the dependencies
#### as several libraries in the Intel OneAPI collection do not link statically.
####
if ("${CMAKE_INSTALL_PREFIX}" MATCHES ".*[Ii][Nn][Tt][Ee][Ll].*")
execute_process(COMMAND which ifx OUTPUT_VARIABLE ifcpath)
string(REGEX REPLACE "\n$" "" ifcpath "${ifcpath}")
if (IS_DIRECTORY "${ifcpath}" OR NOT EXISTS "${ifcpath}")
execute_process(COMMAND which ifx OUTPUT_VARIABLE ifcpath)
string(REGEX REPLACE "\n$" "" ifcpath "${ifcpath}")
if (IS_DIRECTORY "${ifcpath}" OR NOT EXISTS "${ifcpath}")
unset(ifcpath)
endif()
endif()
endif()
set(ilibdir ".")
if (DEFINED ifcpath)
get_filename_component(ilibdir "${ifcpath}" DIRECTORY)
get_filename_component(ilibdir "${ilibdir}" DIRECTORY)
set(ilibdir "${ilibdir}/lib")
if (NOT IS_DIRECTORY "${ilibdir}")
message(NOTICE "${pmwarn} Failed to find the Intel compilers library path from: ${ifcpath}")
message(NOTICE "${pmwarn} The expected Intel compilers library path is: ${ilibdir}")
set(ilibdir ".")
endif()
endif()
####
#### Now recursively find dependencies.
####
function(install_library_with_deps LIBRARY)
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
Expand All @@ -989,26 +1022,28 @@ if (DLL_ENABLED AND DEPS_ENABLED)
LIBRARIES ${LIBRARY}
RESOLVED_DEPENDENCIES_VAR resolved_deps
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
DIRECTORIES "${ilibdir}"
)
foreach(FILE ${resolved_deps})
if(NOT IS_SYMLINK ${FILE})
install_library_with_deps(${FILE})
endif()
endforeach()
foreach(FILE ${unresolved_deps})
message(STATUS "Unresolved from ${LIBRARY}: ${FILE}")
message(NOTICE "${pmwarn} Unresolved dependency from ${LIBRARY}: ${FILE}")
endforeach()
endfunction()
file(GET_RUNTIME_DEPENDENCIES
LIBRARIES $<TARGET_SONAME_FILE:libparamonte>
RESOLVED_DEPENDENCIES_VAR resolved_deps
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
RESOLVED_DEPENDENCIES_VAR resolved_deps
DIRECTORIES "${ilibdir}"
)
foreach(FILE ${resolved_deps})
install_library_with_deps(${FILE})
endforeach()
foreach(FILE ${unresolved_deps})
message(STATUS "Unresolved: ${FILE}")
message(NOTICE "${pmwarn} Unresolved dependency: ${FILE}")
endforeach()
]])
endif()
Expand Down

0 comments on commit f10f4f8

Please sign in to comment.