updated all cmake configuration files

This commit is contained in:
Sylvain PILLOT 2022-08-30 12:51:49 +02:00
parent 9d8213580b
commit 052c358b4b
9 changed files with 39 additions and 319 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/build-cg
/build-fx

View File

@ -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}")

View File

@ -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)

4
build
View File

@ -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/

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="cSDL_image1_2_12" />
<Option pch_mode="2" />
<Option compiler="null" />
<Build>
<Target title="Release">
<Option output="bin/Release/cSDL_image1_2_12" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="null" />
</Target>
</Build>
<Unit filename="IMG.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_bmp.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_gif.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_jpg.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_lbm.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_pcx.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_png.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_pnm.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_tga.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_tif.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_webp.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_xcf.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_xpm.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_xv.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="IMG_xxx.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="Makefile.prizm" />
<Unit filename="SDL/SDL_image.h" />
<Extensions />
</Project>
</CodeBlocks_project_file>

View File

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="SDL/SDL_image.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5336" topLine="97" />
</Cursor>
</File>
<File name="IMG_png.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10146" topLine="66" />
</Cursor>
<Folding>
<Collapse line="76" />
<Collapse line="104" />
<Collapse line="251" />
<Collapse line="262" />
<Collapse line="291" />
<Collapse line="303" />
<Collapse line="326" />
<Collapse line="333" />
<Collapse line="587" />
</Folding>
</File>
<File name="IMG_bmp.c" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2507" topLine="101" />
</Cursor>
<Folding>
<Collapse line="35" />
<Collapse line="54" />
<Collapse line="84" />
<Collapse line="89" />
<Collapse line="112" />
<Collapse line="532" />
<Collapse line="541" />
<Collapse line="834" />
<Collapse line="839" />
<Collapse line="850" />
<Collapse line="856" />
<Collapse line="862" />
</Folding>
</File>
<File name="IMG_webp.c" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1078" topLine="0" />
</Cursor>
</File>
<File name="IMG_tga.c" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1174" topLine="0" />
</Cursor>
</File>
<File name="IMG_lbm.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1677" topLine="9" />
</Cursor>
</File>
<File name="IMG_xxx.c" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1091" topLine="0" />
</Cursor>
</File>
<File name="IMG_gif.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1143" topLine="25" />
</Cursor>
</File>
<File name="IMG_xv.c" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1086" topLine="0" />
</Cursor>
</File>
<File name="IMG_tif.c" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="728" topLine="0" />
</Cursor>
</File>
<File name="IMG.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1748" topLine="36" />
</Cursor>
<Folding>
<Collapse line="85" />
<Collapse line="144" />
</Folding>
</File>
<File name="IMG_pcx.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1468" topLine="24" />
</Cursor>
</File>
<File name="IMG_xpm.c" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1760" topLine="27" />
</Cursor>
</File>
<File name="IMG_jpg.c" open="1" top="1" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13830" topLine="105" />
</Cursor>
<Folding>
<Collapse line="61" />
<Collapse line="136" />
<Collapse line="147" />
<Collapse line="164" />
<Collapse line="176" />
<Collapse line="240" />
<Collapse line="252" />
<Collapse line="257" />
<Collapse line="261" />
<Collapse line="279" />
<Collapse line="291" />
<Collapse line="316" />
<Collapse line="321" />
<Collapse line="327" />
<Collapse line="355" />
<Collapse line="361" />
<Collapse line="367" />
<Collapse line="469" />
<Collapse line="475" />
<Collapse line="480" />
<Collapse line="486" />
</Folding>
</File>
<File name="Makefile.prizm" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="259" topLine="0" />
</Cursor>
</File>
<File name="IMG_pnm.c" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1229" topLine="2" />
</Cursor>
</File>
<File name="IMG_xcf.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1105" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -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()

View File

@ -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()

View File

@ -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