Skip to content

Commit

Permalink
fix Cmake/compile without KDU, enable exrconv, add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith authored Nov 5, 2024
1 parent 8068615 commit a1e1945
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 29 deletions.
29 changes: 4 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build --rm -f ./openexr-ht/Dockerfile -t openexr:latest .
# docker run -it --rm -v C:\\temp:/tmp/ openexr:latest
# docker build --rm -f Dockerfile -t openexr-ht:latest .
# docker run -it --rm -v C:\\temp:/tmp/ openexr-ht:latest
FROM ubuntu:jammy

RUN apt-get update
Expand All @@ -18,32 +18,11 @@ RUN apt-get -y install python3
# install developement debugging tools
RUN apt-get -y install valgrind

# set Kakadu distribution version and unique serial number
ARG KDU_SOURCE_NAME=v8_4_1-00462N
# set path to location of source zip, in this case its here ./v8_2_1-00462N.zip
ARG KDU_SOURCE_ZIP_DIRECTORY=./
WORKDIR /usr/src/kakadu
COPY $KDU_SOURCE_ZIP_DIRECTORY/$KDU_SOURCE_NAME.zip $KDU_SOURCE_NAME.zip
#COPY v8_4_1-00462N.zip /usr/src/kakadu.zip
RUN unzip $KDU_SOURCE_NAME.zip
RUN rm -f $KDU_SOURCE_NAME.zip
# enable HTJ2K
WORKDIR /usr/src/kakadu/$KDU_SOURCE_NAME/
RUN mv srclib_ht srclib_ht_noopt; cp -r altlib_ht_opt srclib_ht
# compile Kakadu SDK and demo apps with HTJ2K enabled (#define FBC_ENABLED)
WORKDIR /usr/src/kakadu/$KDU_SOURCE_NAME/make
RUN make CXXFLAGS=-DFBC_ENABLED -f Makefile-Linux-x86-64-gcc all_but_jni
# set environment variables
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/kakadu/$KDU_SOURCE_NAME/lib/Linux-x86-64-gcc
ENV PATH=$PATH:/usr/src/kakadu/$KDU_SOURCE_NAME/bin/Linux-x86-64-gcc
ENV KDU_INCLUDE_DIR=/usr/src/kakadu/$KDU_SOURCE_NAME/managed/all_includes
ENV KDU_LIBRARY=/usr/src/kakadu/$KDU_SOURCE_NAME/lib/Linux-x86-64-gcc/libkdu_a84R.so

# build OpenEXR
WORKDIR /usr/src/OpenEXR
COPY ./openexr-ht .
COPY . .
WORKDIR /usr/src/OpenEXR/build
RUN cmake .. -DKDU_INCLUDE_DIR=$KDU_INCLUDE_DIR -DKDU_LIBRARY=$KDU_LIBRARY
RUN cmake ..
RUN make
RUN make install

Expand Down
53 changes: 53 additions & 0 deletions Dockerfile_KDU
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# run this docker file outside the openexr-ht folder so Kakadu SDK ZIP is not included in the git repo
# docker build --rm -f ./openexr-ht/Dockerfile_KDU -t openexr-ht-kdu:latest .
# docker run -it --rm -v C:\\temp:/tmp/ openexr-ht-kdu:latest
FROM ubuntu:jammy

RUN apt-get update

# disable interactive install
ENV DEBIAN_FRONTEND noninteractive

# install developement tools
RUN apt-get -y install cmake
RUN apt-get -y install g++
RUN apt-get -y install git
RUN apt-get -y install unzip
RUN apt-get -y install libnuma-dev
RUN apt-get -y install python3

# install developement debugging tools
RUN apt-get -y install valgrind

# set Kakadu distribution version and unique serial number
ARG KDU_SOURCE_NAME=v8_4_1-00462N
# set path to location of source zip, in this case its here ./v8_2_1-00462N.zip
ARG KDU_SOURCE_ZIP_DIRECTORY=./
WORKDIR /usr/src/kakadu
COPY $KDU_SOURCE_ZIP_DIRECTORY/$KDU_SOURCE_NAME.zip $KDU_SOURCE_NAME.zip
RUN unzip $KDU_SOURCE_NAME.zip
RUN rm -f $KDU_SOURCE_NAME.zip
# enable HTJ2K
WORKDIR /usr/src/kakadu/$KDU_SOURCE_NAME/
RUN mv srclib_ht srclib_ht_noopt; cp -r altlib_ht_opt srclib_ht
# compile Kakadu SDK and demo apps with HTJ2K enabled (#define FBC_ENABLED)
WORKDIR /usr/src/kakadu/$KDU_SOURCE_NAME/make
RUN make CXXFLAGS=-DFBC_ENABLED -f Makefile-Linux-x86-64-gcc all_but_jni
# set environment variables
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/kakadu/$KDU_SOURCE_NAME/lib/Linux-x86-64-gcc
ENV PATH=$PATH:/usr/src/kakadu/$KDU_SOURCE_NAME/bin/Linux-x86-64-gcc
ENV KDU_INCLUDE_DIR=/usr/src/kakadu/$KDU_SOURCE_NAME/managed/all_includes
ENV KDU_LIBRARY=/usr/src/kakadu/$KDU_SOURCE_NAME/lib/Linux-x86-64-gcc/libkdu_a84R.so

# build OpenEXR
WORKDIR /usr/src/OpenEXR
COPY ./openexr-ht .
WORKDIR /usr/src/OpenEXR/build
RUN cmake .. -DKDU_INCLUDE_DIR=$KDU_INCLUDE_DIR -DKDU_LIBRARY=$KDU_LIBRARY
RUN make
RUN make install

# finalize docker environment



10 changes: 8 additions & 2 deletions cmake/LibraryDefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ function(OPENEXR_DEFINE_LIBRARY libname)
target_include_directories(${objlib} PRIVATE ${openjph_SOURCE_DIR}/src/core/common)

# we are including KDU
target_include_directories(${objlib} PRIVATE ${KDU_INCLUDE_DIR})
if( KDU_INCLUDE_DIR )
target_include_directories(${objlib} PRIVATE ${KDU_INCLUDE_DIR})
endif()

# we are embedding libdeflate
target_include_directories(${objlib} PRIVATE ${EXR_DEFLATE_INCLUDE_DIR})
Expand All @@ -51,7 +53,11 @@ function(OPENEXR_DEFINE_LIBRARY libname)
target_compile_definitions(${objlib} PRIVATE KDU_AVAILABLE=1)
endif()

target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${KDU_LIBRARY} ${CMAKE_DL_LIBS} openjph)
if(KDU_LIBRARY)
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${KDU_LIBRARY} ${CMAKE_DL_LIBS} openjph)
else()
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${CMAKE_DL_LIBS} openjph)
endif()
if(OPENEXR_CURLIB_PRIVATE_DEPS)
target_link_libraries(${objlib} PRIVATE ${OPENEXR_CURLIB_PRIVATE_DEPS})
endif()
Expand Down
1 change: 1 addition & 0 deletions src/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ add_subdirectory( exrmultipart )
add_subdirectory( exrcheck )
add_subdirectory( exrmanifest )
add_subdirectory( exrperf )
add_subdirectory( exrconv )
2 changes: 0 additions & 2 deletions src/lib/OpenEXRCore/internal_htk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ internal_exr_apply_htk (exr_encode_pipeline_t* encode)

#else

#error

extern "C" exr_result_t
internal_exr_undo_htk (
exr_decode_pipeline_t* decode,
Expand Down

0 comments on commit a1e1945

Please sign in to comment.