cSDL_image/CMakeLists.txt

50 lines
1.4 KiB
CMake

# cSDL_image: build system
cmake_minimum_required(VERSION 3.16)
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
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
)
#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 "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 -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG -DLOAD_JPG)
# 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 FindcSDL_image.cmake so that users can do find_package(LibcSDL_image)
install(FILES cmake/FindcSDL_image.cmake
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")