Skip to content

Commit 669bea1

Browse files
lgritzbrechtvl
andauthored
ci: Windows CI (take 1) (#1930)
First step at getting full Windows CI: This PR gets us as far as doing a Windows build of OSL for each Windows flavor on GHA. This is an important part of making it much harder for us to inadvertently break the build on Windows. We currently only build, but we don't run the testsuite. This is in progress and we don't pass all tests quite yet, but I didn't want to wait any longer to get this much in our CI. This is just about getting our own CI runs for Windows and still relies on helper scripts being run as part of the CI to build or install the dependencies before the main build starts. We want eventually to get to the point where OSL's build system can itself auto-build all the important dependencies if not found and it's not something most users need to worry about. A few notes about specific changes in this patch that came along for the ride: * Port many build_blah.bash scripts (or recent changes thereto) from OIIO to OSL to synchronize them between the two projects and move improvements made on the OIIO side to OSL's versions. * Augment the build_llvm.bash script with logic to work on Windows, too, using pre-built binaries associated with LLVM releases. Note that not all of their releases have Windows binaries pre-built, so you have to pick one of the right releases for it to work. * Fix a problem with the way we propagate C++ std level flags from the main build to the bitcode-generating pass. On Linux and Mac, `-std=c++17` works identically on gcc/clang that we use for OSL itself and the clang we use to generate precompiled bitcode. But on Windows, the standard-setting flags for MSVC we use to build the cpp is different from the flags needed for clang when compiling to bicode. * Modify the ci.yml to allow special branch names to exclude platforms, to simplify iterating over many CI runs when only caring about one platform. If the branch name contains the substring "windows-only", the Linux and Mac CI test variants will be skipped, and analogously for "macos-only" and "linux-only". --------- Signed-off-by: Larry Gritz <[email protected]> Co-authored-by: Brecht Van Lommel <[email protected]>
1 parent 5ad1869 commit 669bea1

21 files changed

+422
-217
lines changed

.github/workflows/build-steps.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ jobs:
120120
path: ./ccache
121121
key: ${{github.job}}-${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
122122
restore-keys: ${{github.job}}-
123-
- name: Setup Nuget.exe (Windows only)
124-
if: runner.os == 'Windows'
125-
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
126123
- name: Build setup
127124
shell: bash
128125
run: |

.github/workflows/ci.yml

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ permissions: read-all
4040
jobs:
4141

4242
aswf-old:
43+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
4344
name: "VFX${{matrix.vfxyear}} ${{matrix.desc}}"
4445
strategy:
4546
fail-fast: false
@@ -202,6 +203,7 @@ jobs:
202203
203204
204205
linux:
206+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
205207
name: "${{matrix.desc}}"
206208
uses: ./.github/workflows/build-steps.yml
207209
with:
@@ -356,7 +358,8 @@ jobs:
356358
batched: b8_AVX2_noFMA
357359
setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF -DEXTRA_CPP_ARGS=-fp-model=consistent"
358360
OPENIMAGEIO_CMAKE_FLAGS=-DBUILD_FMT_VERSION=7.1.3
359-
USE_OPENVDB=0 OPENCOLORIO_CXX=g++
361+
USE_OPENVDB=0
362+
OPENCOLORIO_CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++"
360363
- desc: icx/C++17 llvm14 py3.10 oiio-3.0 avx2
361364
nametag: linux-icx
362365
runner: ubuntu-latest
@@ -371,8 +374,9 @@ jobs:
371374
pybind11_ver: v2.10.0
372375
simd: avx2,f16c
373376
batched: b8_AVX2_noFMA
374-
setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF" USE_OPENVDB=0
375-
OPENCOLORIO_CXX=g++
377+
setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF"
378+
USE_OPENVDB=0
379+
OPENCOLORIO_CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++"
376380

377381
- desc: Debug gcc7/C++17 llvm11 py3.8 oiio2.5 exr3.1 sse4
378382
nametag: linux-debug-gcc7-llvm11
@@ -482,6 +486,7 @@ jobs:
482486

483487

484488
macos:
489+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'linux-only') }}
485490
name: "${{matrix.desc}}"
486491
uses: ./.github/workflows/build-steps.yml
487492
with:
@@ -546,3 +551,83 @@ jobs:
546551
openimageio_ver: main
547552

548553

554+
windows:
555+
if: ${{ ! contains(github.ref, 'linux-only') && ! contains(github.ref, 'macos-only') }}
556+
name: "${{matrix.desc}}"
557+
uses: ./.github/workflows/build-steps.yml
558+
with:
559+
nametag: ${{ matrix.nametag || 'unnamed!' }}
560+
runner: ${{ matrix.runner }}
561+
container: ${{ matrix.container }}
562+
cc_compiler: ${{ matrix.cc_compiler }}
563+
cxx_compiler: ${{ matrix.cxx_compiler }}
564+
cxx_std: ${{ matrix.cxx_std || '17' }}
565+
batched: ${{ matrix.batched }}
566+
build_type: ${{ matrix.build_type || 'Release' }}
567+
depcmds: ${{ matrix.depcmds }}
568+
extra_artifacts: ${{ matrix.extra_artifacts }}
569+
fmt_ver: ${{ matrix.fmt_ver }}
570+
opencolorio_ver: ${{ matrix.opencolorio_ver }}
571+
openexr_ver: ${{ matrix.openexr_ver }}
572+
openimageio_ver: ${{ matrix.openimageio_ver }}
573+
pybind11_ver: ${{ matrix.pybind11_ver }}
574+
python_ver: ${{ matrix.python_ver }}
575+
setenvs: ${{ matrix.setenvs }}
576+
simd: ${{ matrix.simd }}
577+
skip_build: ${{ matrix.skip_build }}
578+
skip_tests: ${{ matrix.skip_tests }}
579+
abi_check: ${{ matrix.abi_check }}
580+
build_docs: ${{ matrix.build_docs }}
581+
generator: ${{ matrix.generator }}
582+
ctest_args: ${{ matrix.ctest_args }}
583+
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
584+
coverage: ${{ matrix.coverage || 0 }}
585+
sonar: ${{ matrix.sonar || 0 }}
586+
strategy:
587+
fail-fast: false
588+
matrix:
589+
include:
590+
- desc: Windows-2019 VS2019
591+
runner: windows-2019
592+
nametag: windows-2019
593+
generator: "Visual Studio 16 2019"
594+
python_ver: "3.9"
595+
opencolorio_ver: v2.3.2
596+
openexr_ver: v3.3.2
597+
openimageio_ver: release
598+
skip_tests: 1
599+
setenvs: export LLVM_VERSION=18.1.8
600+
OSL_CMAKE_FLAGS="-DUSE_LLVM_BTCODE=ON"
601+
PUGIXML_VERSION=v1.14
602+
OpenImageIO_BUILD_MISSING_DEPS="Freetype;TIFF;libdeflate;libjpeg-turbo"
603+
604+
#
605+
# Windows 2022 / MSVS 17 case is below. It's not working yet,
606+
# work in progress.
607+
#
608+
- desc: Windows-2022 VS2022
609+
runner: windows-2022
610+
nametag: windows-2022
611+
generator: "Visual Studio 17 2022"
612+
python_ver: "3.9"
613+
opencolorio_ver: v2.3.2
614+
openexr_ver: v3.3.2
615+
openimageio_ver: release
616+
skip_tests: 1
617+
setenvs: export LLVM_VERSION=18.1.8
618+
OSL_CMAKE_FLAGS="-DUSE_LLVM_BTCODE=ON"
619+
PUGIXML_VERSION=v1.14
620+
OpenImageIO_BUILD_MISSING_DEPS="Freetype;TIFF;libdeflate;libjpeg-turbo"
621+
- desc: Windows-2025 VS2022
622+
runner: windows-2025
623+
nametag: windows-2025
624+
generator: "Visual Studio 17 2022"
625+
python_ver: "3.9"
626+
opencolorio_ver: v2.3.2
627+
openexr_ver: v3.3.2
628+
openimageio_ver: release
629+
skip_tests: 1
630+
setenvs: export LLVM_VERSION=18.1.8
631+
OSL_CMAKE_FLAGS="-DUSE_LLVM_BTCODE=ON"
632+
PUGIXML_VERSION=v1.14
633+
OpenImageIO_BUILD_MISSING_DEPS="Freetype;TIFF;libdeflate;libjpeg-turbo"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Utility script to download and build libpng
4+
#
5+
# Copyright Contributors to the Open Shading Language project.
6+
# SPDX-License-Identifier: BSD-3-Clause
7+
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
8+
9+
# Exit the whole script if any command fails.
10+
set -ex
11+
12+
# Repo and branch/tag/commit of libpng to download if we don't have it yet
13+
LIBPNG_REPO=${LIBPNG_REPO:=https://github.com/glennrp/libpng.git}
14+
LIBPNG_VERSION=${LIBPNG_VERSION:=v1.6.35}
15+
16+
# Where to put libpng repo source (default to the ext area)
17+
LIBPNG_SRC_DIR=${LIBPNG_SRC_DIR:=${PWD}/ext/libpng}
18+
# Temp build area (default to a build/ subdir under source)
19+
LIBPNG_BUILD_DIR=${LIBPNG_BUILD_DIR:=${LIBPNG_SRC_DIR}/build}
20+
# Install area for libpng (default to ext/dist)
21+
LIBPNG_INSTALL_DIR=${LIBPNG_INSTALL_DIR:=${PWD}/ext/dist}
22+
#LIBPNG_CONFIG_OPTS=${LIBPNG_CONFIG_OPTS:=}
23+
24+
pwd
25+
echo "libpng install dir will be: ${LIBPNG_INSTALL_DIR}"
26+
27+
mkdir -p ./ext
28+
pushd ./ext
29+
30+
# Clone libpng project from GitHub and build
31+
if [[ ! -e ${LIBPNG_SRC_DIR} ]] ; then
32+
echo "git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}"
33+
git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}
34+
fi
35+
cd ${LIBPNG_SRC_DIR}
36+
37+
38+
echo "git checkout ${LIBPNG_VERSION} --force"
39+
git checkout ${LIBPNG_VERSION} --force
40+
41+
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
42+
time cmake -S . -B ${LIBPNG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
43+
-DCMAKE_INSTALL_PREFIX=${LIBPNG_INSTALL_DIR} \
44+
-DPNG_EXECUTABLES=OFF \
45+
-DPNG_TESTS=OFF \
46+
${LIBPNG_CONFIG_OPTS}
47+
time cmake --build ${LIBPNG_BUILD_DIR} --config Release --target install
48+
fi
49+
50+
# ls -R ${LIBPNG_INSTALL_DIR}
51+
popd
52+
53+
54+
# Set up paths. These will only affect the caller if this script is
55+
# run with 'source' rather than in a separate shell.
56+
export PNG_ROOT=$LIBPNG_INSTALL_DIR
57+

src/build-scripts/build_llvm.bash

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,36 @@ set -ex
1212
echo "Building LLVM"
1313
uname
1414

15+
: ${LLVM_VERSION:=18.1.8}
16+
: ${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
17+
mkdir -p $LLVM_INSTALL_DIR || true
1518

1619
if [[ `uname` == "Linux" ]] ; then
17-
: ${LLVM_VERSION:=14.0.0}
18-
: ${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
1920
: ${LLVM_DISTRO_NAME:=ubuntu-18.04}
2021
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
2122
echo LLVMTAR = $LLVMTAR
2223
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
2324
ls -l $LLVMTAR
2425
tar xf $LLVMTAR
2526
rm -f $LLVMTAR
26-
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
27-
mkdir -p $LLVM_INSTALL_DIR && true
2827
mv clang+llvm*/* $LLVM_INSTALL_DIR
29-
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
30-
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
31-
# ls -a $LLVM_DIRECTORY
28+
elif [[ `uname -s` == "Windows" || "${RUNNER_OS}" == "Windows" ]] ; then
29+
echo "Installing Windows LLVM"
30+
: ${LLVM_DISTRO_NAME:=ubuntu-18.04}
31+
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-pc-windows-msvc.tar.xz
32+
echo LLVMTAR = $LLVMTAR
33+
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
34+
ls -l $LLVMTAR
35+
tar xf $LLVMTAR
36+
rm -f $LLVMTAR
37+
mv clang+llvm*/* $LLVM_INSTALL_DIR
38+
else
39+
echo Bad uname `uname`
3240
fi
41+
42+
echo "Installed LLVM ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
43+
ls -a $LLVM_INSTALL_DIR || true
44+
ls -a $LLVM_INSTALL_DIR/* || true
45+
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
46+
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
47+
export LLVM_ROOT=${LLVM_INSTALL_DIR}

src/build-scripts/build_opencolorio.bash

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
1919
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
2020
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
2121
OPENCOLORIO_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE:=Release}
22-
OPENCOLORIO_CXX=${OPENCOLORIO_CXX:=g++}
23-
OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
2422
# Just need libs:
25-
OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
23+
OPENCOLORIO_CMAKE_FLAGS+=" -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
2624
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
2725
-DOCIO_BUILD_GPU_TESTS=OFF \
2826
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
@@ -46,13 +44,11 @@ echo "git checkout ${OPENCOLORIO_VERSION} --force"
4644
git checkout ${OPENCOLORIO_VERSION} --force
4745
echo "Building OpenColorIO from commit" `git rev-parse --short HEAD`
4846

49-
time cmake -S . -B ${OPENCOLORIO_BUILD_DIR} \
47+
cmake -S ${OPENCOLORIO_SOURCE_DIR} -B ${OPENCOLORIO_BUILD_DIR} \
5048
-DCMAKE_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE} \
5149
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
52-
-DCMAKE_CXX_COMPILER=${OPENCOLORIO_CXX} \
53-
-DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \
54-
${OPENCOLORIO_BUILDOPTS}
55-
time cmake --build ${OPENCOLORIO_BUILD_DIR} --config Release --target install
50+
${OPENCOLORIO_CMAKE_FLAGS}
51+
time cmake --build ${OPENCOLORIO_BUILD_DIR} --target install --config ${OPENCOLORIO_BUILD_TYPE}
5652
popd
5753

5854
# ls -R ${OPENCOLORIO_INSTALL_DIR}

src/build-scripts/build_openexr.bash

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#!/usr/bin/env bash
22

3-
# Utility script to download and build OpenEXR & IlmBase
4-
#
3+
# Utility script to download and build OpenEXR & Imath
4+
55
# Copyright Contributors to the Open Shading Language project.
66
# SPDX-License-Identifier: BSD-3-Clause
77
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
88

9-
109
# Exit the whole script if any command fails.
1110
set -ex
1211

1312
# Which OpenEXR to retrieve, how to build it
1413
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/openexr.git}
15-
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.1.11}
14+
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.2.4}
1615

1716
# Where to install the final results
1817
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
@@ -28,10 +27,10 @@ pwd
2827
echo "Building OpenEXR ${OPENEXR_VERSION}"
2928
echo "OpenEXR build dir will be: ${OPENEXR_BUILD_DIR}"
3029
echo "OpenEXR install dir will be: ${OPENEXR_INSTALL_DIR}"
31-
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
30+
echo "OpenEXR build type is ${OPENEXR_BUILD_TYPE}"
3231
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
3332

34-
# Clone OpenEXR project (including IlmBase) from GitHub and build
33+
# Clone OpenEXR project (including Imath) from GitHub and build
3534
if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
3635
echo "git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}"
3736
git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}
@@ -42,14 +41,13 @@ pushd ${OPENEXR_SOURCE_DIR}
4241
git checkout ${OPENEXR_VERSION} --force
4342
echo "Building OpenEXR from commit" `git rev-parse --short HEAD`
4443

45-
cmake -S . -B ${OPENEXR_BUILD_DIR} \
44+
cmake -S ${OPENEXR_SOURCE_DIR} -B ${OPENEXR_BUILD_DIR} \
4645
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
4746
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
4847
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
49-
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
48+
-DBUILD_SHARED_LIBS=${OpenEXR_LOCAL_BUILD_SHARED_LIBS:=ON} \
5049
-DOPENEXR_BUILD_UTILS=0 \
5150
-DBUILD_TESTING=0 \
52-
-DPYILMBASE_ENABLE=0 \
5351
-DOPENEXR_VIEWERS_ENABLE=0 \
5452
-DINSTALL_OPENEXR_EXAMPLES=0 \
5553
-DOPENEXR_INSTALL_EXAMPLES=0 \
@@ -64,9 +62,12 @@ popd
6462

6563
# Set up paths. These will only affect the caller if this script is
6664
# run with 'source' rather than in a separate shell.
67-
export ILMBASE_ROOT=$OPENEXR_INSTALL_DIR
68-
export OPENEXR_ROOT=$OPENEXR_INSTALL_DIR
69-
export ILMBASE_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
70-
export OPENEXR_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
71-
export LD_LIBRARY_PATH=$OPENEXR_ROOT/lib:$LD_LIBRARY_PATH
65+
export OpenEXR_ROOT=$OPENEXR_INSTALL_DIR
66+
# Environment variables are case insensitive on Windows, don't set
67+
# it a second time with different case. This seems to trigger a bug
68+
# where the next cmake command fails to find the compiler.
69+
if [[ $(uname -s) != "Windows" && "${RUNNER_OS}" != "Windows" ]]; then
70+
export OPENEXR_ROOT=$OPENEXR_INSTALL_DIR
71+
fi
72+
export LD_LIBRARY_PATH=$OpenEXR_ROOT/lib:$LD_LIBRARY_PATH
7273

0 commit comments

Comments
 (0)