wyvrnpm 2.0.4 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +639 -5
- package/bin/wyvrn.js +220 -10
- package/claude/skills/wyvrnpm.skill +0 -0
- package/cmake/cpp.cmake +9 -0
- package/cmake/functions.cmake +224 -0
- package/cmake/macros.cmake +233 -0
- package/cmake/options.cmake +23 -0
- package/cmake/variables.cmake +171 -0
- package/package.json +3 -1
- package/src/build/cache.js +148 -0
- package/src/build/clone.js +170 -0
- package/src/build/cmake.js +342 -0
- package/src/build/index.js +275 -0
- package/src/build/msvc-env.js +217 -0
- package/src/build/recipe.js +155 -0
- package/src/commands/build.js +283 -0
- package/src/commands/clean.js +56 -16
- package/src/commands/configure.js +6 -5
- package/src/commands/init.js +3 -2
- package/src/commands/install-skill.js +107 -0
- package/src/commands/install.js +262 -19
- package/src/commands/link.js +18 -15
- package/src/commands/profile.js +15 -12
- package/src/commands/publish.js +216 -65
- package/src/commands/show.js +237 -0
- package/src/compat.js +261 -0
- package/src/config.js +3 -1
- package/src/download.js +431 -87
- package/src/ignore.js +118 -0
- package/src/logger.js +94 -0
- package/src/manifest.js +12 -7
- package/src/options.js +303 -0
- package/src/profile.js +56 -4
- package/src/providers/base.js +16 -1
- package/src/providers/file.js +12 -6
- package/src/providers/http.js +15 -10
- package/src/providers/s3.js +14 -9
- package/src/resolve.js +179 -19
- package/src/toolchain/deps.js +164 -0
- package/src/toolchain/index.js +141 -0
- package/src/toolchain/presets.js +263 -0
- package/src/toolchain/template.cmake +66 -0
- package/src/upload-built.js +256 -0
- package/src/version-range.js +301 -0
package/bin/wyvrn.js
CHANGED
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
const yargs = require('yargs');
|
|
6
|
-
const init
|
|
7
|
-
const install
|
|
8
|
-
const clean
|
|
9
|
-
const publish
|
|
10
|
-
const configure
|
|
11
|
-
const profile
|
|
6
|
+
const init = require('../src/commands/init');
|
|
7
|
+
const install = require('../src/commands/install');
|
|
8
|
+
const clean = require('../src/commands/clean');
|
|
9
|
+
const publish = require('../src/commands/publish');
|
|
10
|
+
const configure = require('../src/commands/configure');
|
|
11
|
+
const profile = require('../src/commands/profile');
|
|
12
|
+
const build = require('../src/commands/build');
|
|
13
|
+
const show = require('../src/commands/show');
|
|
14
|
+
const installSkill = require('../src/commands/install-skill');
|
|
12
15
|
const { link, unlink } = require('../src/commands/link');
|
|
13
16
|
|
|
14
17
|
yargs
|
|
18
|
+
.parserConfiguration({ 'populate--': true })
|
|
15
19
|
.option('manifest', {
|
|
16
20
|
type: 'string',
|
|
17
21
|
description: 'Path to manifest file',
|
|
@@ -48,6 +52,44 @@ yargs
|
|
|
48
52
|
type: 'string',
|
|
49
53
|
description: 'Build profile name to use (default: config.defaultProfile → "default")',
|
|
50
54
|
})
|
|
55
|
+
.option('build', {
|
|
56
|
+
type: 'string',
|
|
57
|
+
choices: ['never', 'missing', 'always'],
|
|
58
|
+
default: 'never',
|
|
59
|
+
description:
|
|
60
|
+
'Resolution mode when no exact profile match exists. ' +
|
|
61
|
+
'never=fail; missing=build from source (pending phase 3); always=rebuild (pending phase 3)',
|
|
62
|
+
})
|
|
63
|
+
.option('option', {
|
|
64
|
+
alias: 'o',
|
|
65
|
+
type: 'string',
|
|
66
|
+
array: true,
|
|
67
|
+
description:
|
|
68
|
+
'Override a package option. Repeatable. Format: <pkg>:<name>=<value>. ' +
|
|
69
|
+
'Example: -o zlib:minizip=false -o OpenSSL:fips=true',
|
|
70
|
+
})
|
|
71
|
+
.option('upload-built', {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
description:
|
|
75
|
+
'After successful --build=missing, upload each source-built artefact ' +
|
|
76
|
+
'back to the registry under the active profileHash so the next consumer ' +
|
|
77
|
+
'gets a direct download. Requires write credentials for the upload source.',
|
|
78
|
+
})
|
|
79
|
+
.option('upload-source', {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description:
|
|
82
|
+
'Destination for --upload-built (URL or configured publish-source name). ' +
|
|
83
|
+
'Defaults to the first configured publish source.',
|
|
84
|
+
})
|
|
85
|
+
.option('aws-profile', {
|
|
86
|
+
type: 'string',
|
|
87
|
+
description: 'AWS SSO profile for --upload-built when uploading to S3',
|
|
88
|
+
})
|
|
89
|
+
.option('token', {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'Bearer token for --upload-built when uploading to HTTP',
|
|
92
|
+
})
|
|
51
93
|
.option('platform', {
|
|
52
94
|
type: 'string',
|
|
53
95
|
description: 'v1 legacy platform path (used as fallback if v2 not found)',
|
|
@@ -58,17 +100,158 @@ yargs
|
|
|
58
100
|
type: 'number',
|
|
59
101
|
description: 'HTTP timeout in seconds',
|
|
60
102
|
default: 300,
|
|
103
|
+
})
|
|
104
|
+
.option('format', {
|
|
105
|
+
type: 'string',
|
|
106
|
+
choices: ['text', 'json'],
|
|
107
|
+
default: 'text',
|
|
108
|
+
description: 'Output format. "json" emits a single JSON object on stdout; log lines go to stderr.',
|
|
61
109
|
});
|
|
62
110
|
},
|
|
63
|
-
(argv) => install(
|
|
111
|
+
(argv) => install({
|
|
112
|
+
...argv,
|
|
113
|
+
uploadBuilt: argv['upload-built'],
|
|
114
|
+
uploadSource: argv['upload-source'],
|
|
115
|
+
awsProfile: argv['aws-profile'],
|
|
116
|
+
}),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
// ── build ─────────────────────────────────────────────────────────────────
|
|
120
|
+
.command(
|
|
121
|
+
'build',
|
|
122
|
+
'Configure and build the project via the wyvrnpm-generated CMake preset. ' +
|
|
123
|
+
'Auto-runs `install` if the toolchain is missing or stale.',
|
|
124
|
+
(y) => {
|
|
125
|
+
y
|
|
126
|
+
.option('preset', {
|
|
127
|
+
alias: 'P',
|
|
128
|
+
type: 'string',
|
|
129
|
+
description: 'CMake configure preset name (default: wyvrn-<profile>)',
|
|
130
|
+
})
|
|
131
|
+
.option('profile', {
|
|
132
|
+
alias: 'p',
|
|
133
|
+
type: 'string',
|
|
134
|
+
description: 'Build profile name — determines the default preset',
|
|
135
|
+
})
|
|
136
|
+
.option('config', {
|
|
137
|
+
alias: 'c',
|
|
138
|
+
type: 'string',
|
|
139
|
+
choices: ['Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'],
|
|
140
|
+
default: 'Release',
|
|
141
|
+
description: 'Build configuration',
|
|
142
|
+
})
|
|
143
|
+
.option('target', {
|
|
144
|
+
alias: 't',
|
|
145
|
+
type: 'string',
|
|
146
|
+
description: 'CMake target to build (default: all)',
|
|
147
|
+
})
|
|
148
|
+
.option('verbose', {
|
|
149
|
+
alias: 'v',
|
|
150
|
+
type: 'boolean',
|
|
151
|
+
default: false,
|
|
152
|
+
description: 'Pass --verbose to cmake --build (detailed compiler output)',
|
|
153
|
+
})
|
|
154
|
+
.option('clean', {
|
|
155
|
+
type: 'boolean',
|
|
156
|
+
default: false,
|
|
157
|
+
description: 'Remove the build directory before configuring',
|
|
158
|
+
})
|
|
159
|
+
.option('install', {
|
|
160
|
+
type: 'boolean',
|
|
161
|
+
default: false,
|
|
162
|
+
description: 'Run `cmake --install` after the build (installs to the prefix baked at configure time, or --install-prefix)',
|
|
163
|
+
})
|
|
164
|
+
.option('install-prefix', {
|
|
165
|
+
type: 'string',
|
|
166
|
+
description: 'Override CMAKE_INSTALL_PREFIX for `--install` without reconfiguring',
|
|
167
|
+
})
|
|
168
|
+
.option('auto-install', {
|
|
169
|
+
type: 'boolean',
|
|
170
|
+
default: true,
|
|
171
|
+
description: 'Auto-run `wyvrnpm install` when the toolchain is stale. Disable with --no-auto-install.',
|
|
172
|
+
})
|
|
173
|
+
.option('source', {
|
|
174
|
+
alias: 's',
|
|
175
|
+
type: 'string',
|
|
176
|
+
array: true,
|
|
177
|
+
description: 'Package source(s) — passed through to `install` when auto-installing',
|
|
178
|
+
})
|
|
179
|
+
.option('platform', {
|
|
180
|
+
type: 'string',
|
|
181
|
+
choices: ['win_x64', 'win_x86', 'linux_x64', 'linux_x86', 'osx_x64', 'osx_arm64'],
|
|
182
|
+
default: 'win_x64',
|
|
183
|
+
})
|
|
184
|
+
.option('timeout', {
|
|
185
|
+
type: 'number',
|
|
186
|
+
default: 300,
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
(argv) => build({
|
|
190
|
+
...argv,
|
|
191
|
+
autoInstall: argv['auto-install'],
|
|
192
|
+
installPrefix: argv['install-prefix'],
|
|
193
|
+
}),
|
|
64
194
|
)
|
|
65
195
|
|
|
66
196
|
// ── clean ─────────────────────────────────────────────────────────────────
|
|
67
197
|
.command(
|
|
68
198
|
'clean',
|
|
69
|
-
'Remove downloaded packages and lock file',
|
|
70
|
-
() => {
|
|
71
|
-
|
|
199
|
+
'Remove downloaded packages and lock file. --build-cache also wipes the machine-wide source-build cache.',
|
|
200
|
+
(y) => {
|
|
201
|
+
y
|
|
202
|
+
.option('build-cache', {
|
|
203
|
+
type: 'boolean',
|
|
204
|
+
default: false,
|
|
205
|
+
description: 'Also remove the source-build cache under %LOCALAPPDATA%\\wyvrnpm\\bc\\',
|
|
206
|
+
})
|
|
207
|
+
.option('uploaded-built', {
|
|
208
|
+
type: 'boolean',
|
|
209
|
+
default: false,
|
|
210
|
+
description:
|
|
211
|
+
'Wipe only the local record of artefacts uploaded via --upload-built ' +
|
|
212
|
+
'(the .uploaded-to.json sidecars in the build cache). Does not touch ' +
|
|
213
|
+
'the registry, the artefact zips, or wyvrn_internal/.',
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
(argv) => clean({
|
|
217
|
+
...argv,
|
|
218
|
+
buildCache: argv['build-cache'],
|
|
219
|
+
uploadedBuilt: argv['uploaded-built'],
|
|
220
|
+
}),
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
// ── show ──────────────────────────────────────────────────────────────────
|
|
224
|
+
.command(
|
|
225
|
+
'show <pkg>',
|
|
226
|
+
'Display registry metadata for a package. Surfaces `uploadedBy` so consumer uploads can be told apart from author publishes.',
|
|
227
|
+
(y) => {
|
|
228
|
+
y
|
|
229
|
+
.positional('pkg', {
|
|
230
|
+
type: 'string',
|
|
231
|
+
description: 'Spec: <name>[@<version>[@<profileHash>]]',
|
|
232
|
+
})
|
|
233
|
+
.option('source', {
|
|
234
|
+
alias: 's',
|
|
235
|
+
type: 'string',
|
|
236
|
+
array: true,
|
|
237
|
+
description: 'Source URL(s) to query; defaults to configured install sources',
|
|
238
|
+
})
|
|
239
|
+
.option('aws-profile', {
|
|
240
|
+
type: 'string',
|
|
241
|
+
description: 'AWS SSO profile for S3 sources',
|
|
242
|
+
})
|
|
243
|
+
.option('token', {
|
|
244
|
+
type: 'string',
|
|
245
|
+
description: 'Bearer token for HTTP sources',
|
|
246
|
+
})
|
|
247
|
+
.option('format', {
|
|
248
|
+
type: 'string',
|
|
249
|
+
choices: ['text', 'json'],
|
|
250
|
+
default: 'text',
|
|
251
|
+
description: 'Output format. "json" emits a single JSON object on stdout; log lines go to stderr.',
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
(argv) => show({ ...argv, awsProfile: argv['aws-profile'] }),
|
|
72
255
|
)
|
|
73
256
|
|
|
74
257
|
// ── publish ───────────────────────────────────────────────────────────────
|
|
@@ -107,6 +290,20 @@ yargs
|
|
|
107
290
|
description: 'Overwrite an existing published version',
|
|
108
291
|
default: false,
|
|
109
292
|
})
|
|
293
|
+
.option('option', {
|
|
294
|
+
alias: 'o',
|
|
295
|
+
type: 'string',
|
|
296
|
+
array: true,
|
|
297
|
+
description:
|
|
298
|
+
'Override an option value at publish time. Repeatable. ' +
|
|
299
|
+
'Format: <pkg>:<name>=<value> (pkg must match the package being published).',
|
|
300
|
+
})
|
|
301
|
+
.option('format', {
|
|
302
|
+
type: 'string',
|
|
303
|
+
choices: ['text', 'json'],
|
|
304
|
+
default: 'text',
|
|
305
|
+
description: 'Output format. "json" emits a single JSON object on stdout; log lines go to stderr.',
|
|
306
|
+
})
|
|
110
307
|
;
|
|
111
308
|
},
|
|
112
309
|
(argv) => publish({ ...argv, awsProfile: argv['aws-profile'] }),
|
|
@@ -272,6 +469,19 @@ yargs
|
|
|
272
469
|
(argv) => unlink(argv),
|
|
273
470
|
)
|
|
274
471
|
|
|
472
|
+
// ── install-skill ─────────────────────────────────────────────────────────
|
|
473
|
+
.command(
|
|
474
|
+
'install-skill',
|
|
475
|
+
'Install the bundled wyvrnpm Agent Skill into Claude Code (~/.claude/skills/wyvrnpm/)',
|
|
476
|
+
(y) => {
|
|
477
|
+
y
|
|
478
|
+
.option('claude', { type: 'boolean', description: 'Install for Claude Code', default: false })
|
|
479
|
+
.option('force', { type: 'boolean', description: 'Overwrite an existing installation', default: false })
|
|
480
|
+
.option('dry-run', { type: 'boolean', description: 'Report actions without writing', default: false });
|
|
481
|
+
},
|
|
482
|
+
(argv) => installSkill(argv),
|
|
483
|
+
)
|
|
484
|
+
|
|
275
485
|
.demandCommand(1)
|
|
276
486
|
.strict()
|
|
277
487
|
.help()
|
|
Binary file
|
package/cmake/cpp.cmake
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Define the cpp information ( version, compilation type, thread type, exception handling )
|
|
2
|
+
# Set a C++20 default only if the consumer (or wyvrnpm's toolchain) has not
|
|
3
|
+
# already chosen a standard — the toolchain sets CMAKE_CXX_STANDARD from the
|
|
4
|
+
# active build profile before project(), and that explicit choice must win.
|
|
5
|
+
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
8
|
+
endif()
|
|
9
|
+
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API OFF)
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# ── Internal helper ───────────────────────────────────────────────────────────
|
|
2
|
+
# Collects all sources for the calling directory in three layers:
|
|
3
|
+
#
|
|
4
|
+
# 1. General sources — all .cpp/.h/.hpp under CMAKE_CURRENT_SOURCE_DIR,
|
|
5
|
+
# excluding HAL/, Platform/, and include/HAL|Platform/
|
|
6
|
+
# 2. HAL common — files sitting directly (non-recursive) in any HAL/ or
|
|
7
|
+
# Platform/ root; these are platform-neutral shared headers
|
|
8
|
+
# 3. HAL layered — recursive sources from each applicable subdirectory,
|
|
9
|
+
# resolved in order: family → leaf
|
|
10
|
+
#
|
|
11
|
+
# Family tiers (from variables.cmake derived vars):
|
|
12
|
+
# microsoft — Windows + Xbox
|
|
13
|
+
# unix — Linux + SteamOS + Android + Darwin + PlayStation
|
|
14
|
+
# darwin — macOS + iOS
|
|
15
|
+
# playstation— PS4 + PS5
|
|
16
|
+
#
|
|
17
|
+
# Leaf dirs:
|
|
18
|
+
# win xbox linux steamos mac ios
|
|
19
|
+
# android ps4 ps5
|
|
20
|
+
#
|
|
21
|
+
# Search roots for both family and leaf dirs:
|
|
22
|
+
# HAL/ Platform/ src/HAL/ src/Platform/
|
|
23
|
+
# include/HAL/ include/Platform/
|
|
24
|
+
#
|
|
25
|
+
# Result is written to the variable named by <out_var> in the caller's scope.
|
|
26
|
+
# Any additional arguments are treated as regex patterns to exclude from all source lists.
|
|
27
|
+
function(_wyvrn_collect_sources out_var)
|
|
28
|
+
set(_extra_excludes ${ARGN})
|
|
29
|
+
file(GLOB_RECURSE _sources
|
|
30
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
|
31
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
|
|
32
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"
|
|
33
|
+
)
|
|
34
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]HAL[/\\\\].*")
|
|
35
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]Platform[/\\\\].*")
|
|
36
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]tests[/\\\\].*")
|
|
37
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]vendors[/\\\\].*")
|
|
38
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]wyvrn_internal[/\\\\].*")
|
|
39
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]build[/\\\\].*")
|
|
40
|
+
list(FILTER _sources EXCLUDE REGEX ".*[/\\\\]output[/\\\\].*")
|
|
41
|
+
|
|
42
|
+
# Shared / platform-neutral files sitting directly in any HAL/ or Platform/ root
|
|
43
|
+
file(GLOB _hal_common
|
|
44
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/HAL/*.*"
|
|
45
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/Platform/*.*"
|
|
46
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src/HAL/*.*"
|
|
47
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src/Platform/*.*"
|
|
48
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include/HAL/*.*"
|
|
49
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include/Platform/*.*"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Build an ordered list of HAL subdirectory names to search: family first, then leaf.
|
|
53
|
+
# Each entry is searched under every search root listed in _hal_roots below.
|
|
54
|
+
set(_plat_dirs)
|
|
55
|
+
|
|
56
|
+
# ── Family tiers ──────────────────────────────────────────────────────────
|
|
57
|
+
if(WYVRN_PLATFORM_MICROSOFT)
|
|
58
|
+
list(APPEND _plat_dirs microsoft)
|
|
59
|
+
endif()
|
|
60
|
+
if(WYVRN_PLATFORM_UNIX)
|
|
61
|
+
list(APPEND _plat_dirs unix)
|
|
62
|
+
endif()
|
|
63
|
+
if(WYVRN_PLATFORM_DARWIN)
|
|
64
|
+
list(APPEND _plat_dirs darwin)
|
|
65
|
+
endif()
|
|
66
|
+
if(WYVRN_PLATFORM_PLAYSTATION)
|
|
67
|
+
list(APPEND _plat_dirs playstation)
|
|
68
|
+
endif()
|
|
69
|
+
|
|
70
|
+
# ── Leaf tiers ────────────────────────────────────────────────────────────
|
|
71
|
+
# Exactly one leaf is set by variables.cmake; SteamOS also gets a linux pass
|
|
72
|
+
# first (most SteamOS-targeting code lives there) then a steamos overlay pass.
|
|
73
|
+
if(WYVRN_PLATFORM_WINDOWS)
|
|
74
|
+
list(APPEND _plat_dirs win)
|
|
75
|
+
elseif(WYVRN_PLATFORM_XBOX)
|
|
76
|
+
list(APPEND _plat_dirs xbox)
|
|
77
|
+
elseif(WYVRN_PLATFORM_PS5)
|
|
78
|
+
list(APPEND _plat_dirs ps5)
|
|
79
|
+
elseif(WYVRN_PLATFORM_PS4)
|
|
80
|
+
list(APPEND _plat_dirs ps4)
|
|
81
|
+
elseif(WYVRN_PLATFORM_ANDROID)
|
|
82
|
+
list(APPEND _plat_dirs android)
|
|
83
|
+
elseif(WYVRN_PLATFORM_IOS)
|
|
84
|
+
list(APPEND _plat_dirs ios)
|
|
85
|
+
elseif(WYVRN_PLATFORM_MACOS)
|
|
86
|
+
list(APPEND _plat_dirs mac)
|
|
87
|
+
elseif(WYVRN_PLATFORM_STEAMOS)
|
|
88
|
+
list(APPEND _plat_dirs linux steamos)
|
|
89
|
+
elseif(WYVRN_PLATFORM_LINUX)
|
|
90
|
+
list(APPEND _plat_dirs linux)
|
|
91
|
+
endif()
|
|
92
|
+
|
|
93
|
+
# All directory roots that may contain HAL/<subdir>/ trees
|
|
94
|
+
set(_hal_roots
|
|
95
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/HAL"
|
|
96
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/Platform"
|
|
97
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src/HAL"
|
|
98
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src/Platform"
|
|
99
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include/HAL"
|
|
100
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include/Platform"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
set(_hal_plat)
|
|
104
|
+
foreach(_dir IN LISTS _plat_dirs)
|
|
105
|
+
foreach(_root IN LISTS _hal_roots)
|
|
106
|
+
file(GLOB_RECURSE _tmp "${_root}/${_dir}/*.*")
|
|
107
|
+
list(APPEND _hal_plat ${_tmp})
|
|
108
|
+
endforeach()
|
|
109
|
+
endforeach()
|
|
110
|
+
|
|
111
|
+
foreach(_pat IN LISTS _extra_excludes)
|
|
112
|
+
list(FILTER _sources EXCLUDE REGEX "${_pat}")
|
|
113
|
+
list(FILTER _hal_common EXCLUDE REGEX "${_pat}")
|
|
114
|
+
list(FILTER _hal_plat EXCLUDE REGEX "${_pat}")
|
|
115
|
+
endforeach()
|
|
116
|
+
|
|
117
|
+
set(${out_var} ${_sources} ${_hal_common} ${_hal_plat} PARENT_SCOPE)
|
|
118
|
+
endfunction()
|
|
119
|
+
|
|
120
|
+
# ── Internal helper ───────────────────────────────────────────────────────────
|
|
121
|
+
# Applies the standard Wyvrn compiler flags to <target>.
|
|
122
|
+
function(_wyvrn_apply_compiler_flags target)
|
|
123
|
+
get_target_property(_wyvrn_target_type ${target} TYPE)
|
|
124
|
+
if(_wyvrn_target_type STREQUAL "INTERFACE_LIBRARY")
|
|
125
|
+
return()
|
|
126
|
+
endif()
|
|
127
|
+
target_compile_options(${target} PRIVATE ${WYVRN_COMPILER_FLAGS})
|
|
128
|
+
target_compile_options(${target} PRIVATE $<$<CONFIG:Debug>:${WYVRN_COMPILER_FLAGS_DEBUG}>)
|
|
129
|
+
target_compile_options(${target} PRIVATE $<$<CONFIG:Release>:${WYVRN_COMPILER_FLAGS_RELEASE}>)
|
|
130
|
+
endfunction()
|
|
131
|
+
|
|
132
|
+
# ── SETUP_LIBRARY(target type [EXCLUDE pat...] [extra_sources...]) ────────────
|
|
133
|
+
# Creates a library target from all sources in CMAKE_CURRENT_SOURCE_DIR,
|
|
134
|
+
# with platform-specific HAL sources included automatically.
|
|
135
|
+
#
|
|
136
|
+
# Arguments:
|
|
137
|
+
# target CMake target name
|
|
138
|
+
# type Library type: STATIC | SHARED | INTERFACE | OBJECT
|
|
139
|
+
# EXCLUDE (optional) One or more regex patterns; matched files are
|
|
140
|
+
# excluded from the auto-collected source list
|
|
141
|
+
# extra_sources (optional) Additional source files to append (positional,
|
|
142
|
+
# or via the SOURCES keyword)
|
|
143
|
+
#
|
|
144
|
+
# Side effects:
|
|
145
|
+
# - Registers aliases chroma::<target> and wyvrn::<target>
|
|
146
|
+
# - Applies standard Wyvrn compiler flags
|
|
147
|
+
# - Configures source_group for IDE folder view
|
|
148
|
+
#
|
|
149
|
+
# Example:
|
|
150
|
+
# SETUP_LIBRARY(WyvrnLog STATIC)
|
|
151
|
+
# SETUP_LIBRARY(WyvrnRenderer SHARED ${PLATFORM_GENERATED_SOURCES})
|
|
152
|
+
# SETUP_LIBRARY(WyvrnCore STATIC EXCLUDE ".*legacy.*" ".*_old\\.cpp")
|
|
153
|
+
function(SETUP_LIBRARY target type)
|
|
154
|
+
cmake_parse_arguments(_SETUP "" "" "EXCLUDE;SOURCES" ${ARGN})
|
|
155
|
+
_wyvrn_collect_sources(_sources ${_SETUP_EXCLUDE})
|
|
156
|
+
list(APPEND _sources ${_SETUP_SOURCES} ${_SETUP_UNPARSED_ARGUMENTS})
|
|
157
|
+
|
|
158
|
+
add_library(${target} ${type} ${_sources})
|
|
159
|
+
_wyvrn_apply_compiler_flags(${target})
|
|
160
|
+
set(_src_sources "")
|
|
161
|
+
set(_gen_sources "")
|
|
162
|
+
foreach(_f IN LISTS _sources)
|
|
163
|
+
cmake_path(IS_PREFIX CMAKE_CURRENT_SOURCE_DIR "${_f}" NORMALIZE _is_under_src)
|
|
164
|
+
if(_is_under_src)
|
|
165
|
+
list(APPEND _src_sources "${_f}")
|
|
166
|
+
else()
|
|
167
|
+
list(APPEND _gen_sources "${_f}")
|
|
168
|
+
endif()
|
|
169
|
+
endforeach()
|
|
170
|
+
if(_src_sources)
|
|
171
|
+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${_src_sources})
|
|
172
|
+
endif()
|
|
173
|
+
if(_gen_sources)
|
|
174
|
+
source_group("Generated" FILES ${_gen_sources})
|
|
175
|
+
endif()
|
|
176
|
+
|
|
177
|
+
# chroma is a legacy alias namespace; new code should use wyvrn::, but both are provided for compatibility
|
|
178
|
+
add_library(chroma::${target} ALIAS ${target})
|
|
179
|
+
add_library(wyvrn::${target} ALIAS ${target})
|
|
180
|
+
|
|
181
|
+
get_target_property(_wyvrn_target_type ${target} TYPE)
|
|
182
|
+
if(_wyvrn_target_type STREQUAL "INTERFACE_LIBRARY")
|
|
183
|
+
return()
|
|
184
|
+
endif()
|
|
185
|
+
|
|
186
|
+
target_include_directories(${target}
|
|
187
|
+
PUBLIC
|
|
188
|
+
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${target}>
|
|
189
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
190
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
endfunction()
|
|
194
|
+
|
|
195
|
+
# ── SETUP_EXE(target [EXCLUDE pat...] [extra_sources...]) ─────────────────────
|
|
196
|
+
# Creates an executable target from all sources in CMAKE_CURRENT_SOURCE_DIR,
|
|
197
|
+
# with platform-specific HAL sources included automatically.
|
|
198
|
+
# On Windows and Xbox the WIN32 subsystem flag is set automatically.
|
|
199
|
+
#
|
|
200
|
+
# Arguments:
|
|
201
|
+
# target CMake target name
|
|
202
|
+
# EXCLUDE (optional) One or more regex patterns; matched files are
|
|
203
|
+
# excluded from the auto-collected source list
|
|
204
|
+
# extra_sources (optional) Additional source files to append (positional,
|
|
205
|
+
# or via the SOURCES keyword)
|
|
206
|
+
#
|
|
207
|
+
# Example:
|
|
208
|
+
# SETUP_EXE(ChromaApp)
|
|
209
|
+
# SETUP_EXE(ChromaTool ${TOOL_GENERATED_SOURCES})
|
|
210
|
+
# SETUP_EXE(ChromaTool EXCLUDE ".*test_stub.*" SOURCES ${EXTRA})
|
|
211
|
+
function(SETUP_EXE target)
|
|
212
|
+
cmake_parse_arguments(_SETUP "" "" "EXCLUDE;SOURCES" ${ARGN})
|
|
213
|
+
_wyvrn_collect_sources(_sources ${_SETUP_EXCLUDE})
|
|
214
|
+
list(APPEND _sources ${_SETUP_SOURCES} ${_SETUP_UNPARSED_ARGUMENTS})
|
|
215
|
+
|
|
216
|
+
if(WYVRN_PLATFORM_WINDOWS OR WYVRN_PLATFORM_XBOX)
|
|
217
|
+
add_executable(${target} WIN32 ${_sources})
|
|
218
|
+
else()
|
|
219
|
+
add_executable(${target} ${_sources})
|
|
220
|
+
endif()
|
|
221
|
+
|
|
222
|
+
_wyvrn_apply_compiler_flags(${target})
|
|
223
|
+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${_sources})
|
|
224
|
+
endfunction()
|