diff options
author | chriseth <chris@ethereum.org> | 2017-09-20 15:48:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-20 15:48:24 +0800 |
commit | c0b3e5b0785efd1b601cff470d3e3d4a71b2c283 (patch) | |
tree | 6efde641f685a6a999521748d20c1bdd9244e6bb | |
parent | d6bc0a0631897f893c06dcc9382bf29f23db6b26 (diff) | |
parent | b9e4d5b6c87bd2b787f296e01602ee69d5846ce4 (diff) | |
download | dexon-solidity-c0b3e5b0785efd1b601cff470d3e3d4a71b2c283.tar.gz dexon-solidity-c0b3e5b0785efd1b601cff470d3e3d4a71b2c283.tar.zst dexon-solidity-c0b3e5b0785efd1b601cff470d3e3d4a71b2c283.zip |
Merge pull request #2930 from ethereum/no-deps-submodule
Remove deps git submodule
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | cmake/jsoncpp.cmake | 1 | ||||
m--------- | deps | 0 | ||||
-rw-r--r-- | scripts/install_deps.bat | 2 | ||||
-rw-r--r-- | scripts/install_deps.cmake | 99 |
5 files changed, 101 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ba66d79f..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "deps"] - path = deps - url = https://github.com/ethereum/cpp-dependencies diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake index 79ce4c5f..6ddf4c74 100644 --- a/cmake/jsoncpp.cmake +++ b/cmake/jsoncpp.cmake @@ -24,6 +24,7 @@ endif() ExternalProject_Add(jsoncpp-project PREFIX "${prefix}" + DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads" DOWNLOAD_NAME jsoncpp-1.7.7.tar.gz URL https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz URL_HASH SHA256=087640ebcf7fbcfe8e2717a0b9528fff89c52fcf69fa2a18cc2b538008098f97 diff --git a/deps b/deps deleted file mode 160000 -Subproject e5c8316db8d3daa0abc3b5af8545ce330057608 diff --git a/scripts/install_deps.bat b/scripts/install_deps.bat index 512a28df..d02005cc 100644 --- a/scripts/install_deps.bat +++ b/scripts/install_deps.bat @@ -58,4 +58,4 @@ REM REM Copyright (c) 2016 solidity contributors. REM --------------------------------------------------------------------------- -cmake -P deps\install_deps.cmake +cmake -P scripts\install_deps.cmake diff --git a/scripts/install_deps.cmake b/scripts/install_deps.cmake new file mode 100644 index 00000000..d1284b9e --- /dev/null +++ b/scripts/install_deps.cmake @@ -0,0 +1,99 @@ +get_filename_component(ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../deps" ABSOLUTE) + +set(CACHE_DIR "${ROOT_DIR}/cache") +set(PACKAGES_DIR "${ROOT_DIR}/packages") + +function(download URL DST_FILE STATUS) + set(TMP_FILE "${DST_FILE}.part") + + get_filename_component(FILE_NAME ${DST_FILE} NAME) + if (NOT EXISTS ${DST_FILE}) + message("Downloading ${FILE_NAME}") + file(DOWNLOAD ${URL} ${TMP_FILE} SHOW_PROGRESS STATUS DOWNLOAD_STATUS) + list(GET DOWNLOAD_STATUS 0 STATUS_CODE) + if (STATUS_CODE EQUAL 0) + file(RENAME ${TMP_FILE} ${DST_FILE}) + else() + file(REMOVE ${TMP_FILE}) + list(GET DOWNLOAD_STATUS 1 ERROR_MSG) + + message("ERROR! Downloading '${FILE_NAME}' failed.") + message(STATUS "URL: ${URL}") + message(STATUS "Error: ${STATUS_CODE} ${ERROR_MSG}") + set(STATUS FALSE PARENT_SCOPE) + return() + endif() + else() + message("Using cached ${FILE_NAME}") + endif() + set(STATUS TRUE PARENT_SCOPE) +endfunction(download) + +function(download_and_unpack PACKAGE_URL DST_DIR) + get_filename_component(FILE_NAME ${PACKAGE_URL} NAME) + + set(DST_FILE "${CACHE_DIR}/${FILE_NAME}") + set(TMP_FILE "${DST_FILE}.part") + + file(MAKE_DIRECTORY ${CACHE_DIR}) + file(MAKE_DIRECTORY ${DST_DIR}) + + download(${PACKAGE_URL} ${DST_FILE} STATUS) + + if (STATUS) + message("Unpacking ${FILE_NAME} to ${DST_DIR}") + execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${DST_FILE} + WORKING_DIRECTORY ${DST_DIR}) + endif() +endfunction(download_and_unpack) + +# Packs installed package binaries and headers into an archive. +function(create_package NAME DIR) + message("Creating package ${NAME}") + file(MAKE_DIRECTORY ${PACKAGES_DIR}) + + # To create an archive without addicional top level directory + # (like package-X.Y.Z) we need to know all top level files/dirs. + # Usually it is just "win64" dir. + file(GLOB TOP_FILES RELATIVE ${DIR} "${DIR}/*") + + set(PACKAGE_FILE "${PACKAGES_DIR}/${NAME}.tar.gz") + execute_process(COMMAND ${CMAKE_COMMAND} -E + tar -czf ${PACKAGE_FILE} ${TOP_FILES} + WORKING_DIRECTORY ${DIR}) +endfunction(create_package) + +# Downloads the source code of the package and unpacks it to dedicated 'src' +# dir. Also creates 'build' and 'install' dir to be used by a build script. +function(prepare_package_source NAME VERSION URL) + set(PACKAGE_NAME "${NAME}-${VERSION}") + + set(PACKAGE_DIR "${CACHE_DIR}/${PACKAGE_NAME}") + set(SOURCE_DIR "${PACKAGE_DIR}/src") + set(BUILD_DIR "${PACKAGE_DIR}/build") + set(INSTALL_DIR "${PACKAGE_DIR}/install") + + if (NOT EXISTS ${SOURCE_DIR}) + download_and_unpack(${URL} ${PACKAGE_DIR} STATUS) + file(GLOB ORIG_SOURCE_DIR_NAME "${PACKAGE_DIR}/*") + file(RENAME ${ORIG_SOURCE_DIR_NAME} ${SOURCE_DIR}) + endif() + + file(MAKE_DIRECTORY ${BUILD_DIR}) + file(MAKE_DIRECTORY ${INSTALL_DIR}) + + # Export names and dirs to be used by a package-specific build script. + set(PACKAGE_NAME ${PACKAGE_NAME} PARENT_SCOPE) + set(SOURCE_DIR ${SOURCE_DIR} PARENT_SCOPE) + set(BUILD_DIR ${BUILD_DIR} PARENT_SCOPE) + set(INSTALL_DIR ${INSTALL_DIR} PARENT_SCOPE) +endfunction() + +set(INSTALL_DIR "${ROOT_DIR}/install") +set(SERVER "https://github.com/ethereum/cpp-dependencies/releases/download/vc140/") + +function(download_and_install PACKAGE_NAME) + download_and_unpack("${SERVER}${PACKAGE_NAME}.tar.gz" ${INSTALL_DIR}) +endfunction(download_and_install) + +download_and_install("boost-1.61") |