Skip to content

Commit

Permalink
Support building with Visual Studio 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Sep 30, 2023
1 parent b3088bc commit bdfdb1b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:

jobs:
Build:
runs-on: windows-2019
runs-on: windows-latest

defaults:
run:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
run: |
mkdir ${{ env.BUILD_TYPE }} && cd ${{ env.BUILD_TYPE }}
cmake -G "Visual Studio 16 2019" ^
cmake -G "Visual Studio 17 2022" ^
-A ${{ env.PLATFORM_NAME }} ^
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ^
-DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ^
Expand Down
15 changes: 7 additions & 8 deletions Docs/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
```
git clone --recursive https://github.com/SpriteOvO/AirPodsDesktop.git
cd AirPodsDesktop
mkdir Build
cd Build
```
The current path will be named ___BuildPath___ in the rest of this document.
The current path will be named ___RepoPath___ in the rest of this document.

1. Download and install [CMake](https://cmake.org/download/) (>= v3.20) if you didn't have it.

Expand All @@ -16,7 +14,7 @@ The current path will be named ___BuildPath___ in the rest of this document.

## Windows

1. Download and install __Visual Studio 2019__ if you didn't have it.
1. Download and install __Visual Studio 2022__ if you didn't have it.

2. Clone and bootstrap [vcpkg](https://github.com/microsoft/vcpkg#quick-start-windows) if you didn't have it.

Expand All @@ -25,13 +23,14 @@ Set the installed Qt directory to the `PATH` environment variable, or pass it to

4. Download and install [NSIS](https://sourceforge.net/projects/nsis/files/latest/download). (Optional, not required if you do not generate installer)

5. Open __Powershell__, go to ___BuildPath___.
5. Open __Powershell__, go to ___RepoPath___.
Modify the following arguments according to your needs and run it.

```
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE=<Debug|RelWithDebInfo> -DCMAKE_TOOLCHAIN_FILE=path\to\vcpkg\scripts\buildsystems\vcpkg.cmake ../
cmake --build . --config <Debug|RelWithDebInfo>
ls ./Binary
$BUILD_TYPE="Debug" # or "RelWithDebInfo"
cmake -B Build -S . -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=path\to\vcpkg\scripts\buildsystems\vcpkg.cmake ../
cmake --build Build --config $BUILD_TYPE
ls ./Build/Binary
```

- Note that if you have not just added the Qt directory to the `PATH` environment variable, you need to pass it to the `CMAKE_PREFIX_PATH` option in the first line this way `-DCMAKE_PREFIX_PATH=path\to\Qt\5.15.2\msvc2019`.
Expand Down
5 changes: 5 additions & 0 deletions Source/Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

namespace Helper {

template <class... T>
constexpr inline bool AlwaysFalse = false;

//////////////////////////////////////////////////

template <class E>
[[nodiscard]] constexpr decltype(auto) ToUnderlying(E e) noexcept
{
Expand Down
4 changes: 3 additions & 1 deletion Source/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <spdlog/spdlog.h>
#include <spdlog/fmt/ostr.h>

#include "Helper.h"

namespace Logger {

namespace Details {
Expand Down Expand Up @@ -60,7 +62,7 @@ inline void Log(const spdlog::source_loc &srcloc, Args &&...args)
return spdlog::level::critical;
}
else {
static_assert(false);
static_assert(Helper::AlwaysFalse<decltype(level)>);
}
}();

Expand Down

0 comments on commit bdfdb1b

Please sign in to comment.