comparison mupdf-source/thirdparty/tesseract/cmake/CheckFunctions.cmake @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
2 # use this file except in compliance with the License. You may obtain a copy of
3 # the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
4 # applicable law or agreed to in writing, software distributed under the License
5 # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6 # KIND, either express or implied. See the License for the specific language
7 # governing permissions and limitations under the License.
8 # ##############################################################################
9 #
10 # macros and functions
11 #
12 # ##############################################################################
13
14 # ##############################################################################
15 # FUNCTION check_leptonica_tiff_support
16 # ##############################################################################
17 function(check_leptonica_tiff_support)
18 # check if leptonica was build with tiff support set result to
19 # LEPT_TIFF_RESULT
20 set(TIFF_TEST
21 "#include \"leptonica/allheaders.h\"\n"
22 "int main() {\n"
23 " l_uint8 *data = NULL;\n"
24 " size_t size = 0;\n"
25 " PIX* pix = pixCreate(3, 3, 4);\n"
26 " l_int32 ret_val = pixWriteMemTiff(&data, &size, pix, IFF_TIFF_G3);\n"
27 " pixDestroy(&pix);\n"
28 " lept_free(data);\n"
29 " return ret_val;}\n")
30 if(${CMAKE_VERSION} VERSION_LESS "3.25")
31 message(STATUS "Testing TIFF support in Leptonica is available with CMake >= 3.25 (you have ${CMAKE_VERSION}))")
32 else()
33 set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
34 try_run(
35 LEPT_TIFF_RESULT
36 LEPT_TIFF_COMPILE_SUCCESS
37 SOURCE_FROM_CONTENT tiff_test.cpp "${TIFF_TEST}"
38 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${Leptonica_INCLUDE_DIRS}"
39 LINK_LIBRARIES ${Leptonica_LIBRARIES}
40 COMPILE_OUTPUT_VARIABLE
41 COMPILE_OUTPUT)
42 if(NOT LEPT_TIFF_COMPILE_SUCCESS)
43 message(STATUS "COMPILE_OUTPUT: ${COMPILE_OUTPUT}")
44 message(STATUS "Leptonica_INCLUDE_DIRS: ${Leptonica_INCLUDE_DIRS}")
45 message(STATUS "Leptonica_LIBRARIES: ${Leptonica_LIBRARIES}")
46 message(STATUS "LEPT_TIFF_RESULT: ${LEPT_TIFF_RESULT}")
47 message(STATUS "LEPT_TIFF_COMPILE: ${LEPT_TIFF_COMPILE}")
48 message(WARNING "Failed to compile test")
49 endif()
50 endif()
51 endfunction(check_leptonica_tiff_support)
52
53 # ##############################################################################