From 411516707b001a209f89aaabb4ec33c5300ccf37 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Sun, 26 Nov 2023 13:14:34 -0800 Subject: [PATCH 01/10] add FindAcesContainer.cmake and docker --- cmake/modules/FindAcesContainer.cmake | 139 +++++++++++++++++++ ctlrender/CMakeLists.txt | 34 +++++ docker/Dockerfile_ubuntu_22.04_acescontainer | 37 +++++ unittest/ctlrender/CMakeLists.txt | 11 ++ 4 files changed, 221 insertions(+) create mode 100644 cmake/modules/FindAcesContainer.cmake create mode 100644 docker/Dockerfile_ubuntu_22.04_acescontainer diff --git a/cmake/modules/FindAcesContainer.cmake b/cmake/modules/FindAcesContainer.cmake new file mode 100644 index 00000000..3a39b395 --- /dev/null +++ b/cmake/modules/FindAcesContainer.cmake @@ -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}) + + + diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index 31a2e13c..028715ef 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -50,8 +50,40 @@ else() message( STATUS "TIFF not found, ctlrender will not support TIF files" ) endif() +#set(AcesContainer_DIR "/usr/local/lib/CMake/AcesContainer") +#25 0.685 CMake Warning at ctlrender/CMakeLists.txt:53 (find_package): +#25 0.685 By not providing "FindAcesContainer.cmake" in CMAKE_MODULE_PATH this +#25 0.685 project has asked CMake to find a package configuration file provided by +#25 0.685 "AcesContainer", but CMake did not find one. +#25 0.685 +#25 0.685 Could not find a package configuration file provided by "AcesContainer" +#25 0.685 with any of the following names: +#25 0.685 +#25 0.685 AcesContainerConfig.cmake +#25 0.685 acescontainer-config.cmake +#25 0.685 +#25 0.685 Add the installation prefix of "AcesContainer" to CMAKE_PREFIX_PATH or set +#25 0.685 "AcesContainer_DIR" to a directory containing one of the above files. If +#25 0.685 "AcesContainer" provides a separate development package or SDK, be sure it +#25 0.685 has been installed. +#set(CMAKE_MODULE_PATH "/usr/local/lib/CMake/AcesContainer;${CMAKE_MODULE_PATH}") +#set(AcesContainer_DIR "/usr/local/lib/CMake/AcesContainer") find_package(AcesContainer) +if( AcesContainer_FOUND ) + message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is true") + +else() + message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is false") +endif() + if (TARGET AcesContainer::AcesContainer) + message( STATUS "found 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 @@ -60,6 +92,8 @@ if (TARGET AcesContainer::AcesContainer) PRIVATE AcesContainer::AcesContainer ) +else() + message( STATUS "AcesContainer not found, ctlrender will not support AcesContainer files" ) endif() install(TARGETS ctlrender DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/docker/Dockerfile_ubuntu_22.04_acescontainer b/docker/Dockerfile_ubuntu_22.04_acescontainer new file mode 100644 index 00000000..ef68f1ee --- /dev/null +++ b/docker/Dockerfile_ubuntu_22.04_acescontainer @@ -0,0 +1,37 @@ +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 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 apt-get -y install pkg-config + +# build CTL +WORKDIR /usr/src/CTL +COPY . . +WORKDIR /usr/src/CTL/build +RUN cmake .. +RUN make +RUN make install + +# finalize docker environment +WORKDIR /usr/src/CTL + diff --git a/unittest/ctlrender/CMakeLists.txt b/unittest/ctlrender/CMakeLists.txt index e16000ff..1c05f708 100644 --- a/unittest/ctlrender/CMakeLists.txt +++ b/unittest/ctlrender/CMakeLists.txt @@ -14,6 +14,12 @@ elseif( NOT TARGET TIFF::TIFF AND NOT OpenEXR_FOUND ) message(WARNING "LibTIFF not found, OpenEXR not found, not including TIF or EXR files in ctlrender unit tests") endif() +find_package(AcesContainer) +if( AcesContainer_FOUND ) + message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is true") + message( STATUS "DEBUG: including ACES ctlrender unit tests") +endif() + set(CTLRENDER_OUTPUT_FOLDER "${CMAKE_BINARY_DIR}/unittest/ctlrender/output") message("ctlrender test output folder will be created at: ${CTLRENDER_OUTPUT_FOLDER}") add_custom_target(ctlrender-build-time-make-directory ALL @@ -66,6 +72,11 @@ if(OpenEXR_FOUND) add_test(NAME "ctlrender-EXR_RGBA32->EXR_RGBA_32" COMMAND ${CTLRENDER_PATH} -ctl "${TEST_FILES}/unity_with_alpha.ctl" -format exr32 -force "${TEST_FILES}/colorbars_nuke_rgba_exr32.exr" "${CTLRENDER_OUTPUT_FOLDER}/bars_rgba_exr32_to_exr32.exr") endif() +#ACES tests +if (OpenEXR_FOUND AND AcesContainer_FOUND) + add_test(NAME "ctlrender-EXR16->ACES" COMMAND ${CTLRENDER_PATH} -ctl "${TEST_FILES}/unity.ctl" -format aces -force "${TEST_FILES}/colorbars_nuke_rgb_exr16.exr" "${CTLRENDER_OUTPUT_FOLDER}/bars_rgb_exr16_to_aces.aces") +endif() + # test TIFF32 to EXR and EXR to TIFF32 support if (OpenEXR_FOUND AND TARGET TIFF::TIFF) foreach(J exr exr16 exr32 tiff32) From a32d01e3c180b3b8f2106e2ad9bcf49b8435c3d9 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:12:27 -0800 Subject: [PATCH 02/10] add CMAKE_PREFIX_PATH to AcesContainer --- ctlrender/CMakeLists.txt | 10 ++++++++-- docker/Dockerfile_ubuntu_22.04_acescontainer | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index 028715ef..ba3bef56 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -71,13 +71,18 @@ endif() find_package(AcesContainer) if( AcesContainer_FOUND ) message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is true") + 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}" ) else() message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is false") endif() if (TARGET AcesContainer::AcesContainer) - message( STATUS "found AcesContainer:" ) + message( STATUS "found AcesContainer - TARGET AcesContainer::AcesContainer is true:" ) message( STATUS " AcesContainer_VERSION : ${AcesContainer_VERSION}" ) message( STATUS " AcesContainer_INCLUDE_DIRS : ${AcesContainer_INCLUDE_DIRS}" ) message( STATUS " AcesContainer_LIBRARIES : ${AcesContainer_LIBRARIES}" ) @@ -93,7 +98,8 @@ if (TARGET AcesContainer::AcesContainer) AcesContainer::AcesContainer ) else() - message( STATUS "AcesContainer not found, ctlrender will not support AcesContainer files" ) + message( STATUS "AcesContainer not found - TARGET AcesContainer::AcesContainer is false") + message( STATUS " ctlrender will not support AcesContainer files" ) endif() install(TARGETS ctlrender DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/docker/Dockerfile_ubuntu_22.04_acescontainer b/docker/Dockerfile_ubuntu_22.04_acescontainer index ef68f1ee..fae783e2 100644 --- a/docker/Dockerfile_ubuntu_22.04_acescontainer +++ b/docker/Dockerfile_ubuntu_22.04_acescontainer @@ -28,7 +28,7 @@ RUN apt-get -y install pkg-config WORKDIR /usr/src/CTL COPY . . WORKDIR /usr/src/CTL/build -RUN cmake .. +RUN cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/CMake/AcesContainer .. RUN make RUN make install From 167b9f93dbb5bce97c57c69cb7b75fb7114e5e09 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:10:45 -0800 Subject: [PATCH 03/10] add aces_container to mac release brew workflows --- .github/workflows/mac_release.yml | 6 +++++ ctlrender/CMakeLists.txt | 2 ++ resources/scripts/install_aces_container.bash | 24 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 resources/scripts/install_aces_container.bash diff --git a/.github/workflows/mac_release.yml b/.github/workflows/mac_release.yml index 8d05177b..865db163 100644 --- a/.github/workflows/mac_release.yml +++ b/.github/workflows/mac_release.yml @@ -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 @@ -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 diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index ba3bef56..d3b926ea 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -68,6 +68,8 @@ endif() #25 0.685 has been installed. #set(CMAKE_MODULE_PATH "/usr/local/lib/CMake/AcesContainer;${CMAKE_MODULE_PATH}") #set(AcesContainer_DIR "/usr/local/lib/CMake/AcesContainer") +#set(CMAKE_PREFIX_PATH "/usr/local/lib/CMake/AcesContainer;C:/Program Files (x86)/AcesContainer/CMake/;${CMAKE_PREFIX_PATH}") + find_package(AcesContainer) if( AcesContainer_FOUND ) message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is true") diff --git a/resources/scripts/install_aces_container.bash b/resources/scripts/install_aces_container.bash new file mode 100644 index 00000000..69e6e050 --- /dev/null +++ b/resources/scripts/install_aces_container.bash @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -ex + +git clone https://github.com/ampas/aces_container.git aces_container + +if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then + 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 +else + cmake \ + -S aces_container \ + -B aces_container/build \ + -DCMAKE_INSTALL_PREFIX="." \ + -DBUILD_SHARED_LIBS=OFF + cmake --build aces_container/build --config Release + cmake --install aces_container/build --config Release +fi + +cd ../.. From 6815cb6a50fe07ca0edc0509d4a242e8b82ebed2 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Mon, 27 Nov 2023 14:16:43 -0800 Subject: [PATCH 04/10] install aces container from bash script --- ctlrender/CMakeLists.txt | 16 +++++++---- docker/Dockerfile_ubuntu_22.04_acescontainer | 29 ++++++++++++++------ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index d3b926ea..4af81872 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -72,7 +72,7 @@ endif() find_package(AcesContainer) if( AcesContainer_FOUND ) - message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is true") + message( STATUS "find_package(AcesContainer) - AcesContainer_FOUND is true") message( STATUS " AcesContainer_VERSION : ${AcesContainer_VERSION}" ) message( STATUS " AcesContainer_INCLUDE_DIRS : ${AcesContainer_INCLUDE_DIRS}" ) message( STATUS " AcesContainer_LIBRARIES : ${AcesContainer_LIBRARIES}" ) @@ -84,13 +84,17 @@ else() endif() if (TARGET AcesContainer::AcesContainer) - message( STATUS "found AcesContainer - TARGET AcesContainer::AcesContainer is true:" ) + message( STATUS "find_package(AcesContainer) - TARGET AcesContainer::AcesContainer is true:" ) 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}" ) - +else() + message( STATUS "AcesContainer not found - TARGET AcesContainer::AcesContainer is false") +endif() + +if( AcesContainer_FOUND OR TARGET AcesContainer::AcesContainer) target_compile_definitions(ctlrender PRIVATE -DHAVE_ACESFILE=1 @@ -99,9 +103,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") - message( STATUS " ctlrender will not support AcesContainer files" ) + 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}) diff --git a/docker/Dockerfile_ubuntu_22.04_acescontainer b/docker/Dockerfile_ubuntu_22.04_acescontainer index fae783e2..a85cc9d0 100644 --- a/docker/Dockerfile_ubuntu_22.04_acescontainer +++ b/docker/Dockerfile_ubuntu_22.04_acescontainer @@ -15,23 +15,36 @@ 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 +#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 apt-get -y install pkg-config -# build CTL +# 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 -D CMAKE_PREFIX_PATH=/usr/local/lib/CMake/AcesContainer .. +RUN cmake .. RUN make RUN make install + + # finalize docker environment WORKDIR /usr/src/CTL From ebda6460abce95ebbe49c83c17d21b6ae88e7dad Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:42:03 -0800 Subject: [PATCH 05/10] update acescontainer build steps --- docker/Dockerfile_ubuntu_22.04_acescontainer | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile_ubuntu_22.04_acescontainer b/docker/Dockerfile_ubuntu_22.04_acescontainer index a85cc9d0..d9f791e7 100644 --- a/docker/Dockerfile_ubuntu_22.04_acescontainer +++ b/docker/Dockerfile_ubuntu_22.04_acescontainer @@ -15,26 +15,29 @@ 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/ +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 +#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 +#WORKDIR /usr/src/ +#RUN bash ./CTL/resources/scripts/install_aces_container.bash # build CTL WORKDIR /usr/src/CTL/build From 5826074b99698eb5fcc9c6fe2637306930e388f9 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Wed, 3 Jan 2024 22:57:52 -0800 Subject: [PATCH 06/10] add aces_container to ubuntu_debug workflow test-openexr3 --- .github/workflows/ubuntu_debug.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ubuntu_debug.yml b/.github/workflows/ubuntu_debug.yml index 3bffc341..a17e4bd5 100644 --- a/.github/workflows/ubuntu_debug.yml +++ b/.github/workflows/ubuntu_debug.yml @@ -124,6 +124,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 && + 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 From 8c00e217d8fd5def772d1523409f44276103013b Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:12:17 -0800 Subject: [PATCH 07/10] update ubuntu_debug ci --- .github/workflows/ubuntu_debug.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu_debug.yml b/.github/workflows/ubuntu_debug.yml index a17e4bd5..d8b45024 100644 --- a/.github/workflows/ubuntu_debug.yml +++ b/.github/workflows/ubuntu_debug.yml @@ -130,7 +130,7 @@ jobs: 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 && - cmake --install aces_container/build + sudo cmake --install aces_container/build - name: install pkg-config to help find aces_container run: | From 5c84a0ca4f0d05f7e66a46c6a0ba36b17d7ed647 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:52:23 -0800 Subject: [PATCH 08/10] add aces container valgrind tests --- .github/workflows/ubuntu_debug.yml | 50 +++++++++++++++++-- docker/Dockerfile_ubuntu_22.04_acescontainer | 2 + .../scripts/run_valgrind_aces_container.sh | 32 ++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 resources/test/scripts/run_valgrind_aces_container.sh diff --git a/.github/workflows/ubuntu_debug.yml b/.github/workflows/ubuntu_debug.yml index d8b45024..f769d006 100644 --- a/.github/workflows/ubuntu_debug.yml +++ b/.github/workflows/ubuntu_debug.yml @@ -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 @@ -183,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 @@ -201,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. @@ -245,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 @@ -258,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 + diff --git a/docker/Dockerfile_ubuntu_22.04_acescontainer b/docker/Dockerfile_ubuntu_22.04_acescontainer index d9f791e7..27249152 100644 --- a/docker/Dockerfile_ubuntu_22.04_acescontainer +++ b/docker/Dockerfile_ubuntu_22.04_acescontainer @@ -10,6 +10,8 @@ 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 diff --git a/resources/test/scripts/run_valgrind_aces_container.sh b/resources/test/scripts/run_valgrind_aces_container.sh new file mode 100644 index 00000000..79831841 --- /dev/null +++ b/resources/test/scripts/run_valgrind_aces_container.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -x +set -u + +# get initial path before changing it +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + +cd ./unittest/ctlrender + +valgrind -s --error-exitcode=1 --leak-check=full --track-origins=yes --show-leak-kinds=all ../../ctlrender/ctlrender -force -format aces -ctl ../../../unittest/ctlrender/unity.ctl ../../../unittest/ctlrender/colorbars_nuke_rgb_exr16.exr out.aces +test_18b_status=$? +test_18b_label="ctlrender-rgb-exr16-to-aces" + +# go back to initial path +cd $SCRIPTPATH + +# return valgrind exit codes +if [ $test_18b_status -eq 0 ] +then + echo "Success: valgrind detected no errors" + exit 0 +else + echo "Failure: valgrind detected errors" + + if [ $test_18b_status -ne 0 ] + then + echo "$test_18b_label: valgrind detected errors" + fi + + exit 1 +fi From 2cac873082ef5716ff8fcc54be6f1544c9fe881f Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:53:26 -0800 Subject: [PATCH 09/10] add aces container to address sanitizer CI --- .github/workflows/ubuntu_address_sanitizer.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ubuntu_address_sanitizer.yml b/.github/workflows/ubuntu_address_sanitizer.yml index c1314e7a..14024c5b 100644 --- a/.github/workflows/ubuntu_address_sanitizer.yml +++ b/.github/workflows/ubuntu_address_sanitizer.yml @@ -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 From 1aa86cef7cf992265a62d5bc3caca7247b9decfa Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Thu, 4 Jan 2024 08:46:19 -0800 Subject: [PATCH 10/10] clean up CMakeLists related to AcesContainer --- ctlrender/CMakeLists.txt | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index 4af81872..f1878a51 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -50,51 +50,27 @@ else() message( STATUS "TIFF not found, ctlrender will not support TIF files" ) endif() -#set(AcesContainer_DIR "/usr/local/lib/CMake/AcesContainer") -#25 0.685 CMake Warning at ctlrender/CMakeLists.txt:53 (find_package): -#25 0.685 By not providing "FindAcesContainer.cmake" in CMAKE_MODULE_PATH this -#25 0.685 project has asked CMake to find a package configuration file provided by -#25 0.685 "AcesContainer", but CMake did not find one. -#25 0.685 -#25 0.685 Could not find a package configuration file provided by "AcesContainer" -#25 0.685 with any of the following names: -#25 0.685 -#25 0.685 AcesContainerConfig.cmake -#25 0.685 acescontainer-config.cmake -#25 0.685 -#25 0.685 Add the installation prefix of "AcesContainer" to CMAKE_PREFIX_PATH or set -#25 0.685 "AcesContainer_DIR" to a directory containing one of the above files. If -#25 0.685 "AcesContainer" provides a separate development package or SDK, be sure it -#25 0.685 has been installed. -#set(CMAKE_MODULE_PATH "/usr/local/lib/CMake/AcesContainer;${CMAKE_MODULE_PATH}") -#set(AcesContainer_DIR "/usr/local/lib/CMake/AcesContainer") -#set(CMAKE_PREFIX_PATH "/usr/local/lib/CMake/AcesContainer;C:/Program Files (x86)/AcesContainer/CMake/;${CMAKE_PREFIX_PATH}") - find_package(AcesContainer) if( AcesContainer_FOUND ) - message( STATUS "find_package(AcesContainer) - AcesContainer_FOUND is true") - 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}" ) - + message( STATUS "find_package(AcesContainer) - AcesContainer_FOUND is true") else() - message( STATUS "DEBUG: find_package(AcesContainer) AcesContainer_FOUND is false") + 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}" ) -else() - message( STATUS "AcesContainer not found - TARGET AcesContainer::AcesContainer is false") -endif() -if( AcesContainer_FOUND OR TARGET AcesContainer::AcesContainer) target_compile_definitions(ctlrender PRIVATE -DHAVE_ACESFILE=1