diff --git a/.github/workflows/docker_linuxes.yml b/.github/workflows/docker_linuxes.yml index eb787fa..740e8a3 100644 --- a/.github/workflows/docker_linuxes.yml +++ b/.github/workflows/docker_linuxes.yml @@ -201,3 +201,13 @@ jobs: - name: Run unit tests (ctest) within the Docker image run: docker run ctl:latest sh -c "cd ./build && ctest" + + ubuntu-openexr2-static: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build --no-cache --rm -f ./docker/Dockerfile_ubuntu_22.04_openexr2_static -t ctl:latest . + + - name: Run unit tests (ctest) within the Docker image + run: docker run ctl:latest sh -c "cd ./build && ctest" diff --git a/.github/workflows/mac_release_static.yml b/.github/workflows/mac_release_static.yml new file mode 100644 index 0000000..6012ee4 --- /dev/null +++ b/.github/workflows/mac_release_static.yml @@ -0,0 +1,184 @@ +name: macOS-Release-shared + +on: + push: + paths-ignore: + - 'README.md' + - 'doc/**' + pull_request: + paths-ignore: + - 'README.md' + - 'doc/**' + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + + build-openexr2: + + runs-on: macos-latest + + steps: + + # - name: uninstall openexr + # run: brew uninstall --ignore-dependencies openexr + + # - name: uninstall imath + # run: brew uninstall --ignore-dependencies imath + + - name: install dependencies - openexr v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + build-openexr3: + runs-on: macos-latest + + steps: + + - name: install dependencies - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - name: install dependencies - openexr v3.1 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-3.1 && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + test-openexr2: + + runs-on: macos-latest + + steps: + + # - name: uninstall openexr + # run: brew uninstall --ignore-dependencies openexr + + # - name: uninstall imath + # run: brew uninstall --ignore-dependencies imath + + - name: install dependencies - openexr v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Install + run: sudo cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -V --output-on-failure + + test-openexr3: + runs-on: macos-latest + + steps: + + - name: install dependencies - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - name: install dependencies - openexr v3.1 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-3.1 && + mkdir build && + cd build && + cmake -DBUILD_SHARED_LIBS=OFF .. && + make && + sudo make install + + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=OFF + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Install + run: sudo cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -V --output-on-failure + diff --git a/CMakeLists.txt b/CMakeLists.txt index 28fae87..7d1eb11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,20 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() +# ZLIB is automatically added by OpenEXR 3.x but needs to be added for OpenEXR 2.x +find_package(ZLIB) +if(TARGET ZLIB::ZLIB) + message( STATUS "found ZLIB" ) + message( STATUS " ZLIB_VERSION : ${ZLIB_VERSION}" ) + message( STATUS " ZLIB_INCLUDE_DIRS : ${ZLIB_INCLUDE_DIRS}" ) + message( STATUS " ZLIB_LIBRARIES : ${ZLIB_LIBRARIES}" ) + message( STATUS " ZLIB_INCLUDE_DIR : ${ZLIB_INCLUDE_DIR}" ) + message( STATUS " ZLIB_LIBRARY : ${ZLIB_LIBRARY}" ) +else() + message( STATUS "ZLIB was not found") + message( STAUTS " ZLIB is automatically linked when using OpenEXR 3.x but CTL needs to link to ZLIB if using OpenEXR 2.x" ) +endif() + find_package(OpenEXR 3 CONFIG QUIET) if(OpenEXR_FOUND) message(STATUS "Found OpenEXR ${OpenEXR_VERSION}") diff --git a/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt b/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt index 6750a36..8162dd7 100644 --- a/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt +++ b/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt @@ -33,6 +33,8 @@ target_link_libraries (exr_ctl_exr $<$:IlmBase::Half> $<$:IlmBase::IlmThread> $<$:IlmBase::Iex> + # ZLIB for OpenEXR 2.x: + $<$:ZLIB::ZLIB> ) #target_link_libraries( exr_ctl_exr ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) #target_link_libraries( exr_ctl_exr ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) diff --git a/OpenEXR_CTL/exrdpx/CMakeLists.txt b/OpenEXR_CTL/exrdpx/CMakeLists.txt index ec3acf7..019017f 100644 --- a/OpenEXR_CTL/exrdpx/CMakeLists.txt +++ b/OpenEXR_CTL/exrdpx/CMakeLists.txt @@ -33,6 +33,8 @@ target_link_libraries (exrdpx $<$:IlmBase::Half> $<$:IlmBase::IlmThread> $<$:IlmBase::Iex> + # ZLIB for OpenEXR 2.x: + $<$:ZLIB::ZLIB> ) #target_link_libraries( exrdpx ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) #target_link_libraries( exrdpx ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index fc433db..e6917d8 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -30,6 +30,8 @@ target_link_libraries(ctlrender $<$:IlmBase::Half> $<$:IlmBase::IlmThread> $<$:IlmBase::Iex> + # ZLIB for OpenEXR 2.x: + $<$:ZLIB::ZLIB> ) if( OpenEXR_FOUND ) diff --git a/docker/Dockerfile_ubuntu_22.04_openexr2_static b/docker/Dockerfile_ubuntu_22.04_openexr2_static new file mode 100644 index 0000000..db8af9d --- /dev/null +++ b/docker/Dockerfile_ubuntu_22.04_openexr2_static @@ -0,0 +1,44 @@ +FROM ubuntu:22.04 + +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 + +# install CTL dependencies +#RUN apt-get -y install libopenexr-dev +#RUN apt-get -y install libtiff-dev + +# install CTL dependencies - zlib +RUN apt-get -y install zlib1g-dev + +# install CTL dependecies - openexr +WORKDIR /usr/src/ +RUN git clone https://github.com/AcademySoftwareFoundation/openexr.git +WORKDIR /usr/src/openexr +RUN git checkout RB-2.5 +WORKDIR /usr/src/openexr/build +RUN cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF +RUN make +RUN make install + +# build CTL +WORKDIR /usr/src/CTL +COPY . . +WORKDIR /usr/src/CTL/build +RUN rm -R * || true +RUN cmake -DBUILD_SHARED_LIBS=OFF .. +RUN make +RUN make install + +# add /usr/local/lib to the LD_LIBRARY_PATH +# ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + +# finalize docker environment +WORKDIR /usr/src/CTL + diff --git a/unittest/IlmImfCtl/CMakeLists.txt b/unittest/IlmImfCtl/CMakeLists.txt index b9b33b7..71de5dc 100644 --- a/unittest/IlmImfCtl/CMakeLists.txt +++ b/unittest/IlmImfCtl/CMakeLists.txt @@ -28,6 +28,8 @@ target_link_libraries( IlmImfCtlTest $<$:IlmBase::Half> $<$:IlmBase::IlmThread> $<$:IlmBase::Iex> + # ZLIB for OpenEXR 2.x: + $<$:ZLIB::ZLIB> ) add_test( IlmImfCtl IlmImfCtlTest )