Skip to content

Commit 0f39c0b

Browse files
authored
Factor vcpkg out of CI scripts and into main stream (#318)
* Factor vcpkg out of CI scripts and into main stream * Update README.md * Update .appveyor.yml
1 parent 7e0b5e6 commit 0f39c0b

File tree

5 files changed

+68
-26
lines changed

5 files changed

+68
-26
lines changed

.appveyor.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ install:
4545
- git checkout 58950f88544e4637524dbd6a01d0317cf4cb77fc
4646
- .\bootstrap-vcpkg.bat
4747
- cd %appveyor_build_folder%
48-
- call "%VCPKG_ROOT%\vcpkg" install boost-container-hash:%platform%-windows
49-
- call "%VCPKG_ROOT%\vcpkg" install boost-core:%platform%-windows
50-
- call "%VCPKG_ROOT%\vcpkg" install boost-range:%platform%-windows
51-
- call "%VCPKG_ROOT%\vcpkg" install gtest:%platform%-windows
48+
- call "%VCPKG_ROOT%\vcpkg" install --triplet %platform%-windows
5249

5350
build_script:
5451
- mkdir build

.github/workflows/build.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ jobs:
2727
- name: Setup vcpkg (with binary caching)
2828
uses: lukka/run-vcpkg@v11
2929
with:
30-
runVcpkgInstall: false
30+
runVcpkgInstall: true
31+
vcpkgJsonGlob: "${{ github.workspace }}/vcpkg.json"
3132
vcpkgDirectory: "${{ github.workspace }}/.vcpkg"
3233
vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc"
3334

34-
- name: Install dependencies
35-
shell: bash
36-
run: $VCPKG_ROOT/vcpkg install boost-container-hash gtest
37-
3835
- name: Create Build Environment
3936
run: cmake -E make_directory ${{runner.workspace}}/terminalpp/build
4037

@@ -72,14 +69,11 @@ jobs:
7269
- name: Setup vcpkg (with binary caching)
7370
uses: lukka/run-vcpkg@v11
7471
with:
75-
runVcpkgInstall: false
72+
runVcpkgInstall: true
73+
vcpkgJsonGlob: "${{ github.workspace }}/vcpkg.json"
7674
vcpkgDirectory: "${{ github.workspace }}/.vcpkg"
7775
vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc"
7876

79-
- name: Install dependencies
80-
shell: bash
81-
run: $VCPKG_ROOT/vcpkg install boost-container-hash gtest
82-
8377
- name: Extract branch name
8478
shell: bash
8579
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"

README.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,59 @@
77
[![Coverage Status](https://coveralls.io/repos/github/KazDragon/terminalpp/badge.svg?branch=master)](https://coveralls.io/github/KazDragon/terminalpp?branch=master)
88
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a2741e8f7abf49bc8b496fbf8b51b983)](https://www.codacy.com/gh/KazDragon/terminalpp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=KazDragon/terminalpp&utm_campaign=Badge_Grade)
99

10-
# Terminal++
1110
A C++ library for interacting with ANSI/VT100 terminal or terminal emulator displays.
1211

13-
# Requirements
12+
## Requirements
13+
14+
- C++20 compiler
15+
- CMake 3.16+
16+
- Boost 1.69+ (required)
17+
- Google Test (for tests only)
18+
19+
## Build And Install (From Source)
20+
21+
```bash
22+
git clone https://github.com/KazDragon/terminalpp.git
23+
cd terminalpp
24+
25+
cmake -S . -B build \
26+
-DCMAKE_BUILD_TYPE=Release \
27+
-DCMAKE_INSTALL_PREFIX="$HOME/.local"
28+
29+
cmake --build build --config Release
30+
cmake --install build --config Release
31+
```
32+
33+
## Dependency Resolution With vcpkg
1434

15-
Terminal++ requires a C++20 compiler and the following libraries:
16-
* Boost (At least version 1.69.0)
17-
* (For testing only) Google Test
35+
Terminal++ can resolve dependencies automatically through `vcpkg`:
1836

19-
# Installation - CMake
37+
```bash
38+
cmake -S . -B build \
39+
-DCMAKE_BUILD_TYPE=Release \
40+
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
41+
```
42+
43+
When using manifest mode (`vcpkg.json` in this repository), configure will
44+
trigger dependency installation automatically.
45+
46+
## Consume From CMake (Installed Package)
47+
48+
```cmake
49+
cmake_minimum_required(VERSION 3.16)
50+
project(my_app LANGUAGES CXX)
2051
21-
Terminal++ can be installed from source using CMake. This requires Boost and any other dependencies to have been installed beforehand, using their own instructions, or for the call to `cmake --configure` to be adjusted appropriately (e.g. `-DBOOST_ROOT=...`). If you do not wish to install into a system directory, and thus avoid the use of sudo, you can also pass `-DCMAKE_INSTALL_PREFIX=...` into the `cmake --configure` call.
52+
find_package(terminalpp CONFIG REQUIRED)
2253
23-
git clone https://github.com/KazDragon/terminalpp.git && cd terminalpp
24-
mkdir build && cd build
25-
cmake --configure -DCMAKE_BUILD_TYPE=Release ..
26-
cmake --build .
27-
sudo cmake --install .
54+
add_executable(my_app main.cpp)
55+
target_link_libraries(my_app PRIVATE KazDragon::terminalpp)
56+
```
57+
58+
If installed to a non-system prefix:
59+
60+
```bash
61+
cmake -S . -B build -DCMAKE_PREFIX_PATH="$HOME/.local"
62+
```
2863

2964
# Features / Roadmap
3065

vcpkg-configuration.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
3+
"default-registry": {
4+
"kind": "builtin",
5+
"baseline": "58950f88544e4637524dbd6a01d0317cf4cb77fc"
6+
}
7+
}

vcpkg.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3+
"name": "terminalpp",
4+
"version-string": "0.0.0",
5+
"dependencies": [
6+
"boost-container-hash",
7+
"gtest"
8+
]
9+
}

0 commit comments

Comments
 (0)