Skip to content

Commit ca3a467

Browse files
chxmberlandmarkreidvfxbernie-laberge
authored
Make OpenRV buildable on Xcode 15 (#475)
### Linked issues Fixes #278 ### Summarize your change. OpenRV will now default to using Boost 1.81 if the user has Xcode 15 or greater. Otherwise, OpenRV will default to using Boost 1.80, which is compliant with CY 2023 and works with Xcode 14.3.1. This also is outlined for the user in changes to documentation. ### Describe the reason for the change. Xcode 14.3.1 is deprecated on macOS Sonoma in favour of Xcode 15 and up, which means users on Sonoma or later will not be able to build OpenRV without this change. ### Describe what you have tested and on which operating system. A complete build of OpenRV using `rvbootstrap` on macOS Sonoma and Xcode 15. ### Add a list of changes, and note any that might need special attention during the review. - [ ] CMake automatically uses Boost 1.80 if the Clang version provided by Xcode is less than 15 --------- Signed-off-by: Ben Chamberland <[email protected]> Signed-off-by: Mark Reid <[email protected]> Co-authored-by: Mark Reid <[email protected]> Co-authored-by: Bernard Laberge <[email protected]>
1 parent 950ec03 commit ca3a467

File tree

4 files changed

+64
-20
lines changed

4 files changed

+64
-20
lines changed

cmake/dependencies/boost.cmake

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,46 @@ SET(_major_minor_version
2121
"1_80"
2222
)
2323

24+
SET(_download_hash
25+
077f074743ea7b0cb49c6ed43953ae95
26+
)
27+
28+
# Note: Boost 1.80 cannot be built with XCode 15 which is now the only XCode version available on macOS Sonoma without a hack. Boost 1.81 has all the fixes
29+
# required to be able to be built with XCode 15, however it is not VFX Platform CY2023 compliant which specifies Boost version 1.80. With the aim of making the
30+
# OpenRV build on macOS smoother by default, we will use Boost 1.81 if XCode 15 or more recent.
31+
IF(RV_TARGET_DARWIN)
32+
EXECUTE_PROCESS(
33+
COMMAND xcrun clang --version
34+
OUTPUT_VARIABLE CLANG_FULL_VERSION_STRING
35+
)
36+
STRING(
37+
REGEX
38+
REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${CLANG_FULL_VERSION_STRING}
39+
)
40+
IF(CLANG_VERSION_STRING VERSION_GREATER_EQUAL 15.0)
41+
MESSAGE(STATUS "Clang version ${CLANG_VERSION_STRING} is not compatible with Boost 1.80, using Boost 1.81 instead. "
42+
"Install XCode 14.3.1 if you absolutely want to use Boost version 1.80 as per VFX reference platform CY2023"
43+
)
44+
45+
SET(_version
46+
"1.81.0"
47+
)
48+
49+
SET(_major_minor_version
50+
"1_81"
51+
)
52+
53+
SET(_download_hash
54+
4bf02e84afb56dfdccd1e6aec9911f4b
55+
)
56+
ENDIF()
57+
ENDIF()
58+
2459
STRING(REPLACE "." "_" _version_with_underscore ${_version})
2560
SET(_download_url
2661
"https://archives.boost.io/release/${_version}/source/boost_${_version_with_underscore}.tar.gz"
2762
)
2863

29-
SET(_download_hash
30-
077f074743ea7b0cb49c6ed43953ae95
31-
)
32-
3364
# Set _base_dir for Clean-<target>
3465
SET(_base_dir
3566
${RV_DEPS_BASE_DIR}/${_target}

cmake/dependencies/zlib.cmake

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ SET(_install_dir
2626
${RV_DEPS_BASE_DIR}/${_target}/install
2727
)
2828

29-
# This file is pretty close to being ready to use the Standrd macros: (create_lib_bin especially but maybe rv_make_std_lib). One problem is debug names for Libs which is different but there's ways to fix this.
30-
SET(RV_DEPS_ZLIB_ROOT_DIR
31-
${_install_dir}
29+
# This file is pretty close to being ready to use the Standrd macros: (create_lib_bin especially but maybe rv_make_std_lib). One problem is debug names for Libs
30+
# which is different but there's ways to fix this.
31+
SET(RV_DEPS_ZLIB_ROOT_DIR
32+
${_install_dir}
3233
)
3334

3435
SET(_include_dir
@@ -103,12 +104,11 @@ IF(RV_TARGET_WINDOWS)
103104
LIST(APPEND _zlib_byproducts ${_implibpath})
104105
ENDIF()
105106

106-
# The patch comes from the ZLIB port in Vcpkg repository.
107-
# The name of the patch is kept as is. See https://github.com/microsoft/vcpkg/tree/master/ports/zlib
107+
# The patch comes from the ZLIB port in Vcpkg repository. The name of the patch is kept as is. See https://github.com/microsoft/vcpkg/tree/master/ports/zlib
108108
# Description: Fix unistd.h being incorrectly required when imported from a project defining HAVE_UNISTD_H=0
109-
SET(_patch_command
110-
patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/zconf.h.cmakein_prevent_invalid_inclusions.patch
111-
&& patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/zconf.h.in_prevent_invalid_inclusions.patch
109+
SET(_patch_command
110+
patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/zconf.h.cmakein_prevent_invalid_inclusions.patch && patch -p1 <
111+
${CMAKE_CURRENT_SOURCE_DIR}/patch/zconf.h.in_prevent_invalid_inclusions.patch
112112
)
113113

114114
EXTERNALPROJECT_ADD(
@@ -155,6 +155,18 @@ IF(RV_TARGET_WINDOWS)
155155
${_target}-stage-target ALL
156156
DEPENDS ${RV_STAGE_BIN_DIR}/${_libname}
157157
)
158+
ELSEIF(RV_TARGET_DARWIN)
159+
ADD_CUSTOM_COMMAND(
160+
COMMENT "Installing ${_target}'s libs into ${RV_STAGE_LIB_DIR}"
161+
OUTPUT ${RV_STAGE_LIB_DIR}/${_libname}
162+
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -id "@rpath/${_libname}" "${_lib_dir}/${_libname}"
163+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_lib_dir} ${RV_STAGE_LIB_DIR}
164+
DEPENDS ${_target}
165+
)
166+
ADD_CUSTOM_TARGET(
167+
${_target}-stage-target ALL
168+
DEPENDS ${RV_STAGE_LIB_DIR}/${_libname}
169+
)
158170
ELSE()
159171
ADD_CUSTOM_COMMAND(
160172
COMMENT "Installing ${_target}'s libs into ${RV_STAGE_LIB_DIR}"

docs/build_system/config_macos.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ Note that using an XCode version more recent than 14.3.1 will result in an FFmpe
1515

1616
`xcode-select -p` should return `/Applications/Xcode.app/Contents/Developer`. If it's not the case, run `sudo xcode-select -s /Applications/Xcode.app`
1717

18+
Note that XCode 15 is not compatible with Boost 1.80. If XCode 15 is installed, RV will automatically default to using Boost 1.81 instead.
19+
Install XCode 14.3.1 if you absolutely want to use Boost version 1.80 as per VFX reference platform CY2023.
20+
21+
Please reference [this workaround](https://forums.developer.apple.com/forums/thread/734709) to use XCode 14.3.1 on Sonoma, as it is no longer
22+
compatible by default.
23+
1824
## Install Homebrew
1925

2026
Homebrew is the one stop shop providing all the build requirements. You can install it following the instructions on the [Homebrew page](https://brew.sh).

src/build/make_pyside.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,11 @@ def prepare() -> None:
8686
system = platform.system()
8787
if system == "Darwin":
8888
clang_version_search = re.search(
89-
"version (\d+)\.(\d+)",
89+
"version (\d+)\.(\d+)\.(\d+)",
9090
os.popen("clang --version").read(),
9191
)
92-
clang_version_str = "".join(clang_version_search.groups())
93-
clang_version_int = int(clang_version_str)
94-
95-
if clang_version_int <= 120:
96-
clang_filename_suffix = clang_version_str + "-based-mac.7z"
97-
else:
98-
clang_filename_suffix = clang_version_str + "-based-macos-universal.7z"
92+
clang_version_str = ".".join(clang_version_search.groups())
93+
clang_filename_suffix = clang_version_str + "-based-macos-universal.7z"
9994
elif system == "Linux":
10095
clang_filename_suffix = "80-based-linux-Rhel7.2-gcc5.3-x86_64.7z"
10196
elif system == "Windows":

0 commit comments

Comments
 (0)