Skip to content

Commit 96d0131

Browse files
authored
build: Fix various MacOS problems with GitHub and CMake (#1982)
The combination of cmake 4.0, changing homebrew default package versions, and slight changes rolled out to the GitHub Actions runner images conspired to break our CI for 2 of 3 Mac variants. Fixes: * Apple: only add the -isysroot to the bitcode-generating clang++ command if CMAKE_OSX_SYSROOT is defined. Plot twist -- this is no longer set by cmake starting with cmake 4.0! * Fix incorrect warning message for apple clang vs newish llvm in externalpackages.cmake. * Remove homebrew unlinking of [email protected] that warned in install_homebrew_deps.bash. On the GHA runners, it was giving us warnings because we were asking this package to be unlinked but it wasn't installed. For future needs, add an env variable based way to unlink individual packges. Signed-off-by: Larry Gritz <[email protected]>
1 parent b1b77ef commit 96d0131

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,34 +520,37 @@ jobs:
520520
fail-fast: false
521521
matrix:
522522
include:
523-
- desc: MacOS-13-Intel llvm17
523+
- desc: MacOS-13-Intel llvm17 oiio-release
524524
runner: macos-13
525525
nametag: macos13-p313
526-
cc_compiler: /usr/local/opt/llvm/bin/clang
527-
cxx_compiler: /usr/local/opt/llvm/bin/clang++
526+
cc_compiler: clang
527+
cxx_compiler: clang++
528528
cxx_std: 17
529529
python_ver: "3.13"
530530
aclang: 14
531-
setenvs: export DO_BREW_UPDATE=0 CTEST_TEST_TIMEOUT=120
531+
ctest_test_timeout: 120
532+
setenvs: export HOMEBREW_PREFIX=/usr/local
532533
EXTRA_BREW_PACKAGES="openimageio"
533-
- desc: MacOS-14-ARM llvm17
534+
LLVMBREWVER="@17"
535+
- desc: MacOS-14-ARM llvm19 oiio-release
534536
runner: macos-14
535537
nametag: macos14-arm-p313
536538
cc_compiler: clang
537539
cxx_compiler: clang++
538540
cxx_std: 17
539541
python_ver: "3.13"
540542
aclang: 15
541-
setenvs: export DO_BREW_UPDATE=0
542-
EXTRA_BREW_PACKAGES="openimageio"
543-
- desc: MacOS-15-ARM aclang16/C++17/py3.13
543+
setenvs: export EXTRA_BREW_PACKAGES="openimageio"
544+
LLVMBREWVER="@19"
545+
- desc: MacOS-15-ARM aclang16/C++17/py3.13 llvm19 oiio-main
544546
runner: macos-15
545547
nametag: macos15-arm-py313
546548
cc_compiler: clang
547549
cxx_compiler: clang++
548550
cxx_std: 17
549551
python_ver: "3.13"
550552
openimageio_ver: main
553+
setenvs: export LLVMBREWVER="@19"
551554

552555

553556
windows:

src/build-scripts/install_homebrew_deps.bash

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ echo ""
2828
echo "Before my brew installs:"
2929
brew list --versions
3030

31-
brew install --display-times -q gcc ccache cmake ninja || true
31+
if [[ "${BREW_UNLINK_PACKAGES}" != "" ]] ; then
32+
brew unlink ${BREW_UNLINK_PACKAGES} || true
33+
fi
34+
35+
36+
if [[ "${DO_BREW_CMAKE_INSTALL:=1}" != "0" ]] ; then
37+
brew install --display-times -q cmake || true
38+
fi
39+
brew install --display-times -q gcc ccache ninja || true
3240
brew link --overwrite gcc
3341
brew install --display-times -q python@${PYTHON_VERSION} || true
34-
# brew unlink [email protected] || true
35-
# brew unlink [email protected] || true
36-
brew unlink [email protected] || true
3742
brew link --overwrite --force python@${PYTHON_VERSION} || true
38-
#brew upgrade --display-times -q cmake || true
3943
brew install --display-times -q imath openexr opencolorio || true
4044
#brew install --display-times -q freetype
4145
brew install --display-times -q partio pugixml || true

src/cmake/externalpackages.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ if (LLVM_VERSION VERSION_GREATER_EQUAL 16.0)
8787
if (CMAKE_COMPILER_IS_GNUCC AND (GCC_VERSION VERSION_LESS 7.0))
8888
message (WARNING "${ColorYellow}LLVM 16+ requires gcc 7.0 or higher.${ColorReset}\n")
8989
endif ()
90-
if (CMAKE_COMPILER_IS_CLANG AND (CLANG_VERSION_STRING VERSION_LESS 5.0
91-
OR APPLE_CLANG_VERSION_STRING VERSION_LESS 5.0))
90+
if (CMAKE_COMPILER_IS_CLANG
91+
AND NOT (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 5.0
92+
OR APPLECLANG_VERSION_STRING VERSION_GREATER_EQUAL 5.0))
9293
message (WARNING "${ColorYellow}LLVM 16+ requires clang 5.0 or higher.${ColorReset}\n")
9394
endif ()
9495
endif ()

src/cmake/llvm_macros.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ function ( EMBED_LLVM_BITCODE_IN_CPP src_list suffix output_name list_to_append_
6060
endif ()
6161

6262
if (APPLE)
63-
list (APPEND LLVM_COMPILE_FLAGS -isysroot ${CMAKE_OSX_SYSROOT})
63+
if (CMAKE_OSX_SYSROOT)
64+
list (APPEND LLVM_COMPILE_FLAGS -isysroot ${CMAKE_OSX_SYSROOT})
65+
endif ()
6466
if (CMAKE_OSX_DEPLOYMENT_TARGET)
6567
list (APPEND LLVM_COMPILE_FLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
6668
endif ()

0 commit comments

Comments
 (0)