Skip to content

Commit b22d950

Browse files
committed
Use Qbs OnlineSource, cleanup qbs project
* prepares the Qbs project to be included by other projects with Qbs OnlineSource
1 parent 39ef08e commit b22d950

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+795
-500
lines changed

.github/workflows/qbs_tests.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,27 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
include:
14-
- image: arbmind/qbs-clang:1.21.0-14
14+
- image: arbmind/qbs-clang:3.1.2-18
1515
build_args: "modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi"
16-
- image: arbmind/qbs-clang:2.1.2-17
16+
- image: arbmind/qbs-clang:3.1.2-21
1717
build_args: "modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi"
18-
- image: arbmind/qbs-clang-libstdcpp:1.24.0-15-12
19-
- image: arbmind/qbs-gcc:1.21.0-11
20-
- image: arbmind/qbs-gcc:1.24.0-12
21-
- image: arbmind/qbs-gcc:2.1.2-13
18+
- image: arbmind/qbs-clang-libstdcpp:3.1.2-21-15
19+
- image: arbmind/qbs-gcc:3.1.2-13
20+
- image: arbmind/qbs-gcc:3.1.2-14
21+
- image: arbmind/qbs-gcc:3.1.2-15
2222

2323
steps:
2424
- uses: actions/checkout@v4
2525

26+
# we have no git in container fetch googletest before
2627
- name: Get Googletest
27-
run: third_party/git_clone_googletest.sh
28+
run: script/git_clone_googletest.sh
2829

2930
- name: Build and run Tests
3031
run: >-
3132
docker run --rm -v ${GITHUB_WORKSPACE}:/project -w /project
3233
--env GTEST_OUTPUT=xml:/project/reports/qbs/
34+
--env QBS_GOOGLETEST_SOURCE=/project/script/googletest
3335
${{ matrix.image }}
3436
build
3537
--build-directory /tmp/build
@@ -71,10 +73,6 @@ jobs:
7173
7274
- uses: actions/checkout@v4
7375

74-
- name: Get Googletest
75-
run: third_party/git_clone_googletest.sh
76-
shell: bash
77-
7876
- name: Build and run Tests
7977
env:
8078
GTEST_OUTPUT: xml:${{ github.workspace }}\reports\msvc\

co-cpp19.qbs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,27 @@ import qbs
33
Project {
44
name: "Co-Cpp19"
55

6-
// to use libc++ set
7-
// modules.cpp.cxxStandardLibrary:libc++ modules.cpp.staticLibraries:c++,c++abi
6+
property string version: "2026.01"
7+
property string configProductName: "Co-Cpp19-Config"
8+
property bool enableQbsImports: (sourceDirectory === path)
9+
property bool enableTests: (sourceDirectory === path)
10+
property bool enableThirdParty: (sourceDirectory === path)
811

9-
references: [
10-
"third_party/third_party.qbs",
11-
"src/array19.lib",
12-
"src/coro19.lib",
13-
"src/enum19.lib",
14-
"src/flags19.lib",
15-
"src/meta19.lib",
16-
"src/lookup19.lib",
17-
"src/optional19.lib",
18-
"src/partial19.lib",
19-
"src/serialize19.lib",
20-
"src/signal19.lib",
21-
"src/string19.lib",
22-
"src/strong19.lib",
23-
"src/tuple19.lib",
24-
"src/variant19.lib",
25-
]
26-
27-
AutotestRunner {}
12+
minimumQbsVersion: "3.0"
13+
qbsSearchPaths: enableQbsImports ? ["qbs"] : []
14+
references: ["src/src.qbs"]
2815

2916
// note: if do not use this .qbs project you need a similar setup
3017
Product {
31-
name: "cpp19"
18+
name: "Co-Cpp19-Config"
19+
condition: parent.configProductName === "Co-Cpp19-Config"
3220

3321
Export {
34-
Depends { name: "cpp" }
3522
cpp.cxxLanguageVersion: "c++23"
3623
cpp.treatWarningsAsErrors: true
24+
// to use libc++ set
25+
// modules.cpp.cxxStandardLibrary:libc++
26+
// modules.cpp.staticLibraries:c++,c++abi
3727

3828
Properties {
3929
condition: qbs.toolchain.contains('msvc')
@@ -55,11 +45,19 @@ Project {
5545
"-Wno-gnu-zero-variadic-macro-arguments" // accept this extensions for opaque strong types
5646
)
5747
}
48+
Depends { name: "cpp" }
5849
}
5950
}
60-
51+
SubProject {
52+
condition: parent.enableTests
53+
filePath: "src/tests.qbs"
54+
}
55+
SubProject {
56+
condition: parent.enableThirdParty
57+
filePath: "third_party/third_party.qbs"
58+
}
6159
Product {
62-
name: "_Extra Files_"
60+
name: "[CoCpp19 Extra Files]"
6361
files: [
6462
".clang-format",
6563
".clang-tidy",

qbs/imports/online/QbsProject.qbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SubProject {
2+
property variant source
3+
4+
condition: source && source.found
5+
filePath: source.projectFilePath
6+
}

qbs/imports/online/Source.qbs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import "onlinesource.js" as OnlineSource
2+
3+
Probe {
4+
id: probe
5+
6+
property string name
7+
property string uri
8+
property string projectFile
9+
property path sourceCache
10+
property path buildDirectory: project.buildDirectory
11+
12+
// Results
13+
property path sourceDirectory
14+
property path projectFilePath
15+
16+
configure: {
17+
var result = OnlineSource.fetch({
18+
name: probe.name,
19+
uri: probe.uri,
20+
projectFile: probe.projectFile,
21+
sourceCache: probe.sourceCache,
22+
buildDirectory: probe.buildDirectory,
23+
});
24+
if (result) {
25+
sourceDirectory = result.sourceDirectory;
26+
if (result.projectFile) projectFilePath = result.projectFile;
27+
found = true;
28+
} else {
29+
found = false;
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)