From 337406971a586aef2a30606aee31d7df0822b637 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sat, 14 Jun 2025 01:07:03 -0500 Subject: [PATCH] Additional macOS configuration with llvm@18 --- CMakePresets.json | 99 +++++++++++++++++++ tools/conan/profiles/scwx-macos_clang-18 | 8 ++ .../conan/profiles/scwx-macos_clang-18_armv8 | 8 ++ tools/configure-environment.sh | 35 ++++--- tools/setup-macos-debug.sh | 30 ++++++ tools/setup-macos-release.sh | 30 ++++++ 6 files changed, 197 insertions(+), 13 deletions(-) create mode 100644 tools/conan/profiles/scwx-macos_clang-18 create mode 100644 tools/conan/profiles/scwx-macos_clang-18_armv8 create mode 100755 tools/setup-macos-debug.sh create mode 100755 tools/setup-macos-release.sh diff --git a/CMakePresets.json b/CMakePresets.json index 575be130..2e1fe5f6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -210,6 +210,81 @@ "CC": "gcc-11", "CXX": "g++-11" } + }, + { + "name": "macos-base", + "inherits": "base", + "hidden": true, + "cacheVariables": { + "CMAKE_PREFIX_PATH": "$env{HOME}/Qt/6.8.3/macos" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-clang18-base", + "inherits": "macos-base", + "hidden": true, + "environment": { + "CC": "/opt/homebrew/opt/llvm@18/bin/clang", + "CXX": "/opt/homebrew/opt/llvm@18/bin/clang++", + "PATH": "/opt/homebrew/opt/llvm@18/bin:$penv{PATH}", + "CPPFLAGS": "-I/opt/homebrew/opt/llvm@18/include", + "LDFLAGS": "-L/opt/homebrew/opt/llvm@18/lib -L/opt/homebrew/opt/llvm@18/lib/c++" + } + }, + { + "name": "macos-clang18-x64-base", + "inherits": "macos-clang18-base", + "hidden": true, + "cacheVariables": { + "CONAN_HOST_PROFILE": "scwx-macos_clang-18", + "CONAN_BUILD_PROFILE": "scwx-macos_clang-18" + } + }, + { + "name": "macos-clang18-arm64-base", + "inherits": "macos-clang18-base", + "hidden": true, + "cacheVariables": { + "CONAN_HOST_PROFILE": "scwx-macos_clang-18_armv8", + "CONAN_BUILD_PROFILE": "scwx-macos_clang-18_armv8" + } + }, + { + "name": "macos-clang18-x64-debug", + "inherits": "macos-clang18-x64-base", + "displayName": "macOS Clang 18 x64 Debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "macos-clang18-x64-release", + "inherits": "macos-clang18-x64-base", + "displayName": "macOS Clang 18 x64 Release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "macos-clang18-arm64-debug", + "inherits": "macos-clang18-arm64-base", + "displayName": "macOS Clang 18 Arm64 Debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "macos-clang18-arm64-release", + "inherits": "macos-clang18-arm64-base", + "displayName": "macOS Clang 18 Arm64 Release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } } ], "buildPresets": [ @@ -236,6 +311,30 @@ "configurePreset": "linux-gcc-release", "displayName": "Linux GCC Release", "configuration": "Release" + }, + { + "name": "macos-clang18-x64-debug", + "configurePreset": "macos-clang18-x64-debug", + "displayName": "macOS Clang 18 x64 Debug", + "configuration": "Debug" + }, + { + "name": "macos-clang18-x64-release", + "configurePreset": "macos-clang18-x64-release", + "displayName": "macOS Clang 18 x64 Release", + "configuration": "Release" + }, + { + "name": "macos-clang18-arm64-debug", + "configurePreset": "macos-clang18-arm64-debug", + "displayName": "macOS Clang 18 Arm64 Debug", + "configuration": "Debug" + }, + { + "name": "macos-clang18-arm64-release", + "configurePreset": "macos-clang18-arm64-release", + "displayName": "macOS Clang 18 Arm64 Release", + "configuration": "Release" } ], "testPresets": [ diff --git a/tools/conan/profiles/scwx-macos_clang-18 b/tools/conan/profiles/scwx-macos_clang-18 new file mode 100644 index 00000000..70889284 --- /dev/null +++ b/tools/conan/profiles/scwx-macos_clang-18 @@ -0,0 +1,8 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=clang +compiler.cppstd=20 +compiler.libcxx=libc++ +compiler.version=18 +os=Macos diff --git a/tools/conan/profiles/scwx-macos_clang-18_armv8 b/tools/conan/profiles/scwx-macos_clang-18_armv8 new file mode 100644 index 00000000..63c6d597 --- /dev/null +++ b/tools/conan/profiles/scwx-macos_clang-18_armv8 @@ -0,0 +1,8 @@ +[settings] +arch=armv8 +build_type=Release +compiler=clang +compiler.cppstd=20 +compiler.libcxx=libc++ +compiler.version=18 +os=Macos diff --git a/tools/configure-environment.sh b/tools/configure-environment.sh index bc844493..1dfc714c 100755 --- a/tools/configure-environment.sh +++ b/tools/configure-environment.sh @@ -45,20 +45,29 @@ python3 -m pip install ${PIP_FLAGS} -r "${script_dir}/../requirements.txt" conan profile detect -e # Conan profiles -conan_profiles=( - "scwx-linux_clang-17" - "scwx-linux_clang-17_armv8" - "scwx-linux_clang-18" - "scwx-linux_clang-18_armv8" - "scwx-linux_gcc-11" - "scwx-linux_gcc-11_armv8" - "scwx-linux_gcc-12" - "scwx-linux_gcc-12_armv8" - "scwx-linux_gcc-13" - "scwx-linux_gcc-13_armv8" - "scwx-linux_gcc-14" - "scwx-linux_gcc-14_armv8" +if [[ "$(uname)" == "Darwin" ]]; then + # macOS profiles + conan_profiles=( + "scwx-macos_clang-18" + "scwx-macos_clang-18_armv8" ) +else + # Linux profiles + conan_profiles=( + "scwx-linux_clang-17" + "scwx-linux_clang-17_armv8" + "scwx-linux_clang-18" + "scwx-linux_clang-18_armv8" + "scwx-linux_gcc-11" + "scwx-linux_gcc-11_armv8" + "scwx-linux_gcc-12" + "scwx-linux_gcc-12_armv8" + "scwx-linux_gcc-13" + "scwx-linux_gcc-13_armv8" + "scwx-linux_gcc-14" + "scwx-linux_gcc-14_armv8" + ) +fi # Install Conan profiles for profile_name in "${conan_profiles[@]}"; do diff --git a/tools/setup-macos-debug.sh b/tools/setup-macos-debug.sh new file mode 100755 index 00000000..d9c31c7e --- /dev/null +++ b/tools/setup-macos-debug.sh @@ -0,0 +1,30 @@ +#!/bin/bash +script_source="${BASH_SOURCE[0]:-$0}" +script_dir="$(cd "$(dirname "${script_source}")" && pwd)" + +export build_dir="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "${1:-${script_dir}/../build-debug}")" +export build_type=Debug +export conan_profile=${2:-scwx-macos_clang-18_armv8} +export generator=Ninja +export qt_base="/Users/${USER}/Qt" +export qt_arch=macos +export address_sanitizer=${4:-disabled} + +# Set explicit compiler paths +export CC=/opt/homebrew/opt/llvm@18/bin/clang +export CXX=/opt/homebrew/opt/llvm@18/bin/clang++ +export PATH="/opt/homebrew/opt/llvm@18/bin:$PATH" + +export LDFLAGS="-L/opt/homebrew/opt/llvm@18/lib -L/opt/homebrew/opt/llvm@18/lib/c++" +export CPPFLAGS="-I/opt/homebrew/opt/llvm@18/include" + +# Assign user-specified Python Virtual Environment +if [ "${3:-}" = "none" ]; then + unset venv_path +else + # macOS does not have 'readlink -f', use python for realpath + export venv_path="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "${3:-${script_dir}/../.venv}")" +fi + +# Perform common setup +"${script_dir}/lib/setup-common.sh" diff --git a/tools/setup-macos-release.sh b/tools/setup-macos-release.sh new file mode 100755 index 00000000..39fd40e9 --- /dev/null +++ b/tools/setup-macos-release.sh @@ -0,0 +1,30 @@ +#!/bin/bash +script_source="${BASH_SOURCE[0]:-$0}" +script_dir="$(cd "$(dirname "${script_source}")" && pwd)" + +export build_dir="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "${1:-${script_dir}/../build-release}")" +export build_type=Release +export conan_profile=${2:-scwx-macos_clang-18_armv8} +export generator=Ninja +export qt_base="/Users/${USER}/Qt" +export qt_arch=macos +export address_sanitizer=${4:-disabled} + +# Set explicit compiler paths +export CC=/opt/homebrew/opt/llvm@18/bin/clang +export CXX=/opt/homebrew/opt/llvm@18/bin/clang++ +export PATH="/opt/homebrew/opt/llvm@18/bin:$PATH" + +export LDFLAGS="-L/opt/homebrew/opt/llvm@18/lib -L/opt/homebrew/opt/llvm@18/lib/c++" +export CPPFLAGS="-I/opt/homebrew/opt/llvm@18/include" + +# Assign user-specified Python Virtual Environment +if [ "${3:-}" = "none" ]; then + unset venv_path +else + # macOS does not have 'readlink -f', use python for realpath + export venv_path="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "${3:-${script_dir}/../.venv}")" +fi + +# Perform common setup +"${script_dir}/lib/setup-common.sh"