Skip to content

Commit 6e26eae

Browse files
committed
vcpkg
1 parent 8681102 commit 6e26eae

File tree

10 files changed

+237
-1
lines changed

10 files changed

+237
-1
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,60 @@ jobs:
202202
filename: '.\nuget\*.nupkg'
203203
api-key: ${{ secrets.NUGET_DOT_ORG_API_KEY }}
204204
if: startsWith(github.ref, 'refs/tags/')
205-
205+
##### vcpkg #####
206+
vcpkg:
207+
strategy:
208+
fail-fast: false
209+
matrix:
210+
include:
211+
- {os: debian, codename: bookworm, image_owner: }
212+
# - {os: debian, codename: bookworm, image_owner: i386/, labels: [i386,docker]}
213+
# - {os: debian, codename: bookworm, image_owner: arm32v7/, labels: [ubuntu-24.04-arm]}
214+
# - {os: debian, codename: bookworm, image_owner: arm64v8/, labels: [ubuntu-24.04-arm]}
215+
runs-on: ${{ (matrix.labels == '' && 'ubuntu-latest') || matrix.labels }}
216+
container: ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }}
217+
name: vcpkg - linux | ${{ matrix.image_owner }}
218+
steps:
219+
- name: add cppfw deb repo
220+
uses: myci-actions/add-deb-repo@main
221+
with:
222+
repo: deb https://gagis.hopto.org/repo/cppfw/${{ matrix.os }} ${{ matrix.codename }} main
223+
repo-name: cppfw
224+
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg
225+
install: myci cmake git curl zip unzip tar nodejs pkg-config
226+
- name: git clone
227+
uses: myci-actions/checkout@main
228+
- name: install vcpkg
229+
run: |
230+
git clone https://github.com/microsoft/vcpkg.git vcpkg-installation
231+
(cd vcpkg-installation; ./bootstrap-vcpkg.sh)
232+
- name: set VCPKG_ROOT
233+
uses: myci-actions/export-env-var@main
234+
with: {name: VCPKG_ROOT, value: "$(pwd)/vcpkg-installation"}
235+
- name: add VCPKG_ROOT to PATH
236+
uses: myci-actions/export-env-var@main
237+
with: {name: PATH, value: "$PATH:$VCPKG_ROOT"}
238+
- name: prepare vcpkg port
239+
run: |
240+
myci-vcpkg-prepare.sh --vcpkg-dir build/vcpkg --git-ref ${{ github.sha }}
241+
- name: test vcpkg port
242+
run: |
243+
cd build/vcpkg/test
244+
cmake .
245+
make
246+
./test
247+
- name: upload vcpkg logs to artifacts
248+
if: always() # even if previous steps fail, this one needs to be run
249+
uses: actions/upload-artifact@v4
250+
with:
251+
name: vcpkg_logs
252+
path: |
253+
vcpkg-installation/buildtrees/${{ env.PACKAGE_NAME }}/
254+
build/vcpkg/**/*.log
255+
- name: deploy vcpkg port
256+
run: |
257+
myci-deploy-vcpkg.sh --repo cppfw/vcpkg-repo --port-dir build/vcpkg/overlay/${PACKAGE_NAME}
258+
if: startsWith(github.ref, 'refs/tags/')
206259
##### conan - linux #####
207260
# conan-linux:
208261
# strategy:

build/cmake/CMakeLists.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
include(GNUInstallDirs)
4+
5+
set(name ruis-render-opengl)
6+
7+
project(${name})
8+
9+
# ============================
10+
# = find dependency packages =
11+
12+
find_package(utki CONFIG REQUIRED)
13+
find_package(papki CONFIG REQUIRED)
14+
find_package(ZLIB REQUIRED)
15+
find_package(ruis REQUIRED)
16+
17+
# ============================
18+
19+
file(GLOB_RECURSE srcs "../../src/${name}/*.cpp")
20+
21+
add_library(
22+
${name}
23+
STATIC
24+
${srcs}
25+
)
26+
27+
target_compile_features(${name} PUBLIC cxx_std_17)
28+
set_target_properties(${name} PROPERTIES CXX_STANDARD_REQUIRED ON)
29+
set_target_properties(${name} PROPERTIES CXX_EXTENSIONS OFF)
30+
31+
target_include_directories(
32+
${name}
33+
INTERFACE
34+
$<BUILD_INTERFACE:>
35+
$<INSTALL_INTERFACE:include>
36+
)
37+
38+
target_link_libraries(
39+
${name}
40+
PUBLIC
41+
utki::utki
42+
papki::papki
43+
ruis::ruis
44+
)
45+
46+
# install library header files preserving directory hierarchy
47+
install(
48+
DIRECTORY
49+
"${CMAKE_CURRENT_SOURCE_DIR}/../../src/${name}"
50+
DESTINATION
51+
"${CMAKE_INSTALL_INCLUDEDIR}"
52+
FILES_MATCHING PATTERN
53+
"*.hpp"
54+
)
55+
56+
install(
57+
TARGETS
58+
${name}
59+
EXPORT # generate cmake configs
60+
${name}-config
61+
)
62+
63+
# install cmake configs
64+
install(
65+
EXPORT
66+
${name}-config
67+
FILE
68+
${name}-config.cmake
69+
DESTINATION
70+
${CMAKE_INSTALL_DATAROOTDIR}/${name}
71+
NAMESPACE
72+
${name}::
73+
)

build/vcpkg/portfile.cmake.in

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
2+
3+
vcpkg_from_github(
4+
OUT_SOURCE_PATH SOURCE_PATH
5+
REPO cppfw/${PORT}
6+
REF $(git_ref)
7+
SHA512 $(archive_hash)
8+
HEAD_REF main
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
13+
)
14+
15+
vcpkg_cmake_install()
16+
17+
vcpkg_cmake_config_fixup()
18+
19+
# Delete the include directory from the debug installation to prevent overlap.
20+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
21+
22+
# Install the LICENSE file to the package's share directory and rename it to copyright.
23+
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
24+
25+
# Copy the usage instruction file to the package's share directory.
26+
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

build/vcpkg/test/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
4+
5+
project(test)
6+
7+
find_package(utki CONFIG REQUIRED)
8+
find_package(ruis REQUIRED)
9+
10+
find_package(ruis-render-opengl CONFIG REQUIRED)
11+
12+
add_executable(test main.cpp)
13+
14+
target_link_libraries(test PRIVATE ruis-render-opengl::ruis-render-opengl)

build/vcpkg/test/main.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// this file is to test basic usage of the library,
2+
// mainly test that linking to the library works, so just call any
3+
// non-inline function of the library to test it.
4+
5+
#include <ruis/render/opengl/context.hpp>
6+
7+
int main(int argc, const char** argv){
8+
ruis::render::opengl::context c;
9+
10+
std::cout << "scissor enabled = " << c.is_scissor_enabled() << std::endl;
11+
12+
return 0;
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"default-registry": {
3+
"kind": "git",
4+
"baseline": "9b5cb8e554487f3edb5d50b80188883846f81e14",
5+
"repository": "https://github.com/microsoft/vcpkg"
6+
},
7+
"registries": [
8+
{
9+
"kind": "git",
10+
"repository": "https://github.com/cppfw/vcpkg-repo/",
11+
"baseline": "d8e5b1c5c3235dc67812b87badf166577db53da2",
12+
"reference": "main",
13+
"packages": [
14+
"utki",
15+
"papki",
16+
"ruis"
17+
]
18+
}
19+
],
20+
"overlay-ports": [
21+
"../overlay"
22+
]
23+
}

build/vcpkg/test/vcpkg.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": [
3+
"ruis-render-opengl"
4+
]
5+
}

build/vcpkg/usage

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ruis-render-opengl provides CMake targets:
2+
3+
# TODO: EDIT library dependency packages list
4+
find_package(utki CONFIG REQUIRED)
5+
find_package(ruis REQUIRED)
6+
7+
find_package(ruis-render-opengl CONFIG REQUIRED)
8+
9+
target_link_libraries(main PRIVATE ruis-render-opengl::ruis-render-opengl)

build/vcpkg/vcpkg.json.in

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "ruis-render-opengl",
3+
"version": "$(version)",
4+
"homepage": "https://github.com/cppfw/ruis-render-opengl",
5+
"description": "ruis OpenGL renderer",
6+
"license": "MIT",
7+
"dependencies": [
8+
{
9+
"name" : "vcpkg-cmake",
10+
"host" : true
11+
},
12+
{
13+
"name" : "vcpkg-cmake-config",
14+
"host" : true
15+
},
16+
"utki",
17+
"ruis"
18+
]
19+
}

src/ruis/render/opengl/context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4040

4141
using namespace ruis::render::opengl;
4242

43+
// TODO: remove commented code
4344
// namespace {
4445
// unsigned get_max_texture_size()
4546
// {

0 commit comments

Comments
 (0)