Skip to content

Commit 719e461

Browse files
committed
Use vcpkg for all platform presets
1 parent 6b41152 commit 719e461

File tree

6 files changed

+35
-15
lines changed

6 files changed

+35
-15
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,25 @@ jobs:
6666
run: |
6767
sudo apt update
6868
sudo apt install -y --no-install-recommends \
69-
ninja-build cmake g++ libgtest-dev libsdl2-dev zlib1g-dev libspdlog-dev
69+
ninja-build cmake g++ libspdlog-dev
7070
7171
- name: Install Windows dependencies
7272
if: ${{ matrix.os.runner == 'windows-latest' }}
7373
run: choco install ninja
74-
74+
7575
- uses: ilammy/msvc-dev-cmd@v1
7676
if: ${{ matrix.os.runner == 'windows-latest' }}
7777
with:
7878
arch: win64
7979

80+
- uses: lukka/run-vcpkg@v11
81+
with:
82+
vcpkgGitCommitId: 2e7fd315d713e9eac52f6bdb24afbf1b4dbbe1e5
83+
8084
- name: Configure CMake
8185
env:
8286
CC: ${{ matrix.os.cc }}
8387
CXX: ${{ matrix.os.cxx }}
84-
VCPKG_ROOT: C:/vcpkg
8588
run: cmake --preset ${{ matrix.os.preset }} -DBUILD_TESTING=ON -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=ON
8689

8790
- name: Build ${{ matrix.build_type }}

Brewfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
# Homebrew dependencies to build Descent3
22

3-
# SDL
4-
brew "sdl2"
5-
63
brew "cmake"
7-
brew "googletest"
84
brew "ninja"
9-
10-
# zlib
11-
brew "zlib"

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
cmake_minimum_required(VERSION 3.20) # For using CMAKE_<LANG>_BYTE_ORDER
22

3+
if (NOT DEFINED ENV{VCPKG_ROOT})
4+
message(FATAL_ERROR "
5+
Please set an environment variable VCPKG_ROOT
6+
For example:
7+
export VCPKG_ROOT=/path/to/vcpkg
8+
")
9+
endif()
10+
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE})
11+
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
12+
if(CMAKE_TOOLCHAIN_FILE STREQUAL VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
13+
# prevent endless recursion
14+
unset(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
15+
endif()
16+
317
# set default cmake build type to Debug (None Debug Release RelWithDebInfo MinSizeRel)
418
if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED ENV{CMAKE_BUILD_TYPE})
519
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "default build type")

CMakePresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"architecture": {
2222
"strategy": "external",
2323
"value": "x64"
24-
},
25-
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
24+
}
2625
},
2726
{
2827
"name": "mac",

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ The milestone needs testing on all platforms. Please report issues when found.
9292
- D3 Open Source compiles level scripts in their own hogfiles. Make sure you copy and overwrite `d3-{platform}.hog`.
9393

9494
## Building
95+
#### Prerequisites
96+
1. [**vcpkg**](https://github.com/microsoft/vcpkg)
97+
This project depends on [`vcpkg`](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. You will need to install it locally by cloning https://github.com/microsoft/vcpkg and setting your `VCPKG_ROOT` env var to the repository location.
98+
9599
#### Building - Windows
96100
1. Make sure that you have Git and Visual Studio 2022 with the “Desktop development with C++” workload. If you don’t already have those installed or you aren’t sure, then open an elevated Command Prompt and run:
97101

@@ -146,7 +150,7 @@ Run these commands:
146150
147151
```sh
148152
sudo apt update
149-
sudo apt install -y --no-install-recommends git ninja-build cmake g++ libsdl2-dev zlib1g-dev
153+
sudo apt install -y --no-install-recommends git ninja-build cmake g++
150154
git clone https://github.com/DescentDevelopers/Descent3
151155
cd Descent3
152156
cmake --preset linux -D ENABLE_LOGGER=[ON|OFF]
@@ -160,7 +164,7 @@ Run these commands:
160164

161165
```sh
162166
sudo dnf update --refresh
163-
sudo dnf install -y git ninja-build cmake gcc-c++ SDL2-devel zlib-devel
167+
sudo dnf install -y git ninja-build cmake gcc-c++
164168
git clone https://github.com/DescentDevelopers/Descent3
165169
cd Descent3
166170
cmake --preset linux -D ENABLE_LOGGER=[ON|OFF]

vcpkg.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
"zlib",
66
{
77
"name": "sdl2",
8-
"version>=": "2.30.1"
8+
"version>=": "2.30.1",
9+
"features": ["x11","wayland"],
10+
"platform": "linux"
11+
},
12+
{
13+
"name": "sdl2",
14+
"version>=": "2.30.1",
15+
"platform": "!linux"
916
}
1017
]
1118
}

0 commit comments

Comments
 (0)