cmake_minimum_required(VERSION 3.13) project(codemagic_patch_client_sdk) add_library(codemagic_patch_hashing STATIC ../libs/hashing/package_hash_v1.c ../libs/hashing/sha256.c ) target_include_directories(codemagic_patch_hashing PUBLIC ../libs/hashing ) add_library(codemagic_patch_zstd STATIC ../libs/zstd/lib/common/entropy_common.c ../libs/zstd/lib/common/error_private.c ../libs/zstd/lib/common/fse_decompress.c ../libs/zstd/lib/common/xxhash.c ../libs/zstd/lib/common/zstd_common.c ../libs/zstd/lib/decompress/huf_decompress.c ../libs/zstd/lib/decompress/zstd_ddict.c ../libs/zstd/lib/decompress/zstd_decompress.c ../libs/zstd/lib/decompress/zstd_decompress_block.c ) target_include_directories(codemagic_patch_zstd PUBLIC ../libs/zstd/lib ../libs/zstd/lib/common ../libs/zstd/lib/decompress ) target_compile_definitions(codemagic_patch_zstd PRIVATE ZSTD_DISABLE_ASM ZSTD_LIB_DEPRECATED=0 ) add_library(codemagic_patch_hdiffpatch STATIC ../libs/hdiffpatch/codemagic_patch_hpatch.c ../libs/hdiffpatch/file_for_patch.c ../libs/hdiffpatch/libHDiffPatch/HPatch/patch.c ../libs/hdiffpatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/dir_patch.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/dir_patch_tools.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/new_dir_output.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/new_stream.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/ref_stream.c ../libs/hdiffpatch/dirDiffPatch/dir_patch/res_handle_limit.c ) target_include_directories(codemagic_patch_hdiffpatch PUBLIC ../libs/hdiffpatch ../libs/hdiffpatch/libHDiffPatch/HPatch ../libs/zstd/lib ../libs/zstd/lib/common ../libs/zstd/lib/decompress ) target_compile_definitions(codemagic_patch_hdiffpatch PRIVATE _IS_USED_MULTITHREAD=0 ) target_link_libraries(codemagic_patch_hdiffpatch codemagic_patch_zstd ) add_library(codemagic_patch_artifacts STATIC ../libs/artifacts/codemagic_patch_artifacts.c ) target_include_directories(codemagic_patch_artifacts PUBLIC ../libs/artifacts ../libs/hdiffpatch ../libs/zstd/lib ../libs/zstd/lib/common ../libs/zstd/lib/decompress ) target_link_libraries(codemagic_patch_artifacts codemagic_patch_zstd codemagic_patch_hdiffpatch ) # Isolate the vendored zstd's C symbols (ZSTD_*/HUF_*/FSE_*/XXH*) behind a CMPATCH_ # prefix so they cannot collide with another copy of zstd/xxhash linked into the # host app (same class of bug as the SSZipArchive/MediaPipe minizip clash). # Force-include the auto-generated rename header into every TU that defines or # calls zstd. Header is generated by libs/zstd/gen_zstd_prefix.sh. set(CODEMAGIC_PATCH_ZSTD_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/../libs/zstd/codemagic_patch_zstd_prefix.h") foreach(_cmpatch_zstd_target codemagic_patch_zstd codemagic_patch_hdiffpatch codemagic_patch_artifacts) target_compile_options(${_cmpatch_zstd_target} PRIVATE "-include" "${CODEMAGIC_PATCH_ZSTD_PREFIX_HEADER}") endforeach() add_library(codemagic_patch_jni SHARED src/main/cpp/codemagic_patch_jni.cpp ) target_link_options(codemagic_patch_jni PRIVATE "-Wl,-z,max-page-size=16384" ) target_link_libraries(codemagic_patch_jni codemagic_patch_hashing codemagic_patch_artifacts android log )