libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

CMakeLists.txt (2570B)


      1 cmake_minimum_required (VERSION 2.6)
      2 
      3 set(LIB_VERSION_MAJOR 1)
      4 set(LIB_VERSION_MINOR 2)
      5 set(LIB_VERSION_PATCH 7)
      6 set(LIB_VERSION_STRING ${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${LIB_VERSION_PATCH})
      7 
      8 project (ansilove C)
      9 
     10 include(CheckFunctionExists)
     11 include(GNUInstallDirs)
     12 
     13 # Check if system has strtonum
     14 check_function_exists(strtonum HAVE_STRTONUM)
     15 check_function_exists(reallocarray HAVE_REALLOCARRAY)
     16 
     17 # Additional include directories for compat functions and headers
     18 include_directories("compat" "include" "src")
     19 
     20 # GD
     21 find_path(GD_INCLUDE_DIRS gd.h)
     22 find_library(GD_LIBRARIES NAMES gd REQUIRED)
     23 include_directories(${GD_INCLUDE_DIRS})
     24 
     25 set(CMAKE_BUILD_TYPE Release)
     26 set(SRC src/clean.c src/drawchar.c src/fonts.c src/error.c src/loadfile.c src/init.c src/output.c src/savefile.c)
     27 set(LOADERS src/loaders/ansi.c src/loaders/artworx.c src/loaders/binary.c src/loaders/icedraw.c src/loaders/pcboard.c src/loaders/tundra.c src/loaders/xbin.c)
     28 
     29 if(NOT HAVE_STRTONUM)
     30   set (SRC ${SRC} compat/strtonum.c)
     31 endif()
     32 
     33 if(NOT HAVE_REALLOCARRAY)
     34   set (SRC ${SRC} compat/reallocarray.c)
     35 endif()
     36 
     37 add_definitions(-D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -std=c99 -pedantic)
     38 add_library(ansilove SHARED ${SRC} ${LOADERS})
     39 
     40 target_link_libraries(ansilove ${GD_LIBRARIES} m)
     41 
     42 set_target_properties(ansilove PROPERTIES
     43   VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_MAJOR}
     44   C_VISIBILITY_PRESET hidden)
     45 
     46 install(TARGETS ansilove DESTINATION ${CMAKE_INSTALL_LIBDIR})
     47 install(FILES include/ansilove.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
     48 install(FILES man/libansilove.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     49 install(FILES man/ansilove_clean.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     50 install(FILES man/ansilove_error.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     51 install(FILES man/ansilove_init.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     52 install(FILES man/ansilove_loadfile.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     53 install(FILES man/ansilove_savefile.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     54 install(FILES man/ansilove_ansi.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     55 install(FILES man/ansilove_artworx.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     56 install(FILES man/ansilove_binary.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     57 install(FILES man/ansilove_icedraw.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     58 install(FILES man/ansilove_pcboard.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     59 install(FILES man/ansilove_tundra.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)
     60 install(FILES man/ansilove_xbin.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/)