Skip to content

Add build support for PIE code generation for executables #2898

Add build support for PIE code generation for executables

Add build support for PIE code generation for executables #2898

Workflow file for this run

# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# GitHub Actions workflow file
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: CI
on:
push:
# Versioned branches and tags are ignored for OCIO <= 1.x.x
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
pull_request:
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
jobs:
# Linux jobs run in Docker containers, so the latest OS version is OK. macOS
# and Windows jobs need to be locked to specific virtual environment
# versions to mitigate issues from OS updates, and will require maintenance
# as OS versions are retired.
#
# GH Actions (Free plan) supports 20 concurrent jobs, with 5 concurrent macOS
# jobs. This workflow tries to utilize (but not exceed) that budget to
# promote timely CI.
# ---------------------------------------------------------------------------
# Linux
# ---------------------------------------------------------------------------
linux:
name: 'Linux CentOS 7 VFX CY${{ matrix.vfx-cy }}
<${{ matrix.compiler-desc }}
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
oiio=${{ matrix.use-oiio }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
runs-on: ubuntu-latest
container:
# DockerHub: https://hub.docker.com/u/aswf
# Source: https://github.com/AcademySoftwareFoundation/aswf-docker
image: aswf/ci-ocio:${{ matrix.vfx-cy }}
strategy:
matrix:
build: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
include:
# -------------------------------------------------------------------
# VFX CY2023 (Python 3.10)
# -------------------------------------------------------------------
- build: 12
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2023
- build: 11
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2023
- build: 10
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2023
# -------------------------------------------------------------------
# VFX CY2022 (Python 3.9)
# -------------------------------------------------------------------
- build: 9
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2022
- build: 8
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2022
- build: 7
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2022
# -------------------------------------------------------------------
# VFX CY2021 (Python 3.7)
# -------------------------------------------------------------------
- build: 6
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2021
- build: 5
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2021
- build: 4
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2021
# -------------------------------------------------------------------
# VFX CY2020 (Python 3.7)
# -------------------------------------------------------------------
- build: 3
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2020
- build: 2
build-type: Debug
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 14
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2020
- build: 1
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2020
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/linux/yum/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/linux/yum/install_tests_env.sh
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DPython_EXECUTABLE=$(which python)
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }} \
-- -j$(nproc)
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# macOS
# ---------------------------------------------------------------------------
macos:
name: 'macOS 11
<AppleClang
arch=${{ matrix.arch-type }},
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }},
oiio=${{ matrix.use-oiio}}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: macos-11
strategy:
matrix:
build: [1, 2, 3, 4]
include:
- build: 5
arch-type: "x86_64"
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 17
python-version: '3.11'
# Keeping one universal build
- build: 4
arch-type: "x86_64;arm64"
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.10'
- build: 3
arch-type: "x86_64"
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-openfx: 'OFF'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.10'
- build: 2
arch-type: "x86_64"
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.9'
- build: 1
arch-type: "x86_64"
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 14
python-version: '3.7'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/macos/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/macos/install_tests_env.sh
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DPython_EXECUTABLE=$(which python) \
-DCMAKE_OSX_ARCHITECTURES="${{ matrix.arch-type }}"
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }} \
-- -j$(sysctl -n hw.ncpu)
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# Windows
# ---------------------------------------------------------------------------
# TODO: Install pythonXX_d.lib (or work around it being needed) to support
# Debug build testing with Python bindings and docs enabled.
windows:
name: 'Windows 2019
<MSVC
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }},
oiio=${{ matrix.use-oiio }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-2019
strategy:
matrix:
build: [1, 2, 3, 4]
include:
- build: 4
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'ON'
cxx-standard: 17
python-version: '3.11'
- build: 3
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.9'
- build: 2
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.8'
# C++14, OpenEXR, OpenFX
- build: 1
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 14
python-version: '3.7'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/windows/install_docs_env.sh
shell: bash
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/windows/install_tests_env.sh
shell: bash
- name: Create build directories
run: |
mkdir _install
mkdir _build
shell: bash
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DCMAKE_GENERATOR_PLATFORM=x64 \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DPython_EXECUTABLE=$(which python)
shell: bash
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }}
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
shell: bash
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
shell: bash
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build . \
--config ${{ matrix.build-type }}
export PATH=../../../_install/bin:$PATH
./${{ matrix.build-type }}/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
export PATH=../../../_install/bin:$PATH
./${{ matrix.build-type }}/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist