shithub: m8c

Download patch

ref: 8e09b6f6dfdc6deb9f0dc213a7e7da74f19b2767
parent: fd972a0429363b470ca9989e365e89286238e289
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Sat Mar 22 16:32:45 EDT 2025

add moved files to cmakelists, show debug messages in app log if cmake build type is debug

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,11 +2,11 @@
 
 project(m8c LANGUAGES C)
 
-set(CMAKE_C_FLAGS "-O2 -Wall -Wextra")
-
 set(APP_NAME m8c)
 
-set(USE_LIBSERIALPORT 1)
+if (NOT DEFINED USE_LIBSERIALPORT AND NOT DEFINED USE_LIBUSB AND NOT DEFINED USE_RTMIDI)
+    set(USE_LIBSERIALPORT 1)
+endif ()
 
 find_package(PkgConfig REQUIRED)
 find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
@@ -29,7 +29,7 @@
 endif (USE_RTMIDI)
 
 
-file(GLOB m8c_SRC "src/*.h" "src/*.c")
+file(GLOB m8c_SRC "src/*.h" "src/*.c" "src/backends/*.h" "src/backends/*.c" "src/fonts/*.h")
 
 set(MACOS_CONTENTS "${CMAKE_CURRENT_SOURCE_DIR}/package/macos/m8c.app/Contents")
 
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 #Set all your object files (the object files of all the .c files in your project, e.g. main.o my_sub_functions.o )
-OBJ = src/main.o src/serial.o src/slip.o src/command.o src/render.o src/ini.o src/config.o src/input.o src/gamecontrollers.o src/fx_cube.o src/usb.o src/audio.o src/usb_audio.o src/ringbuffer.o src/inprint2.o src/midi.o src/queue.o
+OBJ = src/main.o src/backends/serialport.o src/backends/slip.o src/command.o src/render.o src/ini.o src/config.o src/input.o src/gamecontrollers.o src/fx_cube.o src/backends/usb.o src/audio.o src/backends/usb_audio.o src/backends/ringbuffer.o src/inprint2.o src/backends/rtmidi.o src/backends/queue.o
 
 #Set any dependant header files so that if they are edited they cause a complete re-compile (e.g. main.h some_subfunctions.h some_definitions_file.h ), or leave blank
-DEPS = src/serial.h src/slip.h src/command.h src/render.h src/ini.h src/config.h src/input.h src/gamecontrollers.h src/fx_cube.h src/audio.h src/ringbuffer.h src/inline_font.h src/midi.h src/queue.h
+DEPS = src/backends/serialport.h src/backends/slip.h src/command.h src/render.h src/ini.h src/config.h src/input.h src/gamecontrollers.h src/fx_cube.h src/audio.h src/backends/ringbuffer.h src/inline_font.h src/backends/rtmidi.h src/backends/queue.h
 
 #Any special libraries you are using in your project (e.g. -lbcm2835 -lrt `pkg-config --libs gtk+-3.0` ), or leave blank
 INCLUDES = $(shell pkg-config --libs sdl3 libserialport | sed 's/-mwindows//')
@@ -9,7 +9,6 @@
 
 #Set any compiler flags you want to use (e.g. -I/usr/include/somefolder `pkg-config --cflags gtk+-3.0` ), or leave blank
 local_CFLAGS = $(CFLAGS) $(shell pkg-config --cflags sdl3 libserialport) -DUSE_LIBSERIALPORT -Wall -Wextra -O2 -pipe -I.
-
 
 #Set the compiler you are using ( gcc for C or g++ for C++ )
 CC = gcc
--- a/src/main.c
+++ b/src/main.c
@@ -21,7 +21,7 @@
 enum app_state app_state = WAIT_FOR_DEVICE;
 
 // Handle CTRL+C / SIGINT, SIGKILL etc.
-void signal_handler(int unused) { app_state = QUIT; }
+void signal_handler(int unused) { (void)unused; app_state = QUIT; }
 
 int main(const int argc, char *argv[]) {
 
@@ -73,8 +73,9 @@
   // initial scan for (existing) gamepads
   gamecontrollers_initialize();
 
-#ifdef DEBUG
-  SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG);
+#ifndef NDEBUG
+  SDL_SetLogPriorities(SDL_LOG_PRIORITY_DEBUG);
+  SDL_LogDebug(SDL_LOG_CATEGORY_TEST,"Running a Debug build");
 #endif
 
   // main loop begin
--- a/src/render.c
+++ b/src/render.c
@@ -4,7 +4,6 @@
 #include "render.h"
 
 #include <SDL3/SDL.h>
-#include <stdio.h>
 
 #include "SDL2_inprint.h"
 #include "command.h"
@@ -75,8 +74,6 @@
   SDL_RenderClear(rend);
 
   renderer_set_font_mode(0);
-
-  SDL_SetLogPriorities(SDL_LOG_PRIORITY_INFO);
 
   dirty = 1;
 
--