Add opt-in native Modern UI foundation and first desktop flow (by Codex)

This commit is contained in:
Codex committed 2026-10-23 18:51:02 +02:00
1 parent a4a37f1cb2
commit 11a6356c1e
42 files changed
+5333 -9

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-3.0-only
add_library(bmh_modern_ui_core STATIC catalog.cpp model.cpp gui_assets.cpp desktop.cpp)
target_include_directories(bmh_modern_ui_core PUBLIC ../..)
target_link_libraries(bmh_modern_ui_core PUBLIC bmh_asset_io)
add_library(bmh_modern_ui STATIC view.cpp ticket_popover.cpp)
target_link_libraries(bmh_modern_ui PUBLIC bmh_modern_ui_core PRIVATE bmh_rmlui bmh_launcher nfd::nfd ${BMH_SDL_TARGET})
if(MSVC)
target_compile_options(bmh_modern_ui_core PRIVATE /W4 /utf-8)
target_compile_options(bmh_modern_ui PRIVATE /W4 /utf-8)
else()
target_compile_options(bmh_modern_ui_core PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(bmh_modern_ui PRIVATE -Wall -Wextra -Wpedantic)
endif()
set(modern_assets "${CMAKE_BINARY_DIR}/assets/modern")
FetchContent_GetProperties(rmlui)
file(MAKE_DIRECTORY "${modern_assets}")
foreach(asset modern.rml theme.rcss ticket.rcss)
configure_file("${CMAKE_SOURCE_DIR}/assets/modern/${asset}" "${modern_assets}/${asset}" COPYONLY)
endforeach()
file(COPY "${CMAKE_SOURCE_DIR}/assets/modern/icons" DESTINATION "${modern_assets}")
foreach(weight Regular Bold)
configure_file("${rmlui_SOURCE_DIR}/Samples/assets/LatoLatin-${weight}.ttf"
"${modern_assets}/LatoLatin-${weight}.ttf" COPYONLY)
endforeach()
set(BMH_MODERN_GUI_ASSETS "" CACHE PATH "Optional externally supplied Modern GUI resource directory")
if(BMH_MODERN_GUI_ASSETS)
if(NOT EXISTS "${BMH_MODERN_GUI_ASSETS}/gui-assets.json")
message(FATAL_ERROR "BMH_MODERN_GUI_ASSETS does not contain gui-assets.json")
endif()
file(COPY "${BMH_MODERN_GUI_ASSETS}/" DESTINATION "${modern_assets}/gui")
endif()
install(DIRECTORY "${modern_assets}/" DESTINATION assets/modern COMPONENT Runtime)
add_executable(modern_ui_core_tests ../../../tests/modern_ui_core_tests.cpp)
target_link_libraries(modern_ui_core_tests PRIVATE bmh_modern_ui_core)
if(MSVC)
target_compile_options(modern_ui_core_tests PRIVATE /utf-8)
endif()
add_test(NAME modern_ui_core_tests COMMAND modern_ui_core_tests)
add_executable(modern_ticket_document_tests ../../../tests/modern_ticket_document_tests.cpp ticket_popover.cpp)
target_link_libraries(modern_ticket_document_tests PRIVATE bmh_modern_ui_core RmlUi::Core)
if(MSVC)
target_compile_options(modern_ticket_document_tests PRIVATE /utf-8)
endif()
foreach(theme midnight silver matchday)
add_test(NAME modern_ticket_${theme} COMMAND modern_ticket_document_tests "${modern_assets}" ${theme})
endforeach()