Skip to content
Open
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
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-129_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ dependencies:
- imagecodecs>=2021.6.8
- ipython
- lazy-loader>=0.4
- libnvimgcodec-dev>=0.6.0,<0.7.0
- libnvimgcodec>=0.6.0,<0.7.0
- libnvimgcodec-dev==0.7.0
- libnvimgcodec==0.7.0
- libnvjpeg-dev
- matplotlib-base>=3.7
- nbsphinx
- ninja
- numpy>=1.23.4,<3.0
- numpydoc>=1.7
- nvimgcodec>=0.6.0,<0.7.0
- nvimgcodec==0.7.0
- openslide-python>=1.3.0
- pip
- pooch>=1.6.0
Expand Down
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-129_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ dependencies:
- ipython
- lazy-loader>=0.4
- libcufile-dev
- libnvimgcodec-dev>=0.6.0,<0.7.0
- libnvimgcodec>=0.6.0,<0.7.0
- libnvimgcodec-dev==0.7.0
- libnvimgcodec==0.7.0
- libnvjpeg-dev
- matplotlib-base>=3.7
- nbsphinx
- ninja
- numpy>=1.23.4,<3.0
- numpydoc>=1.7
- nvimgcodec>=0.6.0,<0.7.0
- nvimgcodec==0.7.0
- openslide-python>=1.3.0
- pip
- pooch>=1.6.0
Expand Down
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-130_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ dependencies:
- imagecodecs>=2021.6.8
- ipython
- lazy-loader>=0.4
- libnvimgcodec-dev>=0.6.0,<0.7.0
- libnvimgcodec>=0.6.0,<0.7.0
- libnvimgcodec-dev==0.7.0
- libnvimgcodec==0.7.0
- libnvjpeg-dev
- matplotlib-base>=3.7
- nbsphinx
- ninja
- numpy>=1.23.4,<3.0
- numpydoc>=1.7
- nvimgcodec>=0.6.0,<0.7.0
- nvimgcodec==0.7.0
- openslide-python>=1.3.0
- pip
- pooch>=1.6.0
Expand Down
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-130_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ dependencies:
- ipython
- lazy-loader>=0.4
- libcufile-dev
- libnvimgcodec-dev>=0.6.0,<0.7.0
- libnvimgcodec>=0.6.0,<0.7.0
- libnvimgcodec-dev==0.7.0
- libnvimgcodec==0.7.0
- libnvjpeg-dev
- matplotlib-base>=3.7
- nbsphinx
- ninja
- numpy>=1.23.4,<3.0
- numpydoc>=1.7
- nvimgcodec>=0.6.0,<0.7.0
- nvimgcodec==0.7.0
- openslide-python>=1.3.0
- pip
- pooch>=1.6.0
Expand Down
71 changes: 47 additions & 24 deletions cpp/plugins/cucim.kit.cuslide2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ find_package(cucim CONFIG REQUIRED
# Define compile options
################################################################################

if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()

################################################################################
# Add library: cucim
################################################################################
Expand All @@ -152,11 +148,8 @@ message(STATUS "NOTE: No codec libraries needed (libjpeg/libtiff/libdeflate)")
message(STATUS " All decoding handled by nvImageCodec GPU acceleration!")
message(STATUS "=============================================================")

# Add library - PURE nvImageCodec implementation (no CPU fallbacks)
add_library(${CUCIM_PLUGIN_NAME}
# Main plugin interface
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/cuslide.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/cuslide.h
# Core implementation library (linkable by tests/benchmarks).
set(CUSLIDE2_CORE_SOURCES
# TIFF structure management (uses nvImageCodec for parsing)
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/tiff/ifd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/tiff/ifd.h
Expand All @@ -167,11 +160,32 @@ add_library(${CUCIM_PLUGIN_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/nvimgcodec/nvimgcodec_decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/nvimgcodec/nvimgcodec_decoder.h
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/nvimgcodec/nvimgcodec_tiff_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/nvimgcodec/nvimgcodec_tiff_parser.h)
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/nvimgcodec/nvimgcodec_tiff_parser.h
)

add_library(cuslide2_core STATIC ${CUSLIDE2_CORE_SOURCES})
set_target_properties(cuslide2_core PROPERTIES POSITION_INDEPENDENT_CODE ON)

# Plugin entrypoint (runtime-loaded via dlopen or plugin framework).
# This should be a MODULE library (CMake: "plugin").
add_library(${CUCIM_PLUGIN_NAME} MODULE
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/cuslide.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cuslide/cuslide.h
)
target_link_libraries(${CUCIM_PLUGIN_NAME} PRIVATE cuslide2_core)

# No special source file properties needed for pure nvImageCodec implementation

# Compile options
set_target_properties(cuslide2_core
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_compile_features(cuslide2_core PRIVATE cxx_std_17)
target_compile_options(cuslide2_core PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Werror -Wall -Wextra>)

set_target_properties(${CUCIM_PLUGIN_NAME}
PROPERTIES
CXX_STANDARD 17
Expand All @@ -185,8 +199,8 @@ target_compile_features(${CUCIM_PLUGIN_NAME} PRIVATE cxx_std_17)
target_compile_options(${CUCIM_PLUGIN_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Werror -Wall -Wextra>)

# Link libraries
target_link_libraries(${CUCIM_PLUGIN_NAME}
PRIVATE
target_link_libraries(cuslide2_core
PUBLIC
deps::fmt
cucim::cucim
deps::pugixml
Expand All @@ -201,7 +215,12 @@ if(WITH_DYNAMIC_NVIMGCODEC)
message(STATUS "============== Dynamic nvImageCodec Loading ==============")

set(nvimgcodec_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/nvimgcodec_dynlink)
include_directories(AFTER SYSTEM "${nvimgcodec_INCLUDE_DIR}")
# Do NOT use include_directories(): it is directory-scoped and would propagate to all following targets.
# Instead, attach this include path only to the targets that need it.
#
# NOTE: cuslide2 public headers (e.g. tiff/ifd.h) include <nvimgcodec.h>, so this must be PUBLIC so
# both the plugin entrypoint target and any other consumers can compile.
target_include_directories(cuslide2_core SYSTEM PUBLIC "${nvimgcodec_INCLUDE_DIR}")


# Use pre-generated stubs (faster builds, no Python clang dependency)
Expand All @@ -221,8 +240,8 @@ if(WITH_DYNAMIC_NVIMGCODEC)
target_link_libraries(nvimgcodec_dynlink PRIVATE ${CMAKE_DL_LIBS})

# Link cuslide2 against dynlink wrapper (instead of libnvimgcodec.so)
target_link_libraries(${CUCIM_PLUGIN_NAME} PRIVATE nvimgcodec_dynlink)
target_compile_definitions(${CUCIM_PLUGIN_NAME} PRIVATE CUCIM_HAS_NVIMGCODEC WITH_DYNAMIC_NVIMGCODEC)
target_link_libraries(cuslide2_core PUBLIC nvimgcodec_dynlink)
target_compile_definitions(cuslide2_core PUBLIC CUCIM_HAS_NVIMGCODEC WITH_DYNAMIC_NVIMGCODEC)

# Set rpath for runtime library search
foreach(rpath IN ITEMS
Expand All @@ -242,29 +261,36 @@ if(WITH_DYNAMIC_NVIMGCODEC)
else()
# Static linking: link directly against nvImageCodec (build-time dependency)
if(TARGET deps::nvimgcodec)
target_link_libraries(${CUCIM_PLUGIN_NAME} PRIVATE deps::nvimgcodec)
target_compile_definitions(${CUCIM_PLUGIN_NAME} PRIVATE CUCIM_HAS_NVIMGCODEC)
target_link_libraries(cuslide2_core PUBLIC deps::nvimgcodec)
target_compile_definitions(cuslide2_core PUBLIC CUCIM_HAS_NVIMGCODEC)
message(STATUS "✓ nvImageCodec enabled (static linking) - GPU-accelerated decoding available")
else()
message(STATUS "⚠ nvImageCodec target not found - GPU acceleration disabled")
endif()
endif()
if (TARGET CUDA::nvjpeg_static)
target_link_libraries(${CUCIM_PLUGIN_NAME}
PRIVATE
target_link_libraries(cuslide2_core
PUBLIC
CUDA::nvjpeg_static
# culibos provides OS abstraction functions needed by nvjpeg_static
CUDA::culibos
CUDA::cudart
)
else()
target_link_libraries(${CUCIM_PLUGIN_NAME}
PRIVATE
target_link_libraries(cuslide2_core
PUBLIC
CUDA::nvjpeg
CUDA::cudart
)
endif()

target_include_directories(cuslide2_core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../cucim.kit.cuslide/src
${CMAKE_CURRENT_SOURCE_DIR}/src # Include cuslide2 src for nvimgcodec headers
${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_include_directories(${CUCIM_PLUGIN_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down Expand Up @@ -317,7 +343,6 @@ install(TARGETS ${INSTALL_TARGETS}
COMPONENT ${CUCIM_PLUGIN_NAME}_Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${CUCIM_PLUGIN_NAME}_Runtime
NAMELINK_COMPONENT ${CUCIM_PLUGIN_NAME}_Development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${CUCIM_PLUGIN_NAME}_Development
)
Expand Down Expand Up @@ -356,5 +381,3 @@ set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
export(PACKAGE ${CUCIM_PLUGIN_NAME})

# REMOVED: endif() - no longer needed since we removed the if(TRUE) wrapper

unset(BUILD_SHARED_LIBS CACHE)
Loading