Skip to content

Commit 449b933

Browse files
committed
Refactor OpenJPH import
1 parent 865d4de commit 449b933

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

cmake/LibraryDefine.cmake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ function(OPENEXR_DEFINE_LIBRARY libname)
2424
PRIVATE cxx_std_${OPENEXR_CXX_STANDARD}
2525
INTERFACE cxx_std_17 )
2626

27-
# we are embedding OpenJPH
28-
target_include_directories(${objlib} PRIVATE ${OPENJPH_OPENJPH_INCLUDE_DIRS})
29-
30-
# we are embedding libdeflate
27+
# we are embedding libdeflate
3128
target_include_directories(${objlib} PRIVATE ${EXR_DEFLATE_INCLUDE_DIR})
3229

3330
if(OPENEXR_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS)
@@ -43,7 +40,7 @@ function(OPENEXR_DEFINE_LIBRARY libname)
4340
if(OPENEXR_CURLIB_CURBINDIR)
4441
target_include_directories(${objlib} PRIVATE $<BUILD_INTERFACE:${OPENEXR_CURLIB_CURBINDIR}>)
4542
endif()
46-
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${CMAKE_DL_LIBS} ${OPENJPH_LIBRARIES})
43+
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${CMAKE_DL_LIBS} openjph)
4744
if(OPENEXR_CURLIB_PRIVATE_DEPS)
4845
target_link_libraries(${objlib} PRIVATE ${OPENEXR_CURLIB_PRIVATE_DEPS})
4946
endif()

cmake/OpenEXRSetup.cmake

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,13 @@ endif()
305305
message(STATUS "Locating OpenJPH")
306306

307307
option(OPENEXR_OJPH_USE_FINDPACKAGE "Use find_package instead of downloading OpenJPH from a git repo" OFF)
308-
set(OPENEXR_OJPH_REPO "https://github.com/aous72/OpenJPH.git" CACHE STRING "OpenJPH Git repo URI")
309-
set(OPENEXR_OJPH_TAG "supporting_differing_components" CACHE STRING "OpenJPH Git repo tag")
308+
set(OPENEXR_OJPH_REPO "https://github.com/palemieux/OpenJPH.git" CACHE STRING "OpenJPH Git repo URI")
309+
set(OPENEXR_OJPH_TAG "add-export" CACHE STRING "OpenJPH Git repo tag")
310310

311311
if (NOT (OPENJPH_INCLUDE_DIRS AND OPENJPH_LIBRARIES))
312312
if (OPENEXR_OJPH_USE_FINDPACKAGE)
313-
find_package(openjph 0.19)
314-
315-
message(STATUS "Using OpenJPH at ${OPENJPH_LIBRARIES}.")
313+
find_package(openjph 0.19 REQUIRED)
314+
message(STATUS "Found OpenJPH locally.")
316315
else()
317316
include(FetchContent)
318317
FetchContent_Declare(
@@ -326,29 +325,18 @@ if (NOT (OPENJPH_INCLUDE_DIRS AND OPENJPH_LIBRARIES))
326325
set(OJPH_BUILD_EXECUTABLES OFF CACHE BOOL "" FORCE)
327326
FetchContent_MakeAvailable(openjph)
328327
install(
329-
TARGETS openjph
330-
EXPORT ${PROJECT_NAME}
331-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
332-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
333-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
334-
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
335-
PUBLIC_HEADER
336-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${OPENEXR_OUTPUT_SUBDIR}
328+
TARGETS openjph
329+
EXPORT ${PROJECT_NAME}
337330
)
338331
set_target_properties(openjph PROPERTIES
339332
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
340333
)
341-
342-
set(OPENJPH_INCLUDE_DIRS "${openjph_SOURCE_DIR}/src/core/common")
343-
set(OPENJPH_LIBRARIES openjph)
334+
include_directories("${openjph_SOURCE_DIR}/src/core/common")
344335

345336
message(STATUS "Building OpenJPH from ${OPENEXR_OJPH_REPO}.")
346337
endif()
347338
endif()
348339

349-
if (NOT (OPENJPH_INCLUDE_DIRS AND OPENJPH_LIBRARIES))
350-
message(SEND_ERROR "OpenJPH could not be found.")
351-
endif()
352340

353341
#######################################
354342
# Find or install Imath

0 commit comments

Comments
 (0)