bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

CMakeLists.txt (1926B)


      1 #
      2 # bdf2sfd 1.1.6
      3 # Copyright (c) 2019-2021, Frederic Cambus
      4 # https://github.com/fcambus/bdf2sfd
      5 #
      6 # Created:      2019-11-21
      7 # Last Updated: 2021-10-18
      8 #
      9 # bdf2sfd is released under the BSD 2-Clause license.
     10 # See LICENSE file for details.
     11 #
     12 # SPDX-License-Identifier: BSD-2-Clause
     13 #
     14 
     15 cmake_minimum_required(VERSION 3.1)
     16 
     17 set(CMAKE_C_STANDARD 99)
     18 set(CMAKE_C_STANDARD_REQUIRED ON)
     19 set(CMAKE_C_EXTENSIONS OFF)
     20 
     21 project(bdf2sfd C)
     22 
     23 include(CheckFunctionExists)
     24 include(GNUInstallDirs)
     25 
     26 # Conditional build options
     27 set(ENABLE_SECCOMP 0 CACHE BOOL "Enable building with seccomp")
     28 
     29 # Check if system has pledge and strtonum
     30 list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE)
     31 check_function_exists(pledge HAVE_PLEDGE)
     32 check_function_exists(strtonum HAVE_STRTONUM)
     33 
     34 if(ENABLE_SECCOMP)
     35   # Check if system has seccomp
     36   message(STATUS "Looking for seccomp")
     37   find_path(SECCOMP NAMES "linux/seccomp.h")
     38   if(SECCOMP)
     39     message(STATUS "Looking for seccomp - found")
     40     add_definitions(-DHAVE_SECCOMP)
     41   else()
     42     message(STATUS "Looking for seccomp - not found")
     43   endif()
     44 endif(ENABLE_SECCOMP)
     45 
     46 # Additional include directories for compat functions + dependencies
     47 include_directories("compat")
     48 
     49 set(SRC src/bdf2sfd.c src/header.c src/parse.c src/polygon.c)
     50 
     51 if(NOT HAVE_PLEDGE)
     52   set(SRC ${SRC} compat/pledge.c)
     53 endif()
     54 
     55 if(NOT HAVE_STRTONUM)
     56   set(SRC ${SRC} compat/strtonum.c)
     57 endif()
     58 
     59 add_definitions(-D_GNU_SOURCE -Wall -Wextra -pedantic)
     60 add_executable(bdf2sfd ${SRC})
     61 
     62 install(TARGETS bdf2sfd DESTINATION ${CMAKE_INSTALL_BINDIR})
     63 install(FILES bdf2sfd.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)
     64 
     65 enable_testing()
     66 add_test(bdf2sfd bdf2sfd)
     67 add_test(8x16 bdf2sfd ${PROJECT_SOURCE_DIR}/tests/spleen-8x16.bdf)
     68 add_test(12x24 bdf2sfd ${PROJECT_SOURCE_DIR}/tests/spleen-12x24.bdf)
     69 add_test(16x32 bdf2sfd ${PROJECT_SOURCE_DIR}/tests/spleen-16x32.bdf)
     70 add_test(32x64 bdf2sfd ${PROJECT_SOURCE_DIR}/tests/spleen-32x64.bdf)