@@ -5,22 +5,11 @@ project(fastfetch
55 LANGUAGES C
66)
77
8- # This is used by github actions for release builds
8+ # This is set to off by github actions for release builds
99OPTION (SET_TWEAK "Add tweak to project version" ON )
1010
11- # Track commits between version bumps for output in --version
12- # Ignored by --version-raw and github actions
13- if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR} /.git" )
14- execute_process (
15- COMMAND git describe --tags
16- WORKING_DIRECTORY "${CMAKE_SOURCE_DIR} "
17- OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
18- OUTPUT_STRIP_TRAILING_WHITESPACE
19- )
20- string (REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK} " )
21- endif ()
22-
23- include (GNUInstallDirs)
11+ # Also create test executables
12+ OPTION (BUILD_TESTS "Build tests" OFF )
2413
2514OPTION (ENABLE_LIBPCI "Enable libpci" ON )
2615OPTION (ENABLE_VULKAN "Enable vulkan" ON )
@@ -34,7 +23,17 @@ OPTION(ENABLE_DCONF "Enable dconf" ON)
3423OPTION (ENABLE_DBUS "Enable dbus-1" ON )
3524OPTION (ENABLE_XFCONF "Enable libxfconf-0" ON )
3625OPTION (ENABLE_RPM "Enable rpm" ON )
37- OPTION (BUILD_TESTS "Build tests" ON )
26+
27+ # Track commits between version bumps for output in --version
28+ if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR} /.git" )
29+ execute_process (
30+ COMMAND git describe --tags
31+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR} "
32+ OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
33+ OUTPUT_STRIP_TRAILING_WHITESPACE
34+ )
35+ string (REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK} " )
36+ endif ()
3837
3938if (NOT CMAKE_BUILD_TYPE )
4039 set (CMAKE_BUILD_TYPE Release)
@@ -66,7 +65,7 @@ find_package(Threads REQUIRED)
6665
6766find_package (PkgConfig REQUIRED)
6867
69- # Init CMake targets.
68+ # Init CMake targets
7069
7170add_library (libfastfetch STATIC
7271 src/util/FFstrbuf.c
@@ -278,7 +277,7 @@ target_link_libraries(flashfetch
278277 PRIVATE libfastfetch
279278)
280279
281- # Testing.
280+ # Testing
282281
283282if (BUILD_TESTS)
284283 add_executable (fastfetch-test -performance
@@ -299,7 +298,9 @@ if (BUILD_TESTS)
299298 add_test (NAME test -strbuf COMMAND fastfetch-test -strbuf)
300299endif ()
301300
302- # Installation.
301+ # Installation
302+
303+ include (GNUInstallDirs)
303304
304305install (
305306 TARGETS fastfetch
@@ -321,3 +322,33 @@ install(
321322 FILES ./LICENSE
322323 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /licenses/${CMAKE_PROJECT_NAME}
323324)
325+
326+ # Packaging
327+
328+ set (CPACK_GENERATOR "DEB;RPM;TZST" )
329+
330+ set (CPACK_PACKAGE_CONTACT
"Linus Dierheimer <[email protected] >" )
331+ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Neofetch clone written in C" )
332+ set (CPACK_PACKAGE_DESCRIPTION "
333+ fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way.
334+ It is written in c to achieve much better performance.
335+ " )
336+ set (CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/LinusDierheimer" )
337+
338+ set (CPACK_DEBIAN_PACKAGE_SECTION, "utils" )
339+ set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
340+ set (CPACK_DEBIAN_PACKAGE_RECOMMENDS "
341+ libpci3
342+ libvulkan1
343+ libwayland-client0
344+ libxcb-randr0
345+ xcb
346+ libxrandr2
347+ libx11-6
348+ libdconf1
349+ libglib2.0-0
350+ libdbus-1-3
351+ libxfconf-0-3
352+ " )
353+
354+ include (CPack)
0 commit comments