Warning, /graphics/krita/3rdparty_vendor/raqm/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2023 Alvin Wong <alvin@alvinhc.com> 0002 # SPDX-License-Identifier: BSD-2-Clause 0003 0004 #[=======================================================================[ 0005 0006 This CMake file builds a patched libraqm as a static library to be linked from 0007 Krita (libkritaflake). We use FetchContent to download a copy of the unmodified 0008 libraqm source and patch it locally. 0009 0010 FetchContent provides a way to use existing source instead of a downloaded copy. 0011 By setting `FETCHCONTENT_SOURCE_DIR_LIBRAQM_SRC` to the path of a local copy of 0012 the patched libraqm source, you can skip the download step, and you will be 0013 able to modify the local copy of the libraqm source to test out changes. 0014 0015 #]=======================================================================] 0016 0017 0018 project(libraqm 0019 VERSION 0.10.1.1 0020 DESCRIPTION "A library for complex text layout" 0021 HOMEPAGE_URL "https://github.com/HOST-Oman/libraqm" 0022 LANGUAGES C 0023 ) 0024 0025 ## 0026 ## Check for FriBidi 0027 ## 0028 find_package(FriBidi 1.0.6 REQUIRED) 0029 set_package_properties(FriBidi PROPERTIES 0030 DESCRIPTION "GNU FriBidi" 0031 URL "https://github.com/fribidi/fribidi" 0032 TYPE REQUIRED 0033 PURPOSE "Needed by libraqm to perform bidirectional text layout." 0034 ) 0035 0036 0037 include(FetchContent) 0038 if(NOT DEFINED PATCH_COMMAND) 0039 if(WIN32) 0040 set(PATCH_COMMAND patch --binary) 0041 else() 0042 set(PATCH_COMMAND patch) 0043 endif() 0044 endif() 0045 0046 0047 if (USE_EXTERNAL_RAQM) 0048 set(RAQM_FETCHCONTENT_ARGS 0049 URL https://github.com/HOST-Oman/libraqm/releases/download/v0.10.1/raqm-0.10.1.tar.xz 0050 # HACK: Whenever you change this file to add patch commands, it causes 0051 # CMake to rerun the patch commands on the already-patched source, which 0052 # results in a failure. Changing the following fake URL tricks CMake 0053 # into re-extracting the source so the patch commands can succeed. 0054 http://:0/hack_to_trigger_re-extract-source/20230914 0055 URL_HASH SHA256=4d76a358358d67c5945684f2f10b3b08fb80e924371bf3ebf8b15cd2e321d05d 0056 PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Add-arbitrary-run-break-function.patch 0057 COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Fix-Unicode-codepoint-conversion-from-UTF-16.patch) 0058 else () 0059 set(RAQM_FETCHCONTENT_ARGS SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/raqm-0.10.1) 0060 endif () 0061 0062 FetchContent_Declare( 0063 libraqm_src 0064 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} 0065 ${RAQM_FETCHCONTENT_ARGS} 0066 ) 0067 0068 FetchContent_MakeAvailable(libraqm_src) 0069 if(NOT libraqm_src_POPULATED) 0070 message(FATAL_ERROR "Missing libraqm source.") 0071 endif() 0072 0073 0074 set(CMAKE_AUTOMOC OFF) 0075 0076 set(RAQM_VERSION_MAJOR ${libraqm_VERSION_MAJOR}) 0077 set(RAQM_VERSION_MINOR ${libraqm_VERSION_MINOR}) 0078 set(RAQM_VERSION_MICRO ${libraqm_VERSION_PATCH}) 0079 set(RAQM_VERSION ${libraqm_VERSION}) 0080 configure_file(${libraqm_src_SOURCE_DIR}/src/raqm-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/raqm-version.h @ONLY) 0081 0082 set(libraqm_SRC 0083 ${libraqm_src_SOURCE_DIR}/src/raqm.c 0084 ${libraqm_src_SOURCE_DIR}/src/raqm.h 0085 ) 0086 0087 add_library(libraqm STATIC ${libraqm_SRC}) 0088 set_property(TARGET libraqm PROPERTY C_STANDARD 99) 0089 0090 target_include_directories(libraqm INTERFACE ${libraqm_src_SOURCE_DIR}/src) 0091 target_include_directories(libraqm PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 0092 0093 target_link_libraries(libraqm 0094 PUBLIC 0095 Freetype::Freetype 0096 PRIVATE 0097 HarfBuzz::HarfBuzz 0098 FriBidi::FriBidi 0099 ) 0100 0101 add_library(Raqm::Raqm ALIAS libraqm)