Skip to content

Commit

Permalink
Switch djvu build to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
max-kammerer committed Nov 6, 2023
1 parent 0d4c0f9 commit cc5e7f0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 47 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 21 additions & 13 deletions nativeLibs/djvuModule/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

}
// buildTypes {
// release {
// ndk {
// debugSymbolLevel 'full'
// }
// }
// }
//
// packagingOptions {
// // specify the path to your object binaries, or generally:
// doNotStrip '**.so'
// }
}

42 changes: 18 additions & 24 deletions nativeLibs/djvuModule/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
Expand Down Expand Up @@ -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)
target_link_libraries(djvu djvucore -lm -llog -ljnigraphics)
16 changes: 6 additions & 10 deletions nativeLibs/mupdfModule/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit cc5e7f0

Please sign in to comment.