Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
paleofetch

# create by https://github.com/iamcco/coc-gitignore (Fri Jun 04 2021 13:56:04 GMT-0500 (hora estándar de Perú))
# CMake.gitignore:
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

# CMake.patch:
# External projects
*-prefix/

# create by https://github.com/iamcco/coc-gitignore (Fri Jun 04 2021 13:56:12 GMT-0500 (hora estándar de Perú))
# C++.gitignore:
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

build/
66 changes: 66 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.16.0)

project(paleofetch
VERSION 0.0.0
DESCRIPTION "Neofetch, but written in C"
HOMEPAGE_URL "https://github.com/JaGoLi/paleofetch"
)

# Without this, paths are not relative in the sources list
cmake_policy(SET CMP0076 NEW)

include(GNUInstallDirs)
include(FindPkgConfig)

# The program itself
add_executable(${PROJECT_NAME})

# Distro logo
set(DISTRO_LOGO "arch" CACHE STRING "The logo that will be displayed.")

add_subdirectory(src) # Sources list

# Shared libraries
pkg_check_modules(libs
REQUIRED IMPORTED_TARGET
libpci
x11
)

# Linking
target_link_libraries(${PROJECT_NAME}
PRIVATE
PkgConfig::libs
)

# Battery directory
execute_process(COMMAND
find
-L
/sys/class/power_supply/
-maxdepth 1
-iname "bat*"
-print0

OUTPUT_VARIABLE BATTERY_DIRECTORY
)

target_compile_definitions(${PROJECT_NAME}
PRIVATE
"BATTERY_DIRECTORY=\"${BATTERY_DIRECTORY}\""
)

# Default flags
if(UNIX)
if(NOT (DEFINED ENV{CFLAGS} OR CMAKE_C_FLAGS))
set(CMAKE_C_FLAGS "-Wall -Wextra -g")
endif()
if(NOT (DEFINED ENV{CXXFLAGS} OR CMAKE_CXX_FLAGS))
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g")
endif()
endif()

# Install target
install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions config_scripts/battery_config.sh

This file was deleted.

12 changes: 12 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
target_sources(${PROJECT_NAME}
PRIVATE
paleofetch.c
)

# Fill @DISTRO_LOGO@
configure_file(config.h.in config.h @ONLY)
target_include_directories(${PROJECT_NAME}
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
5 changes: 4 additions & 1 deletion config.h → src/config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "logos/arch.h"
#pragma once

#include "logos/@DISTRO_LOGO@.h"

//define colors
#define BLACK "\e[1;30m"
#define RED "\e[1;31m"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions paleofetch.h → src/paleofetch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* Forward-declare our functions so users can mention them in their
* configs at the top of the file rather than near the bottom. */

#pragma once

static char *get_title(),
*get_bar(),
*get_os(),
Expand Down