mirror of
https://git.wownero.com/wowlet/wowlet.git
synced 2024-08-15 01:03:14 +00:00
Prepare CMake for Android deployment and development
This commit is contained in:
parent
a2ad4692a3
commit
c024323eab
2 changed files with 101 additions and 23 deletions
|
@ -11,11 +11,13 @@ set(VERSION "beta-2")
|
|||
|
||||
option(FETCH_DEPS "Download dependencies if they are not found" ON)
|
||||
option(XMRIG "Include XMRig module" ON)
|
||||
option(OPENVR "Include OpenVR support" OFF)
|
||||
option(QML "Include QtQuick (QML)" OFF)
|
||||
option(TOR_BIN "Path to Tor binary to embed inside WOWlet" OFF)
|
||||
option(OPENVR "Include OpenVR support")
|
||||
option(QML "Include QtQuick (QML)")
|
||||
option(ANDROID "Android deployment")
|
||||
option(ANDROID_DEBUG "View the Android app on desktop")
|
||||
option(TOR_BIN "Path to Tor binary to embed inside WOWlet")
|
||||
option(STATIC "Link libraries statically, requires static Qt")
|
||||
option(USE_DEVICE_TREZOR "Trezor support compilation" OFF)
|
||||
option(USE_DEVICE_TREZOR "Trezor support compilation")
|
||||
option(DONATE_BEG "Prompt donation window every once in a while" ON)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
|
||||
include(CheckCCompilerFlag)
|
||||
|
@ -28,11 +30,11 @@ include(CheckSymbolExists)
|
|||
|
||||
set(WOWNERO_HEAD "f611d5c9e32bc62f1735f6571b0bdb95cc020531")
|
||||
set(BUILD_GUI_DEPS ON)
|
||||
set(ARCH "x86-64")
|
||||
set(BUILD_64 ON)
|
||||
set(ARCH "x86-64" CACHE STRING "Target architecture")
|
||||
set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries")
|
||||
set(INSTALL_VENDORED_LIBUNBOUND ${STATIC})
|
||||
set(USE_SINGLE_BUILDDIR ON)
|
||||
if(OPENVR)
|
||||
if(OPENVR OR ANDROID_DEBUG)
|
||||
set(QML ON)
|
||||
endif()
|
||||
|
||||
|
@ -41,10 +43,7 @@ set(_CMAKE_BUILD_TYPE "")
|
|||
string(TOUPPER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE)
|
||||
if("${_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
|
||||
set(DEBUG ON)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
message(STATUS "OPENVR: ${OPENVR}")
|
||||
message(STATUS "QML: ${QML}")
|
||||
endif()
|
||||
|
||||
check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
|
||||
|
@ -173,7 +172,7 @@ find_package(Boost 1.58 REQUIRED COMPONENTS
|
|||
program_options
|
||||
locale)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# https://github.com/monero-project/monero-gui/issues/3142#issuecomment-705940446
|
||||
set(CMAKE_SKIP_RPATH ON)
|
||||
|
@ -195,6 +194,17 @@ if("$ENV{DRONE}" STREQUAL "true")
|
|||
message(STATUS "We are inside a static compile with Drone CI")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH})
|
||||
message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'")
|
||||
set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
|
||||
endif()
|
||||
if(APPLE AND NOT CMAKE_PREFIX_PATH)
|
||||
execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To build WOWlet with embedded (and static) Tor, pass CMake -DTOR_BIN=/path/to/tor
|
||||
if(TOR_BIN)
|
||||
if(APPLE)
|
||||
|
@ -249,7 +259,7 @@ if(MINGW)
|
|||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
|
||||
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt)
|
||||
if(DEPENDS)
|
||||
set(ICU_LIBRARIES iconv)
|
||||
set(ICU_LIBRARIES iconv)
|
||||
else()
|
||||
set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv)
|
||||
endif()
|
||||
|
@ -264,7 +274,7 @@ elseif(DRAGONFLY)
|
|||
set(EXTRA_LIBRARIES execinfo ${COMPAT})
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
|
||||
set(EXTRA_LIBRARIES socket nsl resolv)
|
||||
elseif(NOT MSVC AND NOT DEPENDS)
|
||||
elseif(NOT MSVC AND NOT DEPENDS AND NOT ANDROID)
|
||||
find_library(RT rt)
|
||||
set(EXTRA_LIBRARIES ${RT})
|
||||
endif()
|
||||
|
@ -384,10 +394,6 @@ if(OPENVR)
|
|||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/openvr")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/KDMacTouchBar")
|
||||
endif()
|
||||
|
||||
if(WITH_SCANNER)
|
||||
add_library(quirc STATIC
|
||||
contrib/quirc/lib/decode.c
|
||||
|
|
|
@ -57,6 +57,15 @@ if(OPENVR)
|
|||
list(APPEND SOURCE_FILES ${SOURCE_FILES_QML})
|
||||
endif()
|
||||
|
||||
if(ANDROID OR ANDROID_DEBUG)
|
||||
qt5_add_resources(RESOURCES mobile/qml.qrc)
|
||||
file(GLOB SOURCE_FILES_QML
|
||||
"mobile/*.h"
|
||||
"mobile/*.cpp"
|
||||
)
|
||||
list(APPEND SOURCE_FILES ${SOURCE_FILES_QML})
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-declarations") # @TODO: removeme
|
||||
|
||||
add_subdirectory(libwalletqt)
|
||||
|
@ -98,11 +107,16 @@ if(APPLE)
|
|||
list(APPEND RESOURCES ${ICON})
|
||||
endif()
|
||||
|
||||
add_executable(wowlet ${EXECUTABLE_FLAG} main.cpp
|
||||
${SOURCE_FILES}
|
||||
${RESOURCES}
|
||||
${ASSETS_TOR}
|
||||
)
|
||||
if(NOT ANDROID)
|
||||
add_executable(wowlet ${EXECUTABLE_FLAG} main.cpp
|
||||
${SOURCE_FILES}
|
||||
${RESOURCES}
|
||||
${ASSETS_TOR}
|
||||
)
|
||||
else()
|
||||
add_library(wowlet SHARED ${SOURCE_FILES} ${RESOURCES})
|
||||
set_target_properties(wowlet PROPERTIES COMPILE_DEFINITIONS "ANDROID")
|
||||
endif()
|
||||
|
||||
# mac os bundle
|
||||
set_target_properties(wowlet PROPERTIES
|
||||
|
@ -162,6 +176,14 @@ if(XMRIG)
|
|||
target_compile_definitions(wowlet PRIVATE HAS_XMRIG=1)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_compile_definitions(wowlet PRIVATE HAS_ANDROID=1)
|
||||
endif()
|
||||
|
||||
if(ANDROID_DEBUG)
|
||||
target_compile_definitions(wowlet PRIVATE HAS_ANDROID_DEBUG=1)
|
||||
endif()
|
||||
|
||||
if(OPENVR)
|
||||
target_compile_definitions(wowlet PRIVATE HAS_OPENVR=1)
|
||||
target_compile_definitions(wowlet PUBLIC VR_API_PUBLIC)
|
||||
|
@ -220,6 +242,13 @@ else()
|
|||
target_link_libraries(wowlet PUBLIC monero-seed::monero-seed)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# yolo some hardcoded paths
|
||||
target_include_directories(wowlet PUBLIC
|
||||
/opt/android/prefix/include/QtAndroidExtras/
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link Wownero core libraries
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
wallet_merged
|
||||
|
@ -261,6 +290,33 @@ else()
|
|||
Qt5::WebSockets)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# yolo some hardcoded paths
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
/opt/android/prefix/lib/libQt5QuickTemplates2_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Quick_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5QmlModels_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Qml_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Svg_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Widgets_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Gui_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Xml_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5XmlPatterns_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Network_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5Core_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5VirtualKeyboard_arm64-v8a.so
|
||||
/opt/android/prefix/lib/libQt5AndroidExtras_arm64-v8a.so
|
||||
/opt/android/prefix/plugins/bearer/libplugins_bearer_qandroidbearer_arm64-v8a.so
|
||||
GLESv2
|
||||
log
|
||||
z
|
||||
jnigraphics
|
||||
android
|
||||
EGL
|
||||
c++_shared
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link random other stuff
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
${ICU_LIBRARIES}
|
||||
|
@ -294,7 +350,7 @@ if(OPENVR)
|
|||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(wowlet
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
KDMacTouchBar
|
||||
)
|
||||
target_include_directories(wowlet
|
||||
|
@ -329,3 +385,19 @@ endif()
|
|||
install(TARGETS wowlet
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
|
||||
message(STATUS "=============================================")
|
||||
message(STATUS "VERSION_MAJOR: ${VERSION_MAJOR}")
|
||||
message(STATUS "VERSION_MINOR: ${VERSION_MINOR}")
|
||||
message(STATUS "VERSION_REVISION: ${VERSION_REVISION}")
|
||||
message(STATUS "STATIC: ${STATIC}")
|
||||
message(STATUS "Include QtQuick (QML): ${QML}")
|
||||
message(STATUS "VERSION: ${VERSION}")
|
||||
message(STATUS "Include the XMRIG tab: ${XMRIG}")
|
||||
message(STATUS "Include Valve's OpenVR library: ${OPENVR}")
|
||||
message(STATUS "This build is for Android: ${ANDROID}")
|
||||
message(STATUS "This build is for testing the Android app on desktop: ${ANDROID_DEBUG}")
|
||||
message(STATUS "TOR_BIN: ${TOR_BIN}")
|
||||
message(STATUS "DONATE_BEG: ${DONATE_BEG}")
|
||||
message(STATUS "=============================================")
|
Loading…
Reference in a new issue