-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d84d322
commit 989205f
Showing
172 changed files
with
62,766 additions
and
239 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,4 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
|
||
file(GLOB_RECURSE GIF_LIB ${CMAKE_SOURCE_DIR}/giflib/*.*) | ||
file(GLOB_RECURSE FRAME_SEQUENCE ${CMAKE_SOURCE_DIR}/*.cpp*) | ||
|
||
add_library(gifjni | ||
SHARED | ||
${FRAME_SEQUENCE} | ||
${GIF_LIB}) | ||
|
||
list(APPEND LIBS | ||
jnigraphics | ||
android | ||
GLESv2 | ||
log | ||
) | ||
|
||
set(LIBS) | ||
list(APPEND LIBS | ||
jnigraphics | ||
android | ||
GLESv2 | ||
log | ||
) | ||
|
||
target_link_libraries(gifjni ${LIBS}) | ||
add_subdirectory(gif) | ||
add_subdirectory(sticker) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
|
||
file(GLOB_RECURSE GIF_LIB ${CMAKE_SOURCE_DIR}/gif/giflib/*.*) | ||
file(GLOB_RECURSE FRAME_SEQUENCE ${CMAKE_SOURCE_DIR}/gif/*.cpp*) | ||
add_library(gifjni | ||
SHARED | ||
${FRAME_SEQUENCE} | ||
${GIF_LIB}) | ||
|
||
list(APPEND LIBS | ||
jnigraphics | ||
android | ||
GLESv2 | ||
log | ||
) | ||
|
||
set(LIBS) | ||
list(APPEND LIBS | ||
jnigraphics | ||
android | ||
GLESv2 | ||
log | ||
) | ||
|
||
target_link_libraries(gifjni ${LIBS}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
#rlottie base on Telegram 7.9.3 | ||
cmake_minimum_required(VERSION 3.4.1) | ||
message(+++++++++++++++++++++++++++++++++++++cmake:${CMAKE_LIBRARY_OUTPUT_DIRECTORY}${CMA}) | ||
set(CMAKE_CXX_FLAGS "-std=c++14 -DANDROID") | ||
set(CMAKE_C_FLAGS "-w -std=c11 -DANDROID -D_LARGEFILE_SOURCE=1") | ||
set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,sticker/liblz4.a,sticker/librlottie.a") | ||
|
||
if (${ANDROID_ABI} STREQUAL "armeabi-v7a" OR ${ANDROID_ABI} STREQUAL "arm64-v8a") | ||
enable_language(ASM) | ||
else() | ||
enable_language(ASM_NASM) | ||
endif() | ||
|
||
#rlottie | ||
add_library(rlottie STATIC | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottieanimation.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottieitem.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottiekeypath.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottieloader.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottiemodel.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottieparser.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/lottie/lottieproxymodel.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/freetype/v_ft_math.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/freetype/v_ft_raster.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/freetype/v_ft_stroker.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/pixman/vregion.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/stb/stb_image.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vbezier.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vbitmap.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vbrush.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vcompositionfunctions.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vdasher.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vdebug.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vdrawable.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vdrawhelper.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vdrawhelper_neon.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/velapsedtimer.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vimageloader.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vinterpolator.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vmatrix.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vpainter.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vpath.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vpathmesure.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vraster.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vrect.cpp | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/vrle.cpp) | ||
target_compile_options(rlottie PUBLIC | ||
-Wall -fno-rtti -finline-functions -ffast-math -Os -fno-unwind-tables -fno-asynchronous-unwind-tables -Wnon-virtual-dtor -Woverloaded-virtual -Wno-unused-parameter -fvisibility=hidden) | ||
set_target_properties(rlottie PROPERTIES | ||
ANDROID_ARM_MODE arm) | ||
target_compile_definitions(rlottie PUBLIC | ||
HAVE_PTHREAD NDEBUG) | ||
target_include_directories(rlottie PUBLIC | ||
${PROJECT_SOURCE_DIR}/sticker/./ | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/inc | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/ | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/pixman | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/freetype | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/stb) | ||
|
||
if (${ANDROID_ABI} STREQUAL "armeabi-v7a") | ||
target_compile_options(rlottie PUBLIC | ||
-fno-integrated-as) | ||
target_compile_definitions(rlottie PUBLIC | ||
USE_ARM_NEON) | ||
target_sources(rlottie PRIVATE | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/pixman/pixman-arm-neon-asm.S) | ||
elseif(${ANDROID_ABI} STREQUAL "arm64-v8a") | ||
target_compile_options(rlottie PUBLIC | ||
-fno-integrated-as) | ||
target_compile_definitions(rlottie PUBLIC | ||
USE_ARM_NEON __ARM64_NEON__) | ||
target_sources(rlottie PRIVATE | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/src/vector/pixman/pixman-arma64-neon-asm.S) | ||
endif() | ||
|
||
#lz4 | ||
add_library(lz4 STATIC | ||
${PROJECT_SOURCE_DIR}/sticker/lz4/lz4.c | ||
${PROJECT_SOURCE_DIR}/sticker/lz4/lz4frame.c | ||
${PROJECT_SOURCE_DIR}/sticker/lz4/xxhash.c) | ||
target_compile_options(lz4 PUBLIC | ||
-w -O3) | ||
set_target_properties(lz4 PROPERTIES | ||
ANDROID_ARM_MODE arm) | ||
|
||
set(NATIVE_LIB "tmessages.40") | ||
|
||
#tmessages | ||
add_library(${NATIVE_LIB} SHARED | ||
${PROJECT_SOURCE_DIR}/sticker/jni.c | ||
${PROJECT_SOURCE_DIR}/sticker/lottie.cpp) | ||
|
||
target_compile_options(${NATIVE_LIB} PUBLIC | ||
-ffast-math -Os -funroll-loops -ffast-math -fno-strict-aliasing -fno-math-errno) | ||
|
||
target_compile_definitions(${NATIVE_LIB} PUBLIC | ||
BSD=1 NULL=0 SOCKLEN_T=socklen_t ANDROID_NDK DISABLE_IMPORTGL AVOID_TABLES ANDROID_TILE_BASED_DECODE __STDC_CONSTANT_MACROS ANDROID_ARMV6_IDCT OPUS_BUILD FIXED_POINT USE_ALLOCA restrict= __EMX__ LOCALE_NOT_USED HAVE_LRINT HAVE_LRINTF) | ||
|
||
if (${ANDROID_ABI} STREQUAL "armeabi-v7a") | ||
set_target_properties(${NATIVE_LIB} PROPERTIES | ||
ANDROID_ARM_NEON FALSE | ||
ANDROID_ARM_MODE arm) | ||
target_compile_definitions(${NATIVE_LIB} PUBLIC | ||
ANDROID_ARM_NEON=false) | ||
else() | ||
set_target_properties(${NATIVE_LIB} PROPERTIES | ||
ANDROID_ARM_NEON FALSE | ||
ANDROID_ARM_MODE arm) | ||
endif() | ||
|
||
if (${ANDROID_ABI} STREQUAL "armeabi-v7a" OR ${ANDROID_ABI} STREQUAL "arm64-v8a") | ||
target_compile_definitions(${NATIVE_LIB} PUBLIC | ||
LIBYUV_NEON OPUS_HAVE_RTCD OPUS_ARM_ASM) | ||
|
||
elseif(${ANDROID_ABI} STREQUAL "x86") | ||
target_compile_definitions(${NATIVE_LIB} PUBLIC | ||
x86fix) | ||
endif() | ||
|
||
target_include_directories(${NATIVE_LIB} PUBLIC | ||
${PROJECT_SOURCE_DIR}/sticker/rlottie/inc | ||
${PROJECT_SOURCE_DIR}/sticker/lz4) | ||
target_link_libraries(${NATIVE_LIB} | ||
-Wl,--whole-archive -Wl,--no-whole-archive | ||
lz4 | ||
rlottie | ||
jnigraphics | ||
log | ||
z | ||
GLESv2 | ||
EGL | ||
android | ||
OpenSLES | ||
cpufeatures) | ||
|
||
if (${ANDROID_ABI} STREQUAL "x86" OR ${ANDROID_ABI} STREQUAL "x86_64") | ||
target_link_libraries(${NATIVE_LIB} | ||
-Wl,--whole-archive -Wl,--no-whole-archive) | ||
endif() | ||
|
||
#if (${ANDROID_ABI} STREQUAL "x86" OR ${ANDROID_ABI} STREQUAL "x86_64") | ||
# target_link_libraries(${NATIVE_LIB} | ||
# -Wl,--whole-archive vpxasm -Wl,--no-whole-archive | ||
# c) | ||
#endif() | ||
|
||
include(AndroidNdkModules) | ||
android_ndk_import_module_cpufeatures() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef log_h | ||
#define log_h | ||
|
||
#include <android/log.h> | ||
#include <jni.h> | ||
|
||
#define LOG_TAG "tmessages_native" | ||
#ifndef LOG_DISABLED | ||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) | ||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) | ||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) | ||
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) | ||
#else | ||
#define LOGI(...) | ||
#define LOGD(...) | ||
#define LOGE(...) | ||
#define LOGV(...) | ||
#endif | ||
|
||
#ifndef MAX | ||
#define MAX(x, y) ((x) > (y)) ? (x) : (y) | ||
#endif | ||
#ifndef MIN | ||
#define MIN(x, y) ((x) < (y)) ? (x) : (y) | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <jni.h> | ||
#include <stdlib.h> | ||
|
||
jint JNI_OnLoad(JavaVM *vm, void *reserved) { | ||
JNIEnv *env = NULL; | ||
|
||
if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_6) != JNI_OK) { | ||
return -1; | ||
} | ||
return JNI_VERSION_1_6; | ||
} | ||
|
||
void JNI_OnUnload(JavaVM *vm, void *reserved) { | ||
|
||
} | ||
|
Oops, something went wrong.