From fb5bb891fcdd3d95ce6cdd3c1ee27136997725af Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 27 Feb 2023 22:01:03 +0100 Subject: [PATCH 01/15] build: use conan2 --- .github/workflows/build.yml | 18 +++++++++++------- conanfile.py | 34 ++++++++++++++++++++++++++++++++++ conanfile.txt | 15 --------------- 3 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96aa677b1f8..8397adb700e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,15 +112,15 @@ jobs: if: startsWith(matrix.os, 'windows') uses: actions/cache@v3 with: - key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-user-${{ hashFiles('**/conanfile.txt') }} - path: ~/.conan/ + key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }} + path: ~/.conan2/ - name: Cache conan packages part 2 if: startsWith(matrix.os, 'windows') uses: actions/cache@v3 with: - key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-root-${{ hashFiles('**/conanfile.txt') }} - path: C:/.conan/ + key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.py') }} + path: C:/.conan2/ - name: Add Conan to path if: startsWith(matrix.os, 'windows') @@ -138,15 +138,19 @@ jobs: - name: Setup Conan (Windows) if: startsWith(matrix.os, 'windows') run: | - conan profile new --detect --force default - conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default + conan --version + conan profile detect - name: Build (Windows) if: startsWith(matrix.os, 'windows') run: | mkdir 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=. cmake ` -G"NMake Makefiles" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000000..c8aed2cdb7d --- /dev/null +++ b/conanfile.py @@ -0,0 +1,34 @@ +from conan import ConanFile +from conan.tools.files import copy +from os import path + + +class Chatterino(ConanFile): + name = "Chatterino" + requires = "openssl/1.1.1t", "boost/1.81.0" + settings = "os", "compiler", "build_type", "arch" + default_options = {"openssl*:shared": True} + generators = "CMakeDeps", "CMakeToolchain" + + 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, + ) diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 52f1d9109aa..00000000000 --- a/conanfile.txt +++ /dev/null @@ -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 From d178d6bcb3ffa7aa499fb428d672f0f056a1df85 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 27 Feb 2023 22:12:04 +0100 Subject: [PATCH 02/15] chore: update changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36505727def..f68c07e6698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Bugfix: Fixed a potential race condition due to using the wrong lock when loading 7TV badges. (#4402) - Dev: Add capability to build Chatterino with Qt6. (#4393) - Dev: Fix homebrew update action. (#4394) +- Dev: Conan 2.0 is now used instead of Conan 1.0. (#4417) ## 2.4.1 From c198e6ba4f2e9a6b5aae4501a5b7b06bcd322141 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 4 Mar 2023 12:20:11 +0100 Subject: [PATCH 03/15] Update building documentations for conan 2 --- BUILDING_ON_WINDOWS.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BUILDING_ON_WINDOWS.md b/BUILDING_ON_WINDOWS.md index 11de371d41b..de75650a7fb 100644 --- a/BUILDING_ON_WINDOWS.md +++ b/BUILDING_ON_WINDOWS.md @@ -79,16 +79,14 @@ Note: This installation will take about 200 MB of disk space. ### 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: 1. Generate a new profile - `conan profile new --detect --force default` -1. Configure the profile to use `NMake Makefiles` as its generator - `conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default` + `conan profile detect` #### Build @@ -96,10 +94,12 @@ Open up your terminal with the Visual Studio environment variables (e.g. `x64 Na 1. `mkdir 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. `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 Once Chatterino has finished building, to ensure all .dll's are available you can run this from the build directory: From 39ecc11b9365a74e5dc3c65d6b35779adcec7f5a Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 4 Mar 2023 12:23:33 +0100 Subject: [PATCH 04/15] Remove conan clean stage --- .github/workflows/build.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8397adb700e..57e71468e91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,11 +195,6 @@ jobs: name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z path: build/bin/chatterino.pdb.7z - - name: Clean Conan pkgs - if: startsWith(matrix.os, 'windows') - run: conan remove "*" -fsb - shell: bash - # LINUX - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') From 9a254242720792d6c4c6ab64c3fde93669afe22c Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 4 Mar 2023 13:46:12 +0100 Subject: [PATCH 05/15] ci: use 2.0 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 100dd0099d5..57e71468e91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,7 +129,7 @@ jobs: - name: Install dependencies (Windows) if: startsWith(matrix.os, 'windows') run: | - choco install conan -y --version 1.58.0 + choco install conan -y - name: Enable Developer Command Prompt if: startsWith(matrix.os, 'windows') From bfc1b5abbadc3e1637f9040fcb1d110a5e49584b Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 4 Mar 2023 13:46:55 +0100 Subject: [PATCH 06/15] ci: remove second cache This folder isn't used anymore. The packages are stored in `~/.conan2/p` --- .github/workflows/build.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57e71468e91..5c6570cd4ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,20 +108,13 @@ jobs: version: ${{ matrix.qt-version }} # WINDOWS - - name: Cache conan packages part 1 + - name: Cache conan packages if: startsWith(matrix.os, 'windows') uses: actions/cache@v3 with: key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }} path: ~/.conan2/ - - name: Cache conan packages part 2 - if: startsWith(matrix.os, 'windows') - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.py') }} - path: C:/.conan2/ - - name: Add Conan to path if: startsWith(matrix.os, 'windows') run: echo "C:\Program Files\Conan\conan\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append From 75f1aa9b53a32fa09538054ef41a161ea282bd3c Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 4 Mar 2023 14:24:50 +0100 Subject: [PATCH 07/15] fix: force detect --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c6570cd4ec..1dbf8b6c14d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: | conan --version - conan profile detect + conan profile detect -f - name: Build (Windows) if: startsWith(matrix.os, 'windows') From da7dd3d88f0c88494b5f27668f2b944999eececa Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 4 Mar 2023 14:54:44 +0100 Subject: [PATCH 08/15] fix: clean cache --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dbf8b6c14d..cfc91427328 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -188,6 +188,11 @@ jobs: name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z path: build/bin/chatterino.pdb.7z + - name: Clean Conan cache + if: startsWith(matrix.os, 'windows') + run: conan cache clean --source --build --download "*" + shell: bash + # LINUX - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') From 987b7f21ec820f85366461d106b0135be1e33acf Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 27 Mar 2023 12:45:10 +0200 Subject: [PATCH 09/15] build: add support for benchmark and openssl3 --- .github/workflows/build.yml | 3 +++ conanfile.py | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1473b0fb347..9703b69297a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -133,6 +133,8 @@ jobs: run: | conan --version conan profile detect -f + "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_PATH" + shell: powershell - name: Build (Windows) if: startsWith(matrix.os, 'windows') @@ -144,6 +146,7 @@ jobs: -c tools.cmake.cmaketoolchain:generator="NMake Makefiles" ` -b missing ` --output-folder=. + -o with_openssl3="$Env:C2_USE_OPENSSL3" cmake ` -G"NMake Makefiles" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` diff --git a/conanfile.py b/conanfile.py index c8aed2cdb7d..cb1540e091a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,11 +5,29 @@ class Chatterino(ConanFile): name = "Chatterino" - requires = "openssl/1.1.1t", "boost/1.81.0" + requires = "boost/1.81.0" settings = "os", "compiler", "build_type", "arch" - default_options = {"openssl*:shared": True} + default_options = { + "with_benchmark": False, + "with_openssl3": False, + "openssl*:shared": True, + } + options = { + "with_benchmark": [True, False], + # OpenSSL 3 is supported from Qt 6.2.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, From 049298d4627ba241b545ee41af0a5e3a0229ef6f Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 27 Mar 2023 12:57:59 +0200 Subject: [PATCH 10/15] fix: missing tick --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9703b69297a..66f0a840f23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,7 +145,7 @@ jobs: -s build_type=RelWithDebInfo ` -c tools.cmake.cmaketoolchain:generator="NMake Makefiles" ` -b missing ` - --output-folder=. + --output-folder=. ` -o with_openssl3="$Env:C2_USE_OPENSSL3" cmake ` -G"NMake Makefiles" ` From abaa4bcfb32ad2005ef5350acc1f9b38c18959e0 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 27 Mar 2023 13:13:21 +0200 Subject: [PATCH 11/15] fix: env-name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eafdfe3b381..48fa313a25f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -133,7 +133,7 @@ jobs: run: | conan --version conan profile detect -f - "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_PATH" + "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" shell: powershell - name: Build (Windows) From 4be357a186c24a092dd904316c15b926797506a8 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sun, 2 Apr 2023 10:42:19 +0200 Subject: [PATCH 12/15] fix: mention 6.5 over 6.2 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index cb1540e091a..7db329b8ba7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -14,7 +14,7 @@ class Chatterino(ConanFile): } options = { "with_benchmark": [True, False], - # OpenSSL 3 is supported from Qt 6.2.0 onwards. + # Qt is built with OpenSSL 3 from version 6.5.0 onwards "with_openssl3": [True, False], } generators = "CMakeDeps", "CMakeToolchain" From 34165bf1281dd533de0eafcbb8ed815180a7737c Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sun, 2 Apr 2023 12:11:37 +0200 Subject: [PATCH 13/15] fix: cache-key for qt6 --- .github/workflows/build.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 749a86ce0a5..dcbbf0b2c56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,11 +108,17 @@ jobs: version: ${{ matrix.qt-version }} # WINDOWS + - name: Setup conan variables (Windows) + run: | + "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" + "C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "" })" >> "$Env:GITHUB_ENV" + shell: powershell + - name: Cache conan packages if: startsWith(matrix.os, 'windows') uses: actions/cache@v3 with: - key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }} + key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }} path: ~/.conan2/ - name: Add Conan to path @@ -133,7 +139,6 @@ jobs: run: | conan --version conan profile detect -f - "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" shell: powershell - name: Build (Windows) From d20729167686b4bc3a6bbcdff7eb9f15a04ebc5a Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sun, 2 Apr 2023 12:16:24 +0200 Subject: [PATCH 14/15] fix: escape --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcbbf0b2c56..6f25ec77ac2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,7 +111,7 @@ jobs: - name: Setup conan variables (Windows) run: | "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" - "C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "" })" >> "$Env:GITHUB_ENV" + "C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV" shell: powershell - name: Cache conan packages From 9d85cb7ef7d865cb32dad4f60fd6a9363f4ea2e4 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sun, 2 Apr 2023 12:17:24 +0200 Subject: [PATCH 15/15] fix: missing check --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f25ec77ac2..cbb2d3045c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,6 +109,7 @@ jobs: # WINDOWS - name: Setup conan variables (Windows) + if: startsWith(matrix.os, 'windows') run: | "C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" "C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV"