wyvrnpm 2.10.2 → 2.12.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.
Files changed (49) hide show
  1. package/README.md +1914 -1860
  2. package/bin/{wyvrn.js → wyvrnpm.js} +66 -0
  3. package/cmake/cpp.cmake +9 -9
  4. package/cmake/functions.cmake +224 -224
  5. package/cmake/macros.cmake +284 -284
  6. package/package.json +3 -2
  7. package/src/auth.js +66 -66
  8. package/src/binary-dir.js +95 -0
  9. package/src/bootstrap/cookbook.js +196 -196
  10. package/src/bootstrap/detect.js +150 -150
  11. package/src/bootstrap/index.js +220 -220
  12. package/src/bootstrap/version.js +72 -72
  13. package/src/build/cache.js +344 -344
  14. package/src/build/clone.js +170 -170
  15. package/src/build/cmake.js +342 -342
  16. package/src/build/index.js +299 -297
  17. package/src/build/msvc-env.js +260 -260
  18. package/src/build/recipe.js +188 -188
  19. package/src/commands/add.js +141 -141
  20. package/src/commands/bootstrap.js +96 -96
  21. package/src/commands/build.js +482 -452
  22. package/src/commands/cache.js +189 -189
  23. package/src/commands/clean.js +80 -80
  24. package/src/commands/configure.js +92 -92
  25. package/src/commands/init.js +70 -70
  26. package/src/commands/install-skill.js +115 -115
  27. package/src/commands/install.js +730 -674
  28. package/src/commands/link.js +320 -320
  29. package/src/commands/profile.js +237 -237
  30. package/src/commands/publish.js +584 -555
  31. package/src/commands/show.js +252 -252
  32. package/src/commands/version.js +187 -0
  33. package/src/compat.js +273 -273
  34. package/src/conf/index.js +415 -391
  35. package/src/conf/namespaces.js +94 -94
  36. package/src/context.js +230 -230
  37. package/src/http-fetch.js +53 -53
  38. package/src/ignore.js +118 -118
  39. package/src/logger.js +122 -122
  40. package/src/options.js +303 -303
  41. package/src/settings-overrides.js +152 -152
  42. package/src/toolchain/deps.js +164 -164
  43. package/src/toolchain/index.js +212 -212
  44. package/src/toolchain/presets.js +356 -340
  45. package/src/toolchain/template.cmake +77 -77
  46. package/src/upload-built.js +265 -265
  47. package/src/version-range.js +301 -301
  48. package/src/zip-safe.js +52 -52
  49. package/src/zip-stream.js +126 -0
@@ -1,284 +1,284 @@
1
-
2
- # Transitional helper for unified versioning.
3
- #
4
- # The shared generated header is produced once at the top-level and placed under:
5
- # ${CMAKE_BINARY_DIR}/wyvrn/WyvrnConfig.h
6
- # Targets that want to include it as `#include "wyvrn/WyvrnConfig.h"` should
7
- # have `${CMAKE_BINARY_DIR}` on their include path.
8
- #
9
- # This macro exists to preserve older module CMake patterns during migration.
10
- macro(WYVRN_CONFIGURE_VERSION_HEADER)
11
- if(ARGC GREATER 0)
12
- set(_wyvrn_version_target ${ARGV0})
13
- else()
14
- set(_wyvrn_version_target ${PROJECT_NAME})
15
- endif()
16
-
17
- if(NOT DEFINED WYVRN_VERSION_HEADER_INCLUDE_DIR)
18
- set(WYVRN_VERSION_HEADER_INCLUDE_DIR ${CMAKE_BINARY_DIR})
19
- endif()
20
-
21
- target_include_directories(${_wyvrn_version_target}
22
- PUBLIC
23
- $<BUILD_INTERFACE:${WYVRN_VERSION_HEADER_INCLUDE_DIR}>
24
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
25
- )
26
- endmacro()
27
-
28
- # Apply WYVRN_ARCH_SUFFIX to a target's OUTPUT_NAME so the produced artefact
29
- # carries an unambiguous arch marker. Opt-in — call it from your CMakeLists
30
- # only if you want the suffixing:
31
- #
32
- # WYVRN_APPLY_ARCH_SUFFIX(String) # String64.lib / String32.lib
33
- # WYVRN_APPLY_ARCH_SUFFIX(String BASE_NAME my-string) # my-string64.lib / my-string32.lib
34
- #
35
- # BASE_NAME defaults to the target name. The target linkage name (what
36
- # consumers pass to target_link_libraries) is untouched — only the on-disk
37
- # output file changes. Safe to call for any target type; does nothing if
38
- # WYVRN_ARCH_SUFFIX is empty (unknown / unmapped arch).
39
- function(WYVRN_APPLY_ARCH_SUFFIX _wyvrn_target)
40
- set(options)
41
- set(oneValueArgs BASE_NAME)
42
- set(multiValueArgs)
43
- cmake_parse_arguments(_WYVRN_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
44
-
45
- if(NOT TARGET ${_wyvrn_target})
46
- message(FATAL_ERROR "WYVRN_APPLY_ARCH_SUFFIX: '${_wyvrn_target}' is not a target")
47
- endif()
48
-
49
- if("${WYVRN_ARCH_SUFFIX}" STREQUAL "")
50
- # Unknown arch — leave the output name alone rather than stamping a
51
- # misleading value. The caller can still set OUTPUT_NAME manually.
52
- return()
53
- endif()
54
-
55
- if(_WYVRN_ARG_BASE_NAME)
56
- set(_wyvrn_base "${_WYVRN_ARG_BASE_NAME}")
57
- else()
58
- set(_wyvrn_base "${_wyvrn_target}")
59
- endif()
60
-
61
- set_target_properties(${_wyvrn_target} PROPERTIES
62
- OUTPUT_NAME "${_wyvrn_base}${WYVRN_ARCH_SUFFIX}"
63
- )
64
- endfunction()
65
-
66
- function(WYVRN_INSTALL_PACKAGE_EXPORT)
67
- set(options)
68
- set(oneValueArgs
69
- TARGET
70
- EXPORT_NAME
71
- CONFIG_INPUT
72
- CONFIG_OUTPUT
73
- VERSION_OUTPUT
74
- INSTALL_CMAKEDIR
75
- NAMESPACE
76
- EXPORT_FILE
77
- PACKAGE_VERSION
78
- )
79
- set(multiValueArgs)
80
- cmake_parse_arguments(WYVRN_EXPORT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
81
-
82
- include(CMakePackageConfigHelpers)
83
-
84
- if(NOT WYVRN_EXPORT_TARGET)
85
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires TARGET")
86
- endif()
87
- if(NOT WYVRN_EXPORT_EXPORT_NAME)
88
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_NAME")
89
- endif()
90
- if(NOT WYVRN_EXPORT_CONFIG_INPUT)
91
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_INPUT")
92
- endif()
93
- if(NOT WYVRN_EXPORT_CONFIG_OUTPUT)
94
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_OUTPUT")
95
- endif()
96
- if(NOT WYVRN_EXPORT_VERSION_OUTPUT)
97
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires VERSION_OUTPUT")
98
- endif()
99
- if(NOT WYVRN_EXPORT_INSTALL_CMAKEDIR)
100
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires INSTALL_CMAKEDIR")
101
- endif()
102
- if(NOT WYVRN_EXPORT_NAMESPACE)
103
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires NAMESPACE")
104
- endif()
105
- if(NOT WYVRN_EXPORT_EXPORT_FILE)
106
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_FILE")
107
- endif()
108
-
109
- if(NOT WYVRN_EXPORT_PACKAGE_VERSION)
110
- if(DEFINED PROJECT_VERSION AND NOT "${PROJECT_VERSION}" STREQUAL "")
111
- set(WYVRN_EXPORT_PACKAGE_VERSION ${PROJECT_VERSION})
112
- elseif(DEFINED WYVRN_PROJECT_VERSION AND NOT "${WYVRN_PROJECT_VERSION}" STREQUAL "")
113
- set(WYVRN_EXPORT_PACKAGE_VERSION ${WYVRN_PROJECT_VERSION})
114
- else()
115
- message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires PACKAGE_VERSION or a non-empty PROJECT_VERSION/WYVRN_PROJECT_VERSION")
116
- endif()
117
- endif()
118
-
119
- configure_package_config_file(
120
- "${WYVRN_EXPORT_CONFIG_INPUT}"
121
- "${WYVRN_EXPORT_CONFIG_OUTPUT}"
122
- INSTALL_DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
123
- )
124
-
125
- # INTERFACE libraries (header-only) have no compiled binary, so the arch
126
- # stamped by `write_basic_package_version_file()` by default makes CMake
127
- # reject the package when the consumer's CMAKE_SIZEOF_VOID_P differs —
128
- # even though the headers themselves are arch-portable. Pass
129
- # ARCH_INDEPENDENT so a HeaderOnlyLib published from x86_64 is consumable
130
- # from x86 (and vice versa). Binary kinds keep the arch check.
131
- set(_wyvrn_version_args)
132
- get_target_property(_wyvrn_target_type ${WYVRN_EXPORT_TARGET} TYPE)
133
- if(_wyvrn_target_type STREQUAL "INTERFACE_LIBRARY")
134
- list(APPEND _wyvrn_version_args ARCH_INDEPENDENT)
135
- endif()
136
-
137
- write_basic_package_version_file(
138
- "${WYVRN_EXPORT_VERSION_OUTPUT}"
139
- VERSION "${WYVRN_EXPORT_PACKAGE_VERSION}"
140
- COMPATIBILITY SameMajorVersion
141
- ${_wyvrn_version_args}
142
- )
143
-
144
- install(FILES
145
- "${WYVRN_EXPORT_CONFIG_OUTPUT}"
146
- "${WYVRN_EXPORT_VERSION_OUTPUT}"
147
- DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
148
- )
149
-
150
- install(TARGETS ${WYVRN_EXPORT_TARGET}
151
- EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
152
- RUNTIME DESTINATION bin/$<CONFIG> # .dll files (Windows)
153
- LIBRARY DESTINATION lib/$<CONFIG> # .so files (Linux/macOS)
154
- ARCHIVE DESTINATION lib/$<CONFIG> # .lib files (static or import libs)
155
- )
156
-
157
- install(EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
158
- FILE ${WYVRN_EXPORT_EXPORT_FILE}
159
- NAMESPACE ${WYVRN_EXPORT_NAMESPACE}
160
- DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
161
- )
162
- endfunction()
163
-
164
- function(WYVRN_INSTALL_MODULE)
165
- set(options
166
- COPY_DLL_TO_OUTPUT
167
- )
168
- set(oneValueArgs
169
- TARGET
170
- PACKAGE_NAME
171
- INSTALL_CMAKEDIR
172
- NAMESPACE
173
- EXPORT_NAME
174
- EXPORT_FILE
175
- DLL_OUTPUT_DIR
176
- CONSUMER_DLL_OUTPUT_DIR
177
- )
178
- set(multiValueArgs
179
- DEPENDENCIES
180
- FIND_PACKAGES
181
- )
182
- cmake_parse_arguments(WYVRN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
183
-
184
- if(NOT WYVRN_TARGET)
185
- message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires TARGET")
186
- endif()
187
- if(NOT WYVRN_PACKAGE_NAME)
188
- message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires PACKAGE_NAME (example: WyvrnMemory)")
189
- endif()
190
-
191
- if(NOT WYVRN_NAMESPACE)
192
- set(WYVRN_NAMESPACE wyvrn::)
193
- endif()
194
- if(NOT WYVRN_EXPORT_NAME)
195
- set(WYVRN_EXPORT_NAME "${WYVRN_PACKAGE_NAME}Targets")
196
- endif()
197
- if(NOT WYVRN_EXPORT_FILE)
198
- set(WYVRN_EXPORT_FILE "${WYVRN_PACKAGE_NAME}Targets.cmake")
199
- endif()
200
- if(NOT WYVRN_INSTALL_CMAKEDIR)
201
- set(WYVRN_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${WYVRN_PACKAGE_NAME}")
202
- endif()
203
-
204
- if(WYVRN_COPY_DLL_TO_OUTPUT)
205
- get_target_property(_wyvrn_target_type ${WYVRN_TARGET} TYPE)
206
- set(_wyvrn_enable_dll_copy FALSE)
207
-
208
- if(NOT WYVRN_DLL_OUTPUT_DIR)
209
- if(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY AND NOT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
210
- set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
211
- else()
212
- set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
213
- endif()
214
- endif()
215
-
216
- if(WIN32 AND (_wyvrn_target_type STREQUAL "SHARED_LIBRARY" OR _wyvrn_target_type STREQUAL "MODULE_LIBRARY"))
217
- set(_wyvrn_enable_dll_copy TRUE)
218
- add_custom_command(TARGET ${WYVRN_TARGET} POST_BUILD
219
- COMMAND ${CMAKE_COMMAND} -E make_directory "${WYVRN_DLL_OUTPUT_DIR}"
220
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
221
- "$<TARGET_FILE:${WYVRN_TARGET}>"
222
- "${WYVRN_DLL_OUTPUT_DIR}/"
223
- COMMENT "Copying DLL for ${WYVRN_TARGET} to ${WYVRN_DLL_OUTPUT_DIR}"
224
- )
225
- else()
226
- message(WARNING "WYVRN_INSTALL_MODULE(COPY_DLL_TO_OUTPUT) is set for '${WYVRN_TARGET}', but it is not a Windows shared/module library. Skipping DLL copy.")
227
- endif()
228
- endif()
229
-
230
- set(_wyvrn_config_in "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake.in")
231
- set(_wyvrn_config_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake")
232
- set(_wyvrn_version_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}ConfigVersion.cmake")
233
-
234
- set(_wyvrn_config_text "@PACKAGE_INIT@\n\n")
235
-
236
- if(WYVRN_FIND_PACKAGES OR WYVRN_DEPENDENCIES)
237
- string(APPEND _wyvrn_config_text "include(CMakeFindDependencyMacro)\n")
238
- endif()
239
-
240
- foreach(_wyvrn_pkg IN LISTS WYVRN_FIND_PACKAGES)
241
- string(APPEND _wyvrn_config_text "find_package(${_wyvrn_pkg} CONFIG REQUIRED)\n")
242
- endforeach()
243
-
244
- foreach(_wyvrn_dep IN LISTS WYVRN_DEPENDENCIES)
245
- string(APPEND _wyvrn_config_text "find_dependency(${_wyvrn_dep} CONFIG REQUIRED)\n")
246
- endforeach()
247
-
248
- string(APPEND _wyvrn_config_text "\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/${WYVRN_EXPORT_FILE}\")\n")
249
-
250
- if(WYVRN_COPY_DLL_TO_OUTPUT AND _wyvrn_enable_dll_copy)
251
- if(NOT WYVRN_CONSUMER_DLL_OUTPUT_DIR)
252
- set(WYVRN_CONSUMER_DLL_OUTPUT_DIR "\${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
253
- endif()
254
-
255
- string(APPEND _wyvrn_config_text "\nif(WIN32 AND TARGET ${WYVRN_NAMESPACE}${WYVRN_TARGET})\n")
256
- string(APPEND _wyvrn_config_text " if(NOT TARGET ${WYVRN_PACKAGE_NAME}RuntimeCopy)\n")
257
- string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"${WYVRN_CONSUMER_DLL_OUTPUT_DIR}\")\n")
258
- string(APPEND _wyvrn_config_text " if(\"\${_wyvrn_runtime_out}\" STREQUAL \"/$<CONFIG>\")\n")
259
- string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"\${CMAKE_BINARY_DIR}/bin/$<CONFIG>\")\n")
260
- string(APPEND _wyvrn_config_text " endif()\n")
261
- string(APPEND _wyvrn_config_text " add_custom_target(${WYVRN_PACKAGE_NAME}RuntimeCopy ALL\n")
262
- string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E make_directory \"\${_wyvrn_runtime_out}\"\n")
263
- string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E copy_if_different\n")
264
- string(APPEND _wyvrn_config_text " \"$<TARGET_FILE:${WYVRN_NAMESPACE}${WYVRN_TARGET}>\"\n")
265
- string(APPEND _wyvrn_config_text " \"\${_wyvrn_runtime_out}/\"\n")
266
- string(APPEND _wyvrn_config_text " COMMENT \"Copying runtime DLL for ${WYVRN_NAMESPACE}${WYVRN_TARGET} to \${_wyvrn_runtime_out}\"\n")
267
- string(APPEND _wyvrn_config_text " )\n")
268
- string(APPEND _wyvrn_config_text " endif()\n")
269
- string(APPEND _wyvrn_config_text "endif()\n")
270
- endif()
271
-
272
- file(WRITE "${_wyvrn_config_in}" "${_wyvrn_config_text}")
273
-
274
- WYVRN_INSTALL_PACKAGE_EXPORT(
275
- TARGET ${WYVRN_TARGET}
276
- EXPORT_NAME ${WYVRN_EXPORT_NAME}
277
- CONFIG_INPUT "${_wyvrn_config_in}"
278
- CONFIG_OUTPUT "${_wyvrn_config_out}"
279
- VERSION_OUTPUT "${_wyvrn_version_out}"
280
- INSTALL_CMAKEDIR "${WYVRN_INSTALL_CMAKEDIR}"
281
- NAMESPACE ${WYVRN_NAMESPACE}
282
- EXPORT_FILE ${WYVRN_EXPORT_FILE}
283
- )
284
- endfunction()
1
+
2
+ # Transitional helper for unified versioning.
3
+ #
4
+ # The shared generated header is produced once at the top-level and placed under:
5
+ # ${CMAKE_BINARY_DIR}/wyvrn/WyvrnConfig.h
6
+ # Targets that want to include it as `#include "wyvrn/WyvrnConfig.h"` should
7
+ # have `${CMAKE_BINARY_DIR}` on their include path.
8
+ #
9
+ # This macro exists to preserve older module CMake patterns during migration.
10
+ macro(WYVRN_CONFIGURE_VERSION_HEADER)
11
+ if(ARGC GREATER 0)
12
+ set(_wyvrn_version_target ${ARGV0})
13
+ else()
14
+ set(_wyvrn_version_target ${PROJECT_NAME})
15
+ endif()
16
+
17
+ if(NOT DEFINED WYVRN_VERSION_HEADER_INCLUDE_DIR)
18
+ set(WYVRN_VERSION_HEADER_INCLUDE_DIR ${CMAKE_BINARY_DIR})
19
+ endif()
20
+
21
+ target_include_directories(${_wyvrn_version_target}
22
+ PUBLIC
23
+ $<BUILD_INTERFACE:${WYVRN_VERSION_HEADER_INCLUDE_DIR}>
24
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
25
+ )
26
+ endmacro()
27
+
28
+ # Apply WYVRN_ARCH_SUFFIX to a target's OUTPUT_NAME so the produced artefact
29
+ # carries an unambiguous arch marker. Opt-in — call it from your CMakeLists
30
+ # only if you want the suffixing:
31
+ #
32
+ # WYVRN_APPLY_ARCH_SUFFIX(String) # String64.lib / String32.lib
33
+ # WYVRN_APPLY_ARCH_SUFFIX(String BASE_NAME my-string) # my-string64.lib / my-string32.lib
34
+ #
35
+ # BASE_NAME defaults to the target name. The target linkage name (what
36
+ # consumers pass to target_link_libraries) is untouched — only the on-disk
37
+ # output file changes. Safe to call for any target type; does nothing if
38
+ # WYVRN_ARCH_SUFFIX is empty (unknown / unmapped arch).
39
+ function(WYVRN_APPLY_ARCH_SUFFIX _wyvrn_target)
40
+ set(options)
41
+ set(oneValueArgs BASE_NAME)
42
+ set(multiValueArgs)
43
+ cmake_parse_arguments(_WYVRN_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
44
+
45
+ if(NOT TARGET ${_wyvrn_target})
46
+ message(FATAL_ERROR "WYVRN_APPLY_ARCH_SUFFIX: '${_wyvrn_target}' is not a target")
47
+ endif()
48
+
49
+ if("${WYVRN_ARCH_SUFFIX}" STREQUAL "")
50
+ # Unknown arch — leave the output name alone rather than stamping a
51
+ # misleading value. The caller can still set OUTPUT_NAME manually.
52
+ return()
53
+ endif()
54
+
55
+ if(_WYVRN_ARG_BASE_NAME)
56
+ set(_wyvrn_base "${_WYVRN_ARG_BASE_NAME}")
57
+ else()
58
+ set(_wyvrn_base "${_wyvrn_target}")
59
+ endif()
60
+
61
+ set_target_properties(${_wyvrn_target} PROPERTIES
62
+ OUTPUT_NAME "${_wyvrn_base}${WYVRN_ARCH_SUFFIX}"
63
+ )
64
+ endfunction()
65
+
66
+ function(WYVRN_INSTALL_PACKAGE_EXPORT)
67
+ set(options)
68
+ set(oneValueArgs
69
+ TARGET
70
+ EXPORT_NAME
71
+ CONFIG_INPUT
72
+ CONFIG_OUTPUT
73
+ VERSION_OUTPUT
74
+ INSTALL_CMAKEDIR
75
+ NAMESPACE
76
+ EXPORT_FILE
77
+ PACKAGE_VERSION
78
+ )
79
+ set(multiValueArgs)
80
+ cmake_parse_arguments(WYVRN_EXPORT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
81
+
82
+ include(CMakePackageConfigHelpers)
83
+
84
+ if(NOT WYVRN_EXPORT_TARGET)
85
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires TARGET")
86
+ endif()
87
+ if(NOT WYVRN_EXPORT_EXPORT_NAME)
88
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_NAME")
89
+ endif()
90
+ if(NOT WYVRN_EXPORT_CONFIG_INPUT)
91
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_INPUT")
92
+ endif()
93
+ if(NOT WYVRN_EXPORT_CONFIG_OUTPUT)
94
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_OUTPUT")
95
+ endif()
96
+ if(NOT WYVRN_EXPORT_VERSION_OUTPUT)
97
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires VERSION_OUTPUT")
98
+ endif()
99
+ if(NOT WYVRN_EXPORT_INSTALL_CMAKEDIR)
100
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires INSTALL_CMAKEDIR")
101
+ endif()
102
+ if(NOT WYVRN_EXPORT_NAMESPACE)
103
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires NAMESPACE")
104
+ endif()
105
+ if(NOT WYVRN_EXPORT_EXPORT_FILE)
106
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_FILE")
107
+ endif()
108
+
109
+ if(NOT WYVRN_EXPORT_PACKAGE_VERSION)
110
+ if(DEFINED PROJECT_VERSION AND NOT "${PROJECT_VERSION}" STREQUAL "")
111
+ set(WYVRN_EXPORT_PACKAGE_VERSION ${PROJECT_VERSION})
112
+ elseif(DEFINED WYVRN_PROJECT_VERSION AND NOT "${WYVRN_PROJECT_VERSION}" STREQUAL "")
113
+ set(WYVRN_EXPORT_PACKAGE_VERSION ${WYVRN_PROJECT_VERSION})
114
+ else()
115
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires PACKAGE_VERSION or a non-empty PROJECT_VERSION/WYVRN_PROJECT_VERSION")
116
+ endif()
117
+ endif()
118
+
119
+ configure_package_config_file(
120
+ "${WYVRN_EXPORT_CONFIG_INPUT}"
121
+ "${WYVRN_EXPORT_CONFIG_OUTPUT}"
122
+ INSTALL_DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
123
+ )
124
+
125
+ # INTERFACE libraries (header-only) have no compiled binary, so the arch
126
+ # stamped by `write_basic_package_version_file()` by default makes CMake
127
+ # reject the package when the consumer's CMAKE_SIZEOF_VOID_P differs —
128
+ # even though the headers themselves are arch-portable. Pass
129
+ # ARCH_INDEPENDENT so a HeaderOnlyLib published from x86_64 is consumable
130
+ # from x86 (and vice versa). Binary kinds keep the arch check.
131
+ set(_wyvrn_version_args)
132
+ get_target_property(_wyvrn_target_type ${WYVRN_EXPORT_TARGET} TYPE)
133
+ if(_wyvrn_target_type STREQUAL "INTERFACE_LIBRARY")
134
+ list(APPEND _wyvrn_version_args ARCH_INDEPENDENT)
135
+ endif()
136
+
137
+ write_basic_package_version_file(
138
+ "${WYVRN_EXPORT_VERSION_OUTPUT}"
139
+ VERSION "${WYVRN_EXPORT_PACKAGE_VERSION}"
140
+ COMPATIBILITY SameMajorVersion
141
+ ${_wyvrn_version_args}
142
+ )
143
+
144
+ install(FILES
145
+ "${WYVRN_EXPORT_CONFIG_OUTPUT}"
146
+ "${WYVRN_EXPORT_VERSION_OUTPUT}"
147
+ DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
148
+ )
149
+
150
+ install(TARGETS ${WYVRN_EXPORT_TARGET}
151
+ EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
152
+ RUNTIME DESTINATION bin/$<CONFIG> # .dll files (Windows)
153
+ LIBRARY DESTINATION lib/$<CONFIG> # .so files (Linux/macOS)
154
+ ARCHIVE DESTINATION lib/$<CONFIG> # .lib files (static or import libs)
155
+ )
156
+
157
+ install(EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
158
+ FILE ${WYVRN_EXPORT_EXPORT_FILE}
159
+ NAMESPACE ${WYVRN_EXPORT_NAMESPACE}
160
+ DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
161
+ )
162
+ endfunction()
163
+
164
+ function(WYVRN_INSTALL_MODULE)
165
+ set(options
166
+ COPY_DLL_TO_OUTPUT
167
+ )
168
+ set(oneValueArgs
169
+ TARGET
170
+ PACKAGE_NAME
171
+ INSTALL_CMAKEDIR
172
+ NAMESPACE
173
+ EXPORT_NAME
174
+ EXPORT_FILE
175
+ DLL_OUTPUT_DIR
176
+ CONSUMER_DLL_OUTPUT_DIR
177
+ )
178
+ set(multiValueArgs
179
+ DEPENDENCIES
180
+ FIND_PACKAGES
181
+ )
182
+ cmake_parse_arguments(WYVRN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
183
+
184
+ if(NOT WYVRN_TARGET)
185
+ message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires TARGET")
186
+ endif()
187
+ if(NOT WYVRN_PACKAGE_NAME)
188
+ message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires PACKAGE_NAME (example: WyvrnMemory)")
189
+ endif()
190
+
191
+ if(NOT WYVRN_NAMESPACE)
192
+ set(WYVRN_NAMESPACE wyvrn::)
193
+ endif()
194
+ if(NOT WYVRN_EXPORT_NAME)
195
+ set(WYVRN_EXPORT_NAME "${WYVRN_PACKAGE_NAME}Targets")
196
+ endif()
197
+ if(NOT WYVRN_EXPORT_FILE)
198
+ set(WYVRN_EXPORT_FILE "${WYVRN_PACKAGE_NAME}Targets.cmake")
199
+ endif()
200
+ if(NOT WYVRN_INSTALL_CMAKEDIR)
201
+ set(WYVRN_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${WYVRN_PACKAGE_NAME}")
202
+ endif()
203
+
204
+ if(WYVRN_COPY_DLL_TO_OUTPUT)
205
+ get_target_property(_wyvrn_target_type ${WYVRN_TARGET} TYPE)
206
+ set(_wyvrn_enable_dll_copy FALSE)
207
+
208
+ if(NOT WYVRN_DLL_OUTPUT_DIR)
209
+ if(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY AND NOT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
210
+ set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
211
+ else()
212
+ set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
213
+ endif()
214
+ endif()
215
+
216
+ if(WIN32 AND (_wyvrn_target_type STREQUAL "SHARED_LIBRARY" OR _wyvrn_target_type STREQUAL "MODULE_LIBRARY"))
217
+ set(_wyvrn_enable_dll_copy TRUE)
218
+ add_custom_command(TARGET ${WYVRN_TARGET} POST_BUILD
219
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${WYVRN_DLL_OUTPUT_DIR}"
220
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
221
+ "$<TARGET_FILE:${WYVRN_TARGET}>"
222
+ "${WYVRN_DLL_OUTPUT_DIR}/"
223
+ COMMENT "Copying DLL for ${WYVRN_TARGET} to ${WYVRN_DLL_OUTPUT_DIR}"
224
+ )
225
+ else()
226
+ message(WARNING "WYVRN_INSTALL_MODULE(COPY_DLL_TO_OUTPUT) is set for '${WYVRN_TARGET}', but it is not a Windows shared/module library. Skipping DLL copy.")
227
+ endif()
228
+ endif()
229
+
230
+ set(_wyvrn_config_in "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake.in")
231
+ set(_wyvrn_config_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake")
232
+ set(_wyvrn_version_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}ConfigVersion.cmake")
233
+
234
+ set(_wyvrn_config_text "@PACKAGE_INIT@\n\n")
235
+
236
+ if(WYVRN_FIND_PACKAGES OR WYVRN_DEPENDENCIES)
237
+ string(APPEND _wyvrn_config_text "include(CMakeFindDependencyMacro)\n")
238
+ endif()
239
+
240
+ foreach(_wyvrn_pkg IN LISTS WYVRN_FIND_PACKAGES)
241
+ string(APPEND _wyvrn_config_text "find_package(${_wyvrn_pkg} CONFIG REQUIRED)\n")
242
+ endforeach()
243
+
244
+ foreach(_wyvrn_dep IN LISTS WYVRN_DEPENDENCIES)
245
+ string(APPEND _wyvrn_config_text "find_dependency(${_wyvrn_dep} CONFIG REQUIRED)\n")
246
+ endforeach()
247
+
248
+ string(APPEND _wyvrn_config_text "\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/${WYVRN_EXPORT_FILE}\")\n")
249
+
250
+ if(WYVRN_COPY_DLL_TO_OUTPUT AND _wyvrn_enable_dll_copy)
251
+ if(NOT WYVRN_CONSUMER_DLL_OUTPUT_DIR)
252
+ set(WYVRN_CONSUMER_DLL_OUTPUT_DIR "\${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
253
+ endif()
254
+
255
+ string(APPEND _wyvrn_config_text "\nif(WIN32 AND TARGET ${WYVRN_NAMESPACE}${WYVRN_TARGET})\n")
256
+ string(APPEND _wyvrn_config_text " if(NOT TARGET ${WYVRN_PACKAGE_NAME}RuntimeCopy)\n")
257
+ string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"${WYVRN_CONSUMER_DLL_OUTPUT_DIR}\")\n")
258
+ string(APPEND _wyvrn_config_text " if(\"\${_wyvrn_runtime_out}\" STREQUAL \"/$<CONFIG>\")\n")
259
+ string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"\${CMAKE_BINARY_DIR}/bin/$<CONFIG>\")\n")
260
+ string(APPEND _wyvrn_config_text " endif()\n")
261
+ string(APPEND _wyvrn_config_text " add_custom_target(${WYVRN_PACKAGE_NAME}RuntimeCopy ALL\n")
262
+ string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E make_directory \"\${_wyvrn_runtime_out}\"\n")
263
+ string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E copy_if_different\n")
264
+ string(APPEND _wyvrn_config_text " \"$<TARGET_FILE:${WYVRN_NAMESPACE}${WYVRN_TARGET}>\"\n")
265
+ string(APPEND _wyvrn_config_text " \"\${_wyvrn_runtime_out}/\"\n")
266
+ string(APPEND _wyvrn_config_text " COMMENT \"Copying runtime DLL for ${WYVRN_NAMESPACE}${WYVRN_TARGET} to \${_wyvrn_runtime_out}\"\n")
267
+ string(APPEND _wyvrn_config_text " )\n")
268
+ string(APPEND _wyvrn_config_text " endif()\n")
269
+ string(APPEND _wyvrn_config_text "endif()\n")
270
+ endif()
271
+
272
+ file(WRITE "${_wyvrn_config_in}" "${_wyvrn_config_text}")
273
+
274
+ WYVRN_INSTALL_PACKAGE_EXPORT(
275
+ TARGET ${WYVRN_TARGET}
276
+ EXPORT_NAME ${WYVRN_EXPORT_NAME}
277
+ CONFIG_INPUT "${_wyvrn_config_in}"
278
+ CONFIG_OUTPUT "${_wyvrn_config_out}"
279
+ VERSION_OUTPUT "${_wyvrn_version_out}"
280
+ INSTALL_CMAKEDIR "${WYVRN_INSTALL_CMAKEDIR}"
281
+ NAMESPACE ${WYVRN_NAMESPACE}
282
+ EXPORT_FILE ${WYVRN_EXPORT_FILE}
283
+ )
284
+ endfunction()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyvrnpm",
3
- "version": "2.10.2",
3
+ "version": "2.12.2",
4
4
  "description": "A simple, static-hosting-compatible C++ package manager",
5
5
  "keywords": [
6
6
  "c++",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "license": "MIT",
14
14
  "bin": {
15
- "wyvrnpm": "bin/wyvrn.js"
15
+ "wyvrnpm": "bin/wyvrnpm.js"
16
16
  },
17
17
  "main": "src/index.js",
18
18
  "type": "commonjs",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "adm-zip": "^0.5.16",
31
+ "archiver": "^7.0.1",
31
32
  "node-stream-zip": "^1.15.0",
32
33
  "yargs": "^17.7.2",
33
34
  "@aws-sdk/client-s3": "^3.0.0",