Skip to content
Open
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
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ option(freetype-gl_BUILD_HARFBUZZ "Build the freetype-gl harfbuzz support (exper
option(freetype-gl_BUILD_MAKEFONT "Build the makefont tool" ON)
option(freetype-gl_BUILD_TESTS "Build the tests" ON)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be OFF by default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could be. And installing ImageMagick should satisfy Jarvis.


if(${freetype-gl_BUILD_TESTS})
find_package(ImageMagick QUIET COMPONENTS compare)
if(NOT ${ImageMagick_EXECUTABLE_DIR})
message(FATAL_ERROR "ImageMagick was not found. Either provide path to ImageMagick, or disable freetype-gl_BUILD_TESTS option.")
endif()
endif()

include(RequireIncludeFile)
include(RequireFunctionExists)
include(CheckLibraryExists)
Expand Down Expand Up @@ -63,11 +70,10 @@ check_symbol_exists(M_PI math.h HAVE_M_PI)

if(NOT HAVE_M_PI)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_USE_MATH_DEFINES)
unset(HAVE_M_PI CACHE)

check_symbol_exists(M_PI math.h HAVE_M_PI)
check_symbol_exists(M_PI math.h HAVE_M_PI2)

if(NOT HAVE_M_PI)
if(NOT HAVE_M_PI2)
message(FATAL_ERROR "`M_PI` not defined in `math.h`.")
else()
add_definitions(-D_USE_MATH_DEFINES)
Expand Down
40 changes: 21 additions & 19 deletions demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,29 @@ target_include_directories(demo-utils
PUBLIC $<TARGET_PROPERTY:glfw,INTERFACE_INCLUDE_DIRECTORIES>
)

add_custom_command(
DEPENDS
makefont
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
COMMAND
../$<$<BOOL:MSVC>:$(Configuration)/>makefont
ARGS
--font fonts/Vera.ttf
--header ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
--size 16
--variable font
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
)
if(freetype-gl_BUILD_MAKEFONT)
add_custom_command(
DEPENDS
makefont
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
COMMAND
../$<$<BOOL:MSVC>:$(Configuration)/>makefont
ARGS
--font fonts/Vera.ttf
--header ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
--size 16
--variable font
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
)

add_custom_target(generate-embedded-font
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
)
add_custom_target(generate-embedded-font
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h
)

create_demo(embedded-font embedded-font.c)
add_dependencies(embedded-font generate-embedded-font)
create_demo(embedded-font embedded-font.c)
add_dependencies(embedded-font generate-embedded-font)
endif()

create_demo(texture texture.c)
create_demo(font font.c)
Expand Down