Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update OSX builds to llvm clang #5822

Merged
merged 8 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ jobs:
- name: Install dependencies (mac)
if: runner.os == 'macOS'
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel llvm astyle
python3 -m venv ./venv
source ./venv/bin/activate
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist polib luaparser

- name: Build CBN (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
Expand All @@ -266,7 +266,7 @@ jobs:
if: runner.os == 'macOS'
run: |
source ./venv/bin/activate
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} LUA=1 RELEASE=1 LANGUAGES=all USE_HOME_DIR=1 OSX_MIN=11 PCH=0 dmgdist COMPILER=clang++
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} LUA=1 RELEASE=1 LANGUAGES=all USE_HOME_DIR=1 OSX_MIN=11 PCH=0 COMPILER=$(brew --prefix llvm)/bin/clang++ dmgdist
mv CataclysmBN-${{ env.VERSION }}.dmg cbn-${{ matrix.artifact }}-${{ env.VERSION }}.dmg
- name: Set up JDK 11 (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: "Cataclysm OSX Manual Build"

on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- "build-data/osx/**"
- "doc/**"
- "doxygen_doc/**"
- "gfx/**"
- "lang/**"
- "lgtm/**"
- "tools/**"
- "!tools/format/**"
- "utilities/**"
- 'scripts/**'

# We only care about the latest revision of a PR, so cancel previous instances.
concurrency:
group: osx-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true

jobs:
build_catatclysm:
if: github.event.pull_request.draft == false

strategy:
fail-fast: false
matrix:
include:
- name: osx-curses-x64
os: macos-14
mxe: none
tiles: 0
artifact: osx-curses-x64
ext: dmg
content: application/x-apple-diskimage
- name: osx-tiles-x64
os: macos-14
mxe: none
tiles: 1
artifact: osx-tiles-x64
ext: dmg
content: application/x-apple-diskimage
- name: osx-curses-arm
os: macos-14
mxe: none
tiles: 0
artifact: osx-curses-arm
ext: dmg
content: application/x-apple-diskimage
- name: osx-tiles-arm
os: macos-14
mxe: none
tiles: 1
artifact: osx-tiles-arm
ext: dmg
content: application/x-apple-diskimage
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}

env:
ZSTD_CLEVEL: 17

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install runtime dependencies
uses: BrettDong/setup-sdl2-frameworks@v1
with:
sdl2: latest
sdl2-ttf: latest
sdl2-image: latest
sdl2-mixer: latest

- name: Install build dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel llvm astyle
python3 -m venv ./venv
source ./venv/bin/activate
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist polib luaparser

- name: Check Clang OK
run: |
echo "Clang++ version:"
$(brew --prefix llvm)/bin/clang++ --version # Ensure clang++ is installed and working

- name: Build
run: |
source ./venv/bin/activate
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} LUA=1 RELEASE=1 LANGUAGES=all USE_HOME_DIR=1 OSX_MIN=11 PCH=0 COMPILER=$(brew --prefix llvm)/bin/clang++ dmgdist
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ jobs:
- name: Install build dependencies (mac)
if: runner.os == 'macOS'
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install gettext ccache parallel
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install gettext ccache parallel llvm astyle
python3 -m venv ./venv
source ./venv/bin/activate
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist polib luaparser

- name: Build CBN (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
Expand Down Expand Up @@ -308,7 +308,7 @@ jobs:
if: runner.os == 'macOS'
run: |
source ./venv/bin/activate
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LUA=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=11 FRAMEWORK=1 dmgdist
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LUA=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=11 FRAMEWORK=1 COMPILER=$(brew --prefix llvm)/bin/clang++ dmgdist
mv CataclysmBN-unstable.dmg cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.dmg

- name: Set up JDK 11 (android)
Expand Down
17 changes: 17 additions & 0 deletions doc/src/content/docs/en/dev/guides/building/makefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,23 @@ this will not work.

Check that `gcc -v` shows the homebrew version you installed.

### brew clang

If you want to use normal clang instead of apple clang, you can install it with Homebrew:

```sh
brew install llvm
```

Then you can specify the compiler with `COMPILER=$(brew --prefix llvm)/bin/clang++` in your make
command.

It's always good to check that the installed compiler is the one you want.

```sh
$(brew --prefix llvm)/bin/clang++ --version
```

### Compiling

The Cataclysm source is compiled using `make`.
Expand Down
3 changes: 2 additions & 1 deletion src/sol/sol.hpp
scarf005 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
// This header was generated with sol v3.3.0 (revision eba86625)
// https://github.com/ThePhD/sol2

#ifndef SOL_SINGLE_INCLUDE_HPP

Check warning on line 27 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

Header guard does not follow preferred style. [cata-header-guard]
#define SOL_SINGLE_INCLUDE_HPP

#ifndef CATALUA_SOL_WRAPPED
static_assert(false, "sol.hpp must be included via catalua_sol.h");

Check failure on line 31 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

static assertion failed: sol.hpp must be included via catalua_sol.h [clang-diagnostic-error]
#endif

// beginning of sol/sol.hpp
Expand All @@ -52,20 +52,20 @@
#define SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) _LEFT##_RIGHT
#define SOL_CONCAT_TOKENS_I_(_LEFT, _RIGHT) SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT)

#define SOL_RAW_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0)

Check warning on line 55 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_RAW_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0)

Check warning on line 56 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3)

Check warning on line 57 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0)

Check warning on line 58 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Check warning on line 58 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

#define SOL_IS_ON(OP_SYMBOL) SOL_RAW_IS_ON(OP_SYMBOL ## _I_)
#define SOL_IS_OFF(OP_SYMBOL) SOL_RAW_IS_OFF(OP_SYMBOL ## _I_)
#define SOL_IS_DEFAULT_ON(OP_SYMBOL) SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL ## _I_)
#define SOL_IS_DEFAULT_OFF(OP_SYMBOL) SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL ## _I_)

#define SOL_ON |

Check warning on line 65 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_OFF ^

Check warning on line 66 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_DEFAULT_ON +

Check warning on line 67 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
#define SOL_DEFAULT_OFF -

Check warning on line 68 in src/sol/sol.hpp

View workflow job for this annotation

GitHub Actions / build

macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]

#if defined(SOL_BUILD_CXX_MODE)
#if (SOL_BUILD_CXX_MODE != 0)
Expand Down Expand Up @@ -6756,7 +6756,8 @@
static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");

*this = nullopt;
this->construct(std::forward<Args>(args)...);
new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
return **this;
}

/// Swaps this optional with the other.
Expand Down
Loading