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 c8a9cdf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ env:
BUILD_TYPE: RelWithDebInfo
UPLOAD_ARTIFACT: true
CACHE_DEPS: false
FIXED_CMAKE_VERSION: 3.21.4
FIXED_CMAKE_VERSION:

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
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,8 @@ endforeach()
#

if (MSVC)

add_compile_options(
"/MP" # Multi-processor compilation

"/await" # Enable the legacy pre-C++20 coroutine.
# Workaround for cppwinrt v2.0.200609.3 in C++20.
# For more information, see https://github.com/microsoft/cppwinrt/issues/866
)
endif()

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 c8a9cdf

Please sign in to comment.