Skip to content

Commit

Permalink
update polyseed
Browse files Browse the repository at this point in the history
cleanup cmakelists
fix toolchain.cmake.in
  • Loading branch information
MrCyjaneK committed Nov 14, 2024
1 parent d04823d commit baafee3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 124 deletions.
6 changes: 3 additions & 3 deletions contrib/depends/packages/polyseed.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package=polyseed
$(package)_version=2.0.0
$(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags/
$(package)_version=2.0.0-patch
$(package)_download_path=https://github.com/MrCyjaneK/$(package)/archive/refs/tags/
$(package)_download_file=v$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a
$(package)_sha256_hash=28a86b0bc178076ac65dc7d8cc28a79eb546708473efc0e8dce688f1e237ccc2
$(package)_patches=force-static-mingw.patch 0001-disable-soname.patch

define $(package)_preprocess_cmds
Expand Down
3 changes: 2 additions & 1 deletion contrib/depends/toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)

if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a)
SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a)
Expand Down Expand Up @@ -173,5 +172,7 @@ if(ARCHITECTURE STREQUAL "x86_64")
SET(ARCH_ID "x86_64")
endif()

link_directories(@prefix@/lib)

#Create a new global cmake flag that indicates building with depends
set (DEPENDS true)
138 changes: 18 additions & 120 deletions monero_libwallet2_api_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ elseif(${HOST_ABI} STREQUAL "i686-w64-mingw32")
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
elseif(${HOST_ABI} STREQUAL "host-apple-ios")
set(CMAKE_SYSTEM_NAME iOS)
elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
set(CMAKE_SYSTEM_NAME Darwin)
endif()

if (${HOST_ABI} STREQUAL "host-apple-darwin" OR
Expand Down Expand Up @@ -43,84 +47,23 @@ add_library( wallet2_api_c
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")

set(MONERO_DIR ${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR})
set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../contrib/depends/${HOST_ABI})

find_package(PkgConfig REQUIRED)

if(MINGW)
set(WARNINGS "${WARNINGS} -Wno-error=unused-value -Wno-error=unused-but-set-variable")
set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN")
set(Boost_THREADAPI win32)
endif()

find_package(Boost REQUIRED COMPONENTS chrono filesystem program_options system thread date_time regex serialization locale)


#############
# Wownero Seed
#############

if (${MONERO_FLAVOR} STREQUAL "wownero")
set(EXTRA_LIBS_WOWNEROSEED wownero-seed)
if(${HOST_ABI} STREQUAL "aarch64-meego-linux-gnu")
add_library(wownero-seed STATIC IMPORTED)
set_target_properties(wownero-seed PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/lib64/libwownero-seed.a)
else()
add_library(wownero-seed STATIC IMPORTED)
set_target_properties(wownero-seed PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/lib/libwownero-seed.a)
endif()
endif()

# add_subdirectory("${CMAKE_SOURCE_DIR}/../external/utf8proc" ${CMAKE_BINARY_DIR}/utf8proc_build)


add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build)


#############
# System
#############

#find_library( log-lib log )

include_directories( ${EXTERNAL_LIBS_DIR}/include )

message(STATUS EXTERNAL_LIBS_DIR : ${EXTERNAL_LIBS_DIR})

if(${HOST_ABI} STREQUAL "x86_64-linux-gnu" OR
${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR
${HOST_ABI} STREQUAL "x86_64-linux-android")
set(EXTRA_LIBS "wallet-crypto")
else()
set(EXTRA_LIBS "")
endif()

if (${HOST_ABI} STREQUAL "host-apple-darwin" OR
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
if (NOT ${ARCHITECTURE} STREQUAL arm64)
set(EXTRA_LIBS "wallet-crypto")
endif()
endif()
set(MONERO_DIR ${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR})
set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../contrib/depends/${HOST_ABI})

if (${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11")
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" hidapi)
# set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" apple_nghttp2)
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" apple_nghttp2)
elseif(${HOST_ABI} STREQUAL "host-apple-ios")
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" iconv )
endif()

if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR ${HOST_ABI} STREQUAL "i686-w64-mingw32")
set_target_properties(wallet2_api_c PROPERTIES SUFFIX ".dll")
set(EXTRA_LIBS_WINDOWS ssp wsock32 ws2_32 iconv-win iphlpapi crypt32 hidapi)
target_link_options(wallet2_api_c PRIVATE -static-libgcc -static-libstdc++)
endif()

Expand All @@ -130,12 +73,6 @@ if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64
set_target_properties(wallet2_api_c PROPERTIES NO_SONAME 1)
endif()

if (${MONERO_FLAVOR} STREQUAL "monero")
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_WOWNERO)
endif()

if(NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-ios")
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
endif()
Expand All @@ -151,60 +88,21 @@ if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64
set_target_properties(${TARGET} PROPERTIES LINK_DEPENDS ${EXPORTED_SYMBOLS_FILE})
endif()

find_package(OpenSSL REQUIRED)
message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}")
include_directories(${OPENSSL_INCLUDE_DIR})
add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build)


pkg_check_modules(SODIUM REQUIRED libsodium)
message(STATUS "Using libsodium include dir at ${SODIUM_LIBRARIES}")
get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()

# message(FATAL_ERROR "aaa")

target_link_libraries( wallet2_api_c

wallet_api
wallet
cryptonote_core
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
ringct
ringct_basic
net
common
cncrypto
blockchain_db
lmdb
easylogging
# unbound
epee
blocks
checkpoints
device
device_trezor
multisig
version
randomx
hardforks
rpc_base
${EXTRA_LIBS}

${Boost_LIBRARIES}

polyseed
polyseed_static
${EXTRA_LIBS_POLYSEED}
${EXTRA_LIBS_WOWNEROSEED}

bc-ur
utf8proc

${SODIUM_LINK_LIBRARIES}
${OPENSSL_LIBRARIES}

${EXTRA_LIBS_WINDOWS}
${EXTRA_LIBS_APPLE}
${wallet_api_LIB_DEPENDS}

${EXTRA_LIBS_ANDROID}
)

0 comments on commit baafee3

Please sign in to comment.