mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-12 11:12:16 +00:00
* TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) * Add tests for xonly_pubkey_tweak_add * added secp256k1 as submodule, since we need extrakeys feature of secp256k1 * cleanup * add ton_crypto_core secp256k1 dependency * adjust Dockerfile, android and wasm builds * adjust nix build * test windows build with SECP256K1_ENABLE_MODULE_EXTRAKEYS * test windows build with SECP256K1_ENABLE_MODULE_EXTRAKEYS * adjust android build * adjust emscripten build * adjust emscripten build * try macos-13 * emscripten build adjustments * windows build adjustments * final corrections --------- Co-authored-by: neodix <neodix@ton.org>
73 lines
3.4 KiB
CMake
73 lines
3.4 KiB
CMake
# 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.5 FATAL_ERROR)
|
|
|
|
project(TON_ANDROID VERSION 0.5 LANGUAGES C CXX)
|
|
|
|
option(TONLIB_ENABLE_JNI "Enable JNI-compatible TonLib API" ON)
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
string(APPEND CMAKE_CXX_FLAGS " -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections")
|
|
else()
|
|
string(APPEND CMAKE_CXX_FLAGS " -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wconversion -Wno-sign-conversion -fno-omit-frame-pointer -ffunction-sections -fdata-sections")
|
|
endif()
|
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
|
endif()
|
|
|
|
# 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.
|
|
|
|
add_library( # Sets the name of the library.
|
|
native-lib
|
|
|
|
# Sets the library as a shared library.
|
|
SHARED
|
|
|
|
# Provides a relative path to your source file(s).
|
|
native-lib.cpp)
|
|
|
|
|
|
list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/crypto/${ANDROID_ARCH_NAME}")
|
|
set(TON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
|
add_subdirectory(${TON_DIR} ton EXCLUDE_FROM_ALL)
|
|
target_link_libraries(native-lib tonlibjson)
|
|
target_link_libraries(native-lib tonlib)
|
|
|
|
set(TONLIB_API_JAVA_PACKAGE "drinkless/org/ton")
|
|
target_compile_definitions(native-lib PRIVATE PACKAGE_NAME="${TONLIB_API_JAVA_PACKAGE}")
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
add_custom_command(TARGET native-lib POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:native-lib> $<TARGET_FILE:native-lib>.debug
|
|
COMMAND ${CMAKE_STRIP} -S $<TARGET_FILE:native-lib>.debug -o $<TARGET_FILE:native-lib>)
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
add_custom_command(TARGET native-lib POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:native-lib> $<TARGET_FILE:native-lib>.debug
|
|
COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:native-lib>.debug -o $<TARGET_FILE:native-lib>)
|
|
endif()
|
|
|
|
if (NOT CMAKE_CROSSCOMPILING)
|
|
set(TONLIB_API_JAVA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
|
file(MAKE_DIRECTORY ${TONLIB_API_JAVA_PATH}${TONLIB_API_JAVA_PACKAGE})
|
|
set(TONLIB_API_TLO_PATH ${TON_DIR}/tl/generate/scheme/tonlib_api.tlo)
|
|
set(TONLIB_API_TL_PATH ${TON_DIR}/tl/generate/scheme/tonlib_api.tl)
|
|
set(JAVADOC_TL_DOCUMENTATION_GENERATOR_PATH ${TON_DIR}/tl/generate/JavadocTlDocumentationGenerator.php)
|
|
set(GENERATE_JAVA_CMD tonlib_generate_java_api TonApi ${TONLIB_API_TLO_PATH} ${TONLIB_API_JAVA_PATH} ${TONLIB_API_JAVA_PACKAGE})
|
|
if (PHP_EXECUTABLE)
|
|
set(GENERATE_JAVA_CMD ${GENERATE_JAVA_CMD} && ${PHP_EXECUTABLE} ${JAVADOC_TL_DOCUMENTATION_GENERATOR_PATH}
|
|
${TONLIB_API_TL_PATH} ${TONLIB_API_JAVA_PATH}/${TONLIB_API_JAVA_PACKAGE}/TonApi.java androidx.annotation.Nullable @Nullable)
|
|
endif()
|
|
|
|
add_custom_target(tl_generate_java
|
|
COMMAND ${GENERATE_JAVA_CMD}
|
|
COMMENT "Generate java tl source files"
|
|
DEPENDS tonlib_generate_java_api ${TONLIB_API_TLO_PATH}
|
|
)
|
|
add_dependencies(prepare_cross_compiling tl_generate_java)
|
|
endif()
|