Skip to content

Commit

Permalink
[build] returned USE_SYSTEM_FREETYPE option
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Aug 10, 2023
1 parent 8a99a85 commit 9ab6b32
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ option(MUE_COMPILE_USE_PCH "Use precompiled headers." ON)
option(MUE_COMPILE_USE_UNITY "Use unity build." ON)
option(MUE_COMPILE_USE_CCACHE "Try use ccache" ON)
option(MUE_COMPILE_USE_SHARED_LIBS_IN_DEBUG "Build shared libs if possible in debug" OFF)
option(MUE_COMPILE_USE_SYSTEM_FREETYPE "Try use system freetype" OFF) # Important for the maintainer of Linux distributions

# === Debug ===
option(MUE_ENABLE_LOGGER_DEBUGLEVEL "Enable logging debug level" ON)
Expand Down
34 changes: 34 additions & 0 deletions build/cmake/SetupFreeType.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-CLA-applies
#
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2023 MuseScore BVBA and others
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

if (MUE_COMPILE_USE_SYSTEM_FREETYPE)
find_package(Freetype)
if (FREETYPE_FOUND)
message(STATUS "Found freetype: ${FREETYPE_VERSION_STRING}")
else()
message(WARNING "Set MUE_COMPILE_USE_SYSTEM_FREETYPE=ON, but system freetype not found, built-in will be used")
endif()
endif()

if (NOT FREETYPE_FOUND)
add_subdirectory(${THIRDPARTY_DIR}/freetype freetype)
set(FREETYPE_LIBRARIES freetype)
set(FREETYPE_INCLUDE_DIRS ${THIRDPARTY_DIR}/freetype/include)
endif()
6 changes: 3 additions & 3 deletions src/framework/draw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ else()
${CMAKE_CURRENT_LIST_DIR}/internal/qimagepainterprovider.h
)

add_subdirectory(${THIRDPARTY_DIR}/freetype freetype)
set(MODULE_INCLUDE ${THIRDPARTY_DIR}/freetype/include)
set(MODULE_LINK freetype)
include(SetupFreeType)
set(MODULE_INCLUDE ${FREETYPE_INCLUDE_DIRS})
set(MODULE_LINK ${FREETYPE_LIBRARIES})

endif()

Expand Down

0 comments on commit 9ab6b32

Please sign in to comment.