Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 112 additions & 35 deletions graf2d/asimage/src/libAfterImage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,132 @@
# libAferImage CMakeLists.txt

PROJECT(AFTERIMAGE)
project(AFTERIMAGE)
if(WIN32)
# required for the following feature & bug fix:
# 3.15: Added $<REMOVE_DUPLICATES:list> generator expression
# 3.16: Bug fix with CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS: the auto-generated exports
# are now updated only when the object files providing the symbols are updated
# required for the following feature & bug fix: 3.15: Added
# $<REMOVE_DUPLICATES:list> generator expression 3.16: Bug fix with
# CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS: the auto-generated exports are now updated
# only when the object files providing the symbols are updated
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
# Set CMP0091 (MSVC runtime library flags are selected by an abstraction) to OLD
# to keep the old way of selecting the runtime library with the -MD/-MDd compiler flag
# Set CMP0091 (MSVC runtime library flags are selected by an abstraction) to
# OLD to keep the old way of selecting the runtime library with the -MD/-MDd
# compiler flag
cmake_policy(SET CMP0091 OLD)
else()
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
endif()

SET(LIB_NAME libAfterImage)
set(LIB_NAME libAfterImage)

# Microsoft Visual Studio:
IF(MSVC)
# Define
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DNO_DEBUG_OUTPUT /D_MBCS /D_LIB /wd4996 /wd4267 /wd4018 /wd4244")
ENDIF()
set(LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")

set(FREETYPE_INCLUDE_DIR "" CACHE PATH "Path to Freetype include dir")
set(ZLIB_INCLUDE_DIR "" CACHE PATH "Path to zlib include dir")
set(H_FILES
afterbase.h
afterrootpngwrite.h
asfont.h
asimage.h
asvisual.h
bmp.h
colornames.h
export.h
import.h
transform.h
xcf.h
xpm.h
afterimage.h
ascmap.h
asim_afterbase.h
asstorage.h
blender.h
char2uni.h
draw.h
imencdec.h
scanline.h
ungif.h
ximage.h
xwrap.h)

if(NOT EXISTS "${FREETYPE_INCLUDE_DIR}/ft2build.h")
message(SEND_ERROR "Can't find ft2build.h in ${FREETYPE_INCLUDE_DIR}")
endif()

if(NOT EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
message(SEND_ERROR "Can't find zlib.h in ${ZLIB_INCLUDE_DIR}")
endif()
set(SRC_FILES
afterbase.c
ascmap.c
asfont.c
asimage.c
asstorage.c
asvisual.c
blender.c
bmp.c
char2uni.c
export.c
import.c
transform.c
ungif.c
xcf.c
ximage.c
xpm.c
draw.c
imencdec.c
scanline.c
afterrootpngwrite.c)

INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${GIF_INCLUDE_DIR})
add_library(${LIB_NAME} STATIC ${H_FILES} ${SRC_FILES})

set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
target_include_directories(
${LIB_NAME} PUBLIC ${FREETYPE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${GIF_INCLUDE_DIR})

FILE(GLOB H_FILES "*.h")
target_link_directories(${LIB_NAME} PRIVATE ${JPEG_LIBRARY_LOCATION}
${PNG_LIBRARY_LOCATION} ${GIF_LIBRARY_LOCATION})

SET(SRC_FILES
afterbase.c ascmap.c asfont.c
asimage.c asstorage.c asvisual.c blender.c bmp.c char2uni.c
export.c import.c transform.c ungif.c xcf.c ximage.c xpm.c draw.c
imencdec.c scanline.c
afterrootpngwrite.c
)
target_compile_definitions(
${LIB_NAME}
PRIVATE HAVE_ERRNO_H
HAVE_FREETYPE
HAVE_FREETYPE_FREETYPE
HAVE_FT2BUILD_H
HAVE_INTTYPES_H
HAVE_JPEG
HAVE_MALLOC_H
HAVE_MEMORY_H
HAVE_GIF
HAVE_PNG
HAVE_PROTOTYPES
HAVE_STDARG_H
HAVE_STDDEF_H
HAVE_STRING_H
HAVE_SYS_STAT_H
HAVE_SYS_TIME_H
HAVE_SYS_TYPES_H
HAVE_SYS_WAIT_H
HAVE_XPM
HAVE_ZLIB_H)

ADD_LIBRARY(${LIB_NAME} STATIC ${H_FILES} ${SRC_FILES})
if(WIN32)
# Microsoft Visual Studio:
if(MSVC)
# Define
target_compile_definitions(${LIB_NAME} PRIVATE _CRT_SECURE_NO_DEPRECATE
NO_DEBUG_OUTPUT _MBCS _LIB)
target_compile_options(${LIB_NAME}
PRIVATE "/wd4996 /wd4267 /wd4018 /wd4244")

target_link_libraries(${LIB_NAME} PRIVATE ${JPEG_LIBRARY_LOCATION} ${PNG_LIBRARY_LOCATION} ${GIF_LIBRARY_LOCATION})
endif()
target_compile_definitions(
${LIB_NAME}
PRIVATE NO_DOUBLE_FCLOSE_AFTER_FDOPEN X_DISPLAY_MISSING HAVE_SYS_DIRENT_H
HAVE_UNSIGNED_CHAR HAVE_UNSIGNED_SHORT HAVE_BOOLEAN)
else()
target_compile_definitions(
${LIB_NAME}
PRIVATE HAVE_DIRENT_H
HAVE_MMX
HAVE_LONG_LONG
HAVE_STDINT_H
HAVE_STDLIB_H
HAVE_UNISTD_H
HAVE_STRINGS_H
HAVE_TIFF
SHAPE
STDC_HEADERS
TIME_WITH_SYS_TIME)
endif()

install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION})
Loading