Skip to content

Commit

Permalink
Add ENABLE_LEPTWIN option and default off
Browse files Browse the repository at this point in the history
leftwin.c does not build on Windows Server 2019 targets but seems
that tesseract does not actually use it, so disable builds
  • Loading branch information
john-forrest committed Oct 4, 2024
1 parent 21bfa15 commit 8e74e8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ option(ENABLE_JPEG "Enable JPEG support" ON)
option(ENABLE_TIFF "Enable TIFF support" ON)
option(ENABLE_WEBP "Enable WebP support" OFF)
option(ENABLE_OPENJPEG "Enable OpenJPEG support" OFF)

if(WIN32)
option(ENABLE_LEPTWIN "Build leptwin.c on Windows" OFF)
endif()
set(leptonica_INSTALL_CMAKE_DIR
"lib/cmake/leptonica"
CACHE STRING "Install destination for CMake package files")
Expand Down
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
file(GLOB hdr "*.h")
file(GLOB src "*.c")

if (NOT WIN32 OR NOT ENABLE_LEPTWIN)
# leptwin.c can be a problem to compile on some environments
# the main use of this module (tesseract) no longer seems to need it
list(FILTER src EXCLUDE REGEX .*leptwin.c)
list(FILTER hdr EXCLUDE REGEX .*leptwin.h)
endif()

string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")

add_library (leptonica ${src} ${hdr})
Expand Down

0 comments on commit 8e74e8f

Please sign in to comment.