Skip to content

Commit

Permalink
Merge pull request #2 from xsacha/hunter
Browse files Browse the repository at this point in the history
Hunterised 1.74.2
  • Loading branch information
ruslo authored May 30, 2017
2 parents 24162f7 + 95c63fe commit 3d6bf48
Show file tree
Hide file tree
Showing 343 changed files with 20,672 additions and 14,270 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# build directories
/build*
/cppan*
/.cppan*
/win*

# files in prog without a .
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ before_install:
install:
- if [[ $LINUX ]]; then sudo apt-get update; fi
- if [[ $LINUX ]]; then sudo apt-get install -y libwebp-dev libpng12-dev libjpeg8-dev libtiff5-dev libgif-dev libopenjpeg-dev; fi
- wget --no-check-certificate http://www.cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.sh
- sudo sh cmake-3.4.1-Linux-x86_64.sh --skip-license --prefix=/usr
- if [[ $LINUX ]]; then wget https://www.cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.sh; fi
- if [[ $LINUX ]]; then sudo sh cmake-3.6.1-Linux-x86_64.sh --skip-license --prefix=/usr; fi

script:
- mkdir build
Expand Down
97 changes: 58 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
)
endif()

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake")
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.18.65.tar.gz"
SHA1 "59cd3223f10ee630bc3596709a22f2fea4926a7c"
)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")

# Use solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")

###############################################################################
#
# project settings
Expand All @@ -41,20 +43,43 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")
project(leptonica C CXX)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 73)
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})

find_package(GIF)
find_package(JPEG)
find_package(PNG)
find_package(TIFF)
find_package(ZLIB)
set(VERSION_MINOR 74)
set(VERSION_PATCH 2)
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

option(BUILD_PROG "Build utility programs" OFF)

if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan)
find_package(GIF)
hunter_add_package(Jpeg)
find_package(JPEG CONFIG REQUIRED)
hunter_add_package(PNG)
find_package(PNG CONFIG REQUIRED)
hunter_add_package(TIFF)
find_package(TIFF CONFIG REQUIRED)
hunter_add_package(ZLIB)
find_package(ZLIB CONFIG REQUIRED)

find_package(PkgConfig)

if (PKG_CONFIG_FOUND)
pkg_check_modules(WEBP libwebp)
pkg_check_modules(JP2K libopenjp2)
endif()
else()
add_subdirectory(.cppan)

find_package(PkgConfig)
add_definitions(
-DHAVE_LIBGIF=1
-DHAVE_LIBJPEG=1
-DHAVE_LIBPNG=1
-DHAVE_LIBTIFF=1
-DHAVE_LIBWEBP=1
-DHAVE_LIBZ=1

if (PKG_CONFIG_FOUND)
pkg_check_modules(WEBP libwebp)
pkg_check_modules(JP2K libopenjp2)
-DHAVE_LIBJP2K=1
-DLIBJP2K_HEADER="openjpeg.h"
)
endif()

###############################################################################
Expand All @@ -70,48 +95,32 @@ endif()

if (WIN32)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
endif()

if(EXISTS ${PROJECT_SOURCE_DIR}/cppan)
# cppan settings
add_definitions(-DTIF_PLATFORM_CONSOLE=1)

add_subdirectory(cppan)

# leptonica settings
add_definitions(
-DHAVE_LIBGIF=1
-DHAVE_LIBJPEG=1
-DHAVE_LIBPNG=1
-DHAVE_LIBTIFF=1
-DHAVE_LIBWEBP=1
-DHAVE_LIBZ=1
)
endif()

###############################################################################
#
# configure
#
###############################################################################

set(AUTOCONFIG_SRC ${CMAKE_BINARY_DIR}/config_auto.h.in)
set(AUTOCONFIG ${CMAKE_BINARY_DIR}/src/config_auto.h)
set(AUTOCONFIG_SRC ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h.in)
set(AUTOCONFIG ${CMAKE_CURRENT_BINARY_DIR}/src/config_auto.h)

include(Configure)

configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)

set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" "${CMAKE_INSTALL_PREFIX}/include/leptonica")

configure_file(
${CMAKE_SOURCE_DIR}/cmake/templates/LeptonicaConfig-version.cmake.in
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/LeptonicaConfig-version.cmake.in
${CMAKE_BINARY_DIR}/LeptonicaConfig-version.cmake @ONLY)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/templates/LeptonicaConfig.cmake.in
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/LeptonicaConfig.cmake.in
${CMAKE_BINARY_DIR}/LeptonicaConfig.cmake @ONLY)

###############################################################################
Expand All @@ -131,4 +140,14 @@ endif()

add_subdirectory(src)

get_target_property(leptonica_NAME leptonica NAME)
get_target_property(leptonica_VERSION leptonica VERSION)
get_target_property(leptonica_OUTPUT_NAME leptonica OUTPUT_NAME)
configure_file(lept.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/lept.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lept.pc DESTINATION lib/pkgconfig)
install(FILES
${CMAKE_BINARY_DIR}/LeptonicaConfig.cmake
${CMAKE_BINARY_DIR}/LeptonicaConfig-version.cmake
DESTINATION cmake)

###############################################################################
100 changes: 68 additions & 32 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/

README (1.73+: 8 Feb 2016)
README (1.74.2: 19 May 2017)
---------------------------

gunzip leptonica-1.73+.tar.gz
tar -xvf leptonica-1.73+.tar
gunzip leptonica-1.74.2.tar.gz
tar -xvf leptonica-1.74.2.tar

</pre>

Expand Down Expand Up @@ -115,7 +115,7 @@ <h2> <A NAME="BUILDING">
Libraries, executables and prototypes are easily made, as described below.

When you extract from the archive, all files are put in a
subdirectory 'leptonica-1.73'. In that directory you will
subdirectory 'leptonica-1.74.2'. In that directory you will
find a src directory containing the source files for the library,
and a prog directory containing source files for various
testing and example programs.
Expand Down Expand Up @@ -145,16 +145,15 @@ <h2> <A NAME="BUILDING">
(3) Using cmake (supported by Egor Pugin).
The build must always be in a different directory from the root
of the source (here). It is common to build in a subdirectory
of the root. From here:
mkdir build
cd build
cmake ..
make
Alternatively, from here:
mkdir build
cmake -H . -Bbuild (-H means the source directory,
-B means the directory for the build
make
of the root. From the root directory, do this:
mkdir build
cd build
Then to make only the library:
cmake ..
make
To make both the library and the programs:
cmake .. -DBUILD_PROG=1
make
To clean out the current build, just remove everything in
the build subdirectory.

Expand Down Expand Up @@ -236,8 +235,22 @@ <h2> <A NAME="BUILDING">
should not exceed half the number of cores.
If the test fails, just run with 'make check']

Configure supports installing in a local directory (e.g., one that
doesn't require root access). For example, to install in $HOME/local,
./configure --prefix=$HOME/local/
make install
For different ways to build and link leptonica with tesseract, see
https://github.com/tesseract-ocr/tesseract/wiki/Compiling
In brief, using autotools to build tesseract and then install it
in $HOME/local (after installing leptonica there), do the
following from your tesseract root source directory:
./autogen.sh
LIBLEPT_HEADERSDIR=$HOME/local/include ./configure \
--prefix=$HOME/local/ --with-extra-libraries=$HOME/local/lib
make install

Configure also supports building in a separate directory from the
source. Run "/(path-to)/leptonica-1.73/configure" and then "make"
source. Run "/(path-to)/leptonica-1.74.2/configure" and then "make"
from the desired build directory.

Configure has a number of useful options; run "configure --help" for
Expand Down Expand Up @@ -268,17 +281,36 @@ <h2> <A NAME="BUILDING">

(3) Using cmake

There are a couple of flags you can use on the cmake line to
determine what is built here.
The usual method is to build in a directory that is a subdirectory
of the root. First do this from the root directory:
mkdir build
cd build

Then, there are two useful flags you can use on the cmake line to
determine what is built.

* By default, cmake builds a shared library. To make a static
library:
cmake .. -DSTATIC=1

* By default, cmake only builds the library, not the programs.
To make progs from the build subdirectory:
To make both the library and the programs:
cmake .. -DBUILD_PROG=1

The programs are put in build/bin/
To run these (e.g., for testing), move them to the prog
directory and run them from there:
cd bin
mv * ../../prog/
cd ../../prog
alltests_reg generate
alltests_reg compare

To build the library directly from the root directory instead of
the build subdirectory:
mkdir build
cmake -H . -Bbuild (-H means the source directory,
-B means the directory for the build
make

3. Building on Windows

Expand Down Expand Up @@ -1043,21 +1075,24 @@ <h2> <A NAME="CONTENTS">
16. Versions

New versions of the Leptonica library are released several times
a year, and version numbers are provided for each release in
src/makefile.static and in allheaders.h. All even versions from
1.42 to 1.60 were originally archived at http://code.google.com/p/leptonica,
as well as all versions after 1.60. These have now been transferred
by Egor Pugin to github:
a year, and version numbers are provided for each release in the
following files:
src/makefile.static
CMakeLists.txt
configure.ac
allheaders_top.txt (and consequently allheaders.h)
All even versions from 1.42 to 1.60 were originally archived at
http://code.google.com/p/leptonica, as well as all versions after 1.60.
These have now been transferred by Egor Pugin to github:
github.com/danbloomberg/leptonica
Recent releases (1.67 - 1.73) are available both at
where all releases (1.42 - 1.74.2) are available; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/v1.74.2
Most recent releases from 1.67 are also available at
leptonica.org/download.html
and through github; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/v1.73
Note that in most cases if you are downloading from github, you
should download releases, because the the master at github should
always be considered to be unstable. If you download from the master
you need to run the autobuild script to generate configure and
the Makefiles.
Note that if you are downloading from github, the releases are more
likely to be stable than the master. Also, if you download from
the master you need to run the autobuild script to generate the
configure program and the Makefiles.

The number of downloads of leptonica increased by nearly an order
of magnitude with 1.69, due to bundling with tesseract and
Expand All @@ -1069,6 +1104,7 @@ <h2> <A NAME="CONTENTS">
1.71 : 4.2.0
1.72 : 4.3.0
1.73 : 5.0.0
1.74 : 5.1.0

A brief version chronology is maintained in version-notes.html.
Starting with gcc 4.3.3, error warnings (-Werror) are given for
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build Status](https://travis-ci.org/DanBloomberg/leptonica.svg?branch=master)](https://travis-ci.org/DanBloomberg/leptonica)
[![Build status](https://ci.appveyor.com/api/projects/status/vsk607rr6n4j2tmk?svg=true)](https://ci.appveyor.com/project/DanBloomberg/leptonica)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/leptonica/badge.svg)](https://scan.coverity.com/projects/leptonica)

www.leptonica.org

Expand All @@ -22,7 +23,7 @@ www.leptonica.org

## Ancillary utilities ##

* I/O for standard image formats (_jpg_, _png_, _tiff_, _bmp_, _pnm_, _gif_, _ps_, _pdf_, _webp_)
* I/O for standard image formats (_jpg_, _png_, _tiff_, _webp_, _jp2_, _bmp_, _pnm_, _gif_, _ps_, _pdf_)
* Utilities to handle arrays of image-related data types (e.g., _pixa_, _boxa_, _pta_)
* Utilities for stacks, generic arrays, queues, heaps, lists; number and string arrays; etc.

Expand Down Expand Up @@ -55,13 +56,21 @@ www.leptonica.org
* _Robust_: all ptr args checked; extensive use of accessors; exit not permitted
* _Tested_: thorough regression tests provided for most basic functions; valgrind tested
* _ANSI C_: automatically generated prototype header file
* _Portable_: endian-independent; builds in linux, osx, mingw, cygwin, windows
* _Portable_: endian-independent; builds in Linux, macOS, MinGW, Cygwin, Windows
* _Nearly thread-safe_: ref counting on some structs
* _Documentation_: large number of in-line comments; web pages for further background
* _Examples_: many programs provided to test and show usage of approx. 2200 functions in the library
* _Documentation_: large number of in-line comments; doxygen; web pages for further background
* _Examples_: many programs provided to test and show usage of approx. 2600 functions in the library


## Open Source Projects that use Leptonica ##
* [php](http://en.wikipedia.org/wiki/PHP) (scripting language for dynamic web pages)
* [tesseract](https://github.com/tesseract-ocr/tesseract/) (optical character recognition)
* [jbig2enc](http://www.imperialviolet.org/jbig2.html) (encodes multipage binary image documents with jbig2 compression)

## Major contributors to Leptonica ##
* Tom Powers: Tom has supported Leptonica on Windows for many years. He has made many contributions to code quality and documentation, including the beautiful "unofficial documentation" on the web site. Without his effort, Leptonica would not run today on Windows.
* David Bryan: David has worked for years to support Leptonica on multiple platforms. He designed many nice features in Leptonica, such as the severity-based error messaging system, and has identified and fixed countless bugs. And he has built and tested each distribution many times on cross-compilers.
* James Le Cuirot: James has written and supported the autotools scripts on Leptonica distributions for many years, and has helped test every distribution since 1.67.
* Jeff Breidenbach: Jeff has built every Debian distribution for Leptonica. He has also made many improvements to formatted image I/O, including tiff, png and pdf. He is a continuous advocate for simplification.
* Egor Pugin: Egor is co-maintainer of Leptonica on GitHub. He ported everything, including all the old distributions, from Google Code when it shut down. He set Leptonica up for appveyor and travis testing, and has implemented the cppan project, which simplifies building executables on Windows.
* Jürgen Buchmüller: Jürgen wrote text converters to modify Leptonica source code so that it generates documentation using doxygen. He also wrote tiff wrappers for memory I/O.
Loading

0 comments on commit 3d6bf48

Please sign in to comment.