Skip to content

Commit

Permalink
Merge pull request #1412 from KrisThielemans/GHA_MacOSxcode
Browse files Browse the repository at this point in the history
[GHA] remove explicit setting of xcode version
  • Loading branch information
KrisThielemans authored May 5, 2024
2 parents 8664718 + 5ccb440 commit 4e8d40e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ jobs:
CXX=${CXX}-${{ matrix.compiler_version }}
fi
if test 'XX${{ matrix.os }}' = 'XXmacOS-latest'; then
# need to force XCode version for the moment due to a linker bug
# see https://github.com/UCL/STIR/issues/1103
echo DEVELOPER_DIR="/Applications/Xcode_14.1.app/Contents/Developer" >> $GITHUB_ENV
if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
brew install llvm@${{ matrix.compiler_version }}
if test XX${HOMEBREW_PREFIX} = XX; then
Expand Down
5 changes: 5 additions & 0 deletions documentation/release_6.1.htm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ <h3>Bug fixes</h3>
<li>The Relative Difference Prior gave incorrect results, probably since switching to C++-14 in version 6.0, although we are not sure.
See <a href=https://github.com/UCL/STIR/pull/1410>PR #1410</a> and associated <a href=https://github.com/UCL/STIR/pull/1409>issue #1409</a>.
</li>
<li>
Our checks for determining system byte-order were out-of-date and in particular did not work on MacOS 14 on ARM.
We now use CMake's <code>CMAKE_CXX_BYTE_ORDER</code> (available since CMake 3.20).
See <a href=https://github.com/UCL/STIR/pull/1412>PR #1412</a>.
</li>
</ul>

<h3>Known problems</h3>
Expand Down
12 changes: 12 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ else()
set(STIR_USE_BOOST_SHARED_PTR ON)
endif()

# Byte order
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
# Use CMake to find byte order of target system.
# We create some variables that are then used in config.h.in
if (CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN")
set(BIG_ENDIAN_BYTE_ORDER_FROM_CMAKE TRUE)
message(STATUS "CMake detected a big_endian system")
elseif (CMAKE_CXX_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")
set(LITTLE_ENDIAN_BYTE_ORDER_FROM_CMAKE TRUE)
message(STATUS "CMake detected a little_endian system")
endif()
endif()

#### Create stir/config.h

Expand Down
4 changes: 4 additions & 0 deletions src/cmake/STIRConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ namespace stir {

#include "boost/config.hpp"

// 2 variables set via CMake
#cmakedefine BIG_ENDIAN_BYTE_ORDER_FROM_CMAKE
#cmakedefine LITTLE_ENDIAN_BYTE_ORDER_FROM_CMAKE

#cmakedefine HAVE_ECAT
#ifdef HAVE_ECAT
#define HAVE_LLN_MATRIX
Expand Down
12 changes: 8 additions & 4 deletions src/include/stir/ByteOrderDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
START_NAMESPACE_STIR

// currently checked by asserts()
#if !defined(__alpha) && (!defined(_WIN32) || defined(_M_PPC) || defined(_M_MPPC)) && !defined(__i386__) && !defined(__i486__) \
&& !defined(__i586__) && !defined(__i686__) && !defined(__i786__) && !defined(__i886__) && !defined(__k6__) \
&& !defined(__athlon__) && !defined(__x86_64__) && !defined(__k6__) \
|| (defined(__MSL__) && !defined(__LITTLE_ENDIAN))
// partially from https://stackoverflow.com/a/27054190
#if defined(BIG_ENDIAN_BYTE_ORDER_FROM_CMAKE) /* variable set via CMake in stir/config.h */ \
|| (!defined(LITTLE_ENDIAN_BYTE_ORDER_FROM_CMAKE) /* variable set via CMake in stir/config.h */ \
&& ((!defined(__alpha) && (!defined(_WIN32) || defined(_M_PPC) || defined(_M_MPPC)) && !defined(__i386__) \
&& !defined(__i486__) && !defined(__i586__) && !defined(__i686__) && !defined(__i786__) && !defined(__i886__) \
&& !defined(__k6__) && !defined(__athlon__) && !defined(__x86_64__) && !defined(__k6__)) \
|| (defined(__MSL__) && !defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) \
|| (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) /* gcc */) || defined(__BIG_ENDIAN__)))
# define STIRIsNativeByteOrderBigEndian 1
# define STIRIsNativeByteOrderLittleEndian 0
#else
Expand Down

0 comments on commit 4e8d40e

Please sign in to comment.