From cc5e7f05edf8f05530147c58503a479af45c0c79 Mon Sep 17 00:00:00 2001 From: Michael Bogdanov Date: Mon, 6 Nov 2023 16:55:37 +0100 Subject: [PATCH] Switch djvu build to cmake --- .github/workflows/main.yml | 1 + nativeLibs/djvuModule/build.gradle | 34 +++++++++++------- nativeLibs/djvuModule/cmake/CMakeLists.txt | 42 ++++++++++------------ nativeLibs/mupdfModule/build.gradle | 16 ++++----- 4 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99c559fff..ff7e994f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,7 @@ jobs: nativeLibs/mupdfModule/build nativeLibs/mupdfModule/.cxx nativeLibs/djvuModule/build + nativeLibs/djvuModule/.cxx key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} - name: Prepare thirdparty diff --git a/nativeLibs/djvuModule/build.gradle b/nativeLibs/djvuModule/build.gradle index 47ef4e30d..8a5607a43 100644 --- a/nativeLibs/djvuModule/build.gradle +++ b/nativeLibs/djvuModule/build.gradle @@ -9,24 +9,32 @@ android { buildToolsVersion = orionBuildToolsVersion defaultConfig { - minSdkVersion orionMinSdk - if (!excludeNativeLibsSources) { - externalNativeBuild { - ndkBuild { - cppFlags "-fexceptions", "-frtti" - arguments "APP_STL:=c++_static" - } + + externalNativeBuild { + cmake { + arguments "-DANDROID_STL=c++_static" } } } - if (!excludeNativeLibsSources) { - externalNativeBuild { - ndkBuild { - path "jni/Android.mk" - } + externalNativeBuild { + cmake { + path "cmake/CMakeLists.txt" } } -} \ No newline at end of file +// buildTypes { +// release { +// ndk { +// debugSymbolLevel 'full' +// } +// } +// } +// +// packagingOptions { +// // specify the path to your object binaries, or generally: +// doNotStrip '**.so' +// } +} + diff --git a/nativeLibs/djvuModule/cmake/CMakeLists.txt b/nativeLibs/djvuModule/cmake/CMakeLists.txt index d93f72205..226dfc7f9 100644 --- a/nativeLibs/djvuModule/cmake/CMakeLists.txt +++ b/nativeLibs/djvuModule/cmake/CMakeLists.txt @@ -1,25 +1,11 @@ +#LOCAL_ARM_MODE := arm cmake_minimum_required(VERSION 3.2.2) project("orion-djvu-library") set(MY_ROOT "${PROJECT_SOURCE_DIR}/../../djvu/") set(ANDROID_ROOT "${PROJECT_SOURCE_DIR}/../jni") -# -DDEBUGLVL=6 -DRUNTIME_DEBUG_ONLY -add_definitions(-DHAVE_PTHREAD -DNO_LIBGCC_HOOKS -DHAVE_STDINT_H ) -#-DHAVE_NAMESPACES - -#mbstate and wchar -add_definitions(-DHAS_WCHAR -DHAVE_WCHAR_H -DHAVE_MBSTATE_T -DHAS_MBSTATE -DHAVE_STDINCLUDES) - -add_definitions(-DUNIX) - -#for ernno -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} fexceptions") - - -add_library(oriondjvu STATIC +add_library(djvu SHARED ${ANDROID_ROOT}/djvu.c - ${ANDROID_ROOT}/base_geometry.c - ${ANDROID_ROOT}/../../ ${ANDROID_ROOT}/../../common/list.c ${ANDROID_ROOT}/../../common/orion_bitmap.c ) @@ -84,14 +70,22 @@ add_library(djvucore STATIC ${MY_ROOT}/libdjvu/miniexp.cpp ) -target_include_directories(djvucore PUBLIC - ${MY_ROOT}/libdjvu/ - ) +#djvucore lib +target_include_directories(djvucore PUBLIC ${MY_ROOT}/libdjvu/) -target_include_directories(oriondjvu PUBLIC - ${MY_ROOT}/libdjvu/ - ) +# -DDEBUGLVL=6 -DRUNTIME_DEBUG_ONLY +target_compile_definitions(djvucore PRIVATE -DHAVE_PTHREAD -DNO_LIBGCC_HOOKS -DHAVE_STDINT_H -DHAVE_NAMESPACES -DHAVE_STDINCLUDES) +#mbstate and wchar +target_compile_definitions(djvucore PRIVATE -DHAS_WCHAR -DHAVE_WCHAR_H -DHAVE_MBSTATE_T -DHAS_MBSTATE) +#for ernno +target_compile_definitions(djvucore PRIVATE -DUNIX) + + +#DJVU Android +target_include_directories(djvu PUBLIC ${MY_ROOT}/libdjvu/) + +target_compile_definitions(djvu PRIVATE -DORION_FOR_ANDROID) +target_compile_options(djvu PRIVATE -fexceptions -frtti) -target_compile_options(oriondjvu PRIVATE -fexceptions) -target_link_libraries(oriondjvu djvucore) \ No newline at end of file +target_link_libraries(djvu djvucore -lm -llog -ljnigraphics) \ No newline at end of file diff --git a/nativeLibs/mupdfModule/build.gradle b/nativeLibs/mupdfModule/build.gradle index 35f5c6eac..74ee39793 100644 --- a/nativeLibs/mupdfModule/build.gradle +++ b/nativeLibs/mupdfModule/build.gradle @@ -9,20 +9,16 @@ android { defaultConfig { minSdkVersion orionMinSdk - if (!excludeNativeLibsSources) { - externalNativeBuild { - cmake { - arguments "-DANDROID_STL=c++_static" - } + externalNativeBuild { + cmake { + arguments "-DANDROID_STL=c++_static" } } } - if (!excludeNativeLibsSources) { - externalNativeBuild { - cmake { - path "jni/CMakeLists.txt" - } + externalNativeBuild { + cmake { + path "jni/CMakeLists.txt" } } } \ No newline at end of file