wyvrnpm 2.0.2 → 2.1.0

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.
@@ -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()
@@ -0,0 +1,233 @@
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
+ function(WYVRN_INSTALL_PACKAGE_EXPORT)
29
+ set(options)
30
+ set(oneValueArgs
31
+ TARGET
32
+ EXPORT_NAME
33
+ CONFIG_INPUT
34
+ CONFIG_OUTPUT
35
+ VERSION_OUTPUT
36
+ INSTALL_CMAKEDIR
37
+ NAMESPACE
38
+ EXPORT_FILE
39
+ PACKAGE_VERSION
40
+ )
41
+ set(multiValueArgs)
42
+ cmake_parse_arguments(WYVRN_EXPORT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
43
+
44
+ include(CMakePackageConfigHelpers)
45
+
46
+ if(NOT WYVRN_EXPORT_TARGET)
47
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires TARGET")
48
+ endif()
49
+ if(NOT WYVRN_EXPORT_EXPORT_NAME)
50
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_NAME")
51
+ endif()
52
+ if(NOT WYVRN_EXPORT_CONFIG_INPUT)
53
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_INPUT")
54
+ endif()
55
+ if(NOT WYVRN_EXPORT_CONFIG_OUTPUT)
56
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires CONFIG_OUTPUT")
57
+ endif()
58
+ if(NOT WYVRN_EXPORT_VERSION_OUTPUT)
59
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires VERSION_OUTPUT")
60
+ endif()
61
+ if(NOT WYVRN_EXPORT_INSTALL_CMAKEDIR)
62
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires INSTALL_CMAKEDIR")
63
+ endif()
64
+ if(NOT WYVRN_EXPORT_NAMESPACE)
65
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires NAMESPACE")
66
+ endif()
67
+ if(NOT WYVRN_EXPORT_EXPORT_FILE)
68
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires EXPORT_FILE")
69
+ endif()
70
+
71
+ if(NOT WYVRN_EXPORT_PACKAGE_VERSION)
72
+ if(DEFINED PROJECT_VERSION AND NOT "${PROJECT_VERSION}" STREQUAL "")
73
+ set(WYVRN_EXPORT_PACKAGE_VERSION ${PROJECT_VERSION})
74
+ elseif(DEFINED WYVRN_PROJECT_VERSION AND NOT "${WYVRN_PROJECT_VERSION}" STREQUAL "")
75
+ set(WYVRN_EXPORT_PACKAGE_VERSION ${WYVRN_PROJECT_VERSION})
76
+ else()
77
+ message(FATAL_ERROR "WYVRN_INSTALL_PACKAGE_EXPORT requires PACKAGE_VERSION or a non-empty PROJECT_VERSION/WYVRN_PROJECT_VERSION")
78
+ endif()
79
+ endif()
80
+
81
+ configure_package_config_file(
82
+ "${WYVRN_EXPORT_CONFIG_INPUT}"
83
+ "${WYVRN_EXPORT_CONFIG_OUTPUT}"
84
+ INSTALL_DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
85
+ )
86
+
87
+ write_basic_package_version_file(
88
+ "${WYVRN_EXPORT_VERSION_OUTPUT}"
89
+ VERSION "${WYVRN_EXPORT_PACKAGE_VERSION}"
90
+ COMPATIBILITY SameMajorVersion
91
+ )
92
+
93
+ install(FILES
94
+ "${WYVRN_EXPORT_CONFIG_OUTPUT}"
95
+ "${WYVRN_EXPORT_VERSION_OUTPUT}"
96
+ DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
97
+ )
98
+
99
+ install(TARGETS ${WYVRN_EXPORT_TARGET}
100
+ EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
101
+ RUNTIME DESTINATION bin/$<CONFIG> # .dll files (Windows)
102
+ LIBRARY DESTINATION lib/$<CONFIG> # .so files (Linux/macOS)
103
+ ARCHIVE DESTINATION lib/$<CONFIG> # .lib files (static or import libs)
104
+ )
105
+
106
+ install(EXPORT ${WYVRN_EXPORT_EXPORT_NAME}
107
+ FILE ${WYVRN_EXPORT_EXPORT_FILE}
108
+ NAMESPACE ${WYVRN_EXPORT_NAMESPACE}
109
+ DESTINATION "${WYVRN_EXPORT_INSTALL_CMAKEDIR}"
110
+ )
111
+ endfunction()
112
+
113
+ function(WYVRN_INSTALL_MODULE)
114
+ set(options
115
+ COPY_DLL_TO_OUTPUT
116
+ )
117
+ set(oneValueArgs
118
+ TARGET
119
+ PACKAGE_NAME
120
+ INSTALL_CMAKEDIR
121
+ NAMESPACE
122
+ EXPORT_NAME
123
+ EXPORT_FILE
124
+ DLL_OUTPUT_DIR
125
+ CONSUMER_DLL_OUTPUT_DIR
126
+ )
127
+ set(multiValueArgs
128
+ DEPENDENCIES
129
+ FIND_PACKAGES
130
+ )
131
+ cmake_parse_arguments(WYVRN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
132
+
133
+ if(NOT WYVRN_TARGET)
134
+ message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires TARGET")
135
+ endif()
136
+ if(NOT WYVRN_PACKAGE_NAME)
137
+ message(FATAL_ERROR "WYVRN_INSTALL_MODULE requires PACKAGE_NAME (example: WyvrnMemory)")
138
+ endif()
139
+
140
+ if(NOT WYVRN_NAMESPACE)
141
+ set(WYVRN_NAMESPACE wyvrn::)
142
+ endif()
143
+ if(NOT WYVRN_EXPORT_NAME)
144
+ set(WYVRN_EXPORT_NAME "${WYVRN_PACKAGE_NAME}Targets")
145
+ endif()
146
+ if(NOT WYVRN_EXPORT_FILE)
147
+ set(WYVRN_EXPORT_FILE "${WYVRN_PACKAGE_NAME}Targets.cmake")
148
+ endif()
149
+ if(NOT WYVRN_INSTALL_CMAKEDIR)
150
+ set(WYVRN_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${WYVRN_PACKAGE_NAME}")
151
+ endif()
152
+
153
+ if(WYVRN_COPY_DLL_TO_OUTPUT)
154
+ get_target_property(_wyvrn_target_type ${WYVRN_TARGET} TYPE)
155
+ set(_wyvrn_enable_dll_copy FALSE)
156
+
157
+ if(NOT WYVRN_DLL_OUTPUT_DIR)
158
+ if(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY AND NOT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" STREQUAL "")
159
+ set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
160
+ else()
161
+ set(WYVRN_DLL_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
162
+ endif()
163
+ endif()
164
+
165
+ if(WIN32 AND (_wyvrn_target_type STREQUAL "SHARED_LIBRARY" OR _wyvrn_target_type STREQUAL "MODULE_LIBRARY"))
166
+ set(_wyvrn_enable_dll_copy TRUE)
167
+ add_custom_command(TARGET ${WYVRN_TARGET} POST_BUILD
168
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${WYVRN_DLL_OUTPUT_DIR}"
169
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
170
+ "$<TARGET_FILE:${WYVRN_TARGET}>"
171
+ "${WYVRN_DLL_OUTPUT_DIR}/"
172
+ COMMENT "Copying DLL for ${WYVRN_TARGET} to ${WYVRN_DLL_OUTPUT_DIR}"
173
+ )
174
+ else()
175
+ 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.")
176
+ endif()
177
+ endif()
178
+
179
+ set(_wyvrn_config_in "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake.in")
180
+ set(_wyvrn_config_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}Config.cmake")
181
+ set(_wyvrn_version_out "${CMAKE_CURRENT_BINARY_DIR}/${WYVRN_PACKAGE_NAME}ConfigVersion.cmake")
182
+
183
+ set(_wyvrn_config_text "@PACKAGE_INIT@\n\n")
184
+
185
+ if(WYVRN_FIND_PACKAGES OR WYVRN_DEPENDENCIES)
186
+ string(APPEND _wyvrn_config_text "include(CMakeFindDependencyMacro)\n")
187
+ endif()
188
+
189
+ foreach(_wyvrn_pkg IN LISTS WYVRN_FIND_PACKAGES)
190
+ string(APPEND _wyvrn_config_text "find_package(${_wyvrn_pkg} CONFIG REQUIRED)\n")
191
+ endforeach()
192
+
193
+ foreach(_wyvrn_dep IN LISTS WYVRN_DEPENDENCIES)
194
+ string(APPEND _wyvrn_config_text "find_dependency(${_wyvrn_dep} CONFIG REQUIRED)\n")
195
+ endforeach()
196
+
197
+ string(APPEND _wyvrn_config_text "\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/${WYVRN_EXPORT_FILE}\")\n")
198
+
199
+ if(WYVRN_COPY_DLL_TO_OUTPUT AND _wyvrn_enable_dll_copy)
200
+ if(NOT WYVRN_CONSUMER_DLL_OUTPUT_DIR)
201
+ set(WYVRN_CONSUMER_DLL_OUTPUT_DIR "\${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
202
+ endif()
203
+
204
+ string(APPEND _wyvrn_config_text "\nif(WIN32 AND TARGET ${WYVRN_NAMESPACE}${WYVRN_TARGET})\n")
205
+ string(APPEND _wyvrn_config_text " if(NOT TARGET ${WYVRN_PACKAGE_NAME}RuntimeCopy)\n")
206
+ string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"${WYVRN_CONSUMER_DLL_OUTPUT_DIR}\")\n")
207
+ string(APPEND _wyvrn_config_text " if(\"\${_wyvrn_runtime_out}\" STREQUAL \"/$<CONFIG>\")\n")
208
+ string(APPEND _wyvrn_config_text " set(_wyvrn_runtime_out \"\${CMAKE_BINARY_DIR}/bin/$<CONFIG>\")\n")
209
+ string(APPEND _wyvrn_config_text " endif()\n")
210
+ string(APPEND _wyvrn_config_text " add_custom_target(${WYVRN_PACKAGE_NAME}RuntimeCopy ALL\n")
211
+ string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E make_directory \"\${_wyvrn_runtime_out}\"\n")
212
+ string(APPEND _wyvrn_config_text " COMMAND \${CMAKE_COMMAND} -E copy_if_different\n")
213
+ string(APPEND _wyvrn_config_text " \"$<TARGET_FILE:${WYVRN_NAMESPACE}${WYVRN_TARGET}>\"\n")
214
+ string(APPEND _wyvrn_config_text " \"\${_wyvrn_runtime_out}/\"\n")
215
+ string(APPEND _wyvrn_config_text " COMMENT \"Copying runtime DLL for ${WYVRN_NAMESPACE}${WYVRN_TARGET} to \${_wyvrn_runtime_out}\"\n")
216
+ string(APPEND _wyvrn_config_text " )\n")
217
+ string(APPEND _wyvrn_config_text " endif()\n")
218
+ string(APPEND _wyvrn_config_text "endif()\n")
219
+ endif()
220
+
221
+ file(WRITE "${_wyvrn_config_in}" "${_wyvrn_config_text}")
222
+
223
+ WYVRN_INSTALL_PACKAGE_EXPORT(
224
+ TARGET ${WYVRN_TARGET}
225
+ EXPORT_NAME ${WYVRN_EXPORT_NAME}
226
+ CONFIG_INPUT "${_wyvrn_config_in}"
227
+ CONFIG_OUTPUT "${_wyvrn_config_out}"
228
+ VERSION_OUTPUT "${_wyvrn_version_out}"
229
+ INSTALL_CMAKEDIR "${WYVRN_INSTALL_CMAKEDIR}"
230
+ NAMESPACE ${WYVRN_NAMESPACE}
231
+ EXPORT_FILE ${WYVRN_EXPORT_FILE}
232
+ )
233
+ endfunction()
@@ -0,0 +1,23 @@
1
+ option(WYVRN_ENABLE_ASSERTION "Enable assertions" ON)
2
+ option(WYVRN_ENABLE_LOG "Enable logging" ON)
3
+ option(WYVRN_ENABLE_PROFILER "Enable profiler" OFF)
4
+ option(WYVRN_COMPILE_PROFILER_EXE "Compile the profiler executable" OFF)
5
+ option(WYVRN_ENABLE_MEMORY_TRACK "Enable memory tracking" OFF)
6
+ option(WYVRN_MEMORY_TRACK_VERBOSE "Verbose memory tracking (very slow)" OFF)
7
+
8
+ set(WYVRN_OPTIONS
9
+ WYVRN_ENABLE_ASSERTION
10
+ WYVRN_ENABLE_LOG
11
+ WYVRN_ENABLE_PROFILER
12
+ WYVRN_COMPILE_PROFILER_EXE
13
+ WYVRN_ENABLE_MEMORY_TRACK
14
+ WYVRN_MEMORY_TRACK_VERBOSE)
15
+
16
+ foreach(opt IN LISTS WYVRN_OPTIONS)
17
+ if(${opt})
18
+ add_compile_definitions(${opt}=1)
19
+ message(STATUS "Enabled option: ${opt}")
20
+ else()
21
+ add_compile_definitions(${opt}=0)
22
+ endif()
23
+ endforeach()
@@ -0,0 +1,171 @@
1
+ if(MSVC)
2
+ list(APPEND WYVRN_COMPILER_FLAGS
3
+ /W3
4
+ /sdl
5
+ /permissive-
6
+ /EHsc
7
+ )
8
+ else()
9
+ list(APPEND WYVRN_COMPILER_FLAGS
10
+ -Wall
11
+ -Wextra
12
+ )
13
+ endif()
14
+
15
+ option(WYVRN_UNICODE "Enable Unicode character set (_UNICODE, UNICODE)" ON)
16
+ if(WYVRN_UNICODE)
17
+ add_compile_definitions(_UNICODE UNICODE)
18
+ endif()
19
+
20
+ # MSVC runtime library is controlled by CMAKE_MSVC_RUNTIME_LIBRARY (CMP0091),
21
+ # which the wyvrnpm toolchain sets from the active build profile
22
+ # (compiler.runtime=dynamic|static). CMake emits the correct /MD[d] or /MT[d]
23
+ # automatically; appending the flag here would duplicate or conflict when the
24
+ # profile requests a different runtime than the old default of /MD.
25
+
26
+ SET(VENDOR_DIR ${PROJECT_SOURCE_DIR}/vendors)
27
+
28
+ # ── Platform detection ────────────────────────────────────────────────────────
29
+ # Leaf platforms (set exactly one primary leaf; SteamOS is an overlay on Linux)
30
+ #
31
+ # WYVRN_PLATFORM_WINDOWS – desktop Windows (Win32/Win64)
32
+ # WYVRN_PLATFORM_XBOX – Xbox GDK / XDK (pass -DWYVRN_XBOX=ON)
33
+ # WYVRN_PLATFORM_PS4 – PlayStation 4 (CMAKE_SYSTEM_NAME == ORBIS)
34
+ # WYVRN_PLATFORM_PS5 – PlayStation 5 (CMAKE_SYSTEM_NAME == Prospero)
35
+ # WYVRN_PLATFORM_LINUX – generic Linux
36
+ # WYVRN_PLATFORM_STEAMOS – SteamOS (overlay; set alongside LINUX)
37
+ # WYVRN_PLATFORM_ANDROID – Android NDK
38
+ # WYVRN_PLATFORM_MACOS – macOS
39
+ # WYVRN_PLATFORM_IOS – iOS / iPadOS
40
+
41
+ # -- Initialise all leaf variables to FALSE --
42
+ set(WYVRN_PLATFORM_WINDOWS FALSE)
43
+ set(WYVRN_PLATFORM_XBOX FALSE)
44
+ set(WYVRN_PLATFORM_PS4 FALSE)
45
+ set(WYVRN_PLATFORM_PS5 FALSE)
46
+ set(WYVRN_PLATFORM_LINUX FALSE)
47
+ set(WYVRN_PLATFORM_STEAMOS FALSE)
48
+ set(WYVRN_PLATFORM_ANDROID FALSE)
49
+ set(WYVRN_PLATFORM_MACOS FALSE)
50
+ set(WYVRN_PLATFORM_IOS FALSE)
51
+
52
+ # -- Detect leaf --
53
+ if(CMAKE_SYSTEM_NAME STREQUAL "ORBIS")
54
+ set(WYVRN_PLATFORM_PS4 TRUE)
55
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Prospero")
56
+ set(WYVRN_PLATFORM_PS5 TRUE)
57
+ elseif(WIN32)
58
+ if(WYVRN_XBOX OR CHROMA_XBOX)
59
+ set(WYVRN_PLATFORM_XBOX TRUE)
60
+ else()
61
+ set(WYVRN_PLATFORM_WINDOWS TRUE)
62
+ endif()
63
+ elseif(ANDROID)
64
+ set(WYVRN_PLATFORM_ANDROID TRUE)
65
+ elseif(APPLE)
66
+ if(IOS)
67
+ set(WYVRN_PLATFORM_IOS TRUE)
68
+ else()
69
+ set(WYVRN_PLATFORM_MACOS TRUE)
70
+ endif()
71
+ elseif(UNIX)
72
+ set(WYVRN_PLATFORM_LINUX TRUE)
73
+ if(WYVRN_STEAMOS)
74
+ set(WYVRN_PLATFORM_STEAMOS TRUE)
75
+ endif()
76
+ endif()
77
+
78
+ # -- Derived family tier --
79
+ if(WYVRN_PLATFORM_WINDOWS OR WYVRN_PLATFORM_XBOX)
80
+ set(WYVRN_PLATFORM_MICROSOFT TRUE)
81
+ else()
82
+ set(WYVRN_PLATFORM_MICROSOFT FALSE)
83
+ endif()
84
+
85
+ if(WYVRN_PLATFORM_MACOS OR WYVRN_PLATFORM_IOS)
86
+ set(WYVRN_PLATFORM_DARWIN TRUE)
87
+ else()
88
+ set(WYVRN_PLATFORM_DARWIN FALSE)
89
+ endif()
90
+
91
+ if(WYVRN_PLATFORM_PS4 OR WYVRN_PLATFORM_PS5)
92
+ set(WYVRN_PLATFORM_PLAYSTATION TRUE)
93
+ else()
94
+ set(WYVRN_PLATFORM_PLAYSTATION FALSE)
95
+ endif()
96
+
97
+ if(WYVRN_PLATFORM_LINUX OR WYVRN_PLATFORM_ANDROID OR WYVRN_PLATFORM_DARWIN OR WYVRN_PLATFORM_PLAYSTATION)
98
+ set(WYVRN_PLATFORM_UNIX TRUE)
99
+ else()
100
+ set(WYVRN_PLATFORM_UNIX FALSE)
101
+ endif()
102
+
103
+ # -- Derived broad grouping tier --
104
+ if(WYVRN_PLATFORM_WINDOWS OR WYVRN_PLATFORM_MACOS OR WYVRN_PLATFORM_LINUX)
105
+ set(WYVRN_PLATFORM_DESKTOP TRUE)
106
+ else()
107
+ set(WYVRN_PLATFORM_DESKTOP FALSE)
108
+ endif()
109
+
110
+ if(WYVRN_PLATFORM_ANDROID OR WYVRN_PLATFORM_IOS)
111
+ set(WYVRN_PLATFORM_MOBILE TRUE)
112
+ else()
113
+ set(WYVRN_PLATFORM_MOBILE FALSE)
114
+ endif()
115
+
116
+ if(WYVRN_PLATFORM_XBOX OR WYVRN_PLATFORM_PLAYSTATION)
117
+ set(WYVRN_PLATFORM_CONSOLE TRUE)
118
+ else()
119
+ set(WYVRN_PLATFORM_CONSOLE FALSE)
120
+ endif()
121
+
122
+ # -- Emit WYVRN_PLATFORM_* compile definitions (value = 1) --
123
+ foreach(_plat
124
+ WINDOWS XBOX PS4 PS5 LINUX STEAMOS ANDROID MACOS IOS
125
+ MICROSOFT DARWIN PLAYSTATION UNIX
126
+ DESKTOP MOBILE CONSOLE)
127
+ if(WYVRN_PLATFORM_${_plat})
128
+ add_compile_definitions(WYVRN_PLATFORM_${_plat}=1)
129
+ endif()
130
+ endforeach()
131
+
132
+ # -- Backward-compat CHROMA_* CMake variables and compile definitions --
133
+ set(CHROMA_WINDOWS ${WYVRN_PLATFORM_WINDOWS})
134
+ set(CHROMA_XBOX ${WYVRN_PLATFORM_XBOX})
135
+ set(CHROMA_LINUX ${WYVRN_PLATFORM_LINUX})
136
+ set(CHROMA_ANDROID ${WYVRN_PLATFORM_ANDROID})
137
+ set(CHROMA_MACOS ${WYVRN_PLATFORM_MACOS})
138
+ set(CHROMA_IOS ${WYVRN_PLATFORM_IOS})
139
+
140
+ foreach(_plat WINDOWS XBOX LINUX ANDROID MACOS IOS)
141
+ if(WYVRN_PLATFORM_${_plat})
142
+ add_compile_definitions(CHROMA_${_plat}=1)
143
+ endif()
144
+ endforeach()
145
+
146
+ # Status
147
+ message(STATUS "Platform leaf : WINDOWS=${WYVRN_PLATFORM_WINDOWS} XBOX=${WYVRN_PLATFORM_XBOX} PS4=${WYVRN_PLATFORM_PS4} PS5=${WYVRN_PLATFORM_PS5} LINUX=${WYVRN_PLATFORM_LINUX} STEAMOS=${WYVRN_PLATFORM_STEAMOS} ANDROID=${WYVRN_PLATFORM_ANDROID} MACOS=${WYVRN_PLATFORM_MACOS} IOS=${WYVRN_PLATFORM_IOS}")
148
+ message(STATUS "Platform family: MICROSOFT=${WYVRN_PLATFORM_MICROSOFT} DARWIN=${WYVRN_PLATFORM_DARWIN} PLAYSTATION=${WYVRN_PLATFORM_PLAYSTATION} UNIX=${WYVRN_PLATFORM_UNIX}")
149
+ message(STATUS "Platform broad : DESKTOP=${WYVRN_PLATFORM_DESKTOP} MOBILE=${WYVRN_PLATFORM_MOBILE} CONSOLE=${WYVRN_PLATFORM_CONSOLE}")
150
+
151
+ # Arch
152
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
153
+ message(STATUS "Building for x64 (64-bit)")
154
+ add_definitions(-DWYVRN_64)
155
+ set(WYVRN_64 TRUE)
156
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
157
+ message(STATUS "Building for x86 (32-bit)")
158
+ add_definitions(-DWYVRN_32)
159
+ set(WYVRN_32 TRUE)
160
+ else()
161
+ message(STATUS "Unknown architecture")
162
+ endif()
163
+
164
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/output/lib/")
165
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/output/lib/")
166
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/output/bin")
167
+
168
+ add_compile_definitions(
169
+ $<$<CONFIG:Debug>:WYVRN_DEBUG>
170
+ $<$<CONFIG:Release>:WYVRN_RELEASE>
171
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyvrnpm",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "A simple, static-hosting-compatible C++ package manager",
5
5
  "keywords": [
6
6
  "c++",
@@ -19,6 +19,7 @@
19
19
  "files": [
20
20
  "bin/",
21
21
  "src/",
22
+ "cmake/",
22
23
  "README.md"
23
24
  ],
24
25
  "scripts": {