Skip to content

Commit

Permalink
❄️ flake pkg qaterial (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierLDff authored Aug 21, 2024
1 parent 48d9ae0 commit 8157748
Show file tree
Hide file tree
Showing 17 changed files with 326 additions and 50 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 👷 Nix CI

on:
push:
branches:
- main
tags:
- v*
pull_request:
types: [opened, synchronize, labeled]
workflow_dispatch:

jobs:
BuildNixFlake:
runs-on: ubuntu-latest

steps:
-
uses: naostage/nix-installer-action@10f43c0d327c8599928f907a943a737cff2505f3
-
uses: naostage/magic-nix-cache-action@1718a05c5e2bf6ac5d9b1b0ebd5fca6eaef2b923
with:
use-flakehub: false
-
uses: actions/checkout@v4
-
name: 🔨 Build Qaterial
run: |
nix build .#qaterial --print-build-logs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ CMakeLists.txt.user

# CPM cache
.cpm

# nix files
result*
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ set(QATERIAL_ICONS "*.svg" CACHE STRING "Filter embedded icons")
set(QATERIAL_ENABLE_ROBOTO ON CACHE BOOL "Embed to qrc Roboto Regular & Medium")
set(QATERIAL_ENABLE_ROBOTOMONO ON CACHE BOOL "Embed to qrc RobotoMono Regular")
set(QATERIAL_ENABLE_LATO ON CACHE BOOL "Embed to qrc Lato Regular")
set(QATERIAL_FONTS_DIRS "" CACHE STRING "Additional where the library has to look")
# The goal here is to leave source dir untouched from configure/build stage
# This stays as an option if legacy behavior is desired (for example to do hot reload of qml)
set(QATERIAL_ENABLE_GEN_QMLDIR_BINARY_DIR ON CACHE BOOL "Generate `qmldir` file in binary folder instead of source folder")
Expand Down Expand Up @@ -85,6 +86,7 @@ if(QATERIAL_VERBOSE)
message(STATUS "QATERIAL_ENABLE_ROBOTO : ${QATERIAL_ENABLE_ROBOTO}")
message(STATUS "QATERIAL_ENABLE_ROBOTOMONO : ${QATERIAL_ENABLE_ROBOTOMONO}")
message(STATUS "QATERIAL_ENABLE_LATO : ${QATERIAL_ENABLE_LATO}")
message(STATUS "QATERIAL_FONTS_DIRS : ${QATERIAL_FONTS_DIRS}")

message(STATUS "QATERIAL_ENABLE_GEN_QMLDIR_BINARY_DIR: ${QATERIAL_ENABLE_GEN_QMLDIR_BINARY_DIR}")

Expand Down Expand Up @@ -237,11 +239,6 @@ endif()

# Correctly link to static qt
get_target_property(QT_TARGET_TYPE Qt::Core TYPE)
if(NOT QATERIAL_ENABLE_INSTALL AND ${QT_TARGET_TYPE} STREQUAL "STATIC_LIBRARY")
include(${PROJECT_SOURCE_DIR}/cmake/FetchQtStaticCMake.cmake)
qt_generate_qml_plugin_import(${QATERIAL_TARGET} QML_SRC ${CMAKE_CURRENT_SOURCE_DIR}/qml)
qt_generate_plugin_import(${QATERIAL_TARGET})
endif()

list(APPEND QML_IMPORTPATH "${CMAKE_CURRENT_SOURCE_DIR}/qml")
list(APPEND QML_IMPORTPATH ${QML_IMPORT_PATH})
Expand All @@ -256,6 +253,10 @@ if(MSVC)
target_compile_options(${QATERIAL_TARGET} PUBLIC -bigobj)
endif()

if(NOT "${QATERIAL_FONTS_DIRS}" STREQUAL "")
target_compile_definitions(${QATERIAL_TARGET} PRIVATE -DQATERIAL_FONTS_DIRS="${QATERIAL_FONTS_DIRS}")
endif()

# ───── QATERIAL TESTS ─────

if(QATERIAL_ENABLE_TESTS)
Expand Down Expand Up @@ -294,7 +295,10 @@ if (QATERIAL_ENABLE_INSTALL)
NAMESPACE ${QATERIAL_TARGET}::
)

configure_file(cmake/${QATERIAL_TARGET}Config.cmake.in
if(QATERIAL_BUILD_SHARED)
set(SUFFIX_CMAKE_SHARED "Shared")
endif()
configure_file(cmake/${QATERIAL_TARGET}Config${SUFFIX_CMAKE_SHARED}.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${QATERIAL_TARGET}/${QATERIAL_TARGET}Config.cmake"
@ONLY
)
Expand Down
9 changes: 9 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(MDI_REPOSITORY
"https://github.com/OlivierLDff/MaterialDesignSvgo"
CACHE STRING "Repository of Qaterial"
)
set(MDI_TAG
# hash: sha256-Y3+7fnvP2Ye/2jUm7KyMiH+XTjSvwUC0VIJy2vo2xYg=
"113d3f3cfa20a00f1103d4361e00945815316840"
CACHE STRING "Git Tag of Mdi"
)
5 changes: 3 additions & 2 deletions cmake/FetchMaterialDesignIcons.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
# ~~~

include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Dependencies.cmake)

CPMAddPackage(
NAME MaterialDesignIcons
GIT_REPOSITORY "https://github.com/OlivierLDff/MaterialDesignSvgo"
GIT_TAG "7cc6cc10a0a77d2b23dced9247bd73850f57dc29"
GIT_REPOSITORY ${MDI_REPOSITORY}
GIT_TAG ${MDI_TAG}
)

set(MATERIALDESIGNICONS_ICONS_DIR "${MaterialDesignIcons_SOURCE_DIR}/svg")
17 changes: 0 additions & 17 deletions cmake/FetchQaterial.cmake

This file was deleted.

17 changes: 0 additions & 17 deletions cmake/FetchQtStaticCMake.cmake

This file was deleted.

14 changes: 14 additions & 0 deletions cmake/QaterialConfigShared.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
find_package(Qt6 COMPONENTS
Core
Gui
Qml
Quick
QuickControls2
Svg
Xml
Core5Compat
REQUIRED
)
find_package(QOlm REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
46 changes: 45 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8157748

Please sign in to comment.