2019-03-28 04:03:35 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2019-03-28 01:42:41 +00:00
|
|
|
project(fonts LANGUAGES C)
|
|
|
|
|
2019-03-28 08:56:14 +00:00
|
|
|
set(FONT_H "${CMAKE_BINARY_DIR}/include/dynamic/fonts.h")
|
|
|
|
set(FONT_C "${CMAKE_BINARY_DIR}/src/fonts.c")
|
|
|
|
|
|
|
|
file(WRITE ${FONT_H} "#include \"interface/font.h\"\n\n")
|
|
|
|
file(APPEND ${FONT_H} "extern LG_Font * LG_Fonts[];\n\n")
|
|
|
|
|
|
|
|
file(WRITE ${FONT_C} "#include \"interface/font.h\"\n\n")
|
|
|
|
file(APPEND ${FONT_C} "#include <stddef.h>\n\n")
|
|
|
|
|
2019-03-28 09:12:18 +00:00
|
|
|
set(FONTS "_")
|
|
|
|
set(FONTS_LINK "_")
|
2019-03-28 08:56:14 +00:00
|
|
|
function(add_font name)
|
|
|
|
set(FONTS "${FONTS};${name}" PARENT_SCOPE)
|
|
|
|
set(FONTS_LINK "${FONTS_LINK};font_${name}" PARENT_SCOPE)
|
|
|
|
add_subdirectory(${name})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Add/remove fonts here!
|
2021-02-24 04:02:21 +00:00
|
|
|
add_font(freetype)
|
2019-03-28 08:56:14 +00:00
|
|
|
add_font(SDL)
|
|
|
|
|
|
|
|
list(REMOVE_AT FONTS 0)
|
|
|
|
list(REMOVE_AT FONTS_LINK 0)
|
|
|
|
|
|
|
|
list(LENGTH FONTS FONT_COUNT)
|
|
|
|
file(APPEND ${FONT_H} "#define LG_FONT_COUNT ${FONT_COUNT}\n")
|
|
|
|
|
|
|
|
foreach(font ${FONTS})
|
|
|
|
file(APPEND ${FONT_C} "extern LG_Font LGF_${font};\n")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
file(APPEND ${FONT_C} "\nconst LG_Font * LG_Fonts[] =\n{\n")
|
|
|
|
foreach(font ${FONTS})
|
|
|
|
file(APPEND ${FONT_C} " &LGF_${font},\n")
|
|
|
|
endforeach()
|
|
|
|
file(APPEND ${FONT_C} " NULL\n};\n\n")
|
2019-03-28 01:42:41 +00:00
|
|
|
|
2019-03-28 09:15:13 +00:00
|
|
|
add_library(fonts STATIC ${FONT_C})
|
|
|
|
target_link_libraries(fonts ${FONTS_LINK})
|