Skip to content

Commit

Permalink
Issues/0134 openexr2 shared iex_debug trap (#160)
Browse files Browse the repository at this point in the history
* add OpenEXR target link libraries recommended by Openexr Porting Guide - https://openexr.com/en/latest/PortingGuide.html

* add ubuntu openexr2 shared docker 

* add github workflow for mac release shared
  • Loading branch information
michaeldsmith authored Jul 1, 2024
1 parent 25fc443 commit 245451c
Show file tree
Hide file tree
Showing 11 changed files with 322 additions and 41 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker_linuxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,13 @@ jobs:

- name: Run unit tests (ctest) within the Docker image
run: docker run ctl:latest sh -c "cd ./build && ctest"

ubuntu-openexr2-shared:
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_shared -t ctl:latest .

- name: Run unit tests (ctest) within the Docker image
run: docker run ctl:latest sh -c "cd ./build && ctest"
184 changes: 184 additions & 0 deletions .github/workflows/mac_release_shared.yml
Original file line number Diff line number Diff line change
@@ -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=ON .. &&
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=ON

- 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=ON .. &&
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=ON .. &&
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=ON

- 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=ON .. &&
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=ON

- 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=ON .. &&
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=ON .. &&
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=ON

- 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

12 changes: 9 additions & 3 deletions ctlrender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ target_link_libraries(ctlrender
IlmCtl
ctldpx
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)

if( OpenEXR_FOUND )
Expand Down
44 changes: 44 additions & 0 deletions docker/Dockerfile_ubuntu_22.04_openexr2_shared
Original file line number Diff line number Diff line change
@@ -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=ON -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=ON ..
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

17 changes: 7 additions & 10 deletions lib/IlmCtl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,19 @@ target_include_directories(IlmCtl
${CMAKE_CURRENT_SOURCE_DIR}
)

if( IlmBase_FOUND )
target_link_libraries (IlmCtl
target_link_libraries (IlmCtl
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)
else()
target_link_libraries (IlmCtl
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
)
endif()

set_target_properties(IlmCtl
PROPERTIES
Expand Down
30 changes: 13 additions & 17 deletions lib/IlmCtlMath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@ target_include_directories(IlmCtlMath
${CMAKE_CURRENT_SOURCE_DIR}
)

if(IlmBase_FOUND)
target_link_libraries(IlmCtlMath
target_link_libraries (IlmCtlMath
PUBLIC
IlmCtl
PUBLIC
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
)
else()
target_link_libraries(IlmCtlMath
PUBLIC
IlmCtl
PUBLIC
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
)
endif()
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)

set_target_properties(IlmCtlMath
PROPERTIES
Expand Down
11 changes: 11 additions & 0 deletions lib/IlmCtlSimd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ target_link_libraries(IlmCtlSimd
PUBLIC
IlmCtlMath
IlmCtl
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)

set_target_properties(IlmCtlSimd
Expand Down
22 changes: 11 additions & 11 deletions lib/IlmImfCtl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ target_include_directories(IlmImfCtl
target_link_libraries (IlmImfCtl
PUBLIC
IlmCtl
PUBLIC
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
# $<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
# $<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)

set_target_properties(IlmImfCtl
Expand Down
11 changes: 11 additions & 0 deletions unittest/IlmCtl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ target_link_libraries(IlmCtlTest
PRIVATE
IlmCtlSimd
IlmCtl
PRIVATE
# For OpenEXR/Imath 3.x:
$<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
$<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
$<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
# For OpenEXR 2.4/2.5:
$<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
$<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
$<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
$<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
$<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
)

add_test(IlmCtl IlmCtlTest)
Expand Down
Loading

0 comments on commit 245451c

Please sign in to comment.