Skip to content

Commit

Permalink
fix: refactored linking and fixed validation
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Leprince <[email protected]>
  • Loading branch information
pleprince committed Apr 4, 2024
1 parent 2ad98fe commit f2bdfde
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
1 change: 1 addition & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ if(OPENEXR_INSTALL_PKG_CONFIG)
function(openexr_pkg_config_help pcinfile)
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
set(LIB_SUFFIX_DASH ${OPENEXR_LIB_SUFFIX}${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX})
set(LIB_BUILD_SUFFIX ${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX})
if(OPENEXR_ENABLE_THREADING AND TARGET Threads::Threads)
# hrm, can't use properties as they end up as generator expressions
# which don't seem to evaluate
Expand Down
11 changes: 3 additions & 8 deletions cmake/LibraryDefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,14 @@ function(OPENEXR_DEFINE_LIBRARY libname)
message(STATUS "Blosc2: setting up for ${objlib}...")
message(STATUS ">> BLOSC2_INCLUDE_DIRS: ${BLOSC2_INCLUDE_DIRS}")
message(STATUS ">> BLOSC2_LIB_DIR: ${BLOSC2_LIB_DIR}")
message(STATUS ">> BLOSC2_LIB_NAME: ${BLOSC2_LIB_NAME}")
target_include_directories(${objlib} PRIVATE ${BLOSC2_INCLUDE_DIRS})
target_link_directories(${objlib} PRIVATE ${BLOSC2_LIB_DIR})
if(BUILD_SHARED_LIBS)
target_link_libraries(${objlib} PRIVATE "dl" ${BLOSC2_LIB_NAME}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>)
else()
target_link_libraries(${objlib} PUBLIC Blosc2::blosc2_static)
endif()
if(TARGET blosc2_static)
target_link_libraries(${objlib} PRIVATE Blosc2::blosc2_static "dl")
# install the static library if not using the installed lib.
if(TARGET blosc2_static AND NOT Blosc2_FOUND)
install(TARGETS blosc2_static EXPORT ${objlib})
endif()
endif()


if(OPENEXR_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS)
target_compile_definitions(${objlib} PRIVATE ${OPENEXR_CURLIB_PRIV_EXPORT})
Expand Down
3 changes: 2 additions & 1 deletion cmake/OpenEXR.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ libdir=@PKG_CONFIG_INSTALL_LIBDIR@
includedir=@PKG_CONFIG_INSTALL_INCLUDEDIR@
OpenEXR_includedir=${includedir}/OpenEXR
libsuffix=@LIB_SUFFIX_DASH@
libbuildsuffix=@LIB_BUILD_SUFFIX@

Name: OpenEXR
Description: OpenEXR image library
Version: @OPENEXR_VERSION@

Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix}
Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} -lblosc2${libbuildsuffix} -ldl
Cflags: -I${includedir} -I${OpenEXR_includedir} @exr_pthread_cflags@
Requires: Imath
Requires.private: @EXR_DEFLATE_PKGCONFIG_REQUIRES@
Expand Down
8 changes: 0 additions & 8 deletions cmake/OpenEXRSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,6 @@ if(NOT TARGET Blosc2::blosc2_static AND NOT Blosc2_FOUND)

get_target_property(blosc2libdir Blosc2::blosc2_static BINARY_DIR)
set(BLOSC2_LIB_DIR ${blosc2libdir})

get_target_property(blosc2libname Blosc2::blosc2_static OUTPUT_NAME)
set(BLOSC2_LIB_NAME ${blosc2libname})
endif()
else()
message(STATUS "Blosc2: Using installed Blosc2 ${Blosc2_VERSION} from ${Blosc2_DIR}")
Expand All @@ -416,11 +413,6 @@ else()
get_target_property(blosc2libdir Blosc2::blosc2_static BINARY_DIR)
_error_if_not_found("BINARY_DIR" ${blosc2libdir} "")
set(BLOSC2_LIB_DIR ${blosc2libdir})

get_target_property(blosc2libname Blosc2::blosc2_static OUTPUT_NAME)
# fallback because it fails for me but I think it may be a bug.
_error_if_not_found("OUTPUT_NAME" ${blosc2libname} "blosc2")
set(BLOSC2_LIB_NAME ${blosc2libname})
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions src/lib/OpenEXR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ openexr_define_library(OpenEXR
ImfXdr.h
DEPENDENCIES
Imath::Imath
Blosc2::blosc2_static
OpenEXR::Config
OpenEXR::Iex
OpenEXR::IlmThread
Expand Down

0 comments on commit f2bdfde

Please sign in to comment.