mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Upgrade from Conan 1.x to 2.x (#4417)
Conan 1.x is no longer supported - upgrade if you used it for dependency management Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
b209c50b01
commit
281bddb4cf
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
|
@ -108,19 +108,19 @@ jobs:
|
||||||
version: ${{ matrix.qt-version }}
|
version: ${{ matrix.qt-version }}
|
||||||
|
|
||||||
# WINDOWS
|
# WINDOWS
|
||||||
- name: Cache conan packages part 1
|
- name: Setup conan variables (Windows)
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
uses: actions/cache@v3
|
run: |
|
||||||
with:
|
"C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV"
|
||||||
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-user-${{ hashFiles('**/conanfile.txt') }}
|
"C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV"
|
||||||
path: ~/.conan/
|
shell: powershell
|
||||||
|
|
||||||
- name: Cache conan packages part 2
|
- name: Cache conan packages
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
|
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }}
|
||||||
path: C:/.conan/
|
path: ~/.conan2/
|
||||||
|
|
||||||
- name: Add Conan to path
|
- name: Add Conan to path
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
|
@ -129,7 +129,7 @@ jobs:
|
||||||
- name: Install dependencies (Windows)
|
- name: Install dependencies (Windows)
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
choco install conan -y --version 1.58.0
|
choco install conan -y
|
||||||
|
|
||||||
- name: Enable Developer Command Prompt
|
- name: Enable Developer Command Prompt
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
|
@ -138,15 +138,21 @@ jobs:
|
||||||
- name: Setup Conan (Windows)
|
- name: Setup Conan (Windows)
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
conan profile new --detect --force default
|
conan --version
|
||||||
conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default
|
conan profile detect -f
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
- name: Build (Windows)
|
- name: Build (Windows)
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
conan install .. -s build_type=RelWithDebInfo -b missing -pr:b=default
|
conan install .. `
|
||||||
|
-s build_type=RelWithDebInfo `
|
||||||
|
-c tools.cmake.cmaketoolchain:generator="NMake Makefiles" `
|
||||||
|
-b missing `
|
||||||
|
--output-folder=. `
|
||||||
|
-o with_openssl3="$Env:C2_USE_OPENSSL3"
|
||||||
cmake `
|
cmake `
|
||||||
-G"NMake Makefiles" `
|
-G"NMake Makefiles" `
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||||
|
@ -192,9 +198,9 @@ jobs:
|
||||||
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z
|
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z
|
||||||
path: build/bin/chatterino.pdb.7z
|
path: build/bin/chatterino.pdb.7z
|
||||||
|
|
||||||
- name: Clean Conan pkgs
|
- name: Clean Conan cache
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: conan remove "*" -fsb
|
run: conan cache clean --source --build --download "*"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
# LINUX
|
# LINUX
|
||||||
|
|
|
@ -79,16 +79,14 @@ Note: This installation will take about 200 MB of disk space.
|
||||||
|
|
||||||
### Using CMake
|
### Using CMake
|
||||||
|
|
||||||
#### Install conan
|
#### Install conan 2
|
||||||
|
|
||||||
Install [conan](https://conan.io/downloads.html) and make sure it's in your `PATH` (default setting).
|
Install [conan 2](https://conan.io/downloads.html) and make sure it's in your `PATH` (default setting).
|
||||||
|
|
||||||
Then in a terminal, configure conan to use `NMake Makefiles` as its generator:
|
Then in a terminal, configure conan to use `NMake Makefiles` as its generator:
|
||||||
|
|
||||||
1. Generate a new profile
|
1. Generate a new profile
|
||||||
`conan profile new --detect --force default`
|
`conan profile detect`
|
||||||
1. Configure the profile to use `NMake Makefiles` as its generator
|
|
||||||
`conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default`
|
|
||||||
|
|
||||||
#### Build
|
#### Build
|
||||||
|
|
||||||
|
@ -96,10 +94,12 @@ Open up your terminal with the Visual Studio environment variables (e.g. `x64 Na
|
||||||
|
|
||||||
1. `mkdir build`
|
1. `mkdir build`
|
||||||
1. `cd build`
|
1. `cd build`
|
||||||
1. `conan install .. -s build_type=Release --build=missing`
|
1. `conan install .. -s build_type=Release -c tools.cmake.cmaketoolchain:generator="NMake Makefiles" --build=missing --output-folder=.`
|
||||||
1. `cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64" ..`
|
1. `cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64" ..`
|
||||||
1. `nmake`
|
1. `nmake`
|
||||||
|
|
||||||
|
To build a debug build, you'll also need to add the `-s compiler.runtime_type=Debug` flag to the `conan install` invocation. See [this StackOverflow post](https://stackoverflow.com/questions/59828611/windeployqt-doesnt-deploy-qwindowsd-dll-for-a-debug-application/75607313#75607313)
|
||||||
|
|
||||||
#### Ensure DLLs are available
|
#### Ensure DLLs are available
|
||||||
|
|
||||||
Once Chatterino has finished building, to ensure all .dll's are available you can run this from the build directory:
|
Once Chatterino has finished building, to ensure all .dll's are available you can run this from the build directory:
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
- Dev: Only log debug messages when NDEBUG is not defined. (#4442)
|
- Dev: Only log debug messages when NDEBUG is not defined. (#4442)
|
||||||
- Dev: Cleaned up theme related code. (#4450)
|
- Dev: Cleaned up theme related code. (#4450)
|
||||||
- Dev: Ensure tests have default-initialized settings. (#4498)
|
- Dev: Ensure tests have default-initialized settings. (#4498)
|
||||||
|
- Dev: Conan 2.0 is now used instead of Conan 1.0. (#4417)
|
||||||
|
|
||||||
## 2.4.2
|
## 2.4.2
|
||||||
|
|
||||||
|
|
52
conanfile.py
Normal file
52
conanfile.py
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.files import copy
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
|
||||||
|
class Chatterino(ConanFile):
|
||||||
|
name = "Chatterino"
|
||||||
|
requires = "boost/1.81.0"
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
default_options = {
|
||||||
|
"with_benchmark": False,
|
||||||
|
"with_openssl3": False,
|
||||||
|
"openssl*:shared": True,
|
||||||
|
}
|
||||||
|
options = {
|
||||||
|
"with_benchmark": [True, False],
|
||||||
|
# Qt is built with OpenSSL 3 from version 6.5.0 onwards
|
||||||
|
"with_openssl3": [True, False],
|
||||||
|
}
|
||||||
|
generators = "CMakeDeps", "CMakeToolchain"
|
||||||
|
|
||||||
|
def requirements(self):
|
||||||
|
if self.options.get_safe("with_benchmark", False):
|
||||||
|
self.requires("benchmark/1.7.1")
|
||||||
|
|
||||||
|
if self.options.get_safe("with_openssl3", False):
|
||||||
|
self.requires("openssl/3.1.0")
|
||||||
|
else:
|
||||||
|
self.requires("openssl/1.1.1t")
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
copy_bin = lambda dep, selector, subdir: copy(
|
||||||
|
self,
|
||||||
|
selector,
|
||||||
|
dep.cpp_info.bindirs[0],
|
||||||
|
path.join(self.build_folder, subdir),
|
||||||
|
keep_path=False,
|
||||||
|
)
|
||||||
|
for dep in self.dependencies.values():
|
||||||
|
# macOS
|
||||||
|
copy_bin(dep, "*.dylib", "bin")
|
||||||
|
# Windows
|
||||||
|
copy_bin(dep, "*.dll", "bin")
|
||||||
|
copy_bin(dep, "*.dll", "Chatterino2") # used in CI
|
||||||
|
# Linux
|
||||||
|
copy(
|
||||||
|
self,
|
||||||
|
"*.so*",
|
||||||
|
dep.cpp_info.libdirs[0],
|
||||||
|
path.join(self.build_folder, "bin"),
|
||||||
|
keep_path=False,
|
||||||
|
)
|
|
@ -1,15 +0,0 @@
|
||||||
[requires]
|
|
||||||
openssl/1.1.1s
|
|
||||||
boost/1.80.0
|
|
||||||
|
|
||||||
[generators]
|
|
||||||
CMakeDeps
|
|
||||||
CMakeToolchain
|
|
||||||
|
|
||||||
[options]
|
|
||||||
openssl:shared=True
|
|
||||||
|
|
||||||
[imports]
|
|
||||||
bin, *.dll -> ./bin @ keep_path=False
|
|
||||||
bin, *.dll -> ./Chatterino2 @ keep_path=False
|
|
||||||
lib, *.so* -> ./bin @ keep_path=False
|
|
Loading…
Reference in a new issue