58 lines
3.0 KiB
CMake
58 lines
3.0 KiB
CMake
# 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 /bigobj)
|
|
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(GLOB modern_icons CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/assets/modern/icons/*.svg")
|
|
file(MAKE_DIRECTORY "${modern_assets}/icons")
|
|
foreach(icon ${modern_icons})
|
|
get_filename_component(icon_name "${icon}" NAME)
|
|
configure_file("${icon}" "${modern_assets}/icons/${icon_name}" COPYONLY)
|
|
endforeach()
|
|
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()
|
|
add_executable(modern_control_layout_tests ../../../tests/modern_control_layout_tests.cpp)
|
|
target_link_libraries(modern_control_layout_tests PRIVATE bmh_modern_ui_core RmlUi::Core)
|
|
if(MSVC)
|
|
target_compile_options(modern_control_layout_tests PRIVATE /utf-8)
|
|
endif()
|
|
add_test(NAME modern_control_layout_tests COMMAND modern_control_layout_tests "${modern_assets}")
|