IOS CMAKE build settings

This commit is contained in:
Jaquee 2017-04-02 12:19:25 +02:00
parent d8a88d058e
commit f5bd346573
No known key found for this signature in database
GPG Key ID: 384E52B09F45DC39
6 changed files with 42 additions and 21 deletions

View File

@ -27,6 +27,9 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
if (IOS)
INCLUDE(CmakeLists_IOS.txt)
endif()
cmake_minimum_required(VERSION 2.8.7)
@ -77,7 +80,7 @@ if (ARM_TEST STREQUAL "arm")
endif()
endif()
if (ARM_ID STREQUAL "aarch64")
if (ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64")
set(ARM 1)
set(ARM8 1)
endif()
@ -312,7 +315,7 @@ else()
endif()
# Handle OpenSSL, used for sha256sum on binary updates
if (APPLE)
if (APPLE AND NOT IOS)
if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
@ -322,7 +325,7 @@ if (APPLE)
endif()
find_package(OpenSSL REQUIRED)
if(STATIC)
if(STATIC AND NOT IOS)
if(UNIX)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS}")
endif()
@ -337,7 +340,7 @@ endif()
add_subdirectory(external)
# Final setup for miniupnpc
if(UPNP_STATIC)
if(UPNP_STATIC OR IOS)
add_definitions("-DUPNP_STATIC")
else()
add_definitions("-DUPNP_DYNAMIC")
@ -540,8 +543,9 @@ else()
endif(ARM)
if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON")
if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
#From Android 5: "only position independent executables (PIE) are supported"
message(STATUS "Enabling PIE executable")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie")
@ -650,7 +654,7 @@ list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if(ANDROID)
set(ATOMIC libatomic.a)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS)
find_library(ATOMIC atomic)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
endif()

View File

@ -34,11 +34,12 @@
# We always compile if we are building statically to reduce static dependency issues...
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
# others.
if(NOT IOS)
find_package(Miniupnpc QUIET)
endif()
# If we have the correct shared version and we're not building static, use it
if(STATIC)
if(STATIC OR IOS)
set(USE_SHARED_MINIUPNPC false)
elseif(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(USE_SHARED_MINIUPNPC true)

View File

@ -215,6 +215,11 @@ endif ()
if (INSTALL_VENDORED_LIBUNBOUND)
install(TARGETS unbound
ARCHIVE DESTINATION lib)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS unbound
ARCHIVE DESTINATION ${lib_folder})
endif()

View File

@ -101,18 +101,24 @@ add_subdirectory(crypto)
add_subdirectory(ringct)
add_subdirectory(cryptonote_basic)
add_subdirectory(cryptonote_core)
if(NOT IOS)
add_subdirectory(blockchain_db)
endif()
add_subdirectory(mnemonics)
if(NOT IOS)
add_subdirectory(rpc)
endif()
add_subdirectory(wallet)
if(NOT IOS)
add_subdirectory(p2p)
endif()
add_subdirectory(cryptonote_protocol)
if(NOT IOS)
add_subdirectory(simplewallet)
add_subdirectory(daemonizer)
add_subdirectory(daemon)
add_subdirectory(blockchain_utilities)
endif()
if(PER_BLOCK_CHECKPOINT)
add_subdirectory(blocks)

View File

@ -93,7 +93,7 @@ endif()
# Because of the way Qt works on android with JNI, the code does not live in the main android thread
# So this code runs with a 1 MB default stack size.
# This will force the use of the heap for the allocation of the scratchpad
if (ANDROID)
if (ANDROID OR IOS)
if( BUILD_GUI_DEPS )
add_definitions(-DFORCE_USE_HEAP=1)
endif()

View File

@ -132,8 +132,13 @@ if (BUILD_GUI_DEPS)
list(APPEND objlibs $<TARGET_OBJECTS:obj_${lib}>) # matches naming convention in src/CMakeLists.txt
endforeach()
add_library(wallet_merged STATIC ${objlibs})
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS wallet_merged
ARCHIVE DESTINATION lib)
ARCHIVE DESTINATION ${lib_folder})
install(FILES ${wallet_api_headers}
DESTINATION include/wallet)