From cab160112c94a4fc359efb237115fb43cb427ec2 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 9 Jan 2020 17:06:02 +0100 Subject: [PATCH] inital preparation for mobile native library(very dirty) --- .gitignore | 1 + CMakeLists.txt | 18 ++++++++++------- contrib/CMakeLists.txt | 8 +++++++- contrib/db/CMakeLists.txt | 7 +++++++ contrib/zlib/CMakeLists.txt | 40 ++++++++++++++++++------------------- src/CMakeLists.txt | 7 ++----- 6 files changed, 48 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index bf6dbac1..c4630d95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /build* +/_builds/* /tags .DS_Store ._.DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b5f69b..0d9a5646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(VERSION "1.0") cmake_policy(SET CMP0020 OLD) endif() - +set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "Andrey Sabelnikov") set_property(GLOBAL PROPERTY USE_FOLDERS ON) # build types @@ -24,7 +24,7 @@ if (UNIX AND NOT APPLE) endif() else() # multi configurations for MSVC and XCode - set(CMAKE_CONFIGURATION_TYPES "Debug;Release") + set(CMAKE_CONFIGURATION_TYPES "Release") endif() message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}, and built type: ${CMAKE_BUILD_TYPE}") @@ -78,7 +78,7 @@ else() else() set(ARCH_FLAG "-march=${ARCH}") endif() - set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-aggregate-return") + set(WARNINGS "-Wno-implicit-function-declaration -Wall -Wextra -Wpointer-arith -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-aggregate-return") # if(NOT APPLE) # set(WARNINGS "${WARNINGS} -Werror") # endif() @@ -161,10 +161,14 @@ if(STATIC) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) endif() -find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale) -if(MSVC AND (${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54)) - message(SEND_ERROR "Boost version 1.54 is unsupported, more details are available here http://goo.gl/RrCFmA") -endif() + + +#find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options ) #locale +set(Boost_INCLUDE_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/include") +set(Boost_LIBRARY_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/ios/") +set(Boost_LIBRARIES "libboost.a") +set(Boost_VERSION "ofxiOSBoost 1.60.0") + message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index df753f9a..86365e5a 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,12 +1,18 @@ set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library") set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library") set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables") -add_subdirectory(miniupnp/miniupnpc) add_subdirectory(zlib) add_subdirectory(db) add_subdirectory(ethereum) +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + message("excluded db support for IOS build") + return() +endif() +add_subdirectory(miniupnp/miniupnpc) + + set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib") set_property(TARGET zlibstatic PROPERTY FOLDER "contrib") set_property(TARGET mdbx PROPERTY FOLDER "contrib") diff --git a/contrib/db/CMakeLists.txt b/contrib/db/CMakeLists.txt index 9497760e..ad19848c 100644 --- a/contrib/db/CMakeLists.txt +++ b/contrib/db/CMakeLists.txt @@ -1,4 +1,11 @@ + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + message("excluded db support for IOS build") + return() +endif() + + message("DB ENGINE: lmdb") add_subdirectory(liblmdb) if(MSVC) diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt index 0fe939df..696b9f52 100644 --- a/contrib/zlib/CMakeLists.txt +++ b/contrib/zlib/CMakeLists.txt @@ -183,10 +183,10 @@ if(MINGW) set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +#add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -set_target_properties(zlib PROPERTIES SOVERSION 1) +# set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) +# set_target_properties(zlib PROPERTIES SOVERSION 1) if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version @@ -196,22 +196,22 @@ if(NOT CYGWIN) # # This has no effect with MSVC, on that platform the version info for # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) +# set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) endif() if(UNIX) # On unix-like platforms the library is almost always called libz - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) + set_target_properties( zlibstatic PROPERTIES OUTPUT_NAME z) if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + #set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() elseif(BUILD_SHARED_LIBS AND WIN32) # Creates zlib1.dll when building shared library version - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") + # set_target_properties(zlib PROPERTIES SUFFIX "1.dll") endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - install(TARGETS zlib zlibstatic + install(TARGETS zlibstatic RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) @@ -230,20 +230,20 @@ endif() # Example binaries #============================================================================ -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) +#add_executable(example test/example.c) +#target_link_libraries(example zlib) +#add_test(example example) -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) +#add_executable(minigzip test/minigzip.c) +#target_link_libraries(minigzip zlib) if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) +# add_executable(example64 test/example.c) +# target_link_libraries(example64 zlib) +# set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +# add_test(example64 example64) - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +# add_executable(minigzip64 test/minigzip.c) +# target_link_libraries(minigzip64 zlib) +# set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8766375a..e6ea1362 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,4 @@ -if(CMAKE_SYSTEM_NAME STREQL iOS) -{ - return() -} + if(POLICY CMP0043) cmake_policy(SET CMP0043 OLD) endif() @@ -107,7 +104,7 @@ add_dependencies(wallet version ${PCH_LIB_NAME}) ENABLE_SHARED_PCH(WALLET) add_library(currency_core ${CURRENCY_CORE}) -add_dependencies(currency_core version rpc ${PCH_LIB_NAME}) +add_dependencies(currency_core version ${PCH_LIB_NAME}) ENABLE_SHARED_PCH(CURRENCY_CORE) if(CMAKE_SYSTEM_NAME STREQUAL "iOS")