Browse Source

improved eth_download.cmake

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
f9a56e0618
  1. 3
      cmake/EthDependencies.cmake
  2. 14
      extdep/CMakeLists.txt
  3. 5
      extdep/compile/leveldb.cmake
  4. 33
      extdep/eth_download.cmake

3
cmake/EthDependencies.cmake

@ -6,6 +6,9 @@
string(TOLOWER ${CMAKE_SYSTEM_NAME} _system_name)
set (CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/extdep/install/${_system_name}")
# mac os
# https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html
set(ENV{DYLD_FALLBACK_LIBRARY_PATH} ${CMAKE_PREFIX_PATH}/lib)
# Dependencies must have a version number, to ensure reproducible build. The version provided here is the one that is in the extdep repository. If you use system libraries, version numbers may be different.

14
extdep/CMakeLists.txt

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
include(CMakeParseArguments)
include(eth_download.cmake)
# all dependencies will be installed into this directory, separated by platform
@ -30,11 +31,14 @@ if (ETH_COMPILE)
# cryptopp
include(compile/cryptopp.cmake)
else()
eth_download("json-rpc-cpp")
eth_download("qt")
eth_download("cryptopp")
#include(compile/snappy.cmake)
eth_download("leveldb")
eth_download(json-rpc-cpp VERSION 0.3.2)
eth_download(qt)
eth_download(cryptopp)
eth_download(snappy)
eth_download(leveldb)
#include(compile/leveldb.cmake)
#eth_download("leveldb")
endif()
# will be re-eanbled later

5
extdep/compile/leveldb.cmake

@ -1,9 +1,10 @@
if (APPLE)
ExternalProject_Add(leveldb
DEPENDS snappy
#DEPENDS snappy
URL https://leveldb.googlecode.com/files/leveldb-1.15.0.tar.gz
BINARY_DIR leveldb-prefix/src/leveldb
CONFIGURE_COMMAND patch < ${CMAKE_CURRENT_SOURCE_DIR}/compile/leveldb_osx.patch
#CONFIGURE_COMMAND patch < ${CMAKE_CURRENT_SOURCE_DIR}/compile/leveldb_osx.patch
CONFIGURE_COMMAND ""
BUILD_COMMAND export ETH_DEPENDENCY_INSTALL_DIR=${ETH_DEPENDENCY_INSTALL_DIR} && make -j 3
INSTALL_COMMAND cp -rf include/leveldb ${ETH_DEPENDENCY_INSTALL_DIR}/include/ && cp libleveldb.a ${ETH_DEPENDENCY_INSTALL_DIR}/lib && cp libleveldb.dylib.1.15 ${ETH_DEPENDENCY_INSTALL_DIR}/lib/libleveldb.dylib
)

33
extdep/eth_download.cmake

@ -6,7 +6,13 @@
# usage:
#
# eth_download("json-rpc-cpp")
# eth_download("json-rpc-cpp" "0.3.2")
# eth_download("json-rpc-cpp" VERSION "0.3.2")
#
# parsing arguments
# http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html
#
# for macos you may need to specify OSX_SCRIPT with install_name_tool to fix dylib
# http://stackoverflow.com/questions/2985315/using-install-name-tool-whats-going-wrong
#
# TODO:
# check if install_command is handling symlinks correctly on linux and windows
@ -14,30 +20,41 @@
macro(eth_download eth_package_name)
set (extra_macro_args ${ARGN})
if (extra_macro_args GREATER 0)
set(eth_tar_name "${eth_package_name}-${ARGV1}.tar.gz")
set (options)
set (one_value_args VERSION OSX_SCRIPT UNIX_SCRIPT WIN_SCRIPT)
set (multi_value_args)
cmake_parse_arguments (ETH_DOWNLOAD "${options}" "${one_value_args}" "${multi_value_args}" ${extra_macro_args})
if (ETH_DOWNLOAD_VERSION)
set(eth_tar_name "${eth_package_name}-${ETH_DOWNLOAD_VERSION}.tar.gz")
else()
set(eth_tar_name "${eth_package_name}.tar.gz")
endif()
message(STATUS "download path for ${eth_package_name} is : ${ETH_DEPENDENCY_SERVER}/${eth_tar_name}.tar.gz")
message(STATUS "download path for ${eth_package_name} is : ${ETH_DEPENDENCY_SERVER}/${eth_tar_name}")
# we need that to copy symlinks
# see http://superuser.com/questions/138587/how-to-copy-symbolic-links
if (APPLE)
set (eth_package_install cp -a . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_copy cp -a . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_install ${ETH_DOWNLOAD_OSX_SCRIPT})
elseif (UNIX)
set (eth_package_install cp -a . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_copy cp -a . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_install ${ETH_DOWNLOAD_UNIX_SCRIPT})
else ()
set (eth_package_install cmake -E copy_directory . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_copy cmake -E copy_directory . ${ETH_DEPENDENCY_INSTALL_DIR})
set (eth_package_install ${ETH_DOWNLOAD_WIN_SCRIPT})
endif()
if (eth_package_install)
message(STATUS "install script is at: ${eth_package_install}")
endif()
ExternalProject_Add(${eth_package_name}
URL ${ETH_DEPENDENCY_SERVER}/${eth_tar_name}
BINARY_DIR ${eth_package_name}-prefix/src/${eth_package_name}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_COMMAND ${eth_package_copy}
INSTALL_COMMAND ${eth_package_install}
)
endmacro()

Loading…
Cancel
Save