diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3dadc61
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/build-cg
+/build-fx
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1beaa9e..c14a387 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,13 @@
-# SDL_image_prizm: build system
+# cSDL_image: build system
cmake_minimum_required(VERSION 3.16)
-project(LibSDL_image VERSION 1.2.12 LANGUAGES C)
+project(cSDL_image VERSION 1.2.12 LANGUAGES C)
# Libraries that libexample depends on
find_package(Gint 2.9.0 REQUIRED)
-
+find_package(cSDL 1.2.15 REQUIRED)
+find_package(cJPEG 9.2 REQUIRED)
+find_package(cPNG 1.5.30 REQUIRED)
set(SOURCES
IMG.c
@@ -24,23 +26,24 @@ set(SOURCES
IMG_xv.c
)
-include_directories(
- "${PROJECT_SOURCE_DIR}"
- "${FXSDK_INCLUDE}")
-add_compile_options(-Os -lm -m4-nofpu -mb -std=c11 -ffreestanding -nostdlib -Wa,--dsp -lcPNG -lczlib -lSDL_prizm -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG)
+#include_directories(
+# "${PROJECT_SOURCE_DIR}"
+# "${FXSDK_INCLUDE}")
+#add_compile_options(-Os -lm -m4-nofpu -mb -std=c11 -ffreestanding -nostdlib -Wa,--dsp -lcPNG -lczlib -lSDL_prizm -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG)
-# Target name is "SDL_image_prizm", output file is "libSDL_image_prizm.a" (by default)
-add_library(SDL_image_prizm STATIC ${SOURCES})
+# Target name is "cSDL_image", output file is "libcSDL_image.a" (by default)
+add_library(cSDL_image STATIC ${SOURCES})
+target_compile_options(cSDL_image PRIVATE -Os -std=c11)
-# After building, install the target (that is, SDL_image_prizm.a) in the compiler
-install(TARGETS SDL_image_prizm
+# After building, install the target (that is, cSDL_image.a) in the compiler
+install(TARGETS cSDL_image
DESTINATION "${FXSDK_LIB}")
# Install SDL_image.h from the build dir
install(FILES "${PROJECT_SOURCE_DIR}/SDL/SDL_image.h"
DESTINATION "${FXSDK_INCLUDE}/SDL")
-# Install FindSDL_prizm.cmake so that users can do find_package(LibSDL_prizm)
-install(FILES cmake/FindcSDL_image_prizm.cmake
+# Install FindcSDL_image.cmake so that users can do find_package(LibcSDL_image)
+install(FILES cmake/FindcSDL_image.cmake
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
diff --git a/Makefile.prizm b/Makefile.prizm
deleted file mode 100644
index b50f301..0000000
--- a/Makefile.prizm
+++ /dev/null
@@ -1,38 +0,0 @@
-INCLUDE = -I./include -I/home/sylvain/.local/share/giteapc/Lephenixnoir/sh-elf-gcc/lib/gcc/sh3eb-elf/11.1.0/include/openlibm/
-CFLAGS = -O2 $(INCLUDE) -lm -m4-nofpu -mb -ffreestanding -nostdlib -lcJPG -lcPNG -lczlib -lSDL_prizm -Wa,--dsp -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG
-AR = sh-elf-gcc-ar
-RANLIB = sh-elf-gcc-ranlib
-CC = sh-elf-gcc
-
-CONFIG_H =
-TARGET = libSDL_image_prizm.a
-SOURCES = \
- IMG.c \
- IMG_bmp.c \
- IMG_gif.c \
- IMG_jpg.c \
- IMG_lbm.c \
- IMG_pcx.c \
- IMG_png.c \
- IMG_pnm.c \
- IMG_tga.c \
- IMG_tif.c \
- IMG_webp.c \
- IMG_xcf.c \
- IMG_xpm.c \
- IMG_xv.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-all: $(TARGET)
-
-$(TARGET): $(OBJECTS)
- #cp $(CONFIG_H).default $(CONFIG_H)
- $(AR) cr $@ $^
- $(RANLIB) $@
-
-.c.o:
- $(CC) $(INCLUDE) $(CFLAGS) -c $< -o $@
-
-clean:
- rm -f $(OBJECTS) $(TARGET)
diff --git a/build b/build
deleted file mode 100755
index 1fee4d9..0000000
--- a/build
+++ /dev/null
@@ -1,4 +0,0 @@
-make -f Makefile.prizm clean
-make -f Makefile.prizm
-cp libSDL_image_prizm.a ~/.local/share/giteapc/Lephenixnoir/sh-elf-gcc/lib/gcc/sh3eb-elf/11.1.0/
-cp ./SDL/*.h ~/.local/share/giteapc/Lephenixnoir/sh-elf-gcc/lib/gcc/sh3eb-elf/11.1.0/include/SDL/
diff --git a/cSDL_image1_2_12.cbp b/cSDL_image1_2_12.cbp
deleted file mode 100644
index 1769d75..0000000
--- a/cSDL_image1_2_12.cbp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/cSDL_image1_2_12.layout b/cSDL_image1_2_12.layout
deleted file mode 100644
index f9501c2..0000000
--- a/cSDL_image1_2_12.layout
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/cmake/FindcSDL_image.cmake b/cmake/FindcSDL_image.cmake
new file mode 100644
index 0000000..8d8a76a
--- /dev/null
+++ b/cmake/FindcSDL_image.cmake
@@ -0,0 +1,20 @@
+include(FindSimpleLibrary)
+include(FindPackageHandleStandardArgs)
+
+find_simple_library(libcSDL_image.a SDL/SDL_image.h _
+ PATH_VAR CSDL_IMAGE_PATH
+ OTHER_MACROS SDL_IMAGE_MAJOR_VERSION SDL_IMAGE_MINOR_VERSION SDL_IMAGE_PATCHLEVEL)
+
+set(CSDL_IMAGE_VERSION "${SDL_IMAGE_MAJOR_VERSION}.${SDL_IMAGE_MINOR_VERSION}.${SDL_IMAGE_PATCHLEVEL}")
+
+find_package_handle_standard_args(cSDL_image
+ REQUIRED_VARS CSDL_IMAGE_PATH
+ VERSION_VAR CSDL_IMAGE_VERSION)
+
+if(cSDL_image_FOUND)
+ add_library(cSDL_image::cSDL_image UNKNOWN IMPORTED)
+ set_target_properties(cSDL_image::cSDL_image PROPERTIES
+ IMPORTED_LOCATION "${CSDL_IMAGE_PATH}"
+ INTERFACE_LINK_OPTIONS -lcSDL_image)
+ IMPORTED_LINK_INTERFACE_LIBRARIES cSDL::cSDL cJPEG::cJPEG cPNG::cPNG)
+endif()
diff --git a/cmake/FindcSDL_image_prizm.cmake b/cmake/FindcSDL_image_prizm.cmake
deleted file mode 100644
index 59df1c6..0000000
--- a/cmake/FindcSDL_image_prizm.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-find_package(Gint 2.7 REQUIRED)
-# Find libexample.a; if we had platform-specific versions we could look for
-# libexample-${FXSDK_PLATFORM}.a instead.
-execute_process(
- COMMAND ${CMAKE_C_COMPILER} -print-file-name=libSDL_image_prizm.a
- OUTPUT_VARIABLE EX_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
-# EX_PATH is now the full path if libustl.a exists, "libustl.a" otherwise
-if(NOT "${EX_PATH}" STREQUAL "libSDL_image_prizm.a")
- # Find the version.h header
- execute_process(
- COMMAND ${CMAKE_C_COMPILER} -print-file-name=include/zconf.h
- OUTPUT_VARIABLE EX_CONFIG OUTPUT_STRIP_TRAILING_WHITESPACE)
- # Extract version information from the config.h header. This command prints
- # the version on the line matching the regex and deletes every other line.
- execute_process(
- COMMAND sed -E "s/#define.*EX_VERSION\\s+\"(\\S+)\"$/\\1/p; d" ${EX_CONFIG}
- OUTPUT_VARIABLE EX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-endif()
-# The commands above seem common for gint libraries, so the fxSDK provides a
-# helper function to get that directly. We simply provide the archive name,
-# header file name, macro name, and names for output variables.
-# include(FindSimpleLibrary)
-# find_simple_library(libexample.a include/example/config.h "EX_VERSION"
-# PATH_VAR EX_PATH VERSION_VAR EX_VERSION)
-# This CMake utility will handle the version comparisons and other checks. We
-# just specify:
-# -> Some variables that are defined only if the library is found (so if
-# they're undefined, CMake will conclude libexample was not found)
-# -> The version, so CMake can compare with the user's requested one
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(libczlib
- REQUIRED_VARS EX_CONFIG EX_VERSION
- VERSION_VAR EX_VERSION)
-# We now have a LibExample_FOUND variable, let's create the target that users
-# can link against with target_link_libraries()
-if(LibSDL_image_prizm_FOUND)
- # This is an imported target, we don't build it, we just claim it's here
- add_library(libSDL_image_prizm::libSDL_image_prizm UNKNOWN IMPORTED)
- # Here we declare the compiler and linker flags that every user of LibExample
- # needs to use.
- set_target_properties(libSDL_image_prizm::libSDL_image_prizm PROPERTIES
- # If we specify where the library comes from, CMake will watch that file
- # and relink any user application when the library is updated!
- IMPORTED_LOCATION "${EX_PATH}"
- # Linking options
- INTERFACE_LINK_OPTIONS -lSDL_image_prizm
- # Dependencies (for order on the command-line)
- IMPORTED_LINK_INTERFACE_LIBRARIES Gint::Gint)
-endif()
diff --git a/giteapc.make b/giteapc.make
index 453f68d..5b22563 100644
--- a/giteapc.make
+++ b/giteapc.make
@@ -1,23 +1,16 @@
-# giteapc: version=1 depends=Lephenixnoir/gint,Lephenixnoir/sh-elf-gcc,Lephenixnoir/fxsdk,Lephenixnoir/OpenLibm,Vhex-Kernel-Core/fxlibc
+# giteapc: version=1 depends=Lephenixnoir/gint,Lephenixnoir/sh-elf-gcc,Lephenixnoir/fxsdk,Lephenixnoir/OpenLibm,Vhex-Kernel-Core/fxlibc,Slyvtt/cSDL,Slyvtt/cPNG,Slyvtt/cJPEG,Slyvtt/cZlib
-include giteapc-config.make
-
configure:
- @ fxsdk build-fx -c
@ fxsdk build-cg -c
build:
- @ fxsdk build-fx
@ fxsdk build-cg
install:
- @ fxsdk build-fx install
@ fxsdk build-cg install
uninstall:
- @ if [ -e build-fx/install_manifest.txt ]; then \
- xargs rm -f < build-fx/install_manifest.txt; \
- fi
@ if [ -e build-cg/install_manifest.txt ]; then \
xargs rm -f < build-cg/install_manifest.txt; \
fi