ZaStoGram/TMessagesProj/jni/CMakeLists.txt
loop-uh a918b73f48
Some checks failed
Build three ZaStoGram APKs / build (armeabi-v7a, ZaStoGram-standalone-armeabi-v7a, Armv7, armv7) (push) Failing after 49s
Build three ZaStoGram APKs / build (arm64-v8a, ZaStoGram-standalone-arm64-v8a, Arm64, arm64) (push) Failing after 51s
ZaStoGram source guards / guards (push) Failing after 40s
Build three ZaStoGram APKs / build (x86, ZaStoGram-standalone-x86, X86, x86) (push) Failing after 1m8s
Check connection: a path test that runs the real client code and writes one log
New module (jni/tgnet/pathtest, org.telegram.zastogram.pathtest): for every proxy of the list, the official WSS route
and two control hosts it makes 12 attempts 1.5 s apart through the REAL client code and writes one text log with a
JSONL twin into the logs folder (so the logs screen and its zip export carry it): per-attempt lines (server_hello,
alert, rst, fin, silent, connect_failed with time to first byte, DNS and TCP times), a summary table and a plain
verdict per host and profile.

The probe is not a second client: Naive entries go through naive::CreateFor, the WSS route through the real
wss::Socket (setDiagnosticProbe switches off route-health writes), FakeTLS profiles through composeFakeTlsClientHello,
now the single place ConnectionSocket also builds its hello. The probe peeks the first server bytes to classify the
answer. Secrets are never read (random FakeTLS key, throw-away Naive credentials, only the cover domain of a secret),
hosts are ep-<8 hex of sha256(host:port)> unless real names are ticked, every log field is a closed-vocabulary token.

UI: a row in the proxy settings, an offer after a failed proxy check, share button. Tests: JVM tests of the pure
logic, a native host test against the real WssSocket.cpp and local servers (silent, fin, rst, alert, http, overloaded),
guards updated for the shared hello composer. Verified on an x86_64 emulator against lab shapes and the real relay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-29 12:36:51 +00:00

514 lines
21 KiB
CMake

cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-DANDROID -g")
set(CMAKE_C_FLAGS "-w -std=c11 -DANDROID -D_LARGEFILE_SOURCE=1 -g -Wno-error=implicit-function-declaration")
set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -fvisibility=hidden -flto=full")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -flto=full")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto=full -Wl,--gc-sections -Wl,--icf=safe -Wl,-Bsymbolic")
if (${ANDROID_ABI} STREQUAL "armeabi-v7a" OR ${ANDROID_ABI} STREQUAL "arm64-v8a")
enable_language(ASM)
else()
enable_language(ASM_NASM)
endif()
set(CAN_COMPILE_SME FALSE CACHE INTERNAL "Disable libyuv SME" FORCE)
add_subdirectory(
third_party/libyuv
${CMAKE_CURRENT_BINARY_DIR}/libyuv
EXCLUDE_FROM_ALL)
# Abseil
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_BUILD_TESTING OFF)
set(ABSL_ENABLE_INSTALL OFF)
add_subdirectory(
third_party/absl
${CMAKE_CURRENT_BINARY_DIR}/absl
EXCLUDE_FROM_ALL)
add_library(webrtc_absl INTERFACE)
target_link_libraries(webrtc_absl INTERFACE
absl::base
absl::strings
absl::str_format
absl::cord
absl::synchronization
absl::time
absl::status
absl::statusor
absl::hash
absl::flat_hash_map
absl::flat_hash_set
absl::flags
absl::flags_parse
absl::random_random
absl::random_distributions
absl::crc32c
absl::log
absl::check
)
add_library(avutil STATIC IMPORTED)
set_target_properties(avutil PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libavutil.a)
add_library(avformat STATIC IMPORTED)
set_target_properties(avformat PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libavformat.a)
add_library(avcodec STATIC IMPORTED)
set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libavcodec.a)
add_library(swresample STATIC IMPORTED)
set_target_properties(swresample PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libswresample.a)
add_library(swscale STATIC IMPORTED)
set_target_properties(swscale PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libswscale.a)
add_library(crypto STATIC IMPORTED)
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libcrypto.a)
add_library(ssl STATIC IMPORTED)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libssl.a)
#aesige
#add_library(aesige STATIC openssl/aes_ige.c)
#target_compile_options(aesige PUBLIC -Wall -frtti -finline-functions -ffast-math -Oz)
#target_include_directories(aesige PUBLIC third_party/boringssl/include openssl/include)
#target_link_libraries(aesige crypto)
add_library(libvpx STATIC IMPORTED)
set_target_properties(libvpx PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libvpx.a)
add_library(libdav1d STATIC IMPORTED)
set_target_properties(libdav1d PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libdav1d.a)
add_library(libopus STATIC IMPORTED)
set_target_properties(libopus PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libopus.a)
add_library(tde2e STATIC IMPORTED)
set_target_properties(tde2e PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libtde2e.a)
add_library(tdutils STATIC IMPORTED)
set_target_properties(tdutils PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libtdutils.a)
add_subdirectory(
prisma
${CMAKE_CURRENT_BINARY_DIR}/prisma
EXCLUDE_FROM_ALL)
#tgnet
#add_library(mozjpeg STATIC
# mozjpeg/cjpeg.c mozjpeg/cdjpeg.c mozjpeg/rdgif.c mozjpeg/rdppm.c mozjpeg/rdjpeg.c mozjpeg/rdswitch.c mozjpeg/rdbmp.c
# mozjpeg/rdtarga.c mozjpeg/wrbmp.c mozjpeg/wrtarga.c mozjpeg/djpeg.c mozjpeg/cdjpeg.c mozjpeg/rdcolmap.c mozjpeg/rdswitch.c
# mozjpeg/wrgif.c mozjpeg/wrppm.c mozjpeg/jpegtran.c mozjpeg/cdjpeg.c mozjpeg/rdswitch.c mozjpeg/transupp.c mozjpeg/turbojpeg.c
# mozjpeg/jdatadst-tj.c mozjpeg/jdatasrc-tj.c mozjpeg/jcapimin.c mozjpeg/jcapistd.c mozjpeg/jccoefct.c mozjpeg/jccolor.c
# mozjpeg/jcdctmgr.c mozjpeg/jchuff.c mozjpeg/jcext.c mozjpeg/jcicc.c mozjpeg/jcinit.c mozjpeg/jcmainct.c mozjpeg/jcmarker.c
# mozjpeg/jcmaster.c mozjpeg/jcomapi.c mozjpeg/jcparam.c mozjpeg/jcphuff.c mozjpeg/jcprepct.c mozjpeg/jcsample.c
# mozjpeg/jctrans.c mozjpeg/jdapimin.c mozjpeg/jdapistd.c mozjpeg/jdatadst.c mozjpeg/jdatasrc.c
# mozjpeg/jdcoefct.c mozjpeg/jdcolor.c mozjpeg/jddctmgr.c mozjpeg/jdhuff.c mozjpeg/jdicc.c mozjpeg/jdinput.c
# mozjpeg/jdmainct.c mozjpeg/jdmarker.c mozjpeg/jdmaster.c mozjpeg/jdmerge.c mozjpeg/jdphuff.c mozjpeg/jdpostct.c mozjpeg/jdsample.c
# mozjpeg/jdtrans.c mozjpeg/jerror.c mozjpeg/jfdctflt.c mozjpeg/jfdctfst.c mozjpeg/jfdctint.c mozjpeg/jidctflt.c mozjpeg/jidctfst.c
# mozjpeg/jidctint.c mozjpeg/jidctred.c mozjpeg/jquant1.c mozjpeg/jquant2.c mozjpeg/jutils.c mozjpeg/jmemmgr.c mozjpeg/jmemnobs.c)
#target_compile_options(mozjpeg PUBLIC
# -Os)
#set_target_properties(mozjpeg PROPERTIES
# ANDROID_ARM_MODE arm)
#target_compile_definitions(mozjpeg PUBLIC
# BMP_SUPPORTED GIF_SUPPORTED PPM_SUPPORTED TARGA_SUPPORTED)
#target_include_directories(mozjpeg PUBLIC
# mozjpeg
# mozjpeg/simd/nasm)
#
#if (${ANDROID_ABI} STREQUAL "armeabi-v7a")
# target_sources(mozjpeg PRIVATE
# mozjpeg/simd/arm/jsimd_neon.S
# mozjpeg/simd/arm/jsimd.c)
# target_compile_definitions(mozjpeg PUBLIC
# SIZEOF_SIZE_T=4)
#elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
# target_sources(mozjpeg PRIVATE
# mozjpeg/simd/arm64/jsimd_neon.S
# mozjpeg/simd/arm64/jsimd.c)
# target_compile_definitions(mozjpeg PUBLIC
# SIZEOF_SIZE_T=8)
#elseif(${ANDROID_ABI} STREQUAL "x86")
# set(CMAKE_ASM_NASM_COMPILER_ARG1 "${CMAKE_ASM_NASM_COMPILER_ARG1} -DPIC")
# target_sources(mozjpeg PRIVATE
# mozjpeg/simd/i386/jsimd.c
# mozjpeg/simd/i386/jsimdcpu.asm
# mozjpeg/simd/i386/jfdctflt-3dn.asm
# mozjpeg/simd/i386/jidctflt-3dn.asm
# mozjpeg/simd/i386/jquant-3dn.asm
# mozjpeg/simd/i386/jccolor-mmx.asm
# mozjpeg/simd/i386/jcgray-mmx.asm
# mozjpeg/simd/i386/jcsample-mmx.asm
# mozjpeg/simd/i386/jdcolor-mmx.asm
# mozjpeg/simd/i386/jdmerge-mmx.asm
# mozjpeg/simd/i386/jdsample-mmx.asm
# mozjpeg/simd/i386/jfdctfst-mmx.asm
# mozjpeg/simd/i386/jfdctint-mmx.asm
# mozjpeg/simd/i386/jidctfst-mmx.asm
# mozjpeg/simd/i386/jidctint-mmx.asm
# mozjpeg/simd/i386/jidctred-mmx.asm
# mozjpeg/simd/i386/jquant-mmx.asm
# mozjpeg/simd/i386/jfdctflt-sse.asm
# mozjpeg/simd/i386/jidctflt-sse.asm
# mozjpeg/simd/i386/jquant-sse.asm
# mozjpeg/simd/i386/jccolor-sse2.asm
# mozjpeg/simd/i386/jcgray-sse2.asm
# mozjpeg/simd/i386/jchuff-sse2.asm
# mozjpeg/simd/i386/jcphuff-sse2.asm
# mozjpeg/simd/i386/jcsample-sse2.asm
# mozjpeg/simd/i386/jdcolor-sse2.asm
# mozjpeg/simd/i386/jdmerge-sse2.asm
# mozjpeg/simd/i386/jdsample-sse2.asm
# mozjpeg/simd/i386/jfdctfst-sse2.asm
# mozjpeg/simd/i386/jfdctint-sse2.asm
# mozjpeg/simd/i386/jidctflt-sse2.asm
# mozjpeg/simd/i386/jidctfst-sse2.asm
# mozjpeg/simd/i386/jidctint-sse2.asm
# mozjpeg/simd/i386/jidctred-sse2.asm
# mozjpeg/simd/i386/jquantf-sse2.asm
# mozjpeg/simd/i386/jquanti-sse2.asm
# mozjpeg/simd/i386/jccolor-avx2.asm
# mozjpeg/simd/i386/jcgray-avx2.asm
# mozjpeg/simd/i386/jcsample-avx2.asm
# mozjpeg/simd/i386/jdcolor-avx2.asm
# mozjpeg/simd/i386/jdmerge-avx2.asm
# mozjpeg/simd/i386/jdsample-avx2.asm
# mozjpeg/simd/i386/jfdctint-avx2.asm
# mozjpeg/simd/i386/jidctint-avx2.asm
# mozjpeg/simd/i386/jquanti-avx2.asm)
# target_compile_definitions(mozjpeg PUBLIC
# SIZEOF_SIZE_T=4)
#elseif(${ANDROID_ABI} STREQUAL "x86_64")
# set(CMAKE_ASM_NASM_COMPILER_ARG1 "${CMAKE_ASM_NASM_COMPILER_ARG1} -DPIC")
# set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DELF")
# set(CMAKE_ASM_NASM_DEBUG_FORMAT "dwarf2")
# set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -D__x86_64__")
# target_sources(mozjpeg PRIVATE
# mozjpeg/simd/x86_64/jsimd.c
# mozjpeg/simd/x86_64/jsimdcpu.asm
# mozjpeg/simd/x86_64/jfdctflt-sse.asm
# mozjpeg/simd/x86_64/jccolor-sse2.asm
# mozjpeg/simd/x86_64/jcgray-sse2.asm
# mozjpeg/simd/x86_64/jchuff-sse2.asm
# mozjpeg/simd/x86_64/jcphuff-sse2.asm
# mozjpeg/simd/x86_64/jcsample-sse2.asm
# mozjpeg/simd/x86_64/jdcolor-sse2.asm
# mozjpeg/simd/x86_64/jdmerge-sse2.asm
# mozjpeg/simd/x86_64/jdsample-sse2.asm
# mozjpeg/simd/x86_64/jfdctfst-sse2.asm
# mozjpeg/simd/x86_64/jfdctint-sse2.asm
# mozjpeg/simd/x86_64/jidctflt-sse2.asm
# mozjpeg/simd/x86_64/jidctfst-sse2.asm
# mozjpeg/simd/x86_64/jidctint-sse2.asm
# mozjpeg/simd/x86_64/jidctred-sse2.asm
# mozjpeg/simd/x86_64/jquantf-sse2.asm
# mozjpeg/simd/x86_64/jquanti-sse2.asm
# mozjpeg/simd/x86_64/jccolor-avx2.asm
# mozjpeg/simd/x86_64/jcgray-avx2.asm
# mozjpeg/simd/x86_64/jcsample-avx2.asm
# mozjpeg/simd/x86_64/jdcolor-avx2.asm
# mozjpeg/simd/x86_64/jdmerge-avx2.asm
# mozjpeg/simd/x86_64/jdsample-avx2.asm
# mozjpeg/simd/x86_64/jfdctint-avx2.asm
# mozjpeg/simd/x86_64/jidctint-avx2.asm
# mozjpeg/simd/x86_64/jquanti-avx2.asm)
# target_compile_definitions(mozjpeg PUBLIC
# SIZEOF_SIZE_T=8)
#endif()
# mtproxy_core: self-contained MTProxy/FakeTLS policy engine (see mtproxy/README.md).
# Depends only on BoringSSL; PUBLIC-exports jni/ so consumers include it as
# "mtproxy/MtProxyX.h". Java/socket layers link against this, never vice versa.
add_library(mtproxy_core STATIC
mtproxy/MtProxyAdaptivePolicy.cpp
mtproxy/MtProxyClientHelloPolicy.cpp
mtproxy/MtProxyDataPathShaper.cpp
mtproxy/MtProxyEndpointRecorder.cpp
mtproxy/MtProxyEndpointPolicy.cpp
mtproxy/MtProxyFailureEvidence.cpp
mtproxy/MtProxyHandshakePlan.cpp
mtproxy/MtProxyHandshakeScheduler.cpp
mtproxy/MtProxyProbeCoordinator.cpp
mtproxy/MtProxyProbeLease.cpp
mtproxy/MtProxyRecoveryPolicy.cpp
mtproxy/MtProxyRetryAuthority.cpp
mtproxy/MtProxySecretDomain.cpp
mtproxy/MtProxySocketPublisher.cpp
mtproxy/MtProxyServerFlightParser.cpp
mtproxy/MtProxyStartupTimeline.cpp
mtproxy/MtProxyTerminalDiagnostic.cpp)
target_compile_options(mtproxy_core PUBLIC
-Wall -frtti -finline-functions -ffast-math -Oz)
set_target_properties(mtproxy_core PROPERTIES
ANDROID_ARM_MODE arm)
target_compile_definitions(mtproxy_core PUBLIC
HAVE_PTHREAD)
target_include_directories(mtproxy_core PUBLIC
third_party/boringssl/include
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(mtproxy_core
ssl
crypto)
#tgnet
add_library(tgnet STATIC
openssl/aes_ige.c
tgnet/ApiScheme.cpp
tgnet/BuffersStorage.cpp
tgnet/ByteArray.cpp
tgnet/ByteStream.cpp
tgnet/Connection.cpp
tgnet/ConnectionSession.cpp
tgnet/ConnectionsManager.cpp
tgnet/TLSHello.cpp
tgnet/ConnectionSocket.cpp
tgnet/ConnectionSocketStateMachine.cpp
tgnet/wss/WssSocket.cpp
tgnet/wss/WssPool.cpp
tgnet/pathtest/PathTestProbe.cpp
tgnet/pathtest/PathTestJni.cpp
tgnet/Datacenter.cpp
tgnet/EventObject.cpp
tgnet/FileLog.cpp
tgnet/MTProtoScheme.cpp
tgnet/NativeByteBuffer.cpp
tgnet/Request.cpp
tgnet/Timer.cpp
tgnet/TLObject.cpp
tgnet/ProxyCheckInfo.cpp
tgnet/Handshake.cpp
tgnet/Config.cpp)
target_compile_options(tgnet PUBLIC
-Wall -frtti -finline-functions -ffast-math -Oz)
set_target_properties(tgnet PROPERTIES
ANDROID_ARM_MODE arm)
target_compile_definitions(tgnet PUBLIC
HAVE_PTHREAD)
target_include_directories(tgnet PUBLIC
third_party/boringssl/include
openssl/include)
target_include_directories(tgnet PRIVATE
voip/webrtc)
# ZaStoGram Naive transport (fork-only module, see zsg_naive/README.md)
include(zsg_naive/zsg_naive.cmake)
target_link_libraries(tgnet
mtproxy_core
zsg_naive_socket
ssl
crypto)
# tlottie (prebuilt Rust static library)
add_library(tlottie STATIC IMPORTED)
set_target_properties(tlottie PROPERTIES
IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/prebuild/lib/${ANDROID_ABI}/libtlottie.a)
# Wallet Engine: matching Rust archive and generated UniFFI C++20 wrapper.
set(WALLET_ENGINE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/prebuild/include/wallet-engine)
add_library(wallet_engine STATIC IMPORTED)
set_target_properties(wallet_engine PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/prebuild/lib/${ANDROID_ABI}/libwallet_engine.a)
add_library(wallet_engine_cpp STATIC
${WALLET_ENGINE_INCLUDE_DIR}/wallet_engine.cpp
${WALLET_ENGINE_INCLUDE_DIR}/gram_wallet.cpp)
# Keep C++20 local: existing JNI sources include Breakpad's C++17-only headers.
# Any new source that includes wallet_engine.hpp must also opt into C++20.
target_compile_features(wallet_engine_cpp PRIVATE cxx_std_20)
# Keep unused bindings discardable even when voip resets CMAKE_CXX_FLAGS below.
target_compile_options(wallet_engine_cpp PRIVATE -ffunction-sections -fdata-sections)
target_include_directories(wallet_engine_cpp PUBLIC ${WALLET_ENGINE_INCLUDE_DIR})
target_link_libraries(wallet_engine_cpp PUBLIC wallet_engine dl m)
# Compile the JNI bridge as C++20 without changing the legacy JNI sources.
# An object library keeps its JNI entry points in the existing tmessages .so.
add_library(wallet_engine_jni OBJECT wallet/WalletEngineBridge.cpp wallet/GramWalletAdapter.cpp)
target_compile_features(wallet_engine_jni PRIVATE cxx_std_20)
set_target_properties(wallet_engine_jni PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(wallet_engine_jni PRIVATE wallet_engine_cpp)
#sqlite
add_library(sqlite STATIC
sqlite/sqlite3.c)
target_compile_options(sqlite PUBLIC
-fno-strict-aliasing -Oz)
set_target_properties(sqlite PROPERTIES
ANDROID_ARM_MODE arm)
target_compile_definitions(sqlite PUBLIC
NULL=0 SOCKLEN_T=socklen_t LOCALE_NOT_USED ANDROID_NDK DISABLE_IMPORTGL AVOID_TABLES ANDROID_TILE_BASED_DECODE HAVE_STRCHRNUL=0 ANDROID_ARMV6_IDCT)
#breakpad
add_library(breakpad STATIC
third_party/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
third_party/breakpad/src/client/linux/handler/exception_handler.cc
third_party/breakpad/src/client/linux/handler/minidump_descriptor.cc
third_party/breakpad/src/client/linux/log/log.cc
third_party/breakpad/src/client/linux/dump_writer_common/thread_info.cc
third_party/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.cc
third_party/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
third_party/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
third_party/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
third_party/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
third_party/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
third_party/breakpad/src/client/minidump_file_writer.cc
third_party/breakpad/src/common/android/breakpad_getcontext.S
third_party/breakpad/src/common/convert_UTF.c
third_party/breakpad/src/common/md5.cc
third_party/breakpad/src/common/string_conversion.cc
third_party/breakpad/src/common/linux/elfutils.cc
third_party/breakpad/src/common/linux/file_id.cc
third_party/breakpad/src/common/linux/guid_creator.cc
third_party/breakpad/src/common/linux/linux_libc_support.cc
third_party/breakpad/src/common/linux/memory_mapped_file.cc
third_party/breakpad/src/common/linux/safe_readlink.cc)
set_target_properties(breakpad PROPERTIES ANDROID_ARM_MODE arm)
set_property(SOURCE third_party/breakpad/src/common/android/breakpad_getcontext.S PROPERTY LANGUAGE C)
target_include_directories(breakpad PUBLIC
third_party/breakpad/src/common/android/include
third_party/breakpad/src)
#voip
include(${CMAKE_HOME_DIRECTORY}/voip/CMakeLists.txt)
set(NATIVE_LIB "tmessages.49")
#tmessages
add_library(${NATIVE_LIB} SHARED
jni.c
audio.c
webm_encoder.c
image.cpp
intro/IntroRenderer.c
SqliteWrapper.cpp
utilities.cpp
gifvideo.cpp
lottie.cpp
TgNetWrapper.cpp
ffmpeg_jni.cc
fast-edge.cpp
genann.c
secureid_ocr.cpp
tde2e/bridge.cpp
tests.cpp
)
# HTML widgets are libtwidget.so, apart from the client library: the isolated engine process loads only it
# (WidgetEngineService), the client never does. What the client needs of the same code (the gesture policy, the CPU
# filter pass; no widget code reaches either) is compiled into the client library (twidget_client_sources).
include(twidget/twidget.cmake)
add_library(twidget SHARED twidget/twidget-onload.cpp twidget/twidget-seccomp.cpp)
twidget_target_sources(twidget)
twidget_client_sources(${NATIVE_LIB})
target_link_options(twidget PRIVATE "-Wl,-z,max-page-size=16384")
target_link_options(twidget PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/twidget/exports.map")
# Compile JNI directly into the shared library so archive extraction cannot drop its exports.
set(PRISMA_BRIDGE_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/prisma/bridge/PrismaEngine.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/prisma/bridge/PrismaJni.cpp")
target_sources(${NATIVE_LIB} PRIVATE ${PRISMA_BRIDGE_SOURCES})
target_include_directories(${NATIVE_LIB} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/prisma/bridge")
set_property(SOURCE ${PRISMA_BRIDGE_SOURCES} APPEND PROPERTY
COMPILE_OPTIONS -fexceptions -frtti)
set_property(SOURCE ${PRISMA_BRIDGE_SOURCES} APPEND PROPERTY
COMPILE_DEFINITIONS BOOST_REGEX_STANDALONE)
target_compile_options(${NATIVE_LIB} PUBLIC
-ffast-math -Oz -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)
target_sources(${NATIVE_LIB} PRIVATE
third_party/xiph/opusfile/src/info.c
third_party/xiph/opusfile/src/internal.c
third_party/xiph/opusfile/src/opusfile.c
third_party/xiph/opusfile/src/stream.c
third_party/xiph/ogg/src/bitwise.c
third_party/xiph/ogg/src/framing.c)
target_include_directories(${NATIVE_LIB} PUBLIC
third_party/xiph/opus/include
third_party/xiph/opus/silk
third_party/xiph/opus/silk/fixed
third_party/xiph/opus/celt
third_party/xiph/opus
third_party/xiph/opusfile/include
third_party/xiph/ogg/include
third_party/libyuv/include
third_party/absl
third_party/boringssl/include
openssl/include
prebuild/include/${ANDROID_ABI}
third_party/ffmpeg
third_party/libvpx
third_party/dav1d/include
emoji
exoplayer/include
intro
tlottie/include
tgcalls/
webrtc/
td/tde2e
td/tde2e/td/e2e
)
target_link_options(${NATIVE_LIB} PRIVATE "-Wl,-z,max-page-size=16384")
target_link_options(${NATIVE_LIB} PRIVATE "-Wl,-z,common-page-size=16384")
target_link_options(${NATIVE_LIB} PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports.map")
target_link_libraries(${NATIVE_LIB}
-Wl,--whole-archive rnnoise openh264 voipandroid -Wl,--no-whole-archive
webrtc_absl
tgcalls
wasm
tgcalls_tp
tgnet
prisma
tlottie
wallet_engine_jni
wallet_engine_cpp
sqlite
swscale
avformat
avcodec
swresample
libvpx
libdav1d
libopus
tde2e
tdutils
yuv
avutil
ssl
crypto
jnigraphics
log
z
GLESv2
EGL
android
OpenSLES
cpufeatures
breakpad)
#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()