2022-08-30 12:51:49 +02:00
|
|
|
# cSDL_image: build system
|
2022-05-05 22:05:33 +02:00
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2022-08-30 12:51:49 +02:00
|
|
|
project(cSDL_image VERSION 1.2.12 LANGUAGES C)
|
2022-05-05 22:05:33 +02:00
|
|
|
|
|
|
|
# Libraries that libexample depends on
|
2022-08-22 20:58:28 +02:00
|
|
|
find_package(Gint 2.9.0 REQUIRED)
|
2022-08-30 12:51:49 +02:00
|
|
|
find_package(cSDL 1.2.15 REQUIRED)
|
|
|
|
find_package(cJPEG 9.2 REQUIRED)
|
|
|
|
find_package(cPNG 1.5.30 REQUIRED)
|
2022-05-05 22:05:33 +02:00
|
|
|
|
|
|
|
set(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
|
|
|
|
)
|
|
|
|
|
2022-08-30 12:51:49 +02:00
|
|
|
#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)
|
2022-05-05 22:05:33 +02:00
|
|
|
|
2022-08-30 12:51:49 +02:00
|
|
|
# Target name is "cSDL_image", output file is "libcSDL_image.a" (by default)
|
|
|
|
add_library(cSDL_image STATIC ${SOURCES})
|
2022-08-31 11:34:57 +02:00
|
|
|
target_compile_options(cSDL_image PRIVATE -Os -std=c11 -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG -DLOAD_JPG)
|
2022-05-05 22:05:33 +02:00
|
|
|
|
2022-08-30 12:51:49 +02:00
|
|
|
# After building, install the target (that is, cSDL_image.a) in the compiler
|
|
|
|
install(TARGETS cSDL_image
|
2022-08-22 20:58:28 +02:00
|
|
|
DESTINATION "${FXSDK_LIB}")
|
2022-05-05 22:05:33 +02:00
|
|
|
|
2022-08-22 20:58:28 +02:00
|
|
|
# Install SDL_image.h from the build dir
|
2022-05-05 22:05:33 +02:00
|
|
|
install(FILES "${PROJECT_SOURCE_DIR}/SDL/SDL_image.h"
|
2022-08-22 20:58:28 +02:00
|
|
|
DESTINATION "${FXSDK_INCLUDE}/SDL")
|
2022-05-05 22:05:33 +02:00
|
|
|
|
2022-08-30 12:51:49 +02:00
|
|
|
# Install FindcSDL_image.cmake so that users can do find_package(LibcSDL_image)
|
|
|
|
install(FILES cmake/FindcSDL_image.cmake
|
2022-05-05 22:05:33 +02:00
|
|
|
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
|
|
|
|
|