Skip to content

Commit

Permalink
Merge pull request #809 from adriaandegroot/master
Browse files Browse the repository at this point in the history
Draft: CMake-ify the build
  • Loading branch information
q5sys authored Aug 23, 2022
2 parents 86d0e6f + 78f7924 commit 8967f02
Show file tree
Hide file tree
Showing 21 changed files with 571 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ src-qt5/desktop-utils/lumina-archiver/lumina-archiver
src-qt5/desktop-utils/lumina-calculator/lumina-calculator
src-qt5/desktop-utils/lumina-pdf/lumina-pdf
src-qt5/desktop-utils/lumina-notify/lumina-notify
src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/
src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/Makefile
src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/liblthemeengine.so
src-qt5/core/lumina-theme-engine/src/lthemeengine-sstest/Makefile
Expand All @@ -58,3 +57,6 @@ icon-theme/*/Makefile
./Makefile
src-qt5/src-qml/test/*
src-qt5/desktop-utils/lumina-pdf/fontconfig/*

# CMake-build parts
src-qt5/core/build/
45 changes: 45 additions & 0 deletions icon-theme/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# lumina-core/icon-themes build, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>

include(CMakeParseArguments)

# Installs files for a theme. The theme must have a NAME.
# Files are globbed from SUBDIRS, which are assumed to contain
# only SVGs. Those files are installed to corresponding TARGET_SUBDIR/SUBDIRS
# in the destination. TARGET_SUBDIR is optional (some themes are scalable/,
# some aren't). Files listed explicitly in TOPLEVEL are installed at the
# top-level of the theme.
function(install_theme)
set(options "") # None
set(oneValueArgs NAME TARGET_SUBDIR)
set(multiValueArgs TOPLEVEL SUBDIRS)

cmake_parse_arguments(
THEME
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN}
)

if(NOT THEME_NAME)
message(FATAL_ERROR "Missing theme name")
endif()

set(target_directory "${CMAKE_INSTALL_DATADIR}/icons/${THEME_NAME}")

install(FILES ${THEME_TOPLEVEL} DESTINATION ${target_directory})
foreach(d ${THEME_SUBDIRS})
file(GLOB_RECURSE files "${d}/*.svg")
install(
FILES ${files}
DESTINATION ${target_directory}/${THEME_TARGET_SUBDIR}/${d}
)
endforeach()
endfunction()

add_subdirectory(lumina-icons)
add_subdirectory(material-design-light)
add_subdirectory(material-design-dark)
16 changes: 16 additions & 0 deletions icon-theme/lumina-icons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# lumina-icons installation, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>

# This is assumed to be used from inside the icon-theme/CMakeLists,
# which in turn is part of the lumina-core build -- even though
# the source-repository layout doesn't suggest that is the case.

install_theme(
NAME "lumina-icons"
TOPLEVEL
"index.theme"
SUBDIRS
"actions/symbolic"
)
27 changes: 27 additions & 0 deletions icon-theme/material-design-dark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Theme installation, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>

# This is assumed to be used from inside the icon-theme/CMakeLists,
# which in turn is part of the lumina-core build -- even though
# the source-repository layout doesn't suggest that is the case.

install_theme(
NAME "material-design-light"
TARGET_SUBDIR "scalable"
TOPLEVEL
"index.theme"
"LICENSE"
SUBDIRS
actions
applications
categories
devices
emblems
emotes
international
mimetypes
places
status
)
27 changes: 27 additions & 0 deletions icon-theme/material-design-light/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Theme installation, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>

# This is assumed to be used from inside the icon-theme/CMakeLists,
# which in turn is part of the lumina-core build -- even though
# the source-repository layout doesn't suggest that is the case.

install_theme(
NAME "material-design-dark"
TARGET_SUBDIR "scalable"
TOPLEVEL
"index.theme"
"LICENSE"
SUBDIRS
actions
applications
categories
devices
emblems
emotes
international
mimetypes
places
status
)
128 changes: 128 additions & 0 deletions src-qt5/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# lumina-core build, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
project(lumina-core VERSION 1.6.2 LANGUAGES C CXX) # TODO: inherit this from top-level

# CMake Settings (policies to do AUTOMOC as much as possible)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0071 NEW)
include(GNUInstallDirs)

# C++ Settings (pretend everything is modern)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# ECM setup
include(FeatureSummary)
find_package(ECM 5.88.0 NO_MODULE)
set_package_properties(
ECM
PROPERTIES
TYPE REQUIRED
DESCRIPTION "Extra CMake Modules."
URL "https://commits.kde.org/extra-cmake-modules"
)
feature_summary(
WHAT REQUIRED_PACKAGES_NOT_FOUND
FATAL_ON_MISSING_REQUIRED_PACKAGES
)

set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

# Dependencies
set(QT_VERSION 5.15.0)
find_package(
Qt5
${QT_VERSION}
CONFIG
REQUIRED
Concurrent
Core
Gui
Multimedia
MultimediaWidgets
Network
Quick
Qml
Svg
Widgets
X11Extras
)
find_package(X11)
find_package(
XCB
MODULE
COMPONENTS
XCB
KEYSYMS
XKB
XFIXES
AUX
COMPOSITE
DAMAGE
DPMS
EWMH
ICCCM
IMAGE
SCREENSAVER
OPTIONAL_COMPONENTS XTEST
)
if(NOT X11_FOUND OR NOT XCB_XCB_FOUND)
message(FATAL_ERROR "Required XCB component for X11 not found.")
endif()

# OS-detection
#
# This ignores the actual OS and just sets FreeBSD-useful values
add_definitions(
-DL_ETCDIR=QStringLiteral\("${CMAKE_INSTALL_PREFIX}/etc"\)
-DL_SHAREDIR=QStringLiteral\("${CMAKE_INSTALL_PREFIX}/share"\)
)

# Build options
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

# Lumina Components
add_subdirectory(libLumina)
add_subdirectory(lumina-desktop)
add_subdirectory(lumina-session)
add_subdirectory(lumina-open)
add_subdirectory(lumina-info)
add_subdirectory(lumina-pingcursor)
add_subdirectory(lumina-theme-engine)

# Additional files

install(
FILES menu-scripts/README.md menu-scripts/ls.json.sh
DESTINATION ${CMAKE_INSTALL_DATADIR}/lumina-desktop/menu-scripts
)
install(
FILES
themes/DarkGlass.qss.template
themes/Glass.qss.template
themes/Lumina-default.qss.template
themes/None.qss.template
DESTINATION ${CMAKE_INSTALL_DATADIR}/lumina-desktop/themes
)

# This is a typo, also in the original core.pro, should be xtrafiles/theme.cfg
#
#install(
# FILES extrafiles/theme.cfg
# DESTINATION ${CMAKE_INSTALL_DATADIR}/fluxbox/style/lumina-dark/theme.cfg
#)
install(
FILES xtrafiles/globs2
DESTINATION ${CMAKE_INSTALL_DATADIR}/lumina-desktop
)

# The icon theme lives outside of core, but should be
# installed along with it. The icon-themes here is the
# binary-directory to use during the build; there isn't
# much to do there except write Makefiles, since the
# icon themes do nothing but copy files out of the source-tree.
add_subdirectory(../../icon-theme icon-themes)
46 changes: 46 additions & 0 deletions src-qt5/core/libLumina/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# lumina-core/libLumina build, CMake edition. EXPERIMENTAL.
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: Copyright 2022 Adriaan de Groot <[email protected]>
add_library(
libLumina
STATIC
DesktopSettings.cpp
LDesktopUtils.cpp
LFileInfo.cpp
LIconCache.cpp
LInputDevice.cpp
LUtils.cpp
LVideoLabel.cpp
LVideoSurface.cpp
LVideoWidget.cpp
LuminaRandR-X11.cpp
LuminaSingleApplication.cpp
LuminaThemes.cpp
LuminaX11.cpp
LuminaXDG.cpp
ResizeMenu.cpp
XDGMime.cpp
# Header-only classes
ExternalProcess.h
)
if(CMAKE_SYSTEM MATCHES "FreeBSD")
target_sources(libLumina PUBLIC LuminaOS-FreeBSD.cpp)
endif()

target_include_directories(libLumina PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(
libLumina
PUBLIC
Qt5::Concurrent
Qt5::Core
Qt5::MultimediaWidgets
Qt5::Svg
Qt5::Widgets
Qt5::X11Extras
XCB::XCB
XCB::AUX
XCB::DAMAGE
XCB::SCREENSAVER
X11::Xdamage
)
Loading

0 comments on commit 8967f02

Please sign in to comment.