Skip to content

Commit

Permalink
add CI for AcesContainer (#142)
Browse files Browse the repository at this point in the history
* adds CI to use the optional AcesContainer library with ctlrender
* adds FindAcesContainer.cmake module
  • Loading branch information
michaeldsmith authored Jan 4, 2024
1 parent d084184 commit 3673b77
Show file tree
Hide file tree
Showing 9 changed files with 361 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/mac_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: install openexr
run: brew install openexr

- name: install aces_container
run: brew install aces_container

- uses: actions/checkout@v3

- name: Configure CMake
Expand Down Expand Up @@ -203,6 +206,9 @@ jobs:
- name: install openexr
run: brew install openexr

- name: install aces_container
run: brew install aces_container

- uses: actions/checkout@v3

- name: Configure CMake
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/ubuntu_address_sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ jobs:
- name: install libtiff
run: sudo apt-get install libtiff-dev -y

- name: install aces_container
run: |
cd ..
git clone https://github.com/ampas/aces_container.git &&
cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" &&
cmake --build aces_container/build &&
sudo cmake --install aces_container/build
- name: install pkg-config to help find aces_container
run: |
sudo apt-get -y install pkg-config
- uses: actions/checkout@v3

- name: Configure CMake
Expand Down
62 changes: 58 additions & 4 deletions .github/workflows/ubuntu_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ jobs:
make &&
sudo make install
- name: install aces_container
run: |
cd ..
git clone https://github.com/ampas/aces_container.git &&
cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" &&
cmake --build aces_container/build &&
sudo cmake --install aces_container/build
- name: install pkg-config to help find aces_container
run: |
sudo apt-get -y install pkg-config
- uses: actions/checkout@v3

- name: Configure CMake
Expand Down Expand Up @@ -124,6 +136,18 @@ jobs:
make &&
sudo make install
- name: install aces_container
run: |
cd ..
git clone https://github.com/ampas/aces_container.git &&
cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" &&
cmake --build aces_container/build &&
sudo cmake --install aces_container/build
- name: install pkg-config to help find aces_container
run: |
sudo apt-get -y install pkg-config
- uses: actions/checkout@v3

- name: Configure CMake
Expand Down Expand Up @@ -171,6 +195,18 @@ jobs:
make &&
sudo make install
- name: install aces_container
run: |
cd ..
git clone https://github.com/ampas/aces_container.git &&
cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" &&
cmake --build aces_container/build &&
sudo cmake --install aces_container/build
- name: install pkg-config to help find aces_container
run: |
sudo apt-get -y install pkg-config
- uses: actions/checkout@v3

- name: Configure CMake
Expand All @@ -189,6 +225,11 @@ jobs:
# Run valgrind using a bash script
run: pwd && ls && bash ../resources/test/scripts/run_valgrind.sh

- name: Run Valgrind on aces container unit tests
working-directory: ${{github.workspace}}/build
# Run valgrind using a bash script
run: pwd && ls && bash ../resources/test/scripts/run_valgrind_aces_container.sh

valgrind-openexr3:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
Expand Down Expand Up @@ -233,6 +274,18 @@ jobs:
make &&
sudo make install
- name: install aces_container
run: |
cd ..
git clone https://github.com/ampas/aces_container.git &&
cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" &&
cmake --build aces_container/build &&
sudo cmake --install aces_container/build
- name: install pkg-config to help find aces_container
run: |
sudo apt-get -y install pkg-config
- uses: actions/checkout@v3

- name: Configure CMake
Expand All @@ -246,13 +299,14 @@ jobs:
cd ${{ github.workspace }}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
#- name: Make unit tests
# working-directory: ${{github.workspace}}/build
# run: make check

- name: Run Valgrind on unit tests
working-directory: ${{github.workspace}}/build
# Run valgrind using a bash script
run: pwd && ls && bash ../resources/test/scripts/run_valgrind.sh

- name: Run Valgrind on aces container unit tests
working-directory: ${{github.workspace}}/build
# Run valgrind using a bash script
run: pwd && ls && bash ../resources/test/scripts/run_valgrind_aces_container.sh


139 changes: 139 additions & 0 deletions cmake/modules/FindAcesContainer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindAcesContainer
-------

Finds the AcesContainer library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``AcesContainer::AcesContainer``
The AcesContainer library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``AcesContainer_FOUND``
True if the system has the AcesContainer library.
``AcesContainer_VERSION``
The version of the AcesContainer library which was found.
``AcesContainer_INCLUDE_DIRS``
Include directories needed to use AcesContainer.
``AcesContainer_LIBRARIES``
Libraries needed to link to AcesContainer.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``AcesContainer_INCLUDE_DIR``
The directory containing ``AcesContainer.h``.
``AcesContainer_LIBRARY``
The path to the AcesContainer library.

#]=======================================================================]

cmake_minimum_required(VERSION 3.12)
include(GNUInstallDirs)

message(STATUS "running FindAcesContainer.cmake")

# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules

find_package(PkgConfig)
pkg_check_modules(PC_AcesContainer QUIET AcesContainer)

find_path(AcesContainer_INCLUDE_DIR
NAMES aces_Writer.h
#PATHS ${PC_AcesContainer_INCLUDE_DIRS}
PATHS /usr/local/include/
PATH_SUFFIXES aces
)
find_library(AcesContainer_LIBRARY
NAMES AcesContainer
#PATHS ${PC_AcesContainer_LIBRARY_DIRS}
PATHS /usr/local/lib/
)

find_library(AcesContainer_LIBRARY_RELEASE
NAMES AcesContainer
PATHS ${PC_AcesContainer_LIBRARY_DIRS}/Release
)
find_library(AcesContainer_LIBRARY_DEBUG
NAMES AcesContainer
PATHS ${PC_AcesContainer_LIBRARY_DIRS}/Debug
)

include(SelectLibraryConfigurations)
select_library_configurations(AcesContainer)

set(AcesContainer_VERSION ${PC_AcesContainer_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AcesContainer
FOUND_VAR AcesContainer_FOUND
REQUIRED_VARS
AcesContainer_LIBRARY
AcesContainer_INCLUDE_DIR
VERSION_VAR AcesContainer_VERSION
)

if(AcesContainer_FOUND)
set(AcesContainer_LIBRARIES ${AcesContainer_LIBRARY})
set(AcesContainer_INCLUDE_DIRS ${AcesContainer_INCLUDE_DIR})
set(AcesContainer_DEFINITIONS ${PC_AcesContainer_CFLAGS_OTHER})
endif()

if(AcesContainer_FOUND AND NOT TARGET AcesContainer::AcesContainer)
add_library(AcesContainer::AcesContainer UNKNOWN IMPORTED)
set_target_properties(AcesContainer::AcesContainer PROPERTIES
IMPORTED_LOCATION "${AcesContainer_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_AcesContainer_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${AcesContainer_INCLUDE_DIR}"
)
endif()

if(AcesContainer_FOUND)
if (NOT TARGET AcesContainer::AcesContainer)
add_library(AcesContainer::AcesContainer UNKNOWN IMPORTED)
endif()
if (AcesContainer_LIBRARY_RELEASE)
set_property(TARGET AcesContainer::AcesContainer APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE
)
set_target_properties(AcesContainer::AcesContainer PROPERTIES
IMPORTED_LOCATION_RELEASE "${AcesContainer_LIBRARY_RELEASE}"
)
endif()
if (AcesContainer_LIBRARY_DEBUG)
set_property(TARGET AcesContainer::AcesContainer APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG
)
set_target_properties(AcesContainer::AcesContainer PROPERTIES
IMPORTED_LOCATION_DEBUG "${AcesContainer_LIBRARY_DEBUG}"
)
endif()
set_target_properties(AcesContainer::AcesContainer PROPERTIES
INTERFACE_COMPILE_OPTIONS "${PC_AcesContainer_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${AcesContainer_INCLUDE_DIR}"
)
endif()

mark_as_advanced(
AcesContainer_INCLUDE_DIR
AcesContainer_LIBRARY
)

# compatibility variables
set(AcesContainer_VERSION_STRING ${AcesContainer_VERSION})



24 changes: 24 additions & 0 deletions ctlrender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,26 @@ else()
endif()

find_package(AcesContainer)
if( AcesContainer_FOUND )
message( STATUS "find_package(AcesContainer) - AcesContainer_FOUND is true")
else()
message( STATUS "find_package(AcesContainer) - AcesContainer_FOUND is false")
endif()

if (TARGET AcesContainer::AcesContainer)
message( STATUS "find_package(AcesContainer) - TARGET AcesContainer::AcesContainer is true:" )
else()
message( STATUS "find_package(AcesContainer) - TARGET AcesContainer::AcesContainer is false")
endif()

if( AcesContainer_FOUND OR TARGET AcesContainer::AcesContainer)

message( STATUS " AcesContainer_VERSION : ${AcesContainer_VERSION}" )
message( STATUS " AcesContainer_INCLUDE_DIRS : ${AcesContainer_INCLUDE_DIRS}" )
message( STATUS " AcesContainer_LIBRARIES : ${AcesContainer_LIBRARIES}" )
message( STATUS " AcesContainer_INCLUDE_DIR : ${AcesContainer_INCLUDE_DIR}" )
message( STATUS " AcesContainer_LIBRARY : ${AcesContainer_LIBRARY}" )

target_compile_definitions(ctlrender
PRIVATE
-DHAVE_ACESFILE=1
Expand All @@ -60,6 +79,11 @@ if (TARGET AcesContainer::AcesContainer)
PRIVATE
AcesContainer::AcesContainer
)
message( STATUS "AcesContainer found")
message( STATUS " ctlrender will support writing AcesContainer files" )
else()
message( STATUS "AcesContainer not found - TARGET AcesContainer::AcesContainer is false and AcesContainer_FOUND is false")
message( STATUS " ctlrender will not support writing AcesContainer files" )
endif()

install(TARGETS ctlrender DESTINATION ${CMAKE_INSTALL_BINDIR})
55 changes: 55 additions & 0 deletions docker/Dockerfile_ubuntu_22.04_acescontainer
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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

RUN apt-get -y install valgrind

# install CTL dependencies
RUN apt-get -y install libopenexr-dev
RUN apt-get -y install libtiff-dev

# install aces_container
WORKDIR /usr/src/
RUN git clone https://github.com/ampas/aces_container.git
#WORKDIR /usr/src/aces_container/build
#RUN cmake ..
#RUN make
#RUN make install
RUN cmake -S aces_container -B aces_container/build -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing"
RUN cmake --build aces_container/build
RUN cmake --install aces_container/build

RUN apt-get -y install pkg-config

# Make sudo dummy replacement, so we don't weaken docker security
#RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo
#RUN chmod +x /usr/bin/sudo

# copy CTL repo into docker
WORKDIR /usr/src/CTL
COPY . .

# install ACES AcesContainer using install script
#WORKDIR /usr/src/
#RUN bash ./CTL/resources/scripts/install_aces_container.bash

# build CTL
WORKDIR /usr/src/CTL/build
#RUN cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/CMake/AcesContainer ..
RUN cmake ..
RUN make
RUN make install



# finalize docker environment
WORKDIR /usr/src/CTL

Loading

0 comments on commit 3673b77

Please sign in to comment.