From d97dbda808cbfbd67a47c9540a365f1db42d03d9 Mon Sep 17 00:00:00 2001 From: Cary Phillips Date: Mon, 30 Mar 2026 08:26:45 -0700 Subject: [PATCH] Add CI test to validate "cmake --install .. --prefix With this change, when `configure_install_prefix` is provideed, the CI configures and builds with one install prefix but then overrides that in the install step with an explicit `--prefix `. This validates that the custom prefix takes precedence over the cache. This is done for the matrix builds that test with various settings off, so it's sure to catch both with and without the overriding prefix. The `--install` option is only available in cmake 3.15+, but the OpenEXR supported version of cmake is still 3.14 (so that's what the CI uses), so the CI uses 3.15 for these builds. Signed-off-by: Cary Phillips --- .github/workflows/ci_steps.yml | 24 +++++++++++++++++++----- .github/workflows/ci_workflow.yml | 9 +++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_steps.yml b/.github/workflows/ci_steps.yml index 0ab497044e..9ee1d8dc9a 100644 --- a/.github/workflows/ci_steps.yml +++ b/.github/workflows/ci_steps.yml @@ -63,6 +63,8 @@ on: type: string validate_install: type: string + configure_install_prefix: + type: string permissions: contents: read @@ -229,8 +231,10 @@ jobs: # Construct the cmake command as a variable, so the # Configure step below can execute it, but also so we can store # in in the install_manifest as a debugging reference + # Configure/build with a .tmp install prefix, so we can + # validate the install properly overrides it. cmake_args=("-B" "$BUILD_DIR" -S "$WORKSPACE") - cmake_args+=("-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR") + cmake_args+=("-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR${{ inputs.configure_install_prefix}}") cmake_args+=("-DCMAKE_BUILD_TYPE=${{ inputs.build-type }}") cmake_args+=("-DOPENEXR_CXX_STANDARD=${{ inputs.cxx-standard }}") cmake_args+=("-DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED_LIBS }}") @@ -269,22 +273,32 @@ jobs: echo INSTALL_MANIFEST_FILENAME="install_manifest.${os_name}.${build}.txt" >> $GITHUB_ENV shell: bash - - name: Configure & Build + - name: Configure, Build, Install if: inputs.msystem == '' run: | set -x "$CMAKE" --version "$CMAKE" ${{ env.CMAKE_ARGS }} - "$CMAKE" --build $BUILD_DIR --target install --config ${{ inputs.build-type }} + if [ -n "${{ inputs.configure_install_prefix }}" ]; then + "$CMAKE" --build "$BUILD_DIR" --config ${{ inputs.build-type }} + "$CMAKE" --install "$BUILD_DIR" --prefix "$INSTALL_DIR" --config ${{ inputs.build-type }} + else + "$CMAKE" --build "$BUILD_DIR" --target install --config ${{ inputs.build-type }} + fi shell: bash - - name: Configure & Build (msys2) # requires msys2 shell + - name: Configure, Build, Install (msys2) # requires msys2 shell if: inputs.msystem != '' run: | set -x "$CMAKE" --version "$CMAKE" ${{ env.CMAKE_ARGS }} - "$CMAKE" --build $BUILD_DIR --target install --config ${{ inputs.build-type }} + if [ -n "${{ inputs.configure_install_prefix }}" ]; then + "$CMAKE" --build "$BUILD_DIR" --config ${{ inputs.build-type }} + "$CMAKE" --install "$BUILD_DIR" --prefix "$INSTALL_DIR" --config ${{ inputs.build-type }} + else + "$CMAKE" --build "$BUILD_DIR" --target install --config ${{ inputs.build-type }} + fi shell: msys2 {0} - name: Test OpenEXR.pc diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 3e91c56119..49e898b757 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -86,6 +86,7 @@ jobs: RUN_TESTING: ${{ matrix.RUN_TESTING || 'ON' }} namespace: ${{ matrix.namespace }} validate_install: ${{ matrix.validate_install || 'ON' }} + configure_install_prefix: ${{ matrix.configure_install_prefix }} strategy: fail-fast: false @@ -117,6 +118,8 @@ jobs: OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON' OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON' BUILD_TESTING: 'OFF' + configure_install_prefix: '.tmp' + cmake: 3.15.7 - build: 6 label: custom namespace @@ -187,6 +190,7 @@ jobs: BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }} RUN_TESTING: ${{ matrix.RUN_TESTING || 'ON' }} validate_install: ${{ matrix.validate_install || 'ON' }} + configure_install_prefix: ${{ matrix.configure_install_prefix }} strategy: fail-fast: false @@ -218,6 +222,8 @@ jobs: OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON' OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON' BUILD_TESTING: 'OFF' + configure_install_prefix: '.tmp' + cmake: 3.15.7 - build: 6 label: macos-15-intel @@ -271,6 +277,7 @@ jobs: BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }} RUN_TESTING: ${{ matrix.RUN_TESTING || 'ON' }} validate_install: ${{ matrix.validate_install || 'ON' }} + configure_install_prefix: ${{ matrix.configure_install_prefix }} strategy: fail-fast: false @@ -302,6 +309,8 @@ jobs: OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON' OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON' BUILD_TESTING: 'OFF' + configure_install_prefix: '.tmp' + cmake: 3.15.7 - build: 6 label: vfx2023