aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2018-03-20 00:33:49 +0100
committerTheCharlatan <seb.kung@gmail.com>2018-09-10 22:05:36 +0200
commit56b6e41ea7b7c17b513c24797d234e5cf9df8fa2 (patch)
tree7a319632b4178438e2578b22c37ad973e83994ad
parentDisable stack unwinding for mingw32 depends build. (diff)
downloadmonero-56b6e41ea7b7c17b513c24797d234e5cf9df8fa2.tar.xz
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
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt19
-rw-r--r--contrib/depends/Makefile4
-rw-r--r--contrib/depends/packages/boost.mk14
-rw-r--r--contrib/depends/packages/packages.mk5
-rw-r--r--contrib/depends/packages/unwind.mk4
-rw-r--r--contrib/depends/toolchain.cmake.in65
-rw-r--r--src/blockchain_utilities/CMakeLists.txt4
-rw-r--r--src/checkpoints/CMakeLists.txt10
-rw-r--r--src/cryptonote_basic/CMakeLists.txt10
-rw-r--r--src/daemon/CMakeLists.txt4
10 files changed, 102 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32100e574..b1fea6899 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -413,6 +413,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
endif ()
if (APPLE AND NOT IOS)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default")
if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
@@ -486,7 +487,9 @@ if(MSVC)
include_directories(SYSTEM src/platform/msc)
else()
include(TestCXXAcceptsFlag)
- set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
+ if (NOT DEPENDS)
+ 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}")
if(ARCH STREQUAL "default")
set(ARCH_FLAG "")
@@ -671,6 +674,10 @@ else()
message(STATUS "Selecting VFP for ARMv6")
set(CMAKE_C_FLAGS "${CMAKE_C_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)
if(ARM7)
@@ -725,7 +732,7 @@ else()
endif()
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()
set(DEBUG_FLAGS "-g3")
@@ -815,8 +822,12 @@ endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
- set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32)
- set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} icuio icuin icuuc icudt icutu iconv)
+ 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)
+ endif()
elseif(APPLE OR OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile
index be81626b1..b0c032c09 100644
--- a/contrib/depends/Makefile
+++ b/contrib/depends/Makefile
@@ -67,7 +67,7 @@ endif
ifeq ($(host_os),linux)
host_cmake=Linux
endif
-ifeq ($(host_os),darwin11)
+ifeq ($(host_os),darwin)
host_cmake=Darwin
endif
@@ -182,6 +182,8 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_
-e 's|@debug@|$(DEBUG)|' \
-e 's|@depends@|$(host_cmake)|' \
-e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\
+ -e 's|@sdk@|$(SDK_PATH)|'\
+ -e 's|@arch@|$(host_arch)|'\
$< > $@
$(AT)touch $@
diff --git a/contrib/depends/packages/boost.mk b/contrib/depends/packages/boost.mk
index 9d3dda74a..89db5a415 100644
--- a/contrib/depends/packages/boost.mk
+++ b/contrib/depends/packages/boost.mk
@@ -1,8 +1,8 @@
-package=boost
-$(package)_version=1_58_0
-$(package)_download_path=https://sourceforge.net/projects/boost/files/boost/1.58.0
-$(package)_file_name=$(package)_$($(package)_version).tar.gz
-$(package)_sha256_hash=a004d9b3fa95e956383693b86fce1b68805a6f71c2e68944fa813de0fb8c8102
+package=boost
+$(package)_version=1_64_0
+$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
+$(package)_file_name=$(package)_$($(package)_version).tar.bz2
+$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
define $(package)_set_vars
$(package)_config_opts_release=variant=release
@@ -19,13 +19,13 @@ $(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_toolset_darwin=darwin
$(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_linux=-fPIC
endef
define $(package)_preprocess_cmds
- echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
+ echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STR IP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
endef
define $(package)_config_cmds
diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk
index 1aca06096..af92191bb 100644
--- a/contrib/depends/packages/packages.mk
+++ b/contrib/depends/packages/packages.mk
@@ -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
wallet_packages=bdb
@@ -13,6 +13,9 @@ endif
ifeq ($(host_os),darwin11)
package += unwind
endif
+ifeq ($(host_os),mingw32)
+packages += icu4c
+endif
ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
diff --git a/contrib/depends/packages/unwind.mk b/contrib/depends/packages/unwind.mk
index 06e142115..e1bcb35b2 100644
--- a/contrib/depends/packages/unwind.mk
+++ b/contrib/depends/packages/unwind.mk
@@ -5,7 +5,9 @@ $(package)_file_name=lib$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992
define $(package)_config_cmds
- $($(package)_autoconf) --disable-shared --enable-static
+ cp -f $(BASEDIR)/config.guess config/config.guess &&\
+ cp -f $(BASEDIR)/config.sub config/config.sub &&\
+ $($(package)_autoconf) --disable-shared --enable-static
endef
define $(package)_build_cmds
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index eb4fcba04..06217363c 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -1,12 +1,6 @@
-# this one is important
+# Set the system name, either Darwin, Linux, or Windows
SET(CMAKE_SYSTEM_NAME @depends@)
-
-#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(CMAKE_BUILD_TYPE release)
SET(STATIC true)
SET(UNBOUND_STATIC true)
@@ -14,6 +8,8 @@ SET(UNBOUND_STATIC true)
# where is the target environment
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(Readline_ROOT_DIR @prefix@)
@@ -28,18 +24,57 @@ SET(UNBOUND_LIBRARY @prefix@/lib/libunbound.a)
SET(ZMQ_INCLUDE_PATH @prefix@/include)
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
-#SET(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON)
-#SET(BOOST_IGNORE_SYSTEM_PATH ON)
-#SET(BOOST_ROOT @prefix@)
-#SET(BOOST_LIBRARYDIR @prefix@/lib)
+SET(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON)
+SET(BOOST_IGNORE_SYSTEM_PATH ON)
+SET(BOOST_ROOT @prefix@)
+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
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_INCLUDE ONLY) # Find includes in target
-#set (MINGW_FLAG "-m64")
-#set (USE_LTO_DEFAULT false)
+# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
+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()
+
+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 cmake flag that indicates building with depends
+#Create a new global cmake flag that indicates building with depends
set (DEPENDS true)
diff --git a/src/blockchain_utilities/CMakeLists.txt b/src/blockchain_utilities/CMakeLists.txt
index 338ec3e4b..bc2ea6876 100644
--- a/src/blockchain_utilities/CMakeLists.txt
+++ b/src/blockchain_utilities/CMakeLists.txt
@@ -28,7 +28,9 @@
set(blocksdat "")
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.*)
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)
diff --git a/src/checkpoints/CMakeLists.txt b/src/checkpoints/CMakeLists.txt
index 02bb2891a..715006522 100644
--- a/src/checkpoints/CMakeLists.txt
+++ b/src/checkpoints/CMakeLists.txt
@@ -27,9 +27,13 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE)
- find_library(IOKIT_LIBRARY IOKit)
- mark_as_advanced(IOKIT_LIBRARY)
- list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
+ if(DEPENDS)
+ list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+ else()
+ find_library(IOKIT_LIBRARY IOKit)
+ mark_as_advanced(IOKIT_LIBRARY)
+ list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
+ endif()
endif()
set(checkpoints_sources
diff --git a/src/cryptonote_basic/CMakeLists.txt b/src/cryptonote_basic/CMakeLists.txt
index d50a9df67..21445959d 100644
--- a/src/cryptonote_basic/CMakeLists.txt
+++ b/src/cryptonote_basic/CMakeLists.txt
@@ -27,9 +27,13 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE)
- find_library(IOKIT_LIBRARY IOKit)
- mark_as_advanced(IOKIT_LIBRARY)
- list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
+ if(DEPENDS)
+ list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+ else()
+ find_library(IOKIT_LIBRARY IOKit)
+ mark_as_advanced(IOKIT_LIBRARY)
+ list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
+ endif()
endif()
set(cryptonote_basic_sources
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index 84004c3c6..b1c4b711d 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -28,7 +28,9 @@
set(blocksdat "")
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.*)
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)