Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions algo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ if (ICEBUG_ENABLED)
${ICEBUG_LIB}
Arrow::arrow_shared
OpenMP::OpenMP_CXX)
if (WIN32 AND ICEBUG_STATE_LIB)
# The static networkit.lib imports the GlobalState singleton from networkit_state.dll;
# link its import lib so the __imp_GlobalState::* thunks resolve.
target_link_libraries(${_algo_target} PRIVATE ${ICEBUG_STATE_LIB})
# Deploy the DLL next to the built extension so those imports resolve at load time.
add_custom_command(TARGET ${_algo_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${ICEBUG_STATE_DLL}"
"$<TARGET_FILE_DIR:${_algo_target}>")
endif ()
# Let the loaded extension find a shared libnetworkit (prebuilt path); harmless for a static lib.
set_target_properties(${_algo_target} PROPERTIES
BUILD_RPATH "${ICEBUG_RPATH_DIR}"
Expand Down
16 changes: 16 additions & 0 deletions algo/cmake/download_icebug.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ if (DEFINED ICEBUG_SOURCE_DIR)
"${ICEBUG_SOURCE_DIR}/extlibs/ttmath")
find_library(ICEBUG_LIB networkit PATHS "${ICEBUG_SOURCE_DIR}/build" NO_DEFAULT_PATH REQUIRED)
get_filename_component(ICEBUG_RPATH_DIR "${ICEBUG_LIB}" DIRECTORY)
if (WIN32)
# See the prebuilt branch below: on Windows the GlobalState singleton is a separate
# DLL + import lib that the static networkit.lib imports via dllimport thunks.
find_library(ICEBUG_STATE_LIB networkit_state PATHS "${ICEBUG_SOURCE_DIR}/build" NO_DEFAULT_PATH REQUIRED)
set(ICEBUG_STATE_DLL "${ICEBUG_SOURCE_DIR}/build/networkit_state.dll")
endif ()
return()
endif ()

Expand Down Expand Up @@ -85,4 +91,14 @@ endif ()
set(ICEBUG_INCLUDE_DIR "${ICEBUG_VENDOR_DIR}/include")
set(ICEBUG_RPATH_DIR "${ICEBUG_VENDOR_DIR}/lib")
find_library(ICEBUG_LIB networkit PATHS "${ICEBUG_VENDOR_DIR}/lib" NO_DEFAULT_PATH REQUIRED)
if (WIN32)
# The vendored Windows artifact splits NetworKit into a large static lib (networkit.lib)
# plus a separate DLL + import lib for the GlobalState singleton (networkit_state). The
# static lib's members (Log.cpp.obj etc.) reference the GlobalState accessors via
# __imp_* dllimport thunks, so consumers must ALSO link the import lib and deploy the DLL
# next to the loaded extension.
find_library(ICEBUG_STATE_LIB networkit_state PATHS "${ICEBUG_VENDOR_DIR}/lib/networkit" NO_DEFAULT_PATH REQUIRED)
set(ICEBUG_STATE_DLL "${ICEBUG_VENDOR_DIR}/lib/networkit/networkit_state.dll")
message(STATUS "icebug state lib: ${ICEBUG_STATE_LIB}")
endif ()
message(STATUS "icebug: ${ICEBUG_LIB}")
Loading