Skip to content

Commit

Permalink
Support include through CMake Package Manager + Fix recent breaking c…
Browse files Browse the repository at this point in the history
…hange in freetype (lenmus#400)

* Update CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR to PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR respectively to support include through package managers

* FT_Outline now uses unsigned tags (from commit 044d142)

* Support both freetype < 2.13.3 and later

* Make sure project is defined before PROJECT_SOURCE_DIR is referenced
  • Loading branch information
lancelotblanchard authored Aug 28, 2024
1 parent bf85045 commit 529a3df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,13 @@ cmake_policy(SET CMP0042 NEW) #MACOSX_RPATH is enabled by default
#Windows 10 camplains
cmake_policy(SET CMP0054 NEW) # quoted arguments will not be further dereferenced

# project name
project(lomse)

#prevent in-source builds
# make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
get_filename_component(srcdir "${PROJECT_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${PROJECT_BINARY_DIR}" REALPATH)

# disallow in-source builds
if("${srcdir}" STREQUAL "${bindir}")
Expand All @@ -233,10 +236,6 @@ cmake_policy(SET CMP0054 NEW) # quoted arguments will not be further dereferen
message(FATAL_ERROR "Quitting configuration")
endif()


# project name
project(lomse)

# uncomment for debugging
#set(CMAKE_VERBOSE_MAKEFILE on)

Expand Down Expand Up @@ -419,8 +418,8 @@ message(STATUS "")
include( ${LOMSE_ROOT_DIR}/build-version.cmake )

add_custom_target (build-version ALL
COMMAND ${CMAKE_COMMAND} -D LOMSE_ROOT_DIR=${CMAKE_SOURCE_DIR} -P ${CMAKE_SOURCE_DIR}/build-version.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -D LOMSE_ROOT_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/build-version.cmake
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "setting Lomse version information ...")

# identify platform and compiler
Expand Down
6 changes: 6 additions & 0 deletions src/render/lomse_font_freetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ bool decompose_ft_outline(const FT_Outline& outline, bool flip_y, const trans_af

FT_Vector* point;
FT_Vector* limit;
// Freetype version 2.13.3 and later uses unsigned char for tags
#if (FREETYPE_MAJOR > 2) || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR > 13) || \
(FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 13 && FREETYPE_PATCH >= 3)
unsigned char* tags;
#else
char* tags;
#endif

int n; // index of contour in outline
int first; // index of first point in contour
Expand Down

0 comments on commit 529a3df

Please sign in to comment.