From 16d6aa1d19415ee4a782baea143c71a9a1bbe02d Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 16 Jul 2024 13:23:18 +0200 Subject: res: automatically export UI files --- .gitlab-ci.yml | 2 +- CMakeLists.txt | 3 +- Containerfile.ci | 11 ++++- README.md | 1 + cmake/Modules/Cambalache.cmake | 28 +++++++++++++ res/.gitignore | 1 + res/CMakeLists.txt | 11 +++-- res/widgets/participant_row.ui | 86 --------------------------------------- res/widgets/turn_order_view.ui | 24 ----------- res/windows/main.ui | 81 ------------------------------------ res/windows/participant_editor.ui | 73 --------------------------------- 11 files changed, 50 insertions(+), 271 deletions(-) create mode 100644 cmake/Modules/Cambalache.cmake create mode 100644 res/.gitignore delete mode 100644 res/widgets/participant_row.ui delete mode 100644 res/widgets/turn_order_view.ui delete mode 100644 res/windows/main.ui delete mode 100644 res/windows/participant_editor.ui diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4aaede..1132bb7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ default: - image: registry.source.arknet.ch/fmorgner/turns/ci:1.1.0 + image: registry.source.arknet.ch/fmorgner/turns/ci:latest build: stage: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b9015..3ccf083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ enable_testing() list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules") +include("Cambalache") include("CheckIPOSupported") include("GlibCompileResources") include("GNUInstallDirs") @@ -23,7 +24,7 @@ check_ipo_supported(RESULT CAN_DO_IPO LANGUAGES CXX) set(CMAKE_CXX_STANDARD "23") set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${CAN_DO_IPO}) +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${CAN_DO_IPO}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") diff --git a/Containerfile.ci b/Containerfile.ci index eab8e5f..59a07f3 100644 --- a/Containerfile.ci +++ b/Containerfile.ci @@ -20,9 +20,16 @@ RUN pacman-key --init \ 'pkgconf' \ 'weston' \ && locale-gen \ - && yes | pacman -Sccdd \ && useradd -m builduser \ - && echo 'builduser ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + && echo 'builduser ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \ + && mkdir aur && chown builduser: aur \ + && cd aur \ + && sudo -u builduser git clone 'https://aur.archlinux.org/cambalache.git' \ + && cd cambalache \ + && sudo -u builduser makepkg -irs --noconfirm --noprogressbar --needed \ + && cd ../.. \ + && rm -rf aur \ + && yes | pacman -Sccdd ENV XDG_RUNTIME_DIR=/tmp \ WAYLAND_DISPLAY=wl-test-env diff --git a/README.md b/README.md index aff531b..5a64781 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ bookie depends on the following libraries: - `libadwaita` >= 1.5 and tools: + - `cambalache` >= 0.90.4 - `cmake` >= 3.29 - `gcc` >= 14.1 - `ninja` >= 1.11 diff --git a/cmake/Modules/Cambalache.cmake b/cmake/Modules/Cambalache.cmake new file mode 100644 index 0000000..8f83375 --- /dev/null +++ b/cmake/Modules/Cambalache.cmake @@ -0,0 +1,28 @@ +find_program(CAMBALACHE_BIN "cambalache" REQUIRED) + +function(export_cambalache_files SOURCE_FILE) + set(SINGLE_VALUE_ARGS "") + set(MULTI_VALUE_ARGS "UI_FILES") + cmake_parse_arguments( + PARSE_ARGV 1 + "" + "${OPTIONS}" + "${SINGLE_VALUE_ARGS}" + "${MULTI_VALUE_ARGS}" + ) + + foreach(FILE IN LISTS _UI_FILES) + list(APPEND ABSOULUTE_UI_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}") + endforeach() + + add_custom_command(OUTPUT + ${ABSOULUTE_UI_FILES} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND "${CAMBALACHE_BIN}" + ARGS + "-E" + "${SOURCE_FILE}" + VERBATIM + MAIN_DEPENDENCY "${SOURCE_FILE}" + ) +endfunction() \ No newline at end of file diff --git a/res/.gitignore b/res/.gitignore new file mode 100644 index 0000000..25284c2 --- /dev/null +++ b/res/.gitignore @@ -0,0 +1 @@ +*.ui \ No newline at end of file diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index fda52b8..325c584 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -2,13 +2,18 @@ add_library("res") -target_add_glib_resources("res" - PREFIX "ch/arknet/Turns" - UI_FILES +set(UI_FILES "widgets/participant_row.ui" "widgets/turn_order_view.ui" "windows/main.ui" "windows/participant_editor.ui" +) + +export_cambalache_files("ui.cmb" UI_FILES ${UI_FILES}) + +target_add_glib_resources("res" + PREFIX "ch/arknet/Turns" + UI_FILES ${UI_FILES} CSS_FILES "style.css" "style-dark.css" diff --git a/res/widgets/participant_row.ui b/res/widgets/participant_row.ui deleted file mode 100644 index 7948eab..0000000 --- a/res/widgets/participant_row.ui +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - diff --git a/res/widgets/turn_order_view.ui b/res/widgets/turn_order_view.ui deleted file mode 100644 index d00c3c8..0000000 --- a/res/widgets/turn_order_view.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/res/windows/main.ui b/res/windows/main.ui deleted file mode 100644 index e01c8d1..0000000 --- a/res/windows/main.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - crossfade - - - - - win.add_participant - center - Add participant - - - - contact-new-symbolic - - - - - - - - - No active turn order - Turns - - - - - open-menu - main_menu - Main Menu - - - - - win.add_participant - contact-new - Add participant - - - - - win.start - media-playback-start-symbolic - Start turn order - - - - - - - - True - Finish - - - - - - - - - - - - - True - - -- cgit v1.2.3