Skip to content

Commit

Permalink
[MIN] ALPHA 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
nots1dd committed Jan 27, 2025
1 parent c3edab2 commit 9f84cd0
Show file tree
Hide file tree
Showing 17 changed files with 415 additions and 237 deletions.
29 changes: 20 additions & 9 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,32 @@ This target runs the initialization script (`init.sh`).

---

### 12. **global_build**
### 12. **build-global**
This target builds and installs the project globally.

- **Command**:
```sh
make global_build
make build-global
```
- **Description**:
- This will configure the build with a `BUILD_GLOBAL` flag and install the project using `ninja` after the build completes.
- Useful for installing the project globally for system-wide usage.
- Just runs sudo make install after building for target local release (adds inLimbo.desktop and icon to system wide directories)

---

### 12. **build-global-uninstall**
This target uninstalls every system wide installed file of inLimbo using `install_manifests.txt` in build directory.

- **Command**:
```sh
make build-global-uninstall
```

> [!NOTE]
>
> If you remove `build/` directory, the `install_manifests.txt` will not exist so this wont work
>
> Will come with a workaround in the future
>
---

Expand Down Expand Up @@ -226,8 +242,3 @@ make -j
./run_webassembly.py # assuming the compilation has no errors
# This will run in port 8000
```

> [!NOTE]
>
> Debug building using make needs to be setup, will be available soon. (it may not work using make currently)
>
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,3 +883,38 @@ Sizeable commit, a lot of bugs resolved which is great, still hoping for better
- Centering of the image_view (NOT THAT BIG)

---

## [ALPHA 2.7] --- 27-01-2025

### Added
**NIL**

### Changed
- Overall version bump to 2.7

- Added `build-global`, `build-global-uninstall` to makefile

- Subsequent makefile, readme and build file changes

- CMakeLists.txt now posts a very neat verbose output of the build configuration it will undergo (useful for debugging)

- Moved `PlayingState` struct definition outside of `ui_handler` header

- Overall code formatting and minor fixes

### Fixed
- Debug builds for ASan and TSan using makefile

### Removed
- Removed debounce time for now, seems unnecessary but might add in the future

Small commit with some neat build changes that makes life pretty easy

### Known Issues to fix in immediate commits
- Holding the keybind for PlayNextSong() / PlayPrevSong() doesnt break anything, but MiniAudioPlayer class is not as responsive as the UI, so it lags behind (MAJOR ISSUE)

(The outcome of the above issue would be that if you hold PlayNextSong() func call and it goes to Song A, the MiniAudioPlayer might still be playing Song B, which appears BEFORE Song A)

- Centering of the image_view (NOT THAT BIG)

---
68 changes: 62 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ cmake_minimum_required (VERSION 3.22)

project(inLimbo
LANGUAGES CXX
VERSION 1.0.0
VERSION 2.7
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CONFIG_TOML_FILE "$ENV{HOME}/.config/inLimbo/config.toml")
set(INLIMBO_CACHE_DIR "$ENV{HOME}/.cache/inLimbo")
set(MINIAUDIO_FILE_RELATIVE "src/music/miniaudio.h")
set(CIMG_FILE_RELATIVE "src/ui/components/libs/CImg.h")
set(TOML_FILE_RELATIVE "src/parser/toml.hpp")
set(INLIMBO_DEBUG_BUILD OFF)

enable_testing()

Expand Down Expand Up @@ -42,6 +48,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug-ASan")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug-TSan")
set(EXECUTABLE_NAME "inLimbo-DBG-TSan")
else()
set(CMAKE_BUILD_TYPE "Local Release")
set(EXECUTABLE_NAME "inLimbo")
endif()

Expand All @@ -61,6 +68,7 @@ target_include_directories(${EXECUTABLE_NAME} PRIVATE src)

if(CMAKE_BUILD_TYPE STREQUAL "Debug-ASan")
# Enable AddressSanitizer
set(INLIMBO_DEBUG_BUILD ON)
message(STATUS "Enabling AddressSanitizer for Debug-AddressSanitizer build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
Expand All @@ -76,6 +84,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug-ASan")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")

elseif(CMAKE_BUILD_TYPE STREQUAL "Debug-TSan")
set(INLIMBO_DEBUG_BUILD ON)
# Enable ThreadSanitizer
message(STATUS "Enabling ThreadSanitizer for Debug-ThreadSanitizer build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -g")
Expand Down Expand Up @@ -115,6 +124,7 @@ endif()

# --- Handle Global Build ---------------------------------------------------------
if(DEFINED GLOBAL_BUILD AND GLOBAL_BUILD)
set(CMAKE_BUILD_TYPE "Global")
set(CMAKE_INSTALL_PREFIX "/usr/")
message(STATUS "Starting GLOBAL_BUILD for inLimbo...")

Expand All @@ -126,7 +136,6 @@ if(DEFINED GLOBAL_BUILD AND GLOBAL_BUILD)
else()
# Local build (build in ./build directory)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/build")

message(STATUS "Building locally, binaries will be located in ./build/")
endif()

Expand Down Expand Up @@ -176,18 +185,65 @@ target_link_libraries(${EXECUTABLE_NAME}
)

# --- Ensure the config.toml file is created in the correct directory ---------------------
if (NOT EXISTS "$ENV{HOME}/.config/inLimbo/config.toml")
if (NOT EXISTS ${CONFIG_TOML_FILE})
message(STATUS "Creating config.toml...")
file(MAKE_DIRECTORY "$ENV{HOME}/.config/inLimbo")
configure_file("${CMAKE_SOURCE_DIR}/src/parser/examples/config.toml" "$ENV{HOME}/.config/inLimbo/config.toml" COPYONLY)
configure_file("${CMAKE_SOURCE_DIR}/src/parser/examples/config.toml" ${CONFIG_TOML_FILE} COPYONLY)
endif()
if (NOT EXISTS "$ENV{HOME}/.cache/inLimbo/")
file(MAKE_DIRECTORY "$ENV{HOME}/.cache/inLimbo")
if (NOT EXISTS ${INLIMBO_CACHE_DIR})
file(MAKE_DIRECTORY ${INLIMBO_CACHE_DIR})
endif()

# --- Add Tests Directory Only if INLIMBO_TESTING is Defined ----------------------
if(DEFINED INLIMBO_TESTING AND INLIMBO_TESTING)
set(CMAKE_BUILD_TYPE "Build-Test")
message("--> Enabling TESTING for INLIMBO...")
add_subdirectory(tests)
else()
message("--> TESTING is disabled for INLIMBO.")
endif()

# --- Sanity check for required headers ----
message(STATUS "================== SANITY CHECKS ==========================")
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${MINIAUDIO_FILE_RELATIVE}")
message(FATAL_ERROR "**Miniaudio header not found. File should exist at the expected location: ${MINIAUDIO_FILE_RELATIVE} (Maybe run init.sh?)**")
else()
message(STATUS "Found Miniaudio header...")
endif()

if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${CIMG_FILE_RELATIVE}")
message(FATAL_ERROR "**CImg header not found. File should exist at the expected location: ${CIMG_FILE_RELATIVE} (Maybe run init.sh?)**")
else()
message(STATUS "Found CImg header...")
endif()

if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${TOML_FILE_RELATIVE}")
message(FATAL_ERROR "**TOML++ header not found. File should exist at the expected location: ${TOML_FILE_RELATIVE} (Maybe run init.sh?)**")
else()
message(STATUS "Found TOML++ header...")
endif()
message(STATUS "================== SANITY CHECKS END ========================")

# --- Print Build Configuration ----------------------------------------------------
message(STATUS "\n\n-- Building the ${PROJECT_NAME} project v${PROJECT_VERSION}...\n")
message(STATUS "┌─ Build Configuration for inLimbo ────────────────────────")
message(STATUS "│ Operating System : ${CMAKE_SYSTEM_NAME}")
message(STATUS "│ Build Type : ${CMAKE_BUILD_TYPE} (ALPHA)")
message(STATUS "│ CMake Version : ${CMAKE_VERSION}")
message(STATUS "│ Compiler : ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "│ Compiler Flags : ${CMAKE_CXX_FLAGS}")
message(STATUS "│ Executable Name : ${EXECUTABLE_NAME}")
message(STATUS "│ C++ Standard : ${CMAKE_CXX_STANDARD}")
message(STATUS "│ Install Prefix (GLOBAL) : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "│ Local Build Directory : ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message(STATUS "│ Miniaudio header : YES (${MINIAUDIO_FILE_RELATIVE})")
message(STATUS "│ CImg header : YES (${CIMG_FILE_RELATIVE})")
message(STATUS "│ TOML++ header : YES (${TOML_FILE_RELATIVE})")
message(STATUS "│ GLib/Gio Libraries : ${GLIB_LIBRARIES}")
message(STATUS "│ FTXUI Fetched : YES")
message(STATUS "│ Config file location : ${CONFIG_TOML_FILE}")
message(STATUS "│ Cache dir location : ${INLIMBO_CACHE_DIR}")
message(STATUS "│ Build Global Option : ${BUILD_GLOBAL}")
message(STATUS "│ Enable Testing : ${INLIMBO_TESTING}")
message(STATUS "│ Enable Debug Build : ${INLIMBO_DEBUG_BUILD}")
message(STATUS "└──────────────────────────────────────────────────────────\n")
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ BUILD_DIR_DBG_ASAN := build-dbg-asan
BUILD_DIR_DBG_TSAN := build-dbg-tsan
BUILD_DBG_ASAN_DIR := build-dbg-asan
BUILD_DBG_TSAN_DIR := build-dbg-tsan
BUILD_GLOBAL := GLOBAL_BUILD
EXECUTABLE := inLimbo
CMAKE := cmake
CMAKE_BUILD_TYPE := Release
SCRIPT := ./init.sh
TEST_SUITE_SCRIPT := ./run_tests.sh
VERBOSE_FLAG := VERBOSE=1
TESTING_FLAG := INLIMBO_TESTING
INSTALL_MANIFEST := $(BUILD_DIR)/install_manifest.txt

# Targets
.PHONY: all build clean rebuild build-all init asan tsan global_build build-test build-test-all
.PHONY: all build clean rebuild build-all init asan tsan build-global build-test build-test-all build-global-uninstall

all: build-all

Expand All @@ -25,7 +27,7 @@ build-test-all:
$(MAKE) build-test

build-test:
$(CMAKE) -S . -B $(BUILD_DIR) -D $(TESTING_FLAG)=ON
$(CMAKE) -S . -B $(BUILD_DIR) -D $(TESTING_FLAG)=ON -D $(BUILD_GLOBAL)=OFF
$(CMAKE) --build $(BUILD_DIR)

build-all:
Expand All @@ -35,7 +37,7 @@ build-all:

build:
@echo "==> Fresh Building inLimbo with $(CMAKE_BUILD_TYPE)..."
$(CMAKE) -S . -B build $(BUILD_DIR) -D $(TESTING_FLAG)=OFF
$(CMAKE) -S . -B build $(BUILD_DIR) -D $(TESTING_FLAG)=OFF -D $(BUILD_GLOBAL)=OFF
$(CMAKE) --build $(BUILD_DIR)

rebuild:
Expand All @@ -44,6 +46,7 @@ rebuild:

asan:
@echo "==> Building in AddressSanitizer mode..."
$(MAKE) init
mkdir -p $(BUILD_DIR_DBG_ASAN)
cmake -S . -B $(BUILD_DIR_DBG_ASAN) -DCMAKE_BUILD_TYPE=Debug-ASan
cmake --build $(BUILD_DIR_DBG_ASAN)
Expand All @@ -54,6 +57,7 @@ asan_run: asan

tsan:
@echo "==> Building in ThreadSanitizer mode..."
$(MAKE) init
mkdir -p $(BUILD_DIR_DBG_TSAN)
cmake -S . -B $(BUILD_DIR_DBG_TSAN) -DCMAKE_BUILD_TYPE=Debug-TSan
cmake --build $(BUILD_DIR_DBG_TSAN)
Expand All @@ -70,11 +74,21 @@ init:
@echo "==> Running initialization script..."
$(SCRIPT)

global_build:
@echo "==> Building globally and installing..."
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && $(CMAKE) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -DBUILD_GLOBAL=ON .. && $(NINJA)
cd $(BUILD_DIR) && sudo ninja install
build-global:
@echo "==> Building inLimbo GLOBALLY and installing..."
$(CMAKE) -S . -B build $(BUILD_DIR) -D $(TESTING_FLAG)=OFF -D $(BUILD_GLOBAL)=ON
$(CMAKE) --build $(BUILD_DIR)
cd $(BUILD_DIR) && sudo $(MAKE) install

build-global-uninstall:
@echo "==> Uninstalling inLimbo from the GLOBAL build..."
@if [ -f "$(INSTALL_MANIFEST)" ]; then \
xargs -a $(INSTALL_MANIFEST) sudo rm -v; \
echo "--> Uninstallation complete."; \
else \
echo "**Error: No install_manifest.txt found. Please ensure the project was installed.**"; \
exit 1; \
fi

verbose:
@echo "==> Building with verbose output..."
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ A simple command using makefile should build everything you want:
make build-all
```
For a **GLOBAL BUILD**:

```bash
make build-global
```

Check out [BUILD.md](https://github.com/nots1dd/inLimbo/blob/main/BUILD.md) for more options to build targets

> [!NOTE]
Expand All @@ -114,6 +120,8 @@ Check out [BUILD.md](https://github.com/nots1dd/inLimbo/blob/main/BUILD.md) for

inLimbo is in active development and is prone to having *A LOT* of issues

-> Makefile also allows for building and running of a debug build.

To try out **DEBUG BUILD** to find bugs/issues:

1. Debug build with `AddressSanitizer` (ASan):
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3 - ALPHA
2.7 - ALPHA
3 changes: 1 addition & 2 deletions src/arg-handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
#include "./cmd-line-args.hpp"
#include <filesystem>
#include <iostream>
#include <stdexcept>
#include <string_view>
#include <unordered_map>

// Constants
constexpr const char* DBUS_SERVICE_NAME =
"org.mpris.MediaPlayer2.inLimbo"; ///< DBus service name used by inLimbo.
constexpr const char* VERSION = "2.5 (ALPHA)"; ///< Current version of the application.
constexpr const char* VERSION = "2.7 (ALPHA)"; ///< Current version of the application.

bool shouldRunApp =
false; ///< Indicates if the application should proceed to run after handling arguments.
Expand Down
12 changes: 9 additions & 3 deletions src/cmd-line-args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,20 @@ class CommandLineArgs
* @return `true` if the flag is present, otherwise `false`.
*/
[[nodiscard]]
auto hasFlag(const std::string& flag) const -> bool { return args.find(flag) != args.end(); }
auto hasFlag(const std::string& flag) const -> bool
{
return args.find(flag) != args.end();
}
/**
* @brief Retrieves the list of positional arguments.
*
* @return A reference to a vector containing the positional arguments.
*/
[[nodiscard]]
auto getPositionalArgs() const -> const std::vector<std::string>& { return positionalArgs; }
[[nodiscard]]
auto getPositionalArgs() const -> const std::vector<std::string>&
{
return positionalArgs;
}

/**
* @brief Prints usage information and program details.
Expand Down
2 changes: 1 addition & 1 deletion src/dirsort/inode_mapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using namespace std;

#define LIB_BIN_NAME "lib.bin"
#define LIB_BIN_NAME "lib.bin"

class InodeFileMapper
{
Expand Down
5 changes: 1 addition & 4 deletions src/dirsort/songmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ class SongTree
*
* @return The nested map structure of songs.
*/
auto returnSongMap()
{
return tree;
}
auto returnSongMap() { return tree; }

/**
* @brief Serializes the SongTree object.
Expand Down
Loading

0 comments on commit 9f84cd0

Please sign in to comment.