# Generated by uniffi-bindgen-react-native cmake_minimum_required(VERSION 3.9.0) project(FedimintClient) set (CMAKE_VERBOSE_MAKEFILE ON) set (CMAKE_CXX_STANDARD 17) # Resolve the path to the uniffi-bindgen-react-native package execute_process( COMMAND node -p "require.resolve('uniffi-bindgen-react-native/package.json')" OUTPUT_VARIABLE UNIFFI_BINDGEN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) # Get the directory; get_filename_component and cmake_path will normalize # paths with Windows path separators. get_filename_component(UNIFFI_BINDGEN_PATH "${UNIFFI_BINDGEN_PATH}" DIRECTORY) # Specifies a path to native header files. include_directories( ../cpp ../cpp/generated ${UNIFFI_BINDGEN_PATH}/cpp/includes ) add_library(react-native-fedimint-client SHARED ../cpp/react-native-fedimint-client.cpp ../cpp/generated/fedimint_client_uniffi.cpp cpp-adapter.cpp ) # Set C++ compiler flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") add_library( my_rust_lib SHARED IMPORTED ) set_target_properties( my_rust_lib PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libfedimint_client_uniffi.so ) # Add ReactAndroid libraries, being careful to account for different versions. find_package(ReactAndroid REQUIRED CONFIG) find_library(LOGCAT log) # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file, # which we don't use. Thus falling back to version number sniffing. if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) set(REACTNATIVE_MERGED_SO true) endif() # https://github.com/react-native-community/discussions-and-proposals/discussions/816 # This if-then-else can be removed once this library does not support version below 0.76 if (REACTNATIVE_MERGED_SO) target_link_libraries(react-native-fedimint-client ReactAndroid::reactnative) else() target_link_libraries(react-native-fedimint-client ReactAndroid::turbomodulejsijni ReactAndroid::react_nativemodule_core ) endif() find_package(fbjni REQUIRED CONFIG) find_library(ZLIB z) target_link_libraries( react-native-fedimint-client fbjni::fbjni ReactAndroid::jsi ${LOGCAT} ${ZLIB} my_rust_lib )