Skip to content

Commit 660d6bf

Browse files
committed
Tentative move to standalone with VCPKG.
1 parent ef56b9e commit 660d6bf

7 files changed

Lines changed: 148 additions & 26 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,39 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88

9+
env:
10+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
11+
912
jobs:
1013
build:
1114
runs-on: windows-2022
1215
steps:
13-
- name: Build UI Base
14-
id: build-uibase
15-
uses: ModOrganizer2/build-with-mob-action@master
16+
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
17+
- name: Export GitHub Actions cache environment variables
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
22+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
23+
24+
- name: Install Qt
25+
uses: jurplel/install-qt-action@v3
1626
with:
17-
mo2-third-parties: gtest spdlog boost
18-
mo2-dependencies: cmake_common
19-
mo2-cmake-command: -DUIBASE_TESTS=1 ..
27+
version: 6.7.0
28+
modules:
29+
cache: true
2030

21-
- name: Build UI Base Tests
22-
run: cmake --build vsbuild --config RelWithDebInfo -j4 --target uibase-tests
23-
working-directory: ${{ steps.build-uibase.outputs.working-directory }}
31+
- uses: actions/checkout@v4
32+
- uses: lukka/run-vcpkg@v11
33+
with:
34+
vcpkgJsonGlob: ${{ github.workspace }}/usvfs/vcpkg.json
35+
36+
- name: Configure UI Base build
37+
shell: pwsh
38+
run: cmake --preset vs2022-windows "-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" -DBUILD_TESTING=ON
39+
40+
- name: Build UI Base
41+
run: cmake --build vsbuild --config RelWithDebInfo --target uibase-tests
2442

2543
- name: Test UI Base
2644
run: ctest --test-dir vsbuild -C RelWithDebInfo --output-on-failure
27-
working-directory: ${{ steps.build-uibase.outputs.working-directory }}

CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ cmake_minimum_required(VERSION 3.16)
22

33
project(uibase)
44

5-
if(DEFINED DEPENDENCIES_DIR)
6-
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
7-
else()
8-
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
9-
endif()
5+
find_package(mo2-cmake CONFIG REQUIRED)
106

117
add_subdirectory(src)
128

13-
set(UIBASE_TESTS ${UIBASE_TESTS} CACHE BOOL "build tests for uibase")
14-
if (UIBASE_TESTS)
9+
set(BUILD_TESTING ${BUILD_TESTING} CACHE BOOL "build tests for uibase")
10+
if (BUILD_TESTING)
1511
enable_testing()
1612
add_subdirectory(tests)
1713
endif()

CMakePresets.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"configurePresets": [
3+
{
4+
"errors": {
5+
"deprecated": true
6+
},
7+
"hidden": true,
8+
"name": "cmake-dev",
9+
"warnings": {
10+
"deprecated": true,
11+
"dev": true
12+
}
13+
},
14+
{
15+
"cacheVariables": {
16+
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
17+
"type": "BOOL",
18+
"value": "ON"
19+
}
20+
},
21+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
22+
"hidden": true,
23+
"name": "vcpkg"
24+
},
25+
{
26+
"cacheVariables": {
27+
"VCPKG_MANIFEST_FEATURES": {
28+
"type": "STRING",
29+
"value": "testing"
30+
}
31+
},
32+
"hidden": true,
33+
"inherits": ["vcpkg"],
34+
"name": "vcpkg-dev"
35+
},
36+
{
37+
"binaryDir": "${sourceDir}/vsbuild",
38+
"architecture": {
39+
"strategy": "set",
40+
"value": "x64"
41+
},
42+
"cacheVariables": {
43+
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
44+
"VCPKG_TARGET_TRIPLET": {
45+
"type": "STRING",
46+
"value": "x64-windows-static-md"
47+
}
48+
},
49+
"generator": "Visual Studio 17 2022",
50+
"inherits": ["cmake-dev", "vcpkg-dev"],
51+
"name": "vs2022-windows",
52+
"toolset": "v143"
53+
}
54+
],
55+
"buildPresets": [
56+
{
57+
"name": "vs2022-windows",
58+
"resolvePackageReferences": "on",
59+
"configurePreset": "vs2022-windows"
60+
}
61+
],
62+
"version": 4
63+
}

src/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
find_package(Qt6 CONFIG REQUIRED COMPONENTS Network Qml Quick QuickWidgets Widgets)
4+
find_package(spdlog CONFIG REQUIRED)
5+
find_package(Boost REQUIRED CONFIG COMPONENTS thread)
6+
37
add_library(uibase SHARED)
4-
mo2_configure_uibase(uibase
5-
WARNINGS ON
6-
EXTERNAL_WARNINGS ON
7-
TRANSLATIONS OFF
8-
PUBLIC_DEPENDS Qt::Widgets Qt::Network Qt::QuickWidgets
9-
PRIVATE_DEPENDS boost boost::thread Qt::Qml Qt::Quick spdlog)
10-
target_compile_definitions(uibase PRIVATE -DUIBASE_EXPORT)
8+
mo2_configure_uibase(uibase WARNINGS ON EXTERNAL_WARNINGS ON TRANSLATIONS OFF)
9+
target_compile_definitions(uibase PRIVATE -DUIBASE_EXPORT SPDLOG_USE_STD_FORMAT)
10+
11+
target_link_libraries(uibase
12+
PUBLIC Qt6::Widgets Qt6::Network Qt6::QuickWidgets
13+
PRIVATE Boost::headers Boost::thread spdlog::spdlog_header_only Qt6::Qml Qt6::Quick)
1114
mo2_install_target(uibase)
1215

1316
mo2_add_filter(NAME src/interfaces GROUPS

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.16)
22

33
add_executable(uibase-tests EXCLUDE_FROM_ALL)
4-
mo2_configure_tests(uibase-tests
5-
WARNINGS OFF DEPENDS uibase)
4+
mo2_configure_tests(uibase-tests WARNINGS OFF)
5+
target_link_libraries(uibase-tests PRIVATE uibase)

vcpkg-configuration.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"default-registry": {
3+
"kind": "git",
4+
"repository": "https://github.com/Microsoft/vcpkg",
5+
"baseline": "f61a294e765b257926ae9e9d85f96468a0af74e7"
6+
},
7+
"registries": [
8+
{
9+
"kind": "git",
10+
"repository": "https://github.com/Microsoft/vcpkg",
11+
"baseline": "f61a294e765b257926ae9e9d85f96468a0af74e7",
12+
"packages": ["boost*", "boost-*"]
13+
},
14+
{
15+
"kind": "git",
16+
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
17+
"baseline": "3f02fd7a85876d4919627d9a9663c33180292bda",
18+
"packages": ["mo2-cmake"]
19+
}
20+
]
21+
}

vcpkg.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"dependencies": [
3+
"mo2-cmake",
4+
{
5+
"name": "spdlog",
6+
"features": ["wchar"]
7+
},
8+
"boost-thread"
9+
],
10+
"overrides": [
11+
{
12+
"name": "spdlog",
13+
"version": "1.14.1"
14+
}
15+
],
16+
"features": {
17+
"testing": {
18+
"description": "Build UI Base tests.",
19+
"dependencies": ["gtest"]
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)