2021-04-07 17:36:03 +02:00
|
|
|
cmake_minimum_required(VERSION 3.1.0) # Threads::Threads is needed
|
2021-02-18 22:25:36 +01:00
|
|
|
|
|
|
|
project(fastfetch)
|
|
|
|
|
2021-03-07 20:05:00 +01:00
|
|
|
option(BUILD_TESTS "Build test programs" OFF)
|
|
|
|
|
2021-02-22 20:36:25 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-list --count HEAD
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE GIT_REV_LIST
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE GIT_REV_PARSE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PROJECT_VERSION "r${GIT_REV_LIST}.${GIT_REV_PARSE}")
|
|
|
|
|
2021-04-25 11:48:25 +02:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O3")
|
2021-04-09 14:07:05 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-O3")
|
2021-04-07 17:36:03 +02:00
|
|
|
|
2021-03-07 20:05:00 +01:00
|
|
|
if(BUILD_TESTS)
|
2021-04-09 14:07:05 +02:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native -pipe -fno-plt -Wconversion -Wpedantic")
|
2021-03-07 20:05:00 +01:00
|
|
|
endif(BUILD_TESTS)
|
2021-02-22 17:14:46 +01:00
|
|
|
|
2021-02-22 20:36:25 +01:00
|
|
|
configure_file(src/fastfetch_config.h.in fastfetch_config.h)
|
2021-03-06 11:28:38 +01:00
|
|
|
|
2021-04-07 17:36:03 +02:00
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
find_package (PkgConfig)
|
2021-04-05 23:42:07 +02:00
|
|
|
|
|
|
|
if(${PkgConfig_FOUND})
|
2021-04-07 17:36:03 +02:00
|
|
|
pkg_check_modules (GLIB2 glib-2.0)
|
2021-04-05 23:42:07 +02:00
|
|
|
endif(${PkgConfig_FOUND})
|
|
|
|
|
|
|
|
if(NOT DEFINED GLIB2_INCLUDE_DIRS)
|
|
|
|
set(GLIB2_INCLUDE_DIRS
|
|
|
|
/usr/include/glib-2.0/
|
|
|
|
/usr/lib/glib-2.0/include/
|
|
|
|
)
|
|
|
|
endif(NOT DEFINED GLIB2_INCLUDE_DIRS)
|
|
|
|
|
2021-02-27 16:40:05 +01:00
|
|
|
include_directories(
|
|
|
|
${PROJECT_BINARY_DIR}
|
|
|
|
${PROJECT_SOURCE_DIR}/src
|
2021-04-05 23:42:07 +02:00
|
|
|
${GLIB2_INCLUDE_DIRS}
|
2021-02-27 16:40:05 +01:00
|
|
|
)
|
2021-02-22 20:36:25 +01:00
|
|
|
|
2021-04-09 14:07:05 +02:00
|
|
|
link_libraries(
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
Threads::Threads
|
|
|
|
)
|
|
|
|
|
2021-02-27 18:30:05 +01:00
|
|
|
set(SRCS
|
2021-03-19 20:57:07 +01:00
|
|
|
src/util/FFstrbuf.c
|
2021-04-24 13:05:43 +02:00
|
|
|
src/util/FFlist.c
|
2021-04-09 14:07:05 +02:00
|
|
|
src/common/init.c
|
|
|
|
src/common/threading.c
|
|
|
|
src/common/io.c
|
2021-04-18 15:19:21 +02:00
|
|
|
src/common/processing.c
|
2021-04-09 14:07:05 +02:00
|
|
|
src/common/logo.c
|
|
|
|
src/common/format.c
|
|
|
|
src/common/parsing.c
|
2021-04-22 21:41:42 +02:00
|
|
|
src/common/calculateOS.c
|
2021-04-09 14:07:05 +02:00
|
|
|
src/common/calculatePlasma.c
|
2021-04-22 21:41:42 +02:00
|
|
|
src/common/calculateGTK.c
|
2021-04-09 14:07:05 +02:00
|
|
|
src/common/calculateTerminal.c
|
|
|
|
src/common/calculateWM.c
|
2021-02-27 16:40:05 +01:00
|
|
|
src/modules/break.c
|
2021-02-27 19:22:28 +01:00
|
|
|
src/modules/custom.c
|
2021-02-27 16:40:05 +01:00
|
|
|
src/modules/title.c
|
|
|
|
src/modules/seperator.c
|
|
|
|
src/modules/os.c
|
|
|
|
src/modules/host.c
|
|
|
|
src/modules/kernel.c
|
|
|
|
src/modules/uptime.c
|
|
|
|
src/modules/packages.c
|
|
|
|
src/modules/shell.c
|
|
|
|
src/modules/resolution.c
|
2021-04-16 16:49:33 +02:00
|
|
|
src/modules/resolution_x11.c
|
|
|
|
src/modules/resolution_wayland.c
|
2021-03-19 20:57:07 +01:00
|
|
|
src/modules/de.c
|
2021-03-05 21:38:35 +01:00
|
|
|
src/modules/wm.c
|
2021-04-03 23:10:14 +02:00
|
|
|
src/modules/wmtheme.c
|
2021-02-27 16:40:05 +01:00
|
|
|
src/modules/theme.c
|
|
|
|
src/modules/icons.c
|
|
|
|
src/modules/font.c
|
|
|
|
src/modules/terminal.c
|
2021-03-11 17:21:18 +01:00
|
|
|
src/modules/terminalfont.c
|
2021-02-27 16:40:05 +01:00
|
|
|
src/modules/cpu.c
|
|
|
|
src/modules/gpu.c
|
|
|
|
src/modules/memory.c
|
|
|
|
src/modules/disk.c
|
|
|
|
src/modules/battery.c
|
|
|
|
src/modules/locale.c
|
|
|
|
src/modules/colors.c
|
2021-02-18 22:25:36 +01:00
|
|
|
)
|
|
|
|
|
2021-02-27 18:30:05 +01:00
|
|
|
add_executable(fastfetch
|
|
|
|
src/fastfetch.c
|
2021-03-03 19:59:39 +01:00
|
|
|
src/util/FFvaluestore.c
|
2021-02-27 18:30:05 +01:00
|
|
|
${SRCS}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(flashfetch
|
|
|
|
src/flashfetch.c
|
|
|
|
${SRCS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(flashfetch PUBLIC
|
|
|
|
FASTFETCH_BUILD_FLASHFETCH
|
|
|
|
)
|
|
|
|
|
2021-03-07 20:05:00 +01:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
add_executable(fastfetch-test-performance
|
|
|
|
tests/performance.c
|
|
|
|
${SRCS}
|
|
|
|
)
|
|
|
|
endif(BUILD_TESTS)
|