Skip to content

Commit

Permalink
* Migrate builds for Leptonica and Tesseract to CMake ([issue #1163](#…
Browse files Browse the repository at this point in the history
…1163))

 * Introduce `macosx-arm64` builds for Leptonica and Tesseract ([issue #814](#814))
  • Loading branch information
saudet committed Apr 1, 2022
1 parent 78540be commit 50bcfee
Show file tree
Hide file tree
Showing 145 changed files with 746 additions and 866 deletions.
3 changes: 3 additions & 0 deletions .github/actions/deploy-macosx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ runs:
export MACOSX_DEPLOYMENT_TARGET=10.15
echo "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET" >> $GITHUB_ENV
echo Removing broken stuff from Mono
sudo rm -Rf /Library/Frameworks/Mono.framework
if [[ "$CI_DEPLOY_PLATFORM" == "macosx-arm64" ]]; then
echo Removing old SDKs without ARM support
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/MacOSX10*
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/leptonica.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
macosx-arm64:
runs-on: macos-10.15
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
macosx-x86_64:
runs-on: macos-10.15
steps:
Expand All @@ -73,7 +77,7 @@ jobs:
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64]
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-arm64, macosx-x86_64, windows-x86, windows-x86_64]
runs-on: ubuntu-18.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
6 changes: 5 additions & 1 deletion .github/workflows/tesseract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
macosx-arm64:
runs-on: macos-10.15
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
macosx-x86_64:
runs-on: macos-10.15
steps:
Expand All @@ -73,7 +77,7 @@ jobs:
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64]
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-arm64, macosx-x86_64, windows-x86, windows-x86_64]
runs-on: ubuntu-18.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

* Migrate builds for Leptonica and Tesseract to CMake ([issue #1163](https://github.com/bytedeco/javacpp-presets/issues/1163))
* Introduce `macosx-arm64` builds for Leptonica and Tesseract ([issue #814](https://github.com/bytedeco/javacpp-presets/issues/814))
* Map instances of `torch::OrderedDict` using C++ templates from PyTorch ([issue #623](https://github.com/bytedeco/javacpp-presets/issues/623))
* Add presets for Bullet Physics SDK 3.22 ([pull #1153](https://github.com/bytedeco/javacpp-presets/pull/1153))
* Add `long[] pytorch.Tensor.shape()` method for convenience ([pull #1161](https://github.com/bytedeco/javacpp-presets/pull/1161))
Expand Down
342 changes: 207 additions & 135 deletions leptonica/cppbuild.sh

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions leptonica/giflib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
diff -ruN giflib-5.2.1/CMakeLists.txt giflib-5.2.1-patch/CMakeLists.txt
--- giflib-5.2.1/CMakeLists.txt 1970-01-01 09:00:00.000000000 +0900
+++ giflib-5.2.1-patch/CMakeLists.txt 2022-03-31 10:10:57.340022595 +0900
@@ -0,0 +1,142 @@
+cmake_minimum_required(VERSION 2.6.0)
+
+project(giflib C)
+
+SET(BUILD_STATIC_LIBS OFF CACHE BOOL "Whether to also build static libs")
+
+execute_process(COMMAND ./getversion
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+set(LIBMAJOR 7)
+set(LIBMINOR 1)
+set(LIBPOINT 0)
+set(LIBVER "${LIBMAJOR}.${LIBMINOR}.${LIBPOINT}")
+
+set(giflib_SRC
+ dgif_lib.c
+ egif_lib.c
+ getarg.c
+ gifalloc.c
+ gif_err.c
+ gif_font.c
+ gif_hash.c
+ openbsd-reallocarray.c
+ qprintf.c
+ quantize.c
+)
+
+# Some utilities are installed
+set(giflib_INSTALLABLE
+ gif2rgb
+ gifbuild
+ gifecho
+ giffilter
+ giffix
+ gifinto
+ giftext
+ giftool
+ gifsponge
+ gifclrmp
+)
+
+# Some utilities are only used internally for testing.
+# There is a parallel list in doc/Makefile.
+# These are all candidates for removal in future releases.
+set(giflib_UTILS
+ ${giflib_INSTALLABLE}
+ gifbg
+ gifcolor
+ gifhisto
+ gifwedge
+)
+
+file(GLOB giflib_MAN doc/*.1)
+
+### Build library / tools
+
+add_library(giflib SHARED ${giflib_SRC})
+target_link_libraries(giflib m)
+set_target_properties(giflib PROPERTIES VERSION ${LIBVER} SOVERSION ${LIBMAJOR})
+if(WIN32)
+ set_target_properties(giflib PROPERTIES SUFFIX "-${LIBMAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif(WIN32)
+
+if(${BUILD_STATIC_LIBS})
+ add_library(giflib_static STATIC ${giflib_SRC})
+ set_target_properties(giflib_static PROPERTIES OUTPUT_NAME giflib)
+endif(${BUILD_STATIC_LIBS})
+
+
+foreach(UTILITY ${giflib_UTILS})
+ add_executable(${UTILITY} ${UTILITY}.c)
+ target_link_libraries(${UTILITY} giflib)
+endforeach()
+
+### Installation
+
+install(TARGETS giflib
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+)
+
+if(${BUILD_STATIC_LIBS})
+ install(TARGETS giflib_static ARCHIVE DESTINATION lib${LIB_SUFFIX})
+endif(${BUILD_STATIC_LIBS})
+
+foreach(UTILITY ${giflib_UTILS})
+ install(TARGETS ${UTILITY} DESTINATION bin)
+endforeach()
+
+install(FILES gif_lib.h DESTINATION include)
+install(FILES ${giflib_MAN} DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)
+
+
+### Distribution tarball
+set(giflib_DIST
+ *.c
+ *.h
+ README
+ NEWS
+ TODO
+ COPYING
+ getversion
+ ChangeLog
+ CMakeLists.txt
+ build.adoc
+ history.adoc
+ control
+ doc/whatsinagif
+ doc/*.1
+ doc/*.xml
+ doc/*.txt
+ doc/index.html.in
+ doc/00README
+ doc/Makefile
+ tests
+ pic
+)
+# We include all of the XML, and also generated manual pages
+# so people working from the distribution tarball won't need xmlto.
+add_custom_target(dist-gz
+ COMMAND tar --transform='s:^:giflib-${VERSION}/:' -czf giflib-${VERSION}.tar.gz ${giflib_DIST}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+)
+
+add_custom_target(dist-bz2
+ COMMAND tar --transform='s:^:giflib-${VERSION}/:' -cjf giflib-${VERSION}.tar.bz2 ${giflib_DIST}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+)
+
+add_custom_target(dist DEPENDS dist-gz DEPENDS dist-bz2)
+
+
+### Auditing tools
+
+# cppcheck should run clean
+add_custom_target(cppcheck
+ COMMAND cppcheck --inline-suppr --template gcc --enable=all --suppress=unusedFunction --force *.[ch]
+)
9 changes: 8 additions & 1 deletion leptonica/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-ppc64le}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down Expand Up @@ -114,7 +120,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-macosx-arm64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -168,6 +174,7 @@
requires static org.bytedeco.${javacpp.moduleId}.linux.armhf;
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64;
requires static org.bytedeco.${javacpp.moduleId}.linux.ppc64le;
requires static org.bytedeco.${javacpp.moduleId}.macosx.arm64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/BOX.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,15 +8,15 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;



/*-------------------------------------------------------------------------*
* Basic rectangle and rectangle arrays *
*-------------------------------------------------------------------------*/
/** Basic rectangle */
@Name("Box") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("Box") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class BOX extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/BOXA.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,11 +8,11 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;


/** Array of Box */
@Name("Boxa") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("Boxa") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class BOXA extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/BOXAA.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,11 +8,11 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;


/** Array of Boxa */
@Name("Boxaa") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("Boxaa") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class BOXAA extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/CCBORD.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,7 +8,7 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;



Expand Down Expand Up @@ -51,7 +51,7 @@
* global coords.
* </pre>
*/
@Name("CCBord") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("CCBord") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class CCBORD extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/CCBORDA.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,11 +8,11 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;


/** Array of CCBord */
@Name("CCBorda") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("CCBorda") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class CCBORDA extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/DLLIST.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,7 +8,7 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;


/**
Expand Down Expand Up @@ -41,7 +41,7 @@
* </pre>
*/

@Name("DoubleLinkedList") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("DoubleLinkedList") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class DLLIST extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
6 changes: 3 additions & 3 deletions leptonica/src/gen/java/org/bytedeco/leptonica/DPIX.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.leptonica;

Expand All @@ -8,11 +8,11 @@

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.leptonica.global.leptonica.*;


/** Pix with double array */
@Name("DPix") @Properties(inherit = org.bytedeco.leptonica.presets.lept.class)
@Name("DPix") @Properties(inherit = org.bytedeco.leptonica.presets.leptonica.class)
public class DPIX extends AbstractDPIX {
static { Loader.load(); }
/** Default native constructor. */
Expand Down
Loading

0 comments on commit 50bcfee

Please sign in to comment.