Add support for apple and arm building

Add pcsc-lite to linux builds
Fixup windows icu4c linking with depends, the static libraries have an 's' appended to them
Compiling depends arm-linux-gnueabihf will allow you to compile armv6zk monero binaries
This commit is contained in:
TheCharlatan 2018-03-20 00:33:49 +01:00
parent 29311fd140
commit 56b6e41ea7
10 changed files with 102 additions and 37 deletions

View File

@ -413,6 +413,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
endif () endif ()
if (APPLE AND NOT IOS) if (APPLE AND NOT IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default")
if (NOT OpenSSL_DIR) if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_VARIABLE OPENSSL_ROOT_DIR
@ -486,7 +487,9 @@ if(MSVC)
include_directories(SYSTEM src/platform/msc) include_directories(SYSTEM src/platform/msc)
else() else()
include(TestCXXAcceptsFlag) include(TestCXXAcceptsFlag)
if (NOT DEPENDS)
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all") set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endif()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}") message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default") if(ARCH STREQUAL "default")
set(ARCH_FLAG "") set(ARCH_FLAG "")
@ -671,6 +674,10 @@ else()
message(STATUS "Selecting VFP for ARMv6") message(STATUS "Selecting VFP for ARMv6")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp")
if(DEPENDS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm")
endif()
endif(ARM6) endif(ARM6)
if(ARM7) if(ARM7)
@ -725,7 +732,7 @@ else()
endif() endif()
if(APPLE) if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -DGTEST_HAS_TR1_TUPLE=0")
endif() endif()
set(DEBUG_FLAGS "-g3") set(DEBUG_FLAGS "-g3")
@ -815,8 +822,12 @@ endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW) if(MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32) set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
if(DEPENDS)
set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} sicuio sicuin sicuuc sicudt sicutu iconv)
else()
set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} icuio icuin icuuc icudt icutu iconv) set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} icuio icuin icuuc icudt icutu iconv)
endif()
elseif(APPLE OR OPENBSD OR ANDROID) elseif(APPLE OR OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "") set(EXTRA_LIBRARIES "")
elseif(FREEBSD) elseif(FREEBSD)

View File

@ -67,7 +67,7 @@ endif
ifeq ($(host_os),linux) ifeq ($(host_os),linux)
host_cmake=Linux host_cmake=Linux
endif endif
ifeq ($(host_os),darwin11) ifeq ($(host_os),darwin)
host_cmake=Darwin host_cmake=Darwin
endif endif
@ -182,6 +182,8 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_
-e 's|@debug@|$(DEBUG)|' \ -e 's|@debug@|$(DEBUG)|' \
-e 's|@depends@|$(host_cmake)|' \ -e 's|@depends@|$(host_cmake)|' \
-e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\ -e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\
-e 's|@sdk@|$(SDK_PATH)|'\
-e 's|@arch@|$(host_arch)|'\
$< > $@ $< > $@
$(AT)touch $@ $(AT)touch $@

View File

@ -1,8 +1,8 @@
package=boost package=boost
$(package)_version=1_58_0 $(package)_version=1_64_0
$(package)_download_path=https://sourceforge.net/projects/boost/files/boost/1.58.0 $(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
$(package)_file_name=$(package)_$($(package)_version).tar.gz $(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_sha256_hash=a004d9b3fa95e956383693b86fce1b68805a6f71c2e68944fa813de0fb8c8102 $(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts_release=variant=release $(package)_config_opts_release=variant=release
@ -19,7 +19,7 @@ $(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar) $(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_toolset_darwin=darwin $(package)_toolset_darwin=darwin
$(package)_archiver_darwin=$($(package)_libtool) $(package)_archiver_darwin=$($(package)_libtool)
$(package)_config_libraries=system,filesystem,thread,date_time,chrono,regex,serialization,program_options,locale $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale
$(package)_cxxflags=-std=c++11 -fvisibility=hidden $(package)_cxxflags=-std=c++11 -fvisibility=hidden
$(package)_cxxflags_linux=-fPIC $(package)_cxxflags_linux=-fPIC
endef endef

View File

@ -1,4 +1,4 @@
packages:=boost openssl libevent zeromq cppzmq zlib expat ldns unbound cppzmq readline libiconv icu4c packages:=boost openssl libevent zeromq cppzmq zlib expat ldns unbound cppzmq readline libiconv
native_packages := native_ccache native_packages := native_ccache
wallet_packages=bdb wallet_packages=bdb
@ -13,6 +13,9 @@ endif
ifeq ($(host_os),darwin11) ifeq ($(host_os),darwin11)
package += unwind package += unwind
endif endif
ifeq ($(host_os),mingw32)
packages += icu4c
endif
ifneq ($(build_os),darwin) ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus

View File

@ -5,6 +5,8 @@ $(package)_file_name=lib$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992 $(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992
define $(package)_config_cmds define $(package)_config_cmds
cp -f $(BASEDIR)/config.guess config/config.guess &&\
cp -f $(BASEDIR)/config.sub config/config.sub &&\
$($(package)_autoconf) --disable-shared --enable-static $($(package)_autoconf) --disable-shared --enable-static
endef endef

View File

@ -1,12 +1,6 @@
# this one is important # Set the system name, either Darwin, Linux, or Windows
SET(CMAKE_SYSTEM_NAME @depends@) SET(CMAKE_SYSTEM_NAME @depends@)
SET(CMAKE_BUILD_TYPE release)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_CXX_COMPILER @CXX@)
SET(STATIC true) SET(STATIC true)
SET(UNBOUND_STATIC true) SET(UNBOUND_STATIC true)
@ -14,6 +8,8 @@ SET(UNBOUND_STATIC true)
# where is the target environment # where is the target environment
SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr) SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
SET(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by CMakeLists.txt." FORCE) SET(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by CMakeLists.txt." FORCE)
SET(Readline_ROOT_DIR @prefix@) SET(Readline_ROOT_DIR @prefix@)
@ -28,18 +24,57 @@ SET(UNBOUND_LIBRARY @prefix@/lib/libunbound.a)
SET(ZMQ_INCLUDE_PATH @prefix@/include) SET(ZMQ_INCLUDE_PATH @prefix@/include)
SET(ZMQ_LIB @prefix@/lib/libzmq.a) SET(ZMQ_LIB @prefix@/lib/libzmq.a)
#SET(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON) SET(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON)
#SET(BOOST_IGNORE_SYSTEM_PATH ON) SET(BOOST_IGNORE_SYSTEM_PATH ON)
#SET(BOOST_ROOT @prefix@) SET(BOOST_ROOT @prefix@)
#SET(BOOST_LIBRARYDIR @prefix@/lib) SET(BOOST_LIBRARYDIR @prefix@/lib)
SET(Boost_COMPILER "-clang")
SET(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
SET(Boost_NO_SYSTEM_PATHS TRUE)
SET(Boost_USE_STATIC_LIBS TRUE)
SET(Boost_USE_STATIC_RUNTIME TRUE)
SET(OpenSSL_DIR @prefix@/lib)
# for libraries and headers in the target directories # for libraries and headers in the target directories
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
#set (MINGW_FLAG "-m64") # specify the cross compiler to be used. Darwin uses clang provided by the SDK.
#set (USE_LTO_DEFAULT false) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CMAKE_C_COMPILER @prefix@/native/bin/clang)
SET(CMAKE_C_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++)
SET(CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin11)
SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-apple-darwin11-)
SET(APPLE True)
SET(BUILD_TAG "mac-x64")
SET(BUILD_64 ON)
SET(ARCH "x86_64")
SET(BREW OFF)
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)
else()
SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_CXX_COMPILER @CXX@)
endif()
#Create a new cmake flag that indicates building with depends set(ARCH @arch@)
if(ARCH STREQUAL "arm")
set(ARCH "armv6zk")
set(ARMID "armv6zk")
set(BUILD_64 OFF)
set(CMAKE_BUILD_TYPE release)
set(BUILD_TAG "linux-armv6")
set(ARM6)
endif()
#Create a new global cmake flag that indicates building with depends
set (DEPENDS true) set (DEPENDS true)

View File

@ -28,7 +28,9 @@
set(blocksdat "") set(blocksdat "")
if(PER_BLOCK_CHECKPOINT) if(PER_BLOCK_CHECKPOINT)
if(APPLE) if(APPLE AND DEPENDS)
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} --target=x86_64-apple-darwin11 -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*)
elseif(APPLE AND NOT DEPENDS)
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*) add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*)
else() else()
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat) add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat)

View File

@ -27,10 +27,14 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE) if(APPLE)
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
else()
find_library(IOKIT_LIBRARY IOKit) find_library(IOKIT_LIBRARY IOKit)
mark_as_advanced(IOKIT_LIBRARY) mark_as_advanced(IOKIT_LIBRARY)
list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY}) list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
endif() endif()
endif()
set(checkpoints_sources set(checkpoints_sources
checkpoints.cpp) checkpoints.cpp)

View File

@ -27,10 +27,14 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE) if(APPLE)
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
else()
find_library(IOKIT_LIBRARY IOKit) find_library(IOKIT_LIBRARY IOKit)
mark_as_advanced(IOKIT_LIBRARY) mark_as_advanced(IOKIT_LIBRARY)
list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY}) list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
endif() endif()
endif()
set(cryptonote_basic_sources set(cryptonote_basic_sources
account.cpp account.cpp

View File

@ -28,7 +28,9 @@
set(blocksdat "") set(blocksdat "")
if(PER_BLOCK_CHECKPOINT) if(PER_BLOCK_CHECKPOINT)
if(APPLE) if(APPLE AND DEPENDS)
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} --target=x86_64-apple-darwin11 -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*)
elseif(APPLE AND NOT DEPENDS)
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*) add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*)
else() else()
add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat) add_custom_command(OUTPUT blocksdat.o MAIN_DEPENDENCY ../blocks/checkpoints.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat)