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

ci: use conan on macos #291

Merged
merged 14 commits into from
Dec 24, 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
4 changes: 2 additions & 2 deletions .CI/SetupHomebrewDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ do
arch -x86_64 "$x86_64_homebrew_dir/bin/brew" install $(arch -x86_64 "$x86_64_homebrew_dir/bin/brew" --cache --bottle-tag=x86_64_ventura "$dep")
done

echo "Relinking boost libraries"
c2-make-universal-dylib lib/libboost_random-mt.dylib
# echo "Relinking boost libraries"
# c2-make-universal-dylib lib/libboost_random-mt.dylib

echo "Relinking OpenSSL 3 libcrypto"
c2-make-universal-dylib lib/libcrypto.dylib
Expand Down
48 changes: 22 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ env:
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/chatterino7' || startsWith(github.ref, 'refs/heads/bugfix-release') || startsWith(github.ref, 'refs/heads/release/')}}
CHATTERINO_REQUIRE_CLEAN_GIT: On
C2_BUILD_WITH_QT6: Off
# Last known good conan version
# 2.0.3 has a bug on Windows (conan-io/conan#13606)
CONAN_VERSION: 2.4.0
CONAN_VERSION: 2.11.0

jobs:
build-ubuntu-docker:
Expand Down Expand Up @@ -184,32 +182,32 @@ jobs:
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }}
path: ~/.conan2/

- name: Install Conan (Windows)
if: startsWith(matrix.os, 'windows')
run: |
python3 -c "import site; import sys; print(f'{site.USER_BASE}\\Python{sys.version_info.major}{sys.version_info.minor}\\Scripts')" >> "$GITHUB_PATH"
pip3 install --user "conan==${{ env.CONAN_VERSION }}"
shell: powershell
- name: Setup Python (Windows/macOS)
uses: actions/setup-python@v5
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')
with:
python-version: "3.13"

- name: Setup Conan (Windows)
if: startsWith(matrix.os, 'windows')
- name: Install and Setup Conan (Windows/macOS)
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')
run: |
pip install conan==${{env.CONAN_VERSION}}
conan --version
conan profile detect -f
shell: powershell
shell: bash

- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
- name: Install dependencies (Windows/macOS)
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')
run: |
mkdir build
cd build
conan install .. `
-s build_type=RelWithDebInfo `
-c tools.cmake.cmaketoolchain:generator="NMake Makefiles" `
-b missing `
--output-folder=. `
-o with_openssl3="$Env:C2_USE_OPENSSL3"
shell: powershell
conan install .. \
-s build_type=${{startsWith(matrix.os, 'macos') && 'Release' || 'RelWithDebInfo'}} \
-c tools.cmake.cmaketoolchain:generator="Ninja" \
-b missing \
--output-folder=. \
-o with_openssl3="$C2_USE_OPENSSL3"
shell: bash

- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
Expand Down Expand Up @@ -278,22 +276,20 @@ jobs:
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew tap-new gh/local-boost
brew tap homebrew/core --force
brew extract --version=1.86.0 boost gh/local-boost
# binary dependencies
./.CI/SetupHomebrewDeps.sh boost@1.86.0 openssl@3
./.CI/SetupHomebrewDeps.sh openssl@3
# build and header-only dependencies
brew install rapidjson p7zip create-dmg cmake tree
shell: bash

- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
mkdir -p build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
QT_QPA_PLATFORM: minimal
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
CONAN_VERSION: 2.11.0

concurrency:
group: test-macos-${{ github.ref }}
Expand All @@ -23,7 +24,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13]
os: [macos-latest]
qt-version: [6.7.1]
plugins: [true]
fail-fast: false
Expand Down Expand Up @@ -55,13 +56,24 @@ jobs:
modules: ${{ env.QT_MODULES }}
version: ${{ matrix.qt-version }}

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: |
brew install openssl rapidjson p7zip create-dmg cmake
brew tap-new gh/local-boost
brew tap homebrew/core --force
brew extract --version=1.86.0 boost gh/local-boost
brew install boost@1.86.0
brew install openssl rapidjson p7zip create-dmg cmake ninja

pip install conan==${{env.CONAN_VERSION}}
conan --version
conan profile detect -f
mkdir build-test
cd build-test
conan install .. \
-s build_type=RelWithDebInfo \
-c tools.cmake.cmaketoolchain:generator="Ninja" \
-b missing \
--output-folder=.

- name: Install httpbox
run: |
Expand All @@ -72,10 +84,11 @@ jobs:

- name: Build
run: |
mkdir build-test
mkdir -p build-test
cd build-test
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \
-DBUILD_TESTS=On \
-DBUILD_APP=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ if (BUILD_WITH_QTKEYCHAIN)
endif()
endif()

find_package(RapidJSON REQUIRED)
find_package(RapidJSON MODULE REQUIRED)

find_package(Websocketpp REQUIRED)

Expand Down
23 changes: 18 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from conan import ConanFile
from conan.tools.files import copy
from conan.tools.cmake import CMakeToolchain
from os import path


class Chatterino(ConanFile):
name = "Chatterino"
requires = "libavif/1.0.4"
settings = "os", "compiler", "build_type", "arch"
default_options = {
"with_benchmark": False,
Expand All @@ -18,19 +18,32 @@ class Chatterino(ConanFile):
# Qt is built with OpenSSL 3 from version 6.5.0 onwards
"with_openssl3": [True, False],
}
generators = "CMakeDeps", "CMakeToolchain"
generators = "CMakeDeps"

def requirements(self):
self.requires("boost/1.86.0")

if self.settings.os != "Windows":
return

self.requires("boost/1.85.0")
self.requires("libavif/1.1.1")
if self.options.get_safe("with_benchmark", False):
self.requires("benchmark/1.8.4")
self.requires("benchmark/1.9.0")

self.requires("openssl/3.2.2")
self.requires("openssl/3.3.2")

def generate(self):
tc = CMakeToolchain(self)
tc.blocks.remove("compilers")
tc.blocks.remove("cmake_flags_init")
tc.blocks.remove("cppstd")
tc.blocks.remove("libcxx")
tc.blocks.remove("generic_system")
tc.blocks.remove("user_toolchain")
tc.blocks.remove("output_dirs")
tc.blocks.remove("apple_system")
tc.generate()

def copy_bin(dep, selector, subdir):
src = path.realpath(dep.cpp_info.bindirs[0])
dst = path.realpath(path.join(self.build_folder, subdir))
Expand Down
Loading