From 727c904c3e0a8d8323805b7279599543e6a7cc53 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Fri, 23 Dec 2022 15:57:56 -0800 Subject: [PATCH 1/5] update CMake using cmake_refactor branch, add support for OpenExr3/Imath3 --- .gitattributes | 4 + .github/workflows/cmake_address_sanitizer.yml | 80 ++++-- .github/workflows/cmake_debug.yml | 6 +- .github/workflows/cmake_no_libtiff.yml | 2 +- .github/workflows/cmake_no_openexr.yml | 64 ----- .github/workflows/cmake_release.yml | 8 +- CMakeLists.txt | 161 +++++------ Dockerfile_openexr3 | 56 ++++ OpenEXR_CTL/CMakeLists.txt | 8 +- OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt | 23 +- OpenEXR_CTL/exrdpx/CMakeLists.txt | 23 +- cmake/modules/FindImath.cmake | 256 ++++++++++++++++++ configure.cmake | 58 ---- ctlrender/CMakeLists.txt | 95 ++++--- doc/CMakeLists.txt | 2 +- lib/CMakeLists.txt | 18 +- lib/IlmCtl/CMakeLists.txt | 76 ++++-- lib/IlmCtl/CtlInterpreter.cpp | 3 +- lib/IlmCtlMath/CMakeLists.txt | 61 +++-- lib/IlmCtlMath/CtlPointTree.h | 2 +- lib/IlmCtlSimd/CMakeLists.txt | 71 ++++- lib/IlmImfCtl/CMakeLists.txt | 46 +++- lib/dpx/CMakeLists.txt | 45 ++- unittest/CMakeLists.txt | 15 +- unittest/IlmCtl/CMakeLists.txt | 114 ++++---- unittest/IlmCtlMath/CMakeLists.txt | 34 +-- unittest/IlmImfCtl/CMakeLists.txt | 41 ++- unittest/ctlrender/CMakeLists.txt | 9 +- 28 files changed, 894 insertions(+), 487 deletions(-) create mode 100644 .gitattributes delete mode 100644 .github/workflows/cmake_no_openexr.yml create mode 100644 Dockerfile_openexr3 create mode 100644 cmake/modules/FindImath.cmake delete mode 100644 configure.cmake diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c70dace8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# use linux line-endings for everything except BAT and CMD files +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf diff --git a/.github/workflows/cmake_address_sanitizer.yml b/.github/workflows/cmake_address_sanitizer.yml index 61cd9e5d..7ab2668a 100644 --- a/.github/workflows/cmake_address_sanitizer.yml +++ b/.github/workflows/cmake_address_sanitizer.yml @@ -15,7 +15,7 @@ env: BUILD_TYPE: asan jobs: - test: + test-openexr2: # 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. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix @@ -49,21 +49,65 @@ jobs: cd ${{ github.workspace }} cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - name: Make and run unit tests + - name: Test working-directory: ${{github.workspace}}/build - run: make check - - - name: IlmCtlTest - if: always() - working-directory: ${{github.workspace}}/build/unittest/IlmCtl - run: ./IlmCtlTest - - - name: IlmCtlMath - if: always() - working-directory: ${{github.workspace}}/build/unittest/IlmCtlMath - run: ./IlmCtlMathTest - - - name: IlmImfCtl - if: always() - working-directory: ${{github.workspace}}/build/unittest/IlmImfCtl - run: ./IlmImfCtlTest + # 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 -C ${{env.BUILD_TYPE}} + + + + + test-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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install dependencies - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install dependencies - openexr v3.1 + run: | + cd .. + sudo apt-get -y install zlib1g-dev && + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-3.1 && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install libtiff + run: sudo apt-get install libtiff-dev -y + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: | + cd ${{ github.workspace }} + cmake --build ${{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 -C ${{env.BUILD_TYPE}} diff --git a/.github/workflows/cmake_debug.yml b/.github/workflows/cmake_debug.yml index f7525c5b..7ee372aa 100644 --- a/.github/workflows/cmake_debug.yml +++ b/.github/workflows/cmake_debug.yml @@ -94,9 +94,9 @@ 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: Make unit tests + # working-directory: ${{github.workspace}}/build + # run: make check - name: Run Valgrind on unit tests working-directory: ${{github.workspace}}/build diff --git a/.github/workflows/cmake_no_libtiff.yml b/.github/workflows/cmake_no_libtiff.yml index 205b7482..0cade7b4 100644 --- a/.github/workflows/cmake_no_libtiff.yml +++ b/.github/workflows/cmake_no_libtiff.yml @@ -65,4 +65,4 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: sudo make check + run: ctest -V diff --git a/.github/workflows/cmake_no_openexr.yml b/.github/workflows/cmake_no_openexr.yml deleted file mode 100644 index 46f8b9c7..00000000 --- a/.github/workflows/cmake_no_openexr.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CMake - No OpenEXR - -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: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - name: remove openexr - run: sudo apt-get --purge remove libopenexr-dev -y - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - test: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - name: remove openexr - run: sudo apt-get --purge remove libopenexr-dev -y - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: make check diff --git a/.github/workflows/cmake_release.yml b/.github/workflows/cmake_release.yml index ae7ea986..d1382f85 100644 --- a/.github/workflows/cmake_release.yml +++ b/.github/workflows/cmake_release.yml @@ -55,7 +55,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: make check + run: ctest -V valgrind: # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. @@ -94,9 +94,9 @@ 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: Make unit tests + # working-directory: ${{github.workspace}}/build + # run: make check - name: Run Valgrind on unit tests working-directory: ${{github.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f910fb4..68f1f6fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,93 +1,100 @@ -cmake_minimum_required(VERSION 2.8) -project( CTL ) +cmake_minimum_required(VERSION 3.1) +project(CTL VERSION 1.5.2) +enable_testing() +include(GNUInstallDirs) -set( CTL_MAJOR_VERSION 1 ) -set( CTL_MINOR_VERSION 5 ) -set( CTL_PATCH_VERSION 0 ) -set( CTL_VERSION ${CTL_MAJOR_VERSION}.${CTL_MINOR_VERSION}.${CTL_PATCH_VERSION} ) +set(CMAKE_MODULE_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" + ${CMAKE_MODULE_PATH} +) -## Make install directories overrideable -set( INSTALL_LIB_DIR lib CACHE PATH "Install directory for libraries" ) -set( INSTALL_BIN_DIR bin CACHE PATH "Install directory for executable binaries" ) -set( INSTALL_INCLUDE_DIR include CACHE PATH "Install directory for public header files" ) -set( INSTALL_DOC_DIR doc CACHE PATH "Install directory for documentation" ) -if( WIN32 AND NOT CYGWIN ) - set(DEF_INSTALL_CMAKE_DIR CMake) -else() - set(DEF_INSTALL_CMAKE_DIR lib/CMake/CTL) -endif() -set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Install directory for project CMake files" ) +add_definitions( -DPACKAGE="${PROJECT_NAME}" -DVERSION="${PROJECT_VERSION}" ) -# use, i.e. don't skip the full RPATH for the build tree -SET(CMAKE_SKIP_BUILD_RPATH FALSE) -# when building, don't use the install RPATH already -# (but later on when installing) -SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -# add the automatically determined parts of the RPATH -# which point to directories outside the build tree to the install RPATH -SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -# the RPATH to be used when installing, but only if it's not a system directory -LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) -IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -ENDIF("${isSystemDir}" STREQUAL "-1") +option(CTL_BUILD_TESTS "Build the unit tests" ON) +option(CTL_BUILD_TOOLS "Build the utility commands (ctlrender, etc)" ON) set(CMAKE_CXX_FLAGS_ASAN - "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" - CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds." - FORCE) - -## convert install paths to absolute -foreach( p LIB BIN INCLUDE CMAKE DOC) - set( var INSTALL_${p}_DIR ) - if( NOT IS_ABSOLUTE "${${var}}" ) - set( ${var} "${CMAKE_INSTALL_PREFIX}/${${var}}" ) - endif() -endforeach() - -option(ENABLE_SHARED "Enable Shared Libraries" ON) + "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" + CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds." + FORCE) -if ( ENABLE_SHARED ) -set( DO_SHARED SHARED ) +if( NOT DEFINED CMAKE_BUILD_TYPE ) + MESSAGE( STATUS "To use AddressSanitizer, use \"cmake .. -DCMAKE_BUILD_TYPE=asan\"" ) +elseif( CMAKE_BUILD_TYPE STREQUAL "asan" ) + MESSAGE( STATUS "Using AddressSanitizer - CMAKE_BUILD_TYPE : \"${CMAKE_BUILD_TYPE}\"") else() -set( DO_SHARED STATIC ) + MESSAGE( STATUS "CMAKE_BUILD_TYPE : \"${CMAKE_BUILD_TYPE}\"") + MESSAGE( STATUS "To use AddressSanitizer, use \"cmake .. -DCMAKE_BUILD_TYPE=asan\"" ) endif() -# Find packages and set up global settings -include( configure.cmake ) +find_package(Imath CONFIG) -# generated config files end up in binary dir so to find them, need -# to add to include path -include_directories( "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}" ) -# implement find library stuff... +if (NOT TARGET Imath::Imath) + message( STATUS " Couldn't find Imath::Imath, maybe it's older and has IlmBase?") + find_package(IlmBase CONFIG) + if(NOT IlmBase_FOUND) + message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)") + find_package(IlmBase QUIET) + endif() + if( IlmBase_FOUND) + message( STATUS "found IlmBase, version ${IlmBase_VERSION}" ) + else() + message( SEND_ERROR "IlmBase not found, please set the include and library paths manually" ) + endif() +else() + message( STATUS "found Imath, version ${Imath_VERSION}" ) + message( STATUS " Imath_FOUND : ${Imath_FOUND}" ) + message( STATUS " Imath_LIBRARY : ${Imath_LIBRARY}" ) + message( STATUS " Imath_INCLUDE_DIR : ${Imath_INCLUDE_DIR}" ) + #find_package(IlmBase CONFIG) + #if(NOT IlmBase_FOUND) + # message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)") + # find_package(IlmBase QUIET) + #endif() + #if( IlmBase_FOUND) + # message( STATUS "found IlmBase, version ${IlmBase_VERSION}" ) + #endif() +endif () -add_definitions( -DPACKAGE="CTL" -DVERSION="${CTL_VERSION}" ) -add_subdirectory(doc) -add_subdirectory(lib) -add_subdirectory(ctlrender) -add_subdirectory(OpenEXR_CTL) -add_subdirectory(unittest EXCLUDE_FROM_ALL) +if(IlmBase_FOUND) + message( STATUS "IlmBase_INCLUDE_DIR : ${IlmBase_INCLUDE_DIR}" ) + #find_package(OpenEXR QUIET CONFIG) + find_package(OpenEXR CONFIG) + if(NOT OpenEXR_FOUND) + message( STATUS " Couldn't find OpenEXR with find_package(OpenEXR CONFIG), trying find_package(OpenEXR QUIET)") + find_package(OpenEXR QUIET) + endif() +else() + find_package(OpenEXR QUIET CONFIG REQUIRED) + if(${OpenEXR_VERSION} VERSION_GREATER_EQUAL 3.0) + message( STATUS " IlmBase not found and OpenEXR_VERSION: ${OpenEXR_VERSION} is greater than or equal to 3.0, we don't need IlmBase") + else() + message( STATUS " IlmBase not found and OpenEXR_VERSION: ${OpenEXR_VERSION} is not greater than or equal to 3.0, we need IlmBase") + find_package(IlmBase CONFIG) + if(NOT IlmBase_FOUND) + message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)") + find_package(IlmBase QUIET) + endif() + if( IlmBase_FOUND) + message( STATUS "found IlmBase, version ${IlmBase_VERSION}" ) + endif() + endif() +endif() -# Add all targets to the build-tree export set -export( TARGETS IlmCtl IlmCtlMath IlmCtlSimd FILE "${PROJECT_BINARY_DIR}/CTLLibraryDepends.cmake" ) -export(PACKAGE CTL) - -# Create a CTLBuildTreeSettings.cmake file for the use from the build tree -file(RELATIVE_PATH CONF_REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") -configure_file(config/CTLBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CTLBuildTreeSettings.cmake" @ONLY) -configure_file(config/CTLConfig.cmake.in "${PROJECT_BINARY_DIR}/CTLConfig.cmake" @ONLY) -configure_file(config/CTLConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CTLConfigVersion.cmake" @ONLY) +if( OpenEXR_FOUND ) + message( STATUS "found OpenEXR, version ${OpenEXR_VERSION}" ) +else() + message( SEND_ERROR "OpenEXR not found, this is a required dependency" ) +endif() -if ( PKG_CONFIG_FOUND ) -configure_file(config/CTL.pc.in "${PROJECT_BINARY_DIR}/CTL.pc" @ONLY) -install( FILES "${PROJECT_BINARY_DIR}/CTL.pc" DESTINATION lib/pkgconfig COMPONENT dev ) +add_subdirectory(lib) +add_subdirectory(doc) +if (CTL_BUILD_TOOLS) + add_subdirectory(ctlrender) + add_subdirectory(OpenEXR_CTL) endif() -install( FILES - "${PROJECT_BINARY_DIR}/CTLConfig.cmake" - "${PROJECT_BINARY_DIR}/CTLConfigVersion.cmake" - DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev) -install(FILES "${PROJECT_BINARY_DIR}/CTLLibraryDepends.cmake" DESTINATION - "${INSTALL_CMAKE_DIR}" COMPONENT dev) +if (CTL_BUILD_TESTS) + add_subdirectory(unittest) +endif() diff --git a/Dockerfile_openexr3 b/Dockerfile_openexr3 new file mode 100644 index 00000000..2fd496ac --- /dev/null +++ b/Dockerfile_openexr3 @@ -0,0 +1,56 @@ +FROM ubuntu:focal + +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 developement debugging tools +RUN apt-get -y install valgrind + +# install CTL dependencies +#RUN apt-get -y install libilmbase-dev +#RUN apt-get -y install libopenexr-dev +#RUN apt-get -y install zlib1g-dev + +WORKDIR /usr/src/ +RUN git clone https://github.com/madler/zlib.git +WORKDIR /usr/src/zlib/build +RUN cmake .. +RUN make +RUN make install + +WORKDIR /usr/src/ +RUN git clone https://github.com/AcademySoftwareFoundation/Imath.git +WORKDIR /usr/src/Imath/build +RUN cmake .. +RUN make +RUN make install + +WORKDIR /usr/src/ +RUN git clone https://github.com/AcademySoftwareFoundation/openexr.git +WORKDIR /usr/src/openexr +RUN git checkout RB-3.1 +WORKDIR /usr/src/openexr/build +RUN cmake .. +RUN make +RUN make install + +RUN apt-get -y install libtiff-dev + +# 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/OpenEXR_CTL/CMakeLists.txt b/OpenEXR_CTL/CMakeLists.txt index c1ca53ef..9b7b5c22 100644 --- a/OpenEXR_CTL/CMakeLists.txt +++ b/OpenEXR_CTL/CMakeLists.txt @@ -1,8 +1,8 @@ if ( NOT OpenEXR_FOUND ) -message(WARNING "OpenEXR not found, Skipping OpenEXR_CTL") -return() + message(WARNING "OpenEXR not found, Skipping OpenEXR_CTL") + return() endif() add_subdirectory( CtlModules ) @@ -12,8 +12,8 @@ add_subdirectory( exr_ctl_exr ) add_custom_target( OpenEXR_CTL DEPENDS CtlModules exrdpx exr_ctl_exr ) if ( PKG_CONFIG_FOUND ) -configure_file(../config/OpenEXR_CTL.pc.in "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" @ONLY) -install( FILES "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" DESTINATION lib/pkgconfig COMPONENT dev ) + configure_file(../config/OpenEXR_CTL.pc.in "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" @ONLY) + install( FILES "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" DESTINATION lib/pkgconfig COMPONENT dev ) endif() # TODO CMake config diff --git a/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt b/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt index e396ec5a..e4a414e3 100644 --- a/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt +++ b/OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt @@ -16,9 +16,26 @@ add_executable( exr_ctl_exr main.cpp ) -target_link_libraries( exr_ctl_exr IlmCtlSimd IlmCtlMath IlmCtl IlmImfCtl ) -target_link_libraries( exr_ctl_exr ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) -target_link_libraries( exr_ctl_exr ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) +#target_link_libraries( exr_ctl_exr IlmCtlSimd IlmCtlMath IlmCtl IlmImfCtl ) +target_link_libraries (exr_ctl_exr + PRIVATE + IlmCtlSimd + IlmCtlMath + IlmCtl + IlmImfCtl + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + $<$:Imath::Imath> + $<$:Imath::Half> + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> + $<$:IlmBase::Imath> + $<$:IlmBase::Half> + $<$:IlmBase::IlmThread> + $<$:IlmBase::Iex> + ) +#target_link_libraries( exr_ctl_exr ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) +#target_link_libraries( exr_ctl_exr ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) install( TARGETS exr_ctl_exr DESTINATION ${INSTALL_BIN_DIR} ) diff --git a/OpenEXR_CTL/exrdpx/CMakeLists.txt b/OpenEXR_CTL/exrdpx/CMakeLists.txt index 50bd116e..8099d4a4 100644 --- a/OpenEXR_CTL/exrdpx/CMakeLists.txt +++ b/OpenEXR_CTL/exrdpx/CMakeLists.txt @@ -16,9 +16,26 @@ add_executable( exrdpx main.cpp ) -target_link_libraries( exrdpx IlmCtlSimd IlmCtlMath IlmCtl IlmImfCtl ) -target_link_libraries( exrdpx ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) -target_link_libraries( exrdpx ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) +#target_link_libraries( exrdpx IlmCtlSimd IlmCtlMath IlmCtl IlmImfCtl ) +target_link_libraries (exrdpx + PRIVATE + IlmCtlSimd + IlmCtlMath + IlmCtl + IlmImfCtl + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + $<$:Imath::Imath> + $<$:Imath::Half> + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> + $<$:IlmBase::Imath> + $<$:IlmBase::Half> + $<$:IlmBase::IlmThread> + $<$:IlmBase::Iex> + ) +#target_link_libraries( exrdpx ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) +#target_link_libraries( exrdpx ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} ) install( TARGETS exrdpx DESTINATION ${INSTALL_BIN_DIR} ) diff --git a/cmake/modules/FindImath.cmake b/cmake/modules/FindImath.cmake new file mode 100644 index 00000000..dfb05675 --- /dev/null +++ b/cmake/modules/FindImath.cmake @@ -0,0 +1,256 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright Contributors to the OpenColorIO Project. +# +# Locate or install Imath +# +# Variables defined by this module: +# Imath_FOUND - If FALSE, do not try to link to ilmbase +# Imath_LIBRARY - Imath library to link to +# Imath_INCLUDE_DIR - Where to find ImathConfig.h +# Imath_VERSION - The version of the library +# +# Targets defined by this module: +# Imath::Imath - IMPORTED target, if found +# +# By default, the dynamic libraries of Imath will be found. To find the +# static ones instead, you must set the Imath_STATIC_LIBRARY variable to +# TRUE before calling find_package(Imath ...). +# +# If Imath is not installed in a standard path, you can use the +# Imath_ROOT variable to tell CMake where to find it. If it is not found +# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, Imath will be +# downloaded, built, and statically-linked into libOpenColorIO at build time. +# + +############################################################################### +### Try to find package ### + +#if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL) + set(_Imath_REQUIRED_VARS Imath_LIBRARY) + set(_Imath_LIB_VER "${Imath_FIND_VERSION_MAJOR}_${Imath_FIND_VERSION_MINOR}") + + if(NOT DEFINED Imath_ROOT) + # Search for ImathConfig.cmake + find_package(Imath ${Imath_FIND_VERSION} CONFIG QUIET) + endif() + + if(Imath_FOUND) + get_target_property(Imath_LIBRARY Imath::Imath LOCATION) + else() + list(APPEND _Imath_REQUIRED_VARS Imath_INCLUDE_DIR) + + # Search for Imath.pc + find_package(PkgConfig QUIET) + pkg_check_modules(PC_Imath QUIET "Imath>=${Imath_FIND_VERSION}") + + # Find include directory + find_path(Imath_INCLUDE_DIR + NAMES + Imath/ImathConfig.h + HINTS + ${Imath_ROOT} + ${PC_Imath_INCLUDE_DIRS} + PATH_SUFFIXES + include + ) + + # Lib names to search for + set(_Imath_LIB_NAMES "Imath-${_Imath_LIB_VER}" Imath) + if(BUILD_TYPE_DEBUG) + # Prefer Debug lib names + list(INSERT _Imath_LIB_NAMES 0 "Imath-${_Imath_LIB_VER}_d") + endif() + + if(Imath_STATIC_LIBRARY) + # Prefer static lib names + set(_Imath_STATIC_LIB_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}Imath-${_Imath_LIB_VER}${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${CMAKE_STATIC_LIBRARY_PREFIX}Imath${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + if(BUILD_TYPE_DEBUG) + # Prefer static Debug lib names + list(INSERT _Imath_STATIC_LIB_NAMES 0 + "${CMAKE_STATIC_LIBRARY_PREFIX}Imath-${_Imath_LIB_VER}_d${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif() + endif() + + # Find library + find_library(Imath_LIBRARY + NAMES + ${_Imath_STATIC_LIB_NAMES} + ${_Imath_LIB_NAMES} + HINTS + ${Imath_ROOT} + ${PC_Imath_LIBRARY_DIRS} + PATH_SUFFIXES + lib64 lib + ) + + # Get version from config header file + if(Imath_INCLUDE_DIR) + if(EXISTS "${Imath_INCLUDE_DIR}/Imath/ImathConfig.h") + set(_Imath_CONFIG "${Imath_INCLUDE_DIR}/Imath/ImathConfig.h") + endif() + endif() + + if(_Imath_CONFIG) + file(STRINGS "${_Imath_CONFIG}" _Imath_VER_SEARCH + REGEX "^[ \t]*#define[ \t]+IMATH_VERSION_STRING[ \t]+\"[.0-9]+\".*$") + if(_Imath_VER_SEARCH) + string(REGEX REPLACE ".*#define[ \t]+IMATH_VERSION_STRING[ \t]+\"([.0-9]+)\".*" + "\\1" Imath_VERSION "${_Imath_VER_SEARCH}") + endif() + elseif(PC_Imath_FOUND) + set(Imath_VERSION "${PC_Imath_VERSION}") + endif() + endif() + + # Override REQUIRED if package can be installed + #if(OCIO_INSTALL_EXT_PACKAGES STREQUAL MISSING) + set(Imath_FIND_REQUIRED FALSE) + # endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Imath + REQUIRED_VARS + ${_Imath_REQUIRED_VARS} + VERSION_VAR + Imath_VERSION + ) +#endif() + +############################################################################### +### Create target + +if (NOT TARGET Imath::Imath) + add_library(Imath::Imath UNKNOWN IMPORTED GLOBAL) + add_library(Imath::ImathConfig INTERFACE IMPORTED GLOBAL) + set(_Imath_TARGET_CREATE TRUE) +endif() + +############################################################################### +### Install package from source ### + +if(NOT Imath_FOUND AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE) + include(ExternalProject) + include(GNUInstallDirs) + + set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist") + set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build") + + # Set find_package standard args + set(Imath_FOUND TRUE) + if(_Imath_ExternalProject_VERSION) + set(Imath_VERSION ${_Imath_ExternalProject_VERSION}) + else() + set(Imath_VERSION ${Imath_FIND_VERSION}) + endif() + set(Imath_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}") + + # Set the expected library name + if(BUILD_TYPE_DEBUG) + set(_Imath_LIB_SUFFIX "_d") + endif() + + include(VersionUtils) + split_version_string(${Imath_VERSION} _Imath_ExternalProject) + + set(_Imath_LIB_VER "${_Imath_ExternalProject_VERSION_MAJOR}_${_Imath_ExternalProject_VERSION_MINOR}") + + set(Imath_LIBRARY + "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Imath-${_Imath_LIB_VER}${_Imath_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + + if(_Imath_TARGET_CREATE) + if(MSVC) + set(Imath_CXX_FLAGS "${Imath_CXX_FLAGS} /EHsc") + endif() + + string(STRIP "${Imath_CXX_FLAGS}" Imath_CXX_FLAGS) + + set(Imath_CMAKE_ARGS + ${Imath_CMAKE_ARGS} + -DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET} + -DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_CXX_FLAGS=${Imath_CXX_FLAGS} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE} + -DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT} + -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} + -DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX} + -DBUILD_SHARED_LIBS=OFF + -DBUILD_TESTING=OFF + -DPYTHON=OFF + -DDOCS=OFF + -DIMATH_HALF_USE_LOOKUP_TABLE=OFF + ) + + if(CMAKE_TOOLCHAIN_FILE) + set(Imath_CMAKE_ARGS + ${Imath_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() + + if(APPLE) + string(REPLACE ";" "$" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") + + set(Imath_CMAKE_ARGS + ${Imath_CMAKE_ARGS} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + -DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES} + ) + endif() + + if (ANDROID) + set(Imath_CMAKE_ARGS + ${Imath_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + + # Hack to let imported target be built from ExternalProject_Add + file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR}) + + ExternalProject_Add(imath_install + GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath.git" + GIT_TAG "v${Imath_VERSION}" + GIT_CONFIG advice.detachedHead=false + GIT_SHALLOW TRUE + PREFIX "${_EXT_BUILD_ROOT}/Imath" + BUILD_BYPRODUCTS ${Imath_LIBRARY} + CMAKE_ARGS ${Imath_CMAKE_ARGS} + EXCLUDE_FROM_ALL TRUE + BUILD_COMMAND "" + INSTALL_COMMAND + ${CMAKE_COMMAND} --build . + --config ${CMAKE_BUILD_TYPE} + --target install + --parallel + ) + + add_dependencies(Imath::Imath imath_install) + + message(STATUS "Installing Imath: ${Imath_LIBRARY} (version \"${Imath_VERSION}\")") + endif() +endif() + +############################################################################### +### Configure target ### + +if(_Imath_TARGET_CREATE) + file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR}/Imath) + + set_target_properties(Imath::Imath PROPERTIES + IMPORTED_LOCATION ${Imath_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES "${Imath_INCLUDE_DIR};${Imath_INCLUDE_DIR}/Imath" + ) + set_target_properties(Imath::ImathConfig PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Imath_INCLUDE_DIR};${Imath_INCLUDE_DIR}/Imath" + ) + + mark_as_advanced(Imath_INCLUDE_DIR Imath_LIBRARY Imath_VERSION) +endif() diff --git a/configure.cmake b/configure.cmake deleted file mode 100644 index 1817071f..00000000 --- a/configure.cmake +++ /dev/null @@ -1,58 +0,0 @@ -# Until we get some of these modules into the upstream packages, put them here -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/CMake") - -find_package( PkgConfig QUIET ) - -find_package( IlmBase QUIET ) -if(IlmBase_FOUND) - message( STATUS "found IlmBase, version ${IlmBase_VERSION}" ) - ### - ### Everyone (well, except for DPX) uses IlmBase, so - ### make that a global setting - ### - include_directories( ${IlmBase_INCLUDE_DIRS} ) - link_directories( ${IlmBase_LIBRARY_DIRS} ) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IlmBase_CFLAGS}" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IlmBase_CFLAGS}" ) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${IlmBase_LDFLAGS}" ) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${IlmBase_LDFLAGS}" ) - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${IlmBase_LDFLAGS}" ) -else() - message( SEND_ERROR "IlmBase not found, please set the include and library paths manually" ) -endif() - -find_package( TIFF QUIET ) -if (TIFF_FOUND) - message( STATUS "found TIFF, version ${TIFF_VERSION_STRING}" ) - # Make the variables the same as if pkg-config finds them - set(TIFF_INCLUDE_DIRS ${TIFF_INCLUDE_DIR}) - set(TIFF_LIBRARY_DIR ${TIFF_LIBRARY}) -else() - if ( PKG_CONFIG_FOUND ) - pkg_search_module( TIFF libtiff libtiff-4 ) - if (TIFF_FOUND) - message( STATUS "found TIFF via pkg-config, version ${TIFF_VERSION}" ) - endif() - else() - message( WARNING "Unable to find TIFF libraries, disabling" ) - endif() -endif() - -find_package( OpenEXR QUIET ) -if (OpenEXR_FOUND) - message( STATUS "Found OpenEXR, version ${OpenEXR_VERSION}" ) -else() - message( WARNING "Unable to find OpenEXR libraries, disabling" ) -endif() - -find_package( AcesContainer ) -if (AcesContainer_FOUND) - message( STATUS "Found AcesContainer, version ${AcesContainer_VERSION}" ) -else() - if ( PKG_CONFIG_FOUND ) - pkg_check_modules( AcesContainer AcesContainer ) - else() - message( WARNING "Unable to find AcesContainer libraries, disabling" ) - endif() -endif() diff --git a/ctlrender/CMakeLists.txt b/ctlrender/CMakeLists.txt index 9fced147..b080e127 100644 --- a/ctlrender/CMakeLists.txt +++ b/ctlrender/CMakeLists.txt @@ -1,49 +1,56 @@ - -if (TIFF_FOUND) -add_definitions( -DHAVE_LIBTIFF=1 ) -include_directories( ${TIFF_INCLUDE_DIRS} ) -link_directories( ${TIFF_LIBRARY_DIRS} ) -endif() - -if ( OpenEXR_FOUND ) -add_definitions( -DHAVE_OPENEXR=1 ) -include_directories( ${OpenEXR_INCLUDE_DIRS} ) -link_directories( ${OpenEXR_LIBRARY_DIRS} ) -endif() - -if ( AcesContainer_FOUND ) -add_definitions( -DHAVE_ACESFILE=1 ) -include_directories( ${AcesContainer_INCLUDE_DIRS} ) -link_directories( ${AcesContainer_LIBRARY_DIRS} ) -endif() - -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/lib/IlmCtl" "${PROJECT_SOURCE_DIR}/lib/IlmCtlMath" "${PROJECT_SOURCE_DIR}/lib/IlmCtlSimd" "${PROJECT_SOURCE_DIR}/lib/dpx" ) - -add_executable( ctlrender - main.cc - transform.cc - usage.cc - aces_file.cc - dpx_file.cc - exr_file.cc - tiff_file.cc - format.cc - compression.cc +set(SOURCES + main.cc + transform.cc + usage.cc + aces_file.cc + dpx_file.cc + exr_file.cc + tiff_file.cc + format.cc + compression.cc +) +add_executable(ctlrender ${SOURCES}) +target_include_directories(ctlrender + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) +target_link_libraries(ctlrender + PRIVATE + IlmCtlSimd + IlmCtlMath + IlmCtl + ctldpx + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> ) -target_link_libraries( ctlrender IlmCtlSimd IlmCtlMath IlmCtl ctldpx ${IlmBase_LIBRARIES} ) -target_link_libraries( ctlrender ${IlmBase_LDFLAGS_OTHER} ) -if (TIFF_FOUND) -target_link_libraries( ctlrender ${TIFF_LIBRARIES} ) -target_link_libraries( ctlrender ${TIFF_LDFLAGS_OTHER} ) -endif() -if (OpenEXR_FOUND) -target_link_libraries( ctlrender ${OpenEXR_LIBRARIES} ) -target_link_libraries( ctlrender ${OpenEXR_LDFLAGS_OTHER} ) +find_package(TIFF) +if(TARGET TIFF::TIFF) + message( STATUS "found TIFF, TIFF_LIBRARIES : ${TIFF_LIBRARIES}" ) + target_compile_definitions(ctlrender + PRIVATE + -DHAVE_LIBTIFF=1 + ) + target_link_libraries(ctlrender + PRIVATE + TIFF::TIFF + ) +else() + message( STATUS "TIFF not found" ) endif() -if (AcesContainer_FOUND) -target_link_libraries( ctlrender ${AcesContainer_LIBRARIES} ) -target_link_libraries( ctlrender ${AcesContainer_LDFLAGS_OTHER} ) + +find_package(AcesContainer) +if (TARGET AcesContainer::AcesContainer) + target_compile_definitions(ctlrender + PRIVATE + -DHAVE_ACESFILE=1 + ) + target_link_libraries(ctlrender + PRIVATE + AcesContainer::AcesContainer + ) endif() -install( TARGETS ctlrender DESTINATION bin ) +install(TARGETS ctlrender DESTINATION ${CMAKE_INSTALL_BINDDIR}) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 0b123d03..0e448a57 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1 +1 @@ -install( FILES CtlManual.pdf CtlManual.doc DESTINATION doc/CTL ) +install( FILES CtlManual.pdf CtlManual.doc DESTINATION ${CMAKE_INSTALL_DOCDIR}/CTL ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index bb19a9ba..ddfdc8cb 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,13 +1,5 @@ -add_subdirectory( IlmCtl ) -add_subdirectory( IlmCtlMath ) -add_subdirectory( IlmCtlSimd ) - -if ( OpenEXR_FOUND ) -add_subdirectory( IlmImfCtl ) -endif() - -add_subdirectory( dpx ) - -add_custom_target( CTL DEPENDS IlmCtl IlmCtlMath IlmCtlSimd ) - -### TODO: Add install, pkgconfig stuff +add_subdirectory(IlmCtl) +add_subdirectory(IlmCtlMath) +add_subdirectory(IlmCtlSimd) +add_subdirectory(IlmImfCtl) +add_subdirectory(dpx) diff --git a/lib/IlmCtl/CMakeLists.txt b/lib/IlmCtl/CMakeLists.txt index 3672a431..f99062b5 100644 --- a/lib/IlmCtl/CMakeLists.txt +++ b/lib/IlmCtl/CMakeLists.txt @@ -1,32 +1,52 @@ -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" ) +set(SOURCES + CtlAddr.cpp + CtlAlign.cpp + CtlExc.cpp + CtlFunctionCall.cpp + CtlInterpreter.cpp + CtlLContext.cpp + CtlLex.cpp + CtlMessage.cpp + CtlModule.cpp + CtlModuleSet.cpp + CtlParser.cpp + CtlRcPtr.cpp + CtlSymbolTable.cpp + CtlSyntaxTree.cpp + CtlTokens.cpp + CtlType.cpp + CtlTypeStorage.cpp + CtlStdType.cpp +) + +add_library(IlmCtl ${SOURCES}) -add_library( IlmCtl ${DO_SHARED} - CtlAddr.cpp - CtlAlign.cpp - CtlExc.cpp - CtlFunctionCall.cpp - CtlInterpreter.cpp - CtlLContext.cpp - CtlLex.cpp - CtlMessage.cpp - CtlModule.cpp - CtlModuleSet.cpp - CtlParser.cpp - CtlRcPtr.cpp - CtlSymbolTable.cpp - CtlSyntaxTree.cpp - CtlTokens.cpp - CtlType.cpp - CtlTypeStorage.cpp - CtlStdType.cpp +target_include_directories(IlmCtl + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_libraries( IlmCtl ${IlmBase_LDFLAGS_OTHER} ) -target_link_libraries( IlmCtl Iex IlmThread Half ) +if( IlmBase_FOUND ) + target_link_libraries (IlmCtl + PRIVATE + # For OpenEXR 2.4/2.5: + $<$:IlmBase::Half> + $<$:IlmBase::IlmThread> + $<$:IlmBase::Iex> + ) +else() + target_link_libraries (IlmCtl + PRIVATE + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + $<$:Imath::Half> + ) +endif() -set_target_properties( IlmCtl PROPERTIES - VERSION ${CTL_VERSION} - SOVERSION ${CTL_VERSION} +set_target_properties(IlmCtl + PROPERTIES + VERSION ${CTL_VERSION} + SOVERSION ${CTL_VERSION} ) install( FILES @@ -48,6 +68,8 @@ install( FILES CtlTypeStorage.h CtlStdType.h CtlVersion.h - DESTINATION include/CTL ) +DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/CTL +) -install( TARGETS IlmCtl DESTINATION lib ) +install(TARGETS IlmCtl DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/lib/IlmCtl/CtlInterpreter.cpp b/lib/IlmCtl/CtlInterpreter.cpp index f22058e7..765b888b 100755 --- a/lib/IlmCtl/CtlInterpreter.cpp +++ b/lib/IlmCtl/CtlInterpreter.cpp @@ -413,8 +413,9 @@ void Interpreter::loadFile(const std::string &fileName, if(_moduleName.size()==0) { // This might have unintended consequences... memset(random, 0, sizeof(random)); + long r = static_cast(rand()) << (sizeof(int)*8) | rand(); snprintf(random, sizeof(random)-1, "module.%08x", - (unsigned int)(time(NULL)+lrand48())); + (unsigned int)(time(NULL)+r)); moduleName=random; } else { moduleName=_moduleName; diff --git a/lib/IlmCtlMath/CMakeLists.txt b/lib/IlmCtlMath/CMakeLists.txt index fc78c5d7..925d5a75 100644 --- a/lib/IlmCtlMath/CMakeLists.txt +++ b/lib/IlmCtlMath/CMakeLists.txt @@ -1,26 +1,49 @@ -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/lib/IlmCtl" ) - -add_library( IlmCtlMath ${DO_SHARED} - CtlColorSpace.cpp - CtlLookupTable.cpp - CtlRbfInterpolator.cpp +set(SOURCES + CtlColorSpace.cpp + CtlLookupTable.cpp + CtlRbfInterpolator.cpp ) -target_link_libraries( IlmCtlMath IlmCtl ) -target_link_libraries( IlmCtlMath Imath ) +add_library(IlmCtlMath ${SOURCES}) -set_target_properties( IlmCtlMath PROPERTIES - VERSION ${CTL_VERSION} - SOVERSION ${CTL_VERSION} +target_include_directories(IlmCtlMath + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} ) -install( FILES - CtlColorSpace.h - CtlLookupTable.h - CtlRbfInterpolator.h - CtlSparseMatrix.h - DESTINATION include/CTL ) +if(IlmBase_FOUND) + target_link_libraries(IlmCtlMath + PUBLIC + IlmCtl + PUBLIC + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> + $<$:IlmBase::Imath> + ) +else() + target_link_libraries(IlmCtlMath + PUBLIC + IlmCtl + PUBLIC + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + $<$:Imath::Imath> + ) +endif() + +set_target_properties(IlmCtlMath + PROPERTIES + VERSION ${CTL_VERSION} + SOVERSION ${CTL_VERSION} +) -install( TARGETS IlmCtlMath DESTINATION lib ) +install(FILES + CtlColorSpace.h + CtlLookupTable.h + CtlRbfInterpolator.h + CtlSparseMatrix.h +DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/CTL +) -# TODO Add Imath and Iex libadd dependency and version info +install(TARGETS IlmCtlMath DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/lib/IlmCtlMath/CtlPointTree.h b/lib/IlmCtlMath/CtlPointTree.h index a604c9f9..4c143579 100644 --- a/lib/IlmCtlMath/CtlPointTree.h +++ b/lib/IlmCtlMath/CtlPointTree.h @@ -181,7 +181,7 @@ class PointTree double bl = (_points[b] - _center).length2(); volatile double delta = fabs (al - bl); - const double eps = 2.0 * Imath::limits::epsilon(); + const double eps = 2.0 * std::numeric_limits::epsilon(); // // Impose strict weak ordering... if the lengths are the same, diff --git a/lib/IlmCtlSimd/CMakeLists.txt b/lib/IlmCtlSimd/CMakeLists.txt index 2ba792a2..c62e362f 100644 --- a/lib/IlmCtlSimd/CMakeLists.txt +++ b/lib/IlmCtlSimd/CMakeLists.txt @@ -1,15 +1,40 @@ -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/lib/IlmCtl" "${PROJECT_SOURCE_DIR}/lib/IlmCtlMath" ) +# Build the halfExpLogTable.h file +#add_executable(halfExpLogTable halfExpLogTable.cpp) +#if(IlmBase_FOUND) +# target_link_libraries(halfExpLogTable +# PUBLIC +# # For OpenEXR 2.4/2.5: +# $<$:IlmBase::Imath> +# $<$:IlmBase::Half> +# ) +#else() +# target_link_libraries(halfExpLogTable +# PUBLIC +# # For OpenEXR/Imath 3.x: +# $<$:Imath::Imath> +# $<$:Imath::Half> +# ) +#endif() -add_executable( halfExpLogTable halfExpLogTable.cpp ) -target_link_libraries( halfExpLogTable Half ) +#target_link_libraries(halfExpLogTable +# PUBLIC +# # For OpenEXR/Imath 3.x: +# $<$:Imath::Imath> +# $<$:Imath::Half> +# # For OpenEXR 2.4/2.5: +# $<$:IlmBase::Imath> +# $<$:IlmBase::Half> +#) -add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/halfExpLogTable.h" - COMMAND halfExpLogTable "${CMAKE_CURRENT_BINARY_DIR}/halfExpLogTable.h" "${CMAKE_CURRENT_BINARY_DIR}/halfExpLog.h" - DEPENDS halfExpLogTable ) +#set(HALF_TABLE "${CMAKE_CURRENT_BINARY_DIR}/halfExpLogTable.h") +#set(HALF_EXPFUNCS "${CMAKE_CURRENT_BINARY_DIR}/halfExpLog.h") -include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ) +#add_custom_command( OUTPUT "${HALF_TABLE}" "${HALF_EXPFUNCS}" +# COMMAND halfExpLogTable "${HALF_TABLE}" "${HALF_EXPFUNCS}" +# DEPENDS halfExpLogTable +#) -add_library( IlmCtlSimd ${DO_SHARED} +set(SOURCES CtlSimdAddr.cpp CtlSimdFunctionCall.cpp CtlSimdHalfExpLog.cpp @@ -30,16 +55,32 @@ add_library( IlmCtlSimd ${DO_SHARED} CtlSimdSyntaxTree.cpp CtlSimdType.cpp CtlSimdXContext.cpp - "${CMAKE_CURRENT_BINARY_DIR}/halfExpLogTable.h" + #${HALF_TABLE} + #${HALF_EXPFUNCS} + halfExpLogTable.h + halfExpLog.h ) +add_library(IlmCtlSimd ${SOURCES}) -target_link_libraries( IlmCtlSimd IlmCtlMath IlmCtl ) +target_include_directories(IlmCtlSimd + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_link_libraries(IlmCtlSimd + PUBLIC + IlmCtlMath + IlmCtl +) -set_target_properties( IlmCtlSimd PROPERTIES - VERSION ${CTL_VERSION} - SOVERSION ${CTL_VERSION} +set_target_properties(IlmCtlSimd + PROPERTIES + VERSION ${CTL_VERSION} + SOVERSION ${CTL_VERSION} ) -install( FILES CtlSimdInterpreter.h DESTINATION include/CTL ) +install(FILES CtlSimdInterpreter.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/CTL) -install( TARGETS IlmCtlSimd DESTINATION lib ) +install(TARGETS IlmCtlSimd DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/lib/IlmImfCtl/CMakeLists.txt b/lib/IlmImfCtl/CMakeLists.txt index 47563df4..ee70ec35 100644 --- a/lib/IlmImfCtl/CMakeLists.txt +++ b/lib/IlmImfCtl/CMakeLists.txt @@ -1,16 +1,44 @@ -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/lib/IlmCtl" "${PROJECT_SOURCE_DIR}/lib/IlmCtlMath" "${PROJECT_SOURCE_DIR}/lib/IlmCtlSimd" ) -include_directories( ${OpenEXR_INCLUDE_DIRS} ) -link_directories( ${OpenEXR_LIBRARY_DIRS} ) - -add_library( IlmImfCtl ${DO_SHARED} +set(SOURCES ImfCtlApplyTransforms.cpp ImfCtlCopyFunctionArg.cpp ) -target_link_libraries( IlmImfCtl IlmCtl IlmImf Iex IlmThread Half ) +add_library(IlmImfCtl ${SOURCES}) + +target_include_directories(IlmImfCtl + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) -install( FILES ImfCtlApplyTransforms.h DESTINATION include/OpenEXR ) +#target_link_libraries(IlmImfCtl +# PUBLIC +# IlmCtl +# PRIVATE +# OpenEXR::OpenEXR +# OpenEXR::Iex +# OpenEXR::IlmThread +# Imath::Half +#) +target_link_libraries (IlmImfCtl + PUBLIC + IlmCtl + PUBLIC + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> +# $<$:Imath::Imath> + $<$:Imath::Half> + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> + # $<$:IlmBase::Imath> + $<$:IlmBase::Half> + $<$:IlmBase::IlmThread> + $<$:IlmBase::Iex> + ) -export( TARGETS IlmImfCtl IlmCtl FILE "${PROJECT_BINARY_DIR}/CTLLibraryDepends.cmake" ) +install(FILES + ImfCtlApplyTransforms.h +DESTINATION + ${CMAKE_INSTALL_LIBDIR}/OpenEXR +) -install( TARGETS IlmImfCtl DESTINATION lib ) +install(TARGETS IlmImfCtl DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/lib/dpx/CMakeLists.txt b/lib/dpx/CMakeLists.txt index c8be26e1..1c0b85e2 100644 --- a/lib/dpx/CMakeLists.txt +++ b/lib/dpx/CMakeLists.txt @@ -1,13 +1,36 @@ -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" ) - -add_library( ctldpx - dpx.cc - dpx_raw.cc - dpx_read.cc - dpx_util.cc - dpx_write.cc - dpx_bits.cc - dpx_validate.cc - dpx_rw.cc +set(SOURCES + dpx.cc + dpx_raw.cc + dpx_read.cc + dpx_util.cc + dpx_write.cc + dpx_bits.cc + dpx_validate.cc + dpx_rw.cc +) +add_library(ctldpx STATIC ${SOURCES}) +target_include_directories(ctldpx + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} ) +target_link_libraries(ctldpx + PUBLIC + # For OpenEXR/Imath 3.x: + $<$:Imath::Imath> + # For OpenEXR 2.4/2.5: + $<$:IlmBase::Imath> +) +#target_link_libraries (ctldpx +# PRIVATE +# # For OpenEXR/Imath 3.x: +# $<$:OpenEXR::OpenEXR> +# $<$:Imath::Imath> +# $<$:Imath::Half> +# # For OpenEXR 2.4/2.5: +# $<$:OpenEXR::IlmImf> +# $<$:IlmBase::Imath> +# $<$:IlmBase::Half> +# $<$:IlmBase::IlmThread> +# $<$:IlmBase::Iex> +# ) \ No newline at end of file diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index a49f8d64..fb712f20 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -1,10 +1,7 @@ - -enable_testing() - -add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} --verbose ) - -add_subdirectory( IlmCtl ) -add_subdirectory( IlmCtlMath ) -add_subdirectory( IlmImfCtl ) -add_subdirectory( ctlrender ) +add_subdirectory(IlmCtl) +add_subdirectory(IlmCtlMath) +add_subdirectory(IlmImfCtl) +if (CTL_BUILD_TOOLS) + add_subdirectory(ctlrender) +endif() diff --git a/unittest/IlmCtl/CMakeLists.txt b/unittest/IlmCtl/CMakeLists.txt index 7a31187d..a215cfe8 100644 --- a/unittest/IlmCtl/CMakeLists.txt +++ b/unittest/IlmCtl/CMakeLists.txt @@ -1,62 +1,64 @@ - -add_executable(IlmCtlTest - main.cpp - testCppCall.cpp - testEndOfLine.cpp - testExamples.cpp - testHugeInit.cpp - testParser.cpp - testVarying.cpp - testVaryingLookup.cpp - testVaryingReturn.cpp +set(SOURCES + main.cpp + testCppCall.cpp + testEndOfLine.cpp + testExamples.cpp + testHugeInit.cpp + testParser.cpp + testVarying.cpp + testVaryingLookup.cpp + testVaryingReturn.cpp ) +add_executable(IlmCtlTest ${SOURCES}) -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" - "${PROJECT_SOURCE_DIR}/lib/IlmCtl" - "${PROJECT_SOURCE_DIR}/lib/IlmCtlSimd" ) +target_include_directories(IlmCtlTest + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) -target_link_libraries( IlmCtlTest IlmCtlSimd IlmCtlMath IlmCtl ) -target_link_libraries( IlmCtlTest ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) +target_link_libraries(IlmCtlTest + PRIVATE + IlmCtlSimd + IlmCtl +) -add_test( IlmCtl IlmCtlTest ) -add_dependencies(check IlmCtlTest) +add_test(IlmCtl IlmCtlTest) -file( - COPY - common.ctl - example.ctl - testArray.ctl - testCast.ctl - testComments.ctl - testCppCall.ctl - testCtlVersion.ctl - test.ctl - testDefaults.ctl - testEmpty.ctl - testExamples.ctl - testExamplesNamespace.ctl - testExpr.ctl - testFunc.ctl - testHugeInit.ctl - testInterpolator.ctl - testLiterals.ctl - testLookupTables.ctl - testLoops.ctl - testName2.ctl - testName.ctl - testNameSpace2.ctl - testNameSpace.ctl - testNoName.ctl - testParse.ctl - testScope2.ctl - testScope.ctl - testStdLibrary.ctl - testStruct.ctl - testTypes.ctl - testVarying.ctl - testVaryingLookup.ctl - testVaryingReturn.ctl - testVSArrays.ctl - DESTINATION - ${CMAKE_CURRENT_BINARY_DIR} +file(COPY + common.ctl + example.ctl + testArray.ctl + testCast.ctl + testComments.ctl + testCppCall.ctl + testCtlVersion.ctl + test.ctl + testDefaults.ctl + testEmpty.ctl + testExamples.ctl + testExamplesNamespace.ctl + testExpr.ctl + testFunc.ctl + testHugeInit.ctl + testInterpolator.ctl + testLiterals.ctl + testLookupTables.ctl + testLoops.ctl + testName2.ctl + testName.ctl + testNameSpace2.ctl + testNameSpace.ctl + testNoName.ctl + testParse.ctl + testScope2.ctl + testScope.ctl + testStdLibrary.ctl + testStruct.ctl + testTypes.ctl + testVarying.ctl + testVaryingLookup.ctl + testVaryingReturn.ctl + testVSArrays.ctl +DESTINATION + ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/unittest/IlmCtlMath/CMakeLists.txt b/unittest/IlmCtlMath/CMakeLists.txt index 3d546232..d050ac2f 100644 --- a/unittest/IlmCtlMath/CMakeLists.txt +++ b/unittest/IlmCtlMath/CMakeLists.txt @@ -1,24 +1,20 @@ - -add_executable(IlmCtlMathTest - main.cpp - testAffineRec.cpp - testGaussRec.cpp +set(SOURCES + main.cpp + testAffineRec.cpp + testGaussRec.cpp ) -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" - "${PROJECT_SOURCE_DIR}/lib/IlmCtlMath" ) - -target_link_libraries( IlmCtlMathTest IlmCtlMath ) -target_link_libraries( IlmCtlMathTest ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) - -add_test( IlmCtlMath IlmCtlMathTest ) -add_dependencies(check IlmCtlMathTest) - - +add_executable(IlmCtlMathTest ${SOURCES}) +target_include_directories(IlmCtlMathTest + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) +target_link_libraries(IlmCtlMathTest + PRIVATE + IlmCtlMath + IlmCtl +) -#LDADD = @ILMBASE_LIBS@ -L$(top_builddir)/IlmCtlMath \ -# -lIlmCtlMath -lImath -lIex -lHalf -lpthread -lm - - +add_test(IlmCtlMath IlmCtlMathTest) diff --git a/unittest/IlmImfCtl/CMakeLists.txt b/unittest/IlmImfCtl/CMakeLists.txt index 3eb9408e..30b1e53d 100644 --- a/unittest/IlmImfCtl/CMakeLists.txt +++ b/unittest/IlmImfCtl/CMakeLists.txt @@ -1,35 +1,30 @@ -if ( NOT OpenEXR_FOUND ) - message(WARNING "OpenEXR not found, skipping IlmImfCtl unit test") - return() -endif() - -include_directories( ${OpenEXR_INCLUDE_DIRS} ) -link_directories( ${OpenEXR_LIBRARY_DIRS} ) - -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" - "${PROJECT_SOURCE_DIR}/lib/IlmCtl" - "${PROJECT_SOURCE_DIR}/lib/IlmCtlMath" - "${PROJECT_SOURCE_DIR}/lib/IlmCtlSimd" - "${PROJECT_SOURCE_DIR}/lib/IlmImfCtl" ) - - -add_executable(IlmImfCtlTest +set(SOURCES main.cpp testSourceDestination.cpp testTypes.cpp ) -target_link_libraries( IlmImfCtlTest IlmCtlSimd IlmCtlMath IlmCtl IlmImfCtl ) -target_link_libraries( IlmImfCtlTest ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} ) +add_executable(IlmImfCtlTest ${SOURCES}) + +target_include_directories(IlmImfCtlTest + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_link_libraries( IlmImfCtlTest + PRIVATE + IlmImfCtl + IlmCtlSimd + IlmCtlMath + IlmCtl +) add_test( IlmImfCtl IlmImfCtlTest ) -add_dependencies(check IlmImfCtlTest) -file( - COPY +file(COPY function1.ctl function2.ctl function3.ctl - DESTINATION - ${CMAKE_CURRENT_BINARY_DIR} +DESTINATION + ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/unittest/ctlrender/CMakeLists.txt b/unittest/ctlrender/CMakeLists.txt index 5f693be1..3c4e6840 100644 --- a/unittest/ctlrender/CMakeLists.txt +++ b/unittest/ctlrender/CMakeLists.txt @@ -5,12 +5,13 @@ add_test( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ./test.sh $ ) - -if ( NOT TIFF_FOUND ) + +find_package(TIFF) +if ( TARGET TIFF::TIFF ) + set_property(TEST ctlrender PROPERTY ENVIRONMENT "IS_TIFF_FOUND=1") +else() message(WARNING "LibTIFF not found, skipping tiff-related ctlrender unit tests") set_property(TEST ctlrender PROPERTY ENVIRONMENT "IS_TIFF_FOUND=0") -else() - set_property(TEST ctlrender PROPERTY ENVIRONMENT "IS_TIFF_FOUND=1") endif() #add_dependencies(check ctlrender) From 77d3fe2cf0eca266c5cd54a7f7a46a1b2140c5d7 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Fri, 23 Dec 2022 16:11:31 -0800 Subject: [PATCH 2/5] fix workflow to use ctest instead of make check --- .github/workflows/cmake_address_sanitizer.yml | 9 ++++++--- .github/workflows/cmake_debug.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake_address_sanitizer.yml b/.github/workflows/cmake_address_sanitizer.yml index 7ab2668a..a9c020f0 100644 --- a/.github/workflows/cmake_address_sanitizer.yml +++ b/.github/workflows/cmake_address_sanitizer.yml @@ -15,7 +15,7 @@ env: BUILD_TYPE: asan jobs: - test-openexr2: + openexr2: # 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. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix @@ -58,7 +58,7 @@ jobs: - test-openexr3: + 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. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix @@ -66,6 +66,9 @@ jobs: steps: + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + - name: install dependencies - imath run: | cd .. @@ -86,7 +89,7 @@ jobs: git checkout RB-3.1 && mkdir build && cd build && - cmake .. && + cmake .. -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF && make && sudo make install diff --git a/.github/workflows/cmake_debug.yml b/.github/workflows/cmake_debug.yml index 7ee372aa..48e8d378 100644 --- a/.github/workflows/cmake_debug.yml +++ b/.github/workflows/cmake_debug.yml @@ -55,7 +55,7 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: make check + run: ctest -V valgrind: # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. From 7dad8ee862741491fe41e2fa2551db116e084d97 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Fri, 23 Dec 2022 16:46:23 -0800 Subject: [PATCH 3/5] rename workflows and add openexr3 jobs --- .github/workflows/cmake_debug.yml | 106 ------- .github/workflows/cmake_release.yml | 104 ------- ...tizer.yml => ubuntu_address_sanitizer.yml} | 5 +- .github/workflows/ubuntu_debug.yml | 258 ++++++++++++++++++ ...e_no_libtiff.yml => ubuntu_no_libtiff.yml} | 2 +- .github/workflows/ubuntu_release.yml | 256 +++++++++++++++++ 6 files changed, 519 insertions(+), 212 deletions(-) delete mode 100644 .github/workflows/cmake_debug.yml delete mode 100644 .github/workflows/cmake_release.yml rename .github/workflows/{cmake_address_sanitizer.yml => ubuntu_address_sanitizer.yml} (97%) create mode 100644 .github/workflows/ubuntu_debug.yml rename .github/workflows/{cmake_no_libtiff.yml => ubuntu_no_libtiff.yml} (99%) create mode 100644 .github/workflows/ubuntu_release.yml diff --git a/.github/workflows/cmake_debug.yml b/.github/workflows/cmake_debug.yml deleted file mode 100644 index 48e8d378..00000000 --- a/.github/workflows/cmake_debug.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: CMake - Debug - -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: Debug - -jobs: - build: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - test: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -V - - valgrind: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - name: install dependencies - valgrind - run: sudo apt-get -y install valgrind - - - name: install dependencies - openexr/ilmbase v2.5 - run: | - cd .. - sudo apt-get -y install zlib1g-dev && - git clone https://github.com/AcademySoftwareFoundation/openexr.git && - cd openexr && - git checkout RB-2.5 && - mkdir build && - cd build && - cmake .. && - make && - sudo make install - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: | - 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 - - diff --git a/.github/workflows/cmake_release.yml b/.github/workflows/cmake_release.yml deleted file mode 100644 index d1382f85..00000000 --- a/.github/workflows/cmake_release.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: CMake - Release - -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: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - test: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -V - - valgrind: - # 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. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - - name: install dependencies - valgrind - run: sudo apt-get -y install valgrind - - - name: install dependencies - openexr/ilmbase v2.5 - run: | - cd .. - sudo apt-get -y install zlib1g-dev && - git clone https://github.com/AcademySoftwareFoundation/openexr.git && - cd openexr && - git checkout RB-2.5 && - mkdir build && - cd build && - cmake .. && - make && - sudo make install - - - uses: actions/checkout@v3 - - - 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}} - - - name: Build - # Build your program with the given configuration - run: | - 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 diff --git a/.github/workflows/cmake_address_sanitizer.yml b/.github/workflows/ubuntu_address_sanitizer.yml similarity index 97% rename from .github/workflows/cmake_address_sanitizer.yml rename to .github/workflows/ubuntu_address_sanitizer.yml index a9c020f0..c1314e7a 100644 --- a/.github/workflows/cmake_address_sanitizer.yml +++ b/.github/workflows/ubuntu_address_sanitizer.yml @@ -1,4 +1,4 @@ -name: CMake - AddressSanitizer +name: Ubuntu-AddressSanitizer on: push: @@ -23,6 +23,9 @@ jobs: steps: + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + - name: install dependencies - openexr/ilmbase v2.5 run: | cd .. diff --git a/.github/workflows/ubuntu_debug.yml b/.github/workflows/ubuntu_debug.yml new file mode 100644 index 00000000..980c5942 --- /dev/null +++ b/.github/workflows/ubuntu_debug.yml @@ -0,0 +1,258 @@ +name: Ubuntu-Debug + +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: Debug + +jobs: + build: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install ilmbase + run: sudo apt-get -y install libilmbase-dev + + - name: install openexr + run: sudo apt-get -y install libopenexr-dev + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + test-openexr2: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install CTL dependency - openexr/ilmbase v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -V + + test-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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install dependencies - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install dependencies - zlib + run: sudo apt-get -y install zlib1g-dev + + - 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_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -V + + valgrind-openexr2: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install test tool - valgrind + run: sudo apt-get -y install valgrind + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install CTL dependency - openexr/ilmbase v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: | + cd ${{ github.workspace }} + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - 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 + +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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install test tool - valgrind + run: sudo apt-get -y install valgrind + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install openexr + CTL dependency - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install CTL dependency - openexr v3.1 + run: | + cd .. + sudo apt-get -y install zlib1g-dev && + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-3.1 && + mkdir build && + cd build && + cmake .. -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: | + 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 + + diff --git a/.github/workflows/cmake_no_libtiff.yml b/.github/workflows/ubuntu_no_libtiff.yml similarity index 99% rename from .github/workflows/cmake_no_libtiff.yml rename to .github/workflows/ubuntu_no_libtiff.yml index 0cade7b4..8bfcc5f1 100644 --- a/.github/workflows/cmake_no_libtiff.yml +++ b/.github/workflows/ubuntu_no_libtiff.yml @@ -1,4 +1,4 @@ -name: CMake - No LibTIFF +name: Ubuntu-No LibTIFF on: push: diff --git a/.github/workflows/ubuntu_release.yml b/.github/workflows/ubuntu_release.yml new file mode 100644 index 00000000..f96faf17 --- /dev/null +++ b/.github/workflows/ubuntu_release.yml @@ -0,0 +1,256 @@ +name: Ubuntu-Release + +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: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install ilmbase + run: sudo apt-get -y install libilmbase-dev + + - name: install openexr + run: sudo apt-get -y install libopenexr-dev + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + test-openexr2: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install CTL dependency - openexr/ilmbase v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -V + + test-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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install dependencies - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install dependencies - zlib + run: sudo apt-get -y install zlib1g-dev + + - 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_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -V + + valgrind-openexr2: + # 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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install test tool - valgrind + run: sudo apt-get -y install valgrind + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install CTL dependency - openexr/ilmbase v2.5 + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-2.5 && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: | + cd ${{ github.workspace }} + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - 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 + +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. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + + - name: install test tool - valgrind + run: sudo apt-get -y install valgrind + + - name: remove ilmbase + run: sudo apt-get --purge remove libilmbase-dev -y + + - name: remove openexr + run: sudo apt-get --purge remove libopenexr-dev -y + + - name: install openexr dependency - zlib + run: sudo apt-get -y install zlib1g-dev + + - name: install openexr + CTL dependency - imath + run: | + cd .. + git clone https://github.com/AcademySoftwareFoundation/Imath.git && + cd Imath && + mkdir build && + cd build && + cmake .. && + make && + sudo make install + + - name: install CTL dependency - openexr v3.1 + run: | + cd .. + sudo apt-get -y install zlib1g-dev && + git clone https://github.com/AcademySoftwareFoundation/openexr.git && + cd openexr && + git checkout RB-3.1 && + mkdir build && + cd build && + cmake .. -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF && + make && + sudo make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: | + 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 From c236e13c522346afb09744b80e60812b2726c9f9 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Fri, 23 Dec 2022 16:48:43 -0800 Subject: [PATCH 4/5] fix YAML workflow formatting --- .github/workflows/ubuntu_debug.yml | 2 +- .github/workflows/ubuntu_release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu_debug.yml b/.github/workflows/ubuntu_debug.yml index 980c5942..162fee0e 100644 --- a/.github/workflows/ubuntu_debug.yml +++ b/.github/workflows/ubuntu_debug.yml @@ -189,7 +189,7 @@ jobs: # Run valgrind using a bash script run: pwd && ls && bash ../resources/test/scripts/run_valgrind.sh -valgrind-openexr3: + 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. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix diff --git a/.github/workflows/ubuntu_release.yml b/.github/workflows/ubuntu_release.yml index f96faf17..c370b9df 100644 --- a/.github/workflows/ubuntu_release.yml +++ b/.github/workflows/ubuntu_release.yml @@ -189,7 +189,7 @@ jobs: # Run valgrind using a bash script run: pwd && ls && bash ../resources/test/scripts/run_valgrind.sh -valgrind-openexr3: + 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. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix From 61ce29e687da8bf7b6000b2d3b5c5d17e75a3075 Mon Sep 17 00:00:00 2001 From: michaeldsmith <37905569+michaeldsmith@users.noreply.github.com> Date: Fri, 23 Dec 2022 17:04:40 -0800 Subject: [PATCH 5/5] add macos workflows --- .github/workflows/mac_debug.yml | 178 ++++++++++++++++++++++++++++++ .github/workflows/mac_release.yml | 178 ++++++++++++++++++++++++++++++ 2 files changed, 356 insertions(+) create mode 100644 .github/workflows/mac_debug.yml create mode 100644 .github/workflows/mac_release.yml diff --git a/.github/workflows/mac_debug.yml b/.github/workflows/mac_debug.yml new file mode 100644 index 00000000..76deafba --- /dev/null +++ b/.github/workflows/mac_debug.yml @@ -0,0 +1,178 @@ +name: macOS-Debug + +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: Debug + +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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - 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 .. && + make && + 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{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 .. && + make && + 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{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/.github/workflows/mac_release.yml b/.github/workflows/mac_release.yml new file mode 100644 index 00000000..a1794255 --- /dev/null +++ b/.github/workflows/mac_release.yml @@ -0,0 +1,178 @@ +name: macOS-Release + +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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - 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 .. && + make && + 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{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 .. && + make && + 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 .. && + make && + make install + + - uses: actions/checkout@v3 + + - 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}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{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 +