Skip to content

Commit 1c4eebd

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 1c4eebd

51 files changed

Lines changed: 770 additions & 489 deletions

Some content is hidden

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

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)