mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-09 19:32:03 +02:00
cmake: Android cross compilation support
This commit is contained in:
parent
cb1f3ad0ce
commit
fe73011422
@ -149,9 +149,11 @@ message(STATUS "libusb: include dir at ${LibUSB_INCLUDE_DIRS}")
|
|||||||
message(STATUS "libusb: libraries at ${LibUSB_LIBRARIES}")
|
message(STATUS "libusb: libraries at ${LibUSB_LIBRARIES}")
|
||||||
|
|
||||||
# HIDApi
|
# HIDApi
|
||||||
find_package(HIDAPI REQUIRED)
|
if(NOT ANDROID)
|
||||||
message(STATUS "libhidapi: include dir at ${HIDAPI_INCLUDE_DIRS}")
|
find_package(HIDAPI REQUIRED)
|
||||||
message(STATUS "libhidapi: libraries at ${HIDAPI_LIBRARIES}")
|
message(STATUS "libhidapi: include dir at ${HIDAPI_INCLUDE_DIRS}")
|
||||||
|
message(STATUS "libhidapi: libraries at ${HIDAPI_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Boost
|
# Boost
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
@ -174,7 +176,7 @@ find_package(Boost 1.58 REQUIRED COMPONENTS
|
|||||||
program_options
|
program_options
|
||||||
locale)
|
locale)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
set(CMAKE_SKIP_RPATH ON)
|
set(CMAKE_SKIP_RPATH ON)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
||||||
@ -253,7 +255,15 @@ foreach(QT5_MODULE ${QT5_LIBRARIES})
|
|||||||
include_directories(${${QT5_MODULE}_INCLUDE_DIRS})
|
include_directories(${${QT5_MODULE}_INCLUDE_DIRS})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES})
|
if(NOT (CMAKE_CROSSCOMPILING AND ANDROID))
|
||||||
|
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES})
|
||||||
|
else()
|
||||||
|
set(QT5_LIBRARIES_ABI)
|
||||||
|
foreach(QT5_MODULE ${QT5_LIBRARIES})
|
||||||
|
list(APPEND QT5_LIBRARIES_ABI "${QT5_MODULE}_${CMAKE_ANDROID_ARCH_ABI}")
|
||||||
|
endforeach()
|
||||||
|
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES_ABI})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(QT5_PKG_CONFIG_FOUND)
|
if(QT5_PKG_CONFIG_FOUND)
|
||||||
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
|
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
|
||||||
@ -376,6 +386,23 @@ if(STATIC)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
set(QT5_EXTRA_LIBRARIES_LIST
|
||||||
|
GLESv2
|
||||||
|
log
|
||||||
|
z
|
||||||
|
jnigraphics
|
||||||
|
android
|
||||||
|
EGL
|
||||||
|
Qt5VirtualKeyboard_${CMAKE_ANDROID_ARCH_ABI}
|
||||||
|
c++_shared
|
||||||
|
)
|
||||||
|
foreach(LIBRARY ${QT5_EXTRA_LIBRARIES_LIST})
|
||||||
|
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${ANDROID_PLATFORM_LEVEL}" REQUIRED)
|
||||||
|
list(APPEND QT5_LIBRARIES ${${LIBRARY}_LIBRARY})
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}")
|
message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}")
|
||||||
message(STATUS "Using Boost libraries at ${Boost_LIBRARIES}")
|
message(STATUS "Using Boost libraries at ${Boost_LIBRARIES}")
|
||||||
|
|
||||||
|
@ -81,13 +81,20 @@ if(APPLE)
|
|||||||
list(APPEND RESOURCES ${ICON})
|
list(APPEND RESOURCES ${ICON})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(monero-wallet-gui ${EXECUTABLE_FLAG} main/main.cpp
|
set(monero_wallet_gui_sources
|
||||||
${SOURCE_FILES}
|
${SOURCE_FILES}
|
||||||
${PASS_STRENGTH_FILES}
|
${PASS_STRENGTH_FILES}
|
||||||
${QR_CODE_FILES}
|
${QR_CODE_FILES}
|
||||||
${RESOURCES}
|
${RESOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT ANDROID)
|
||||||
|
add_executable(monero-wallet-gui ${EXECUTABLE_FLAG} ${monero_wallet_gui_sources})
|
||||||
|
else()
|
||||||
|
add_library(monero-wallet-gui SHARED ${monero_wallet_gui_sources})
|
||||||
|
set_target_properties(monero-wallet-gui PROPERTIES COMPILE_DEFINITIONS "ANDROID")
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(monero-wallet-gui PROPERTIES
|
set_target_properties(monero-wallet-gui PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
@ -164,13 +171,17 @@ if(X11_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_SCANNER)
|
if(WITH_SCANNER)
|
||||||
target_link_libraries(monero-wallet-gui
|
if(NOT ANDROID)
|
||||||
${ZBAR_LIBRARIES}
|
target_link_libraries(monero-wallet-gui
|
||||||
jpeg
|
${ZBAR_LIBRARIES}
|
||||||
v4l2
|
jpeg
|
||||||
v4lconvert
|
v4l2
|
||||||
rt
|
v4lconvert
|
||||||
)
|
rt
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(monero-wallet-gui ${ZBAR_LIBRARIES})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(TARGET monero-wallet-gui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:daemon> $<TARGET_FILE_DIR:monero-wallet-gui>)
|
add_custom_command(TARGET monero-wallet-gui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:daemon> $<TARGET_FILE_DIR:monero-wallet-gui>)
|
||||||
|
Loading…
Reference in New Issue
Block a user