diff --git a/.appveyor.yml b/.appveyor.yml index 3552f017fd..161e73fee5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Bitprim developers (see AUTHORS) +# Copyright (c) 2017-2018 Bitprim Inc. # # This file is part of Bitprim. # @@ -22,7 +22,9 @@ branches: - master - dev - /^v\d+\.\d+\.\d+$/ - - feature_compile_time_currencies + - /^release-\d+\.\d+\.\d+$/ + - /^feature-ci-.+$/ + - /^feature_ci_.+$/ build: false @@ -32,21 +34,53 @@ environment: PYTHON_ARCH: "32" matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CONAN_VISUAL_VERSIONS: 15 VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\" - # - MINGW_CONFIGURATIONS: "5.4@x86_64@seh@posix" #5.4@x86_64@sjlj@posix" - # - MINGW_CONFIGURATIONS: "7.2@x86_64@seh@posix" #7.2@x86_64@sjlj@posix" - - - MINGW_CONFIGURATIONS: "7@x86_64@seh@posix, 6@x86_64@seh@posix, 5@x86_64@seh@posix, 4.9@x86_64@seh@posix" + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CONAN_VISUAL_VERSIONS: 14 # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - # CONAN_VISUAL_VERSIONS: 12 + # CONAN_VISUAL_VERSIONS: 12 + + # - MINGW_CONFIGURATIONS: "7@x86_64@seh@posix, 6@x86_64@seh@posix, 5@x86_64@seh@posix, 4.9@x86_64@seh@posix" + + - MINGW_CONFIGURATIONS: "8@x86_64@seh@posix" + - MINGW_CONFIGURATIONS: "7@x86_64@seh@posix" + - MINGW_CONFIGURATIONS: "6@x86_64@seh@posix" + - MINGW_CONFIGURATIONS: "5@x86_64@seh@posix" + # - MINGW_CONFIGURATIONS: "4.9@x86_64@seh@posix" + + +init: + # - echo "*******************************************************" + # - echo %APPVEYOR_REPO_TAG% + # - echo %APPVEYOR_REPO_BRANCH% + # - echo %APPVEYOR_REPO_TAG_NAME% + # - echo %APPVEYOR_REPO_COMMIT_MESSAGE% + # - echo "*******************************************************" + + - ps: | + if ($Env:APPVEYOR_REPO_BRANCH -ceq "master" -And [string]::IsNullOrEmpty($Env:APPVEYOR_REPO_TAG_NAME)) { + Write-Host "branch is master without tags, exiting" + Exit-AppveyorBuild + } + + # Note(fernando): It is implemented natively in Appveyor... + # if ($Env:APPVEYOR_REPO_COMMIT_MESSAGE -like "*\[skip appveyor\]*") { + # Write-Host "[skip appveyor] detected in commit message, exiting" + # Exit-AppveyorBuild + # } install: + # - echo "*******************************************************" + # - echo %APPVEYOR_REPO_TAG% + # - echo %APPVEYOR_REPO_BRANCH% + # - echo %APPVEYOR_REPO_TAG_NAME% + # - echo %APPVEYOR_REPO_COMMIT_MESSAGE% + # - echo "*******************************************************" + - set PATH=%PATH%;%PYTHON%/Scripts/ - pip.exe install conan --upgrade @@ -58,9 +92,41 @@ install: - conan user # It creates the conan data directory test_script: + + - git submodule init + # - git submodule update --remote + - git submodule update + # - dir *.* + # - git fetch --unshallow # - export BITPRIM_BUILD_NUMBER="$(git describe)" - for /f %%i in ('git describe') do set BITPRIM_BUILD_NUMBER=%%i - echo %BITPRIM_BUILD_NUMBER% + # - echo %APPVEYOR_REPO_BRANCH% + # - dir *.* + # - cd + + - ps: | + if ($Env:APPVEYOR_REPO_BRANCH -ceq "dev") { + $Env:BITPRIM_CONAN_CHANNEL = "testing" + } + elseif ($Env:APPVEYOR_REPO_BRANCH.StartsWith("release")) { + $Env:BITPRIM_CONAN_CHANNEL = "stable" + } + elseif ($Env:APPVEYOR_REPO_BRANCH.StartsWith("feature")) { + $Env:BITPRIM_CONAN_CHANNEL = $Env:APPVEYOR_REPO_BRANCH + } + else { + $Env:BITPRIM_CONAN_CHANNEL = "stable" + } + + # if ([System.IO.File]::Exists("conan_channel")) { + # Write-Host "Creating conan_channel file" + # $Env:BITPRIM_CONAN_CHANNEL | Out-File conan_channel + # } + + # - dir *.* + # - echo %BITPRIM_CONAN_CHANNEL% + - python build.py diff --git a/.gitignore b/.gitignore index 7a94b7a1b4..bc981ab360 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,6 @@ CMakeSettings.json /.vs/ProjectSettings.json /.vs/slnx.sqlite -.vscode/ \ No newline at end of file +.vscode/ + +get_branch.py \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..f805158603 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ci_utils"] + path = ci_utils + url = https://github.com/bitprim/bitprim-ci-utils.git diff --git a/.travis.yml b/.travis.yml index 8db9da3cff..d740e1ae43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Bitprim developers (see AUTHORS) +# Copyright (c) 2017-2018 Bitprim Inc. # # This file is part of Bitprim. # @@ -19,11 +19,12 @@ branches: only: - - master + # - master - dev - /^v\d+\.\d+\.\d+$/ - - feature_compile_time_currencies - + - /^release-\d+\.\d+\.\d+$/ + - /^feature-ci-.+$/ + - /^feature_ci_.+$/ linux: &linux os: linux @@ -39,50 +40,67 @@ osx: &osx matrix: include: - - <<: *linux - env: PUSH_TO_REPOS=true + # - <<: *linux + # env: PUSH_TO_REPOS=true + # Linux, GCC, libstdc++ ------------------------------------------------------ - <<: *linux - env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 + env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=lasote/conangcc8 + BITPRIM_RUN_TESTS=true - <<: *linux - env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5 + env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 - <<: *linux - env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc63 + env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6 - <<: *linux - env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 - BITPRIM_RUN_TESTS=true + env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5 - - <<: *linux - env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39 + # - <<: *linux + # env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 + # Linux, Clang, libstdc++ ---------------------------------------------------- - <<: *linux - env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40 + env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=lasote/conanclang60 - <<: *linux env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=lasote/conanclang50 - - <<: *osx - osx_image: xcode7.3 - env: CONAN_APPLE_CLANG_VERSIONS=7.3 + - <<: *linux + env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40 + + # - <<: *linux + # env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39 + + # macOS, apple-Clang, libc++ ------------------------------------------------- + - <<: *osx + osx_image: xcode9 + env: CONAN_APPLE_CLANG_VERSIONS=9.0 + BITPRIM_RUN_TESTS=true + - <<: *osx osx_image: xcode8.3 env: CONAN_APPLE_CLANG_VERSIONS=8.1 + - <<: *osx - osx_image: xcode9 - env: CONAN_APPLE_CLANG_VERSIONS=9.0 - BITPRIM_RUN_TESTS=true + osx_image: xcode7.3 + env: CONAN_APPLE_CLANG_VERSIONS=7.3 +before_install: + - | + if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[skip travis]"* ]]; then + echo "[skip travis] detected in commit message, exiting" + travis_terminate 0 + fi install: - cd ${TRAVIS_BUILD_DIR} - | if [[ "${PUSH_TO_REPOS}" != "true" ]]; then - chmod +x .travis/install.sh - ./.travis/install.sh + chmod +x ci_utils/.travis/install.sh + ./ci_utils/.travis/install.sh fi script: @@ -90,14 +108,40 @@ script: - export BITPRIM_BUILD_NUMBER="$(git describe)" - echo "${BITPRIM_BUILD_NUMBER}" + - | + echo "${TRAVIS_BRANCH}" + if [[ "${TRAVIS_BRANCH}" = "dev" ]]; then + export BITPRIM_CONAN_CHANNEL="testing" + elif [[ "${TRAVIS_BRANCH}" = "release"* ]]; then + export BITPRIM_CONAN_CHANNEL="stable" + elif [[ "${TRAVIS_BRANCH}" = "feature"* ]]; then + export BITPRIM_CONAN_CHANNEL="${TRAVIS_BRANCH}" + else + export BITPRIM_CONAN_CHANNEL="stable" + fi + echo "${BITPRIM_CONAN_CHANNEL}" + + # pwd + # ls -ltra + + # if [ -e conan_channel ] then + # echo "Creating conan_channel file" + # printf "${BITPRIM_CONAN_CHANNEL}" > conan_channel + # fi + + # ls -ltra + + + + - | if [[ "${PUSH_TO_REPOS}" == "true" ]]; then chmod +x .travis/push_other_repo.sh ./.travis/push_other_repo.sh else cd ${TRAVIS_BUILD_DIR} - chmod +x .travis/run.sh - ./.travis/run.sh + chmod +x ci_utils/.travis/run.sh + ./ci_utils/.travis/run.sh fi notifications: diff --git a/.travis/install.sh b/.travis/install.sh deleted file mode 100644 index a1546004a2..0000000000 --- a/.travis/install.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ "$(uname -s)" == 'Darwin' ]]; then - brew update || brew update - brew outdated pyenv || brew upgrade pyenv - brew install pyenv-virtualenv - brew install cmake || true - - if which pyenv > /dev/null; then - eval "$(pyenv init -)" - fi - - pyenv install 2.7.10 - pyenv virtualenv 2.7.10 conan - pyenv rehash - pyenv activate conan -fi - -pip install conan --upgrade -# pip install conan==1.0.0b5 #Fixed Beta version... - -pip install conan_package_tools -pip install cpuid --upgrade - -conan user diff --git a/.travis/run.sh b/.travis/run.sh deleted file mode 100644 index 0a3488ee07..0000000000 --- a/.travis/run.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ "$(uname -s)" == 'Darwin' ]]; then - if which pyenv > /dev/null; then - eval "$(pyenv init -)" - fi - pyenv activate conan -fi - -python build.py diff --git a/CMakeLists.txt b/CMakeLists.txt index d1344e5809..6f964ef706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,15 +91,14 @@ message( STATUS "Bitprim: Compiling for ${MICROARCHITECTURE}") # endif() -if(EXISTS ${CMAKE_SOURCE_DIR}/bitprimbuildinfo.cmake) - include(${CMAKE_SOURCE_DIR}/bitprimbuildinfo.cmake) +if(EXISTS ${CMAKE_SOURCE_DIR}/ci_utils/cmake/bitprimbuildinfo.cmake) + include(${CMAKE_SOURCE_DIR}/ci_utils/cmake/bitprimbuildinfo.cmake) else() message( STATUS "bitprimbuildinfo doent exists") endif() - - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/ci_utils/cmake) include(Secp256k1Tools) diff --git a/conan_channel b/_conan_channel similarity index 100% rename from conan_channel rename to _conan_channel diff --git a/bitprimbuildinfo.cmake b/bitprimbuildinfo.cmake deleted file mode 100644 index 37a33d6db4..0000000000 --- a/bitprimbuildinfo.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# include(CMakeParseArguments) - -# message( STATUS "--------------------------------------------" ) -# get_directory_property( DirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) -# foreach( d ${DirDefs} ) -# message( STATUS "Found Define: " ${d} ) -# endforeach() -# message( STATUS "DirDefs: " ${DirDefs} ) -# message( STATUS "--------------------------------------------" ) - -# message( STATUS "2 NO_CONAN_AT_ALL: " ${NO_CONAN_AT_ALL} ) -# message( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) -# message( STATUS "NOT_USE_CPP11_ABI: " ${NOT_USE_CPP11_ABI} ) -# message( STATUS "CONAN_CXX_FLAGS: " ${CONAN_CXX_FLAGS} ) -# message( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) - - -if (NOT NO_CONAN_AT_ALL) - if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - conan_basic_setup() - - remove_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) - remove_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) - - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - if (NOT NOT_USE_CPP11_ABI) - add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) - message( STATUS "Bitprim: Using _GLIBCXX_USE_CXX11_ABI=1") - else() - add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) - message( STATUS "Bitprim: Using _GLIBCXX_USE_CXX11_ABI=0") - endif() - endif() - else() - message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") - endif() -endif() - -# message( STATUS "CONAN_CXX_FLAGS: " ${CONAN_CXX_FLAGS} ) -# message( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) - diff --git a/build.py b/build.py index 7a4f7d86e5..a5da398d0f 100644 --- a/build.py +++ b/build.py @@ -1,112 +1,18 @@ -from conan.packager import ConanMultiPackager +# from conan.packager import ConanMultiPackager +# import copy +# import re +# import platform import os -import copy -import re -import platform import cpuid - -def get_content(path): - with open(path, 'r') as f: - return f.read() - -def get_version(): - return get_content('conan_version') - -def get_channel(): - return get_content('conan_channel') - -def get_conan_vars(): - login_username = os.getenv("CONAN_LOGIN_USERNAME", "bitprim-bintray") - username = os.getenv("CONAN_USERNAME", "bitprim") - channel = os.getenv("CONAN_CHANNEL", get_channel()) - version = os.getenv("CONAN_VERSION", get_version()) - return login_username, username, channel, version - -def get_value_from_recipe(search_string, recipe="conanfile.py"): - with open(recipe, "r") as conanfile: - contents = conanfile.read() - result = re.search(search_string, contents) - return result - -def get_name_from_recipe(): - return get_value_from_recipe(r'''name\s*=\s*["'](\S*)["']''').groups()[0] - -def get_user_repository(username, repository_name): - # https://api.bintray.com/conan/bitprim/bitprim - return "https://api.bintray.com/conan/{0}/{1}".format(username.lower(), repository_name) - -def get_conan_upload(username): - repository_name = os.getenv("BIPRIM_BINTRAY_REPOSITORY", "bitprim") - return os.getenv("CONAN_UPLOAD", get_user_repository(username, repository_name)) - -def get_conan_remotes(username): - # While redundant, this moves upload remote to position 0. - remotes = [get_conan_upload(username)] - - # # Add bincrafters repository for other users, e.g. if the package would - # # require other packages from the bincrafters repo. - # bincrafters_user = "bincrafters" - # if username != bincrafters_user: - # remotes.append(get_conan_upload(bincrafters_user)) - return remotes - -def get_os(): - return platform.system().replace("Darwin", "Macos") - -def get_archs(): - return ["x86_64"] - # archs = os.getenv("CONAN_ARCHS", None) - # if get_os() == "Macos" and archs is None: - # return ["x86_64"] - # return split_colon_env("CONAN_ARCHS") if archs else None - - -def get_builder(args=None): - name = get_name_from_recipe() - login_username, username, channel, version = get_conan_vars() - reference = "{0}/{1}".format(name, version) - upload = get_conan_upload(username) - remotes = os.getenv("CONAN_REMOTES", get_conan_remotes(username)) - - # upload_when_stable = get_upload_when_stable() - # stable_branch_pattern = os.getenv("CONAN_STABLE_BRANCH_PATTERN", "stable/*") - - archs = get_archs() - builder = ConanMultiPackager( - args=args, - username=username, - login_username=login_username, - channel=channel, - reference=reference, - upload=upload, - remotes=remotes, - archs=archs, - # upload_only_when_stable=upload_when_stable, - # stable_branch_pattern=stable_branch_pattern - ) - - return builder, name - -def handle_microarchs(opt_name, microarchs, filtered_builds, settings, options, env_vars, build_requires): - microarchs = list(set(microarchs)) - - for ma in microarchs: - opts_copy = copy.deepcopy(options) - opts_copy[opt_name] = ma - filtered_builds.append([settings, opts_copy, env_vars, build_requires]) - +from ci_utils.utils import get_builder, handle_microarchs if __name__ == "__main__": builder, name = get_builder() builder.add_common_builds(shared_option_name="%s:shared" % name, pure_c=True) - filtered_builds = [] - for settings, options, env_vars, build_requires in builder.builds: - - # print(settings) - # print(options) - + # for settings, options, env_vars, build_requires in builder.builds: + for settings, options, env_vars, build_requires, reference in builder.items: if settings["build_type"] == "Release" \ and not("%s:shared" % name in options and options["%s:shared" % name]): @@ -120,7 +26,6 @@ def handle_microarchs(opt_name, microarchs, filtered_builds, settings, options, marchs = ["x86_64", ''.join(cpuid.cpu_microarchitecture()), "haswell", "skylake", "skylake-avx512"] handle_microarchs("%s:microarchitecture" % name, marchs, filtered_builds, settings, options, env_vars, build_requires) - # filtered_builds.append([settings, options, env_vars, build_requires]) builder.builds = filtered_builds diff --git a/ci_utils b/ci_utils new file mode 160000 index 0000000000..1341c8a436 --- /dev/null +++ b/ci_utils @@ -0,0 +1 @@ +Subproject commit 1341c8a436bb090ef08020f9691217a58e8b33dc diff --git a/cmake/BitprimTools.cmake b/cmake/BitprimTools.cmake deleted file mode 100644 index f7d5e8269c..0000000000 --- a/cmake/BitprimTools.cmake +++ /dev/null @@ -1,128 +0,0 @@ -# -# Copyright (c) 2017 Bitprim developers (see AUTHORS) -# -# This file is part of Bitprim. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -macro(_replace_release_flag search replace_with) - string(REPLACE "${search}" "${replace_with}" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") - string(REPLACE "${search}" "${replace_with}" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -endmacro() - -function(_add_c_compile_flag _Flag _Var) - check_cxx_compiler_flag(${_Flag} ${_Var}) - if (${_Var}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_Flag}" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_Flag}" ) - endif() -endfunction() - -function(_add_cxx_compile_flag _Flag _Var) - check_cxx_compiler_flag(${_Flag} ${_Var}) - if (${_Var}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_Flag}" ) - endif() -endfunction() - -function(_add_link_flag _Flag _Var) - check_cxx_compiler_flag(${_Flag} ${_Var}) - if (${_Var}) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_Flag}" ) - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${_Flag}" ) - endif() -endfunction() - - -function(_check_has_decl header header_result symbol symbol_result) - check_include_file(${header} ${header_result}) - if (${header_result}) - add_definitions(-D${header_result}) - check_cxx_symbol_exists(${symbol} ${header} ${symbol_result}) - if (${symbol_result}) - add_definitions(-D${symbol_result}=1) - else() - add_definitions(-D${symbol_result}=0) - endif() - endif() -endfunction() - - - -# Build -#============================================================================== -function(_group_sources target sources_dir) - file(GLOB_RECURSE _headers - ${sources_dir}/include/*.h ${sources_dir}/include/*.hpp) - target_sources(${target} PRIVATE ${_headers}) - - get_target_property(sources ${target} SOURCES) - foreach (source ${sources}) - get_filename_component(group ${source} ABSOLUTE) - get_filename_component(group ${group} DIRECTORY) - file(RELATIVE_PATH group "${sources_dir}" "${group}") - if (group) - if (MSVC) - string(REPLACE "/" "\\" group "${group}") - endif() - source_group("${group}" FILES "${source}") - endif() - endforeach() - - set_target_properties(${target} PROPERTIES FOLDER "core") -endfunction() - - - - -# Tests -#============================================================================== -function(_add_tests target) - if (ENABLE_SHARED) - target_compile_definitions(${target} PRIVATE -DBOOST_TEST_DYN_LINK) - endif() - target_include_directories(${target} SYSTEM PUBLIC ${Boost_INCLUDE_DIR}) - target_link_libraries(${target} PUBLIC ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - - foreach (_test_name ${ARGN}) - add_test( - NAME test.core.${_test_name} - COMMAND ${target} - --run_test=${_test_name} - --show_progress=no - --detect_memory_leak=0 - --report_level=no - --build_info=yes) - endforeach() -endfunction() - - - -# macro(remove_cxx_flag flag) -# string(REPLACE "${flag}" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -# endmacro() - -# macro(remove_cxx_flag flag) -# string(REPLACE "${flag}" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -# endmacro() - -# macro(remove_cxx_flag flag) -# string(REPLACE "${flag}" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") -# endmacro() - -# set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}" ) -# message("CMAKE_C_FLAGS_RELEASE is ${CMAKE_C_FLAGS_RELEASE}") -# remove_cxx_flag("-O2") -# message("CMAKE_C_FLAGS_RELEASE is ${CMAKE_C_FLAGS_RELEASE}") diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake deleted file mode 100644 index d99763c08c..0000000000 --- a/cmake/FindGMP.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Try to find the GMP librairies -# GMP_FOUND - system has GMP lib -# GMP_INCLUDE_DIR - the GMP include directory -# GMP_LIBRARIES - Libraries needed to use GMP - -# Copyright (c) 2006, Laurent Montel, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) - # Already in cache, be silent - set(GMP_FIND_QUIETLY TRUE) -endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) - -find_path(GMP_INCLUDE_DIR NAMES gmp.h ) -find_library(GMP_LIBRARIES NAMES gmp libgmp ) -find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx ) -MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} ) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) - -mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) diff --git a/cmake/Secp256k1Tools.cmake b/cmake/Secp256k1Tools.cmake index e78e24e793..46848245ed 100644 --- a/cmake/Secp256k1Tools.cmake +++ b/cmake/Secp256k1Tools.cmake @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Bitprim developers (see AUTHORS) +# Copyright (c) 2017-2018 Bitprim Inc. # # This file is part of Bitprim. # diff --git a/conan_req_version b/conan_req_version index b123147e2a..03e5161d2c 100644 --- a/conan_req_version +++ b/conan_req_version @@ -1 +1 @@ -1.1 \ No newline at end of file +1.4.5 \ No newline at end of file diff --git a/conan_user b/conan_user new file mode 100644 index 0000000000..0f7da7ab6d --- /dev/null +++ b/conan_user @@ -0,0 +1 @@ +bitprim \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index b2f5da657c..44cdad6d15 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Bitprim developers (see AUTHORS) +# Copyright (c) 2017-2018 Bitprim Inc. # # This file is part of Bitprim. # @@ -21,47 +21,7 @@ from conans import ConanFile, CMake from conans import __version__ as conan_version from conans.model.version import Version -import importlib - -def option_on_off(option): - return "ON" if option else "OFF" - -def get_content(file_name): - file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), file_name) - with open(file_path, 'r') as f: - return f.read() - -def get_version(): - return get_content('conan_version') - -def get_channel(): - return get_content('conan_channel') - -def get_conan_req_version(): - return get_content('conan_req_version') - -microarchitecture_default = 'x86_64' - -def get_cpuid(): - try: - # print("*** cpuid OK") - cpuid = importlib.import_module('cpuid') - return cpuid - except ImportError: - # print("*** cpuid could not be imported") - return None - -def get_cpu_microarchitecture_or_default(default): - cpuid = get_cpuid() - if cpuid != None: - # return '%s%s' % cpuid.cpu_microarchitecture() - return '%s' % (''.join(cpuid.cpu_microarchitecture())) - else: - return default - -def get_cpu_microarchitecture(): - return get_cpu_microarchitecture_or_default(microarchitecture_default) - +from ci_utils.utils import option_on_off, get_version, get_conan_req_version, get_cpu_microarchitecture, get_cpuid class Secp256k1Conan(ConanFile): name = "secp256k1" @@ -70,7 +30,6 @@ class Secp256k1Conan(ConanFile): url = "https://github.com/bitprim/secp256k1" description = "Optimized C library for EC operations on curve secp256k1" settings = "os", "compiler", "build_type", "arch" - # settings = "os", "compiler", "build_type", "arch", "os_build", "arch_build" if Version(conan_version) < Version(get_conan_req_version()): raise Exception ("Conan version should be greater or equal than %s. Detected: %s." % (get_conan_req_version(), conan_version)) @@ -129,18 +88,15 @@ class Secp256k1Conan(ConanFile): generators = "cmake" build_policy = "missing" - exports = "conan_channel", "conan_version", "conan_req_version" - exports_sources = "src/*", "include/*", "CMakeLists.txt", "cmake/*", "secp256k1Config.cmake.in", "bitprimbuildinfo.cmake", "contrib/*", "test/*" - + exports = "conan_version", "conan_req_version", "conan_user", "ci_utils/*" #"conan_channel" + exports_sources = "src/*", "include/*", "CMakeLists.txt", "cmake/*", "secp256k1Config.cmake.in", "contrib/*", "test/*" + #, "bitprimbuildinfo.cmake" # with_benchmark = False # with_tests = True # with_openssl_tests = False - - - # https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html # echo "" | gcc -fsyntax-only -march=pepe -xc - # nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 bonnell atom silvermont slm knl x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 @@ -273,6 +229,9 @@ def bignum_lib_name(self): def requirements(self): + self.output.info("********************* self.channel: %s" % (self.channel,)) + # self.requires("Say/0.1@%s/%s" % (self.user, self.channel)) + if self.options.with_bignum_lib: if self.settings.os == "Windows": self.requires("mpir/3.0.0@bitprim/stable")