diff --git a/.appveyor.yml b/.appveyor.yml index 1d22e31..6009cad 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,76 +1,40 @@ -# Copyright Fernando Pelliccioni 2016 -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) - -shallow_clone: true - -os: - - Visual Studio 2015 - # - Visual Studio 2015 CTP - # - Visual Studio 2015 CTP 6 - # - Visual Studio 2015 Preview - # - Visual Studio 2015 RC - # - MinGW - -build: - verbosity: detailed - -configuration: - - Debug +# +# Copyright (c) 2016-2021 Fernando Pelliccioni developers (see AUTHORS) +# branches: - except: - - /pr\/.+/ + only: + - master + - dev -environment: - matrix: - - TESTS_ONLY: true - - EXAMPLES_ONLY: true +build: false +environment: + PYTHON: "C:\\Python27" + PYTHON_VERSION: "2.7.8" + PYTHON_ARCH: "32" + + CONAN_REFERENCE: "algorithm/0.1" + CONAN_USERNAME: "fpelliccioni" + CONAN_LOGIN_USERNAME: "fpelliccioni" + CONAN_CHANNEL: "stable" + VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\" + CONAN_UPLOAD: "https://taocpp.jfrog.io/artifactory/api/conan/tao" + + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CONAN_VISUAL_VERSIONS: 15 + + # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + # CONAN_VISUAL_VERSIONS: 14 + # - MINGW_CONFIGURATIONS: "5.4@x86_64@seh@posix" #5.4@x86_64@sjlj@posix + # - MINGW_CONFIGURATIONS: "7.1@x86_64@seh@posix" #7.1@x86_64@sjlj@posix install: - ############################################################################ - # All external dependencies are installed in C:\projects\deps - ############################################################################ - - mkdir C:\projects\deps - - cd C:\projects\deps - - ############################################################################ - # Install Ninja - ############################################################################ - - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip" - - appveyor DownloadFile %NINJA_URL% -FileName ninja.zip - - 7z x ninja.zip -oC:\projects\deps\ninja > nul - - set PATH=C:\projects\deps\ninja;%PATH% - - ninja --version - - ############################################################################ - # Install a recent CMake - ############################################################################ - - set CMAKE_URL="https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.zip" - - appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip - - 7z x cmake.zip -oC:\projects\deps\cmake > nul - - set PATH=C:\projects\deps\cmake\bin;%PATH% - - cmake --version - - ############################################################################ - # Install a pre-built Clang-cl - ############################################################################ - - set LLVM_URL="https://www.dropbox.com/s/caol8ihddfwqs31/LLVM-3.7.0-win64.zip?dl=1" - - appveyor DownloadFile %LLVM_URL% -FileName llvm.zip - - 7z x llvm.zip -oC:\projects\deps\llvm > nul - - set PATH=C:\projects\deps\llvm\bin;%PATH% - - clang-cl -v - - -before_build: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - - cd C:\projects\algorithm - + - set PATH=%PATH%;%PYTHON%/Scripts/ + - pip.exe install conan --upgrade + - pip.exe install conan_package_tools + - conan user # It creates the conan data directory -build_script: - - mkdir build - - cd build - - cmake .. -GNinja -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19" - - if "%TESTS_ONLY%" == "true" (ninja tests && ctest -R --output-on-failure "test.+") - - if "%EXAMPLES_ONLY%" == "true" (ninja examples && ctest -R --output-on-failure "example.+") +test_script: + - python build.py diff --git a/.github/matrix copy.json b/.github/matrix copy.json new file mode 100644 index 0000000..047de8e --- /dev/null +++ b/.github/matrix copy.json @@ -0,0 +1 @@ +{"config": [{"name": "Linux GCC 10","compiler": "GCC","version": "10","os": "ubuntu-20.04"},{"name": "Linux GCC 9","compiler": "GCC","version": "9","os": "ubuntu-20.04"},{"name": "Linux GCC 8","compiler": "GCC","version": "8","os": "ubuntu-20.04"},{"name": "macOS apple-clang 12","compiler": "apple-clang","version": "12","os": "macos-10.15"},{"name": "Windows VS2019 MD","compiler": "Visual Studio","version": "16","os": "windows-2019","msvc_runtime": "MD"},{"name": "Windows VS2019 MT","compiler": "Visual Studio","version": "16","os": "windows-2019","msvc_runtime": "MT"}]} \ No newline at end of file diff --git a/.github/matrix.json b/.github/matrix.json new file mode 100644 index 0000000..13372a9 --- /dev/null +++ b/.github/matrix.json @@ -0,0 +1 @@ +{"config": [{"name": "Linux GCC 10","compiler": "GCC","version": "10","os": "ubuntu-20.04"},{"name": "Linux GCC 9","compiler": "GCC","version": "9","os": "ubuntu-20.04"},{"name": "Linux GCC 8","compiler": "GCC","version": "8","os": "ubuntu-20.04"}]} \ No newline at end of file diff --git a/.github/workflows/tao.yml b/.github/workflows/tao.yml new file mode 100644 index 0000000..f393b57 --- /dev/null +++ b/.github/workflows/tao.yml @@ -0,0 +1,195 @@ +name: Build and Test + +on: [push, pull_request] + +jobs: + generate-matrix: + name: Generate Job Matrix + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Generate Job Matrix + id: set-matrix + # env: + # MATRIX: '{"config": [{"name": "Linux GCC 10","compiler": "GCC","version": "10","os": "ubuntu-20.04"},{"name": "Linux GCC 9","compiler": "GCC","version": "9","os": "ubuntu-20.04"},{"name": "Linux GCC 8","compiler": "GCC","version": "8","os": "ubuntu-20.04"},{"name": "macOS apple-clang 12","compiler": "apple-clang","version": "12","os": "macos-10.15"}]}' + run: | + MATRIX=$(cat ./.github/matrix.json) + echo "${MATRIX}" + echo "::set-output name=matrix::${MATRIX}" + + builds: + needs: generate-matrix + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} + name: ${{ matrix.config.name }} + steps: + - name: Set git to use LF (Windows) + if: ${{ matrix.config.compiler == 'Visual Studio' }} + run: | + git config --global core.autocrlf false + git config --global core.eol lf + # git config --global --edit + # git config --global core.autocrlf true + # git config --global --edit + + - uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - uses: actions/setup-python@v1 + with: + python-version: "3.8" + + - name: Install Dependencies (Unix) + if: ${{ matrix.config.compiler != 'Visual Studio' }} + run: | + chmod +x .travis/install.sh + ./.travis/install.sh + shell: bash + + - name: Install Dependencies (Windows) + if: ${{ matrix.config.compiler == 'Visual Studio' }} + run: | + set PATH=%PYTHON%;%PYTHON%/Scripts/;%PATH%; + python.exe --version + cmake --version + python.exe -m pip install --upgrade pip + pip.exe install conan_package_tools==0.35.0 + pip.exe install conan --upgrade + conan user + shell: cmd + + - name: Settting EnvVars (Linux) + if: ${{ matrix.config.compiler == 'GCC' }} + shell: bash + run: | + echo "CONAN_GCC_VERSIONS=${{ matrix.config.version }}" >> $GITHUB_ENV + echo "CONAN_DOCKER_IMAGE=conanio/gcc${{ matrix.config.version }}" >> $GITHUB_ENV + + - name: Settting EnvVars (macOS) + if: ${{ matrix.config.compiler == 'apple-clang' }} + shell: bash + run: | + echo "CONAN_APPLE_CLANG_VERSIONS=${{ matrix.config.version }}.0" >> $GITHUB_ENV + + - name: Settting EnvVars (Windows) + if: ${{ matrix.config.compiler == 'Visual Studio' }} + # shell: bash + shell: powershell + run: | + echo "CONAN_VISUAL_VERSIONS=${{ matrix.config.version }}" >> $Env:GITHUB_ENV + echo "CONAN_VISUAL_RUNTIMES=${{ matrix.config.msvc_runtime }}" >> $Env:GITHUB_ENV + # echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $env:GITHUB_ENV + + - name: Build (Unix) + if: ${{ matrix.config.compiler != 'Visual Studio' }} + env: + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }} + CONAN_STABLE_BRANCH_PATTERN: "master$" #"release/*" + shell: bash + run: | + echo ${{ matrix.config.compiler }} + echo ${BPT_MATRIX} + echo ${CONAN_STABLE_BRANCH_PATTERN} + echo ${CONAN_GCC_VERSIONS} + echo ${CONAN_APPLE_CLANG_VERSIONS} + echo ${CONAN_DOCKER_IMAGE} + echo ${CONAN_LOGIN_USERNAME} + + # git rev-list --count master + # git fetch --unshallow + # git fetch origin master:master + git rev-list --count master + + chmod +x .travis/run.sh + ./.travis/run.sh + + - name: Build (Windows) + if: ${{ matrix.config.compiler == 'Visual Studio' }} + env: + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }} + CONAN_STABLE_BRANCH_PATTERN: "master$" #"release/*" + CONAN_UPLOAD: "https://taocpp.jfrog.io/artifactory/api/conan/tao" + shell: powershell + run: | + Write-Host "CONAN_VISUAL_VERSIONS: $Env:CONAN_VISUAL_VERSIONS" + Write-Host "CONAN_VISUAL_RUNTIMES: $Env:CONAN_VISUAL_RUNTIMES" + Write-Host "CONAN_UPLOAD: $Env:CONAN_UPLOAD" + + # $a = python ci_utils/set_envvars_and_files.py + # Write-Host $a + # Invoke-Expression $a + + # $ErrorActionPreference = 'SilentlyContinue' + # conan remote add kth https://taocpp.jfrog.io/artifactory/api/conan/tao + # $ErrorActionPreference = 'Continue' + + # # conan info . --only None + # # conan info . --only None -s compiler=gcc -s compiler.version=5 -s compiler.libcxx=libstdc++ + # python ci_utils/process_conan_reqs.py + + # $ErrorActionPreference = 'SilentlyContinue' + # conan remove "*" -f + # conan remote remove kth + # conan remote remove kthbuild_kth_temp_ + # $ErrorActionPreference = 'Continue' + + python build.py + + upload-aliases: + name: Upload Aliases + needs: [builds] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - uses: actions/setup-python@v1 + with: + python-version: "3.8" + + - name: Install Dependencies + run: | + chmod +x .travis/install.sh + ./.travis/install.sh + shell: bash + + - name: Upload Aliases + env: + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }} + shell: bash + run: | + + # echo "REPO_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV + REPO_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') + echo "My repo name is $REPO_NAME" + + export TAO_BRANCH=$(echo '${{ github.ref }}' | awk -F '/' '{print $3}') + echo "My branch name is $TAO_BRANCH" + + eval $(python ci_utils/set_envvars_and_files.py) + conan user + conan remote add upload_repo https://taocpp.jfrog.io/artifactory/api/conan/tao + conan user + conan user ${CONAN_LOGIN_USERNAME} -r upload_repo -p ${CONAN_PASSWORD} + conan user + echo "conan alias ${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL} ${REPO_NAME}/${TAO_CONAN_VERSION}@tao/${TAO_CONAN_CHANNEL}" + conan alias "${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL}" "${REPO_NAME}/${TAO_CONAN_VERSION}@tao/${TAO_CONAN_CHANNEL}" + echo "conan upload ${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL} --all -r upload_repo" + conan upload "${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL}" --all -r upload_repo + +# References: + # https://github.com/radareorg/radare2 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d62d93 --- /dev/null +++ b/.gitignore @@ -0,0 +1,374 @@ +benchmark - Copy/transform/execute.fusion.vector.erb.cpp +benchmark - Copy/transform/execute.hana.tuple.erb.cpp +benchmark - Copy/transform/execute.std.array.erb.cpp +benchmark - Copy/transform/execute.std.vector.erb.cpp +benchmark - Copy/union/compile.erb.json +benchmark - Copy/union/compile.hana.set.erb.cpp +benchmark - Copy/unpack/compile.erb.json +benchmark - Copy/unpack/compile.fusion.list.erb.cpp +benchmark - Copy/unpack/compile.fusion.vector.erb.cpp +benchmark - Copy/unpack/compile.hana.basic_tuple.erb.cpp +benchmark - Copy/unpack/compile.hana.set.erb.cpp +benchmark - Copy/unpack/compile.hana.tuple.erb.cpp +benchmark - Copy/CMakeLists.txt +benchmark - Copy/at/bloat.erb.json +benchmark - Copy/at/compile.erb.json +benchmark - Copy/at/compile.fusion.list.erb.cpp +benchmark - Copy/at/compile.fusion.vector.erb.cpp +benchmark - Copy/at/compile.hana.tuple.erb.cpp +benchmark - Copy/at/compile.meta.list.erb.cpp +benchmark - Copy/at/compile.mpl.vector.erb.cpp +benchmark - Copy/at/compile.mpl11.list.erb.cpp +benchmark - Copy/at/compile.std.tuple.erb.cpp +benchmark - Copy/at/execute.erb.json +benchmark - Copy/at/execute.fusion.list.erb.cpp +benchmark - Copy/at/execute.fusion.vector.erb.cpp +benchmark - Copy/at/execute.hana.tuple.erb.cpp +benchmark - Copy/at/execute.std.tuple.erb.cpp +benchmark - Copy/at_key/baseline.hpp +benchmark - Copy/at_key/index_of_lookup/baseline.erb.cpp +benchmark - Copy/at_key/index_of_lookup/chart.erb.json +benchmark - Copy/at_key/index_of_lookup/fusion_map.erb.cpp +benchmark - Copy/at_key/index_of_lookup/hana_map.erb.cpp +benchmark - Copy/at_key/index_of_lookup/hana_tuple.erb.cpp +benchmark - Copy/at_key/number_of_lookups/baseline.erb.cpp +benchmark - Copy/at_key/number_of_lookups/chart.erb.json +benchmark - Copy/at_key/number_of_lookups/fusion_map.erb.cpp +benchmark - Copy/at_key/number_of_lookups/hana_map.erb.cpp +benchmark - Copy/at_key/number_of_lookups/hana_tuple.erb.cpp +benchmark - Copy/at_key/pair.hpp +benchmark - Copy/cartesian_product/compile.erb.json +benchmark - Copy/cartesian_product/compile.hana.tuple.erb.cpp +benchmark - Copy/chart.html +benchmark - Copy/count_if/bloat.erb.json +benchmark - Copy/count_if/compile.erb.json +benchmark - Copy/count_if/compile.fusion.list.erb.cpp +benchmark - Copy/count_if/compile.fusion.vector.erb.cpp +benchmark - Copy/count_if/compile.hana.tuple.erb.cpp +benchmark - Copy/count_if/compile.meta.list.erb.cpp +benchmark - Copy/count_if/compile.mpl.vector.erb.cpp +benchmark - Copy/count_if/execute.erb.json +benchmark - Copy/count_if/execute.fusion.vector.erb.cpp +benchmark - Copy/count_if/execute.hana.tuple.erb.cpp +benchmark - Copy/difference/compile.erb.json +benchmark - Copy/difference/compile.hana.set.erb.cpp +benchmark - Copy/filter/compile.erb.json +benchmark - Copy/filter/compile.fusion.list.erb.cpp +benchmark - Copy/filter/compile.fusion.vector.erb.cpp +benchmark - Copy/filter/compile.hana.tuple.erb.cpp +benchmark - Copy/filter/compile.meta.list.erb.cpp +benchmark - Copy/filter/compile.mpl.vector.erb.cpp +benchmark - Copy/filter/compile.mpl11.list.erb.cpp +benchmark - Copy/find_if/compile.erb.json +benchmark - Copy/find_if/compile.fusion.list.erb.cpp +benchmark - Copy/find_if/compile.fusion.vector.erb.cpp +benchmark - Copy/find_if/compile.hana.map.erb.cpp +benchmark - Copy/find_if/compile.hana.set.erb.cpp +benchmark - Copy/find_if/compile.hana.tuple.erb.cpp +benchmark - Copy/find_if/compile.meta.list.erb.cpp +benchmark - Copy/find_if/compile.mpl.vector.erb.cpp +benchmark - Copy/find_if/compile.std.integer_sequence.erb.cpp +benchmark - Copy/fold_left/bloat.erb.json +benchmark - Copy/fold_left/compile.cexpr.recursive.erb.cpp +benchmark - Copy/fold_left/compile.cexpr.unrolled.erb.cpp +benchmark - Copy/fold_left/compile.erb.json +benchmark - Copy/fold_left/compile.fusion.list.erb.cpp +benchmark - Copy/fold_left/compile.fusion.vector.erb.cpp +benchmark - Copy/fold_left/compile.hana.basic_tuple.erb.cpp +benchmark - Copy/fold_left/compile.hana.tuple.erb.cpp +benchmark - Copy/fold_left/compile.meta.list.erb.cpp +benchmark - Copy/fold_left/compile.mpl.vector.erb.cpp +benchmark - Copy/fold_left/compile.mpl11.list.erb.cpp +benchmark - Copy/fold_left/execute.erb.json +benchmark - Copy/fold_left/execute.fusion.list.erb.cpp +benchmark - Copy/fold_left/execute.fusion.vector.erb.cpp +benchmark - Copy/fold_left/execute.hana.tuple.erb.cpp +benchmark - Copy/fold_left/execute.std.array.erb.cpp +benchmark - Copy/fold_left/execute.std.vector.erb.cpp +benchmark - Copy/fold_right/bloat.erb.json +benchmark - Copy/fold_right/compile.erb.json +benchmark - Copy/fold_right/compile.fusion.vector.erb.cpp +benchmark - Copy/fold_right/compile.hana.basic_tuple.erb.cpp +benchmark - Copy/fold_right/compile.hana.tuple.erb.cpp +benchmark - Copy/fold_right/compile.meta.list.erb.cpp +benchmark - Copy/fold_right/compile.mpl.vector.erb.cpp +benchmark - Copy/fold_right/compile.mpl11.list.erb.cpp +benchmark - Copy/fold_right/execute.erb.json +benchmark - Copy/fold_right/execute.fusion.vector.erb.cpp +benchmark - Copy/fold_right/execute.hana.tuple.erb.cpp +benchmark - Copy/including/baseline.erb.cpp +benchmark - Copy/including/compile.erb.json +benchmark - Copy/including/fusion.erb.cpp +benchmark - Copy/including/hana.erb.cpp +benchmark - Copy/including/meta.erb.cpp +benchmark - Copy/including/mpl.erb.cpp +benchmark - Copy/including/mpl11.erb.cpp +benchmark - Copy/insert/compile.erb.json +benchmark - Copy/insert/compile.hana.map.erb.cpp +benchmark - Copy/insert/compile.hana.set.erb.cpp +benchmark - Copy/intersection/compile.erb.json +benchmark - Copy/intersection/compile.hana.set.erb.cpp +benchmark - Copy/is_disjoint/compile.erb.json +benchmark - Copy/is_disjoint/compile.hana.map.erb.cpp +benchmark - Copy/is_disjoint/compile.hana.set.erb.cpp +benchmark - Copy/is_disjoint/compile.hana.tuple.erb.cpp +benchmark - Copy/is_subset/compile.erb.json +benchmark - Copy/is_subset/compile.hana.map.erb.cpp +benchmark - Copy/is_subset/compile.hana.set.erb.cpp +benchmark - Copy/is_subset/compile.hana.tuple.erb.cpp +benchmark - Copy/lexicographical_compare/compile.erb.json +benchmark - Copy/lexicographical_compare/compile.hana.tuple.erb.cpp +benchmark - Copy/make/compile.erb.json +benchmark - Copy/make/compile.fusion.list.erb.cpp +benchmark - Copy/make/compile.fusion.vector.erb.cpp +benchmark - Copy/make/compile.hana.basic_tuple.erb.cpp +benchmark - Copy/make/compile.hana.tuple.erb.cpp +benchmark - Copy/make/compile.meta.list.erb.cpp +benchmark - Copy/make/compile.mpl.vector.erb.cpp +benchmark - Copy/make/compile.mpl11.list.erb.cpp +benchmark - Copy/make/compile.std.array.erb.cpp +benchmark - Copy/make/compile.std.tuple.erb.cpp +benchmark - Copy/map/make/baseline.erb.cpp +benchmark - Copy/map/make/chart.erb.json +benchmark - Copy/map/make/fusion_map.erb.cpp +benchmark - Copy/map/make/hana_map.erb.cpp +benchmark - Copy/measure.hpp +benchmark - Copy/measure.in.rb +benchmark - Copy/partition/compile.erb.json +benchmark - Copy/partition/compile.hana.tuple.erb.cpp +benchmark - Copy/partition/compile.meta.list.erb.cpp +benchmark - Copy/partition/compile.mpl.vector.erb.cpp +benchmark - Copy/product/compile.erb.json +benchmark - Copy/product/compile.hana.range.erb.cpp +benchmark - Copy/product/compile.hana.tuple.heterogeneous.erb.cpp +benchmark - Copy/product/compile.hana.tuple.homogeneous.erb.cpp +benchmark - Copy/product/execute.erb.json +benchmark - Copy/product/execute.hana.tuple.homogeneous.erb.cpp +benchmark - Copy/reverse/move.erb.json +benchmark - Copy/reverse/move.fusion.vector.erb.cpp +benchmark - Copy/reverse/move.hana.tuple.erb.cpp +benchmark - Copy/reverse/nomove.erb.json +benchmark - Copy/reverse/nomove.fusion.vector.erb.cpp +benchmark - Copy/reverse/nomove.hana.tuple.erb.cpp +benchmark - Copy/sort/compile.erb.json +benchmark - Copy/sort/compile.hana.tuple.erb.cpp +benchmark - Copy/sort/compile.mpl.vector.erb.cpp +benchmark - Copy/symmetric_difference/compile.erb.json +benchmark - Copy/symmetric_difference/compile.hana.set.erb.cpp +benchmark - Copy/transform/bloat.erb.json +benchmark - Copy/transform/compile.erb.json +benchmark - Copy/transform/compile.fusion.list.erb.cpp +benchmark - Copy/transform/compile.fusion.vector.erb.cpp +benchmark - Copy/transform/compile.hana.tuple.erb.cpp +benchmark - Copy/transform/compile.hana.types.erb.cpp +benchmark - Copy/transform/compile.meta.list.erb.cpp +benchmark - Copy/transform/compile.mpl.vector.erb.cpp +benchmark - Copy/transform/compile.mpl11.list.erb.cpp +benchmark - Copy/transform/execute.erb.json +benchmark - Copy/transform/execute.fusion.list.erb.cpp +build/CMakeFiles/Makefile2 +build/CMakeFiles/Progress/1 +build/CMakeFiles/Progress/2 +build/CMakeFiles/Progress/3 +build/CMakeFiles/Progress/4 +build/CMakeFiles/Progress/5 +build/CMakeFiles/Progress/6 +build/CMakeFiles/Progress/7 +build/CMakeFiles/Progress/count.txt +build/CMakeFiles/TargetDirectories.txt +build/CMakeFiles/cmake.check_cache +build/CMakeFiles/feature_tests.bin +build/CMakeFiles/feature_tests.cxx +build/CMakeFiles/progress.marks +build/Makefile +build/benchmark/CMakeFiles/CMakeDirectoryInformation.cmake +build/benchmark/CMakeFiles/benchmarks.dir/DependInfo.cmake +build/benchmark/CMakeFiles/benchmarks.dir/build.make +build/benchmark/CMakeFiles/benchmarks.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/benchmarks.dir/depend.internal +build/benchmark/CMakeFiles/benchmarks.dir/depend.make +build/benchmark/CMakeFiles/benchmarks.dir/progress.make +build/benchmark/CMakeFiles/progress.marks +build/benchmark/CMakeFiles/test.bench_test_1.dir/CXX.includecache +build/benchmark/CMakeFiles/test.bench_test_1.dir/DependInfo.cmake +build/benchmark/CMakeFiles/test.bench_test_1.dir/build.make +build/benchmark/CMakeFiles/test.bench_test_1.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/test.bench_test_1.dir/depend.internal +build/benchmark/CMakeFiles/test.bench_test_1.dir/depend.make +build/benchmark/CMakeFiles/test.bench_test_1.dir/flags.make +build/benchmark/CMakeFiles/test.bench_test_1.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/test.bench_test_1.dir/link.txt +build/benchmark/CMakeFiles/test.bench_test_1.dir/linklibs.rsp +build/benchmark/CMakeFiles/test.bench_test_1.dir/objects.a +build/benchmark/CMakeFiles/test.bench_test_1.dir/objects1.rsp +build/benchmark/CMakeFiles/test.bench_test_1.dir/progress.make +build/benchmark/CMakeFiles/test.bench_test_2.dir/CXX.includecache +build/benchmark/CMakeFiles/test.bench_test_2.dir/DependInfo.cmake +build/benchmark/CMakeFiles/test.bench_test_2.dir/build.make +build/benchmark/CMakeFiles/test.bench_test_2.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/test.bench_test_2.dir/depend.internal +build/benchmark/CMakeFiles/test.bench_test_2.dir/depend.make +build/benchmark/CMakeFiles/test.bench_test_2.dir/flags.make +build/benchmark/CMakeFiles/test.bench_test_2.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/test.bench_test_2.dir/link.txt +build/benchmark/CMakeFiles/test.bench_test_2.dir/linklibs.rsp +build/benchmark/CMakeFiles/test.bench_test_2.dir/objects.a +build/benchmark/CMakeFiles/test.bench_test_2.dir/objects1.rsp +build/benchmark/CMakeFiles/test.bench_test_2.dir/progress.make +build/benchmark/CMakeFiles/test.bench_test_3.dir/CXX.includecache +build/benchmark/CMakeFiles/test.bench_test_3.dir/DependInfo.cmake +build/benchmark/CMakeFiles/test.bench_test_3.dir/build.make +build/benchmark/CMakeFiles/test.bench_test_3.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/test.bench_test_3.dir/depend.internal +build/benchmark/CMakeFiles/test.bench_test_3.dir/depend.make +build/benchmark/CMakeFiles/test.bench_test_3.dir/flags.make +build/benchmark/CMakeFiles/test.bench_test_3.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/test.bench_test_3.dir/link.txt +build/benchmark/CMakeFiles/test.bench_test_3.dir/linklibs.rsp +build/benchmark/CMakeFiles/test.bench_test_3.dir/objects.a +build/benchmark/CMakeFiles/test.bench_test_3.dir/objects1.rsp +build/benchmark/CMakeFiles/test.bench_test_3.dir/progress.make +build/benchmark/CTestTestfile.cmake +build/benchmark/Makefile +build/benchmark/Testing/Temporary/CTestCostData.txt +build/benchmark/cmake_install.cmake +build/benchmark/launch_bench.py +build/benchmark/result_test.bench_test_1.exe.txt +build/benchmark/result_test.bench_test_2.exe.txt +build/benchmark/result_test.bench_test_3.exe.txt +build/cmake_install.cmake +build/test/CMakeFiles/CMakeDirectoryInformation.cmake +build/test/CMakeFiles/progress.marks +build/test/CMakeFiles/test.multiple.definitions.dir/DependInfo.cmake +build/test/CMakeFiles/test.multiple.definitions.dir/build.make +build/test/CMakeFiles/test.multiple.definitions.dir/cmake_clean.cmake +build/test/CMakeFiles/test.multiple.definitions.dir/depend.make +build/test/CMakeFiles/test.multiple.definitions.dir/flags.make +build/test/CMakeFiles/test.multiple.definitions.dir/includes_CXX.rsp +build/test/CMakeFiles/test.multiple.definitions.dir/link.txt +build/test/CMakeFiles/test.multiple.definitions.dir/linklibs.rsp +build/test/CMakeFiles/test.multiple.definitions.dir/objects1.rsp +build/test/CMakeFiles/test.multiple.definitions.dir/progress.make +build/test/CMakeFiles/test.shift_right.dir/DependInfo.cmake +build/test/CMakeFiles/test.shift_right.dir/build.make +build/test/CMakeFiles/test.shift_right.dir/cmake_clean.cmake +build/test/CMakeFiles/test.shift_right.dir/depend.make +build/test/CMakeFiles/test.shift_right.dir/flags.make +build/test/CMakeFiles/test.shift_right.dir/includes_CXX.rsp +build/test/CMakeFiles/test.shift_right.dir/link.txt +build/test/CMakeFiles/test.shift_right.dir/linklibs.rsp +build/test/CMakeFiles/test.shift_right.dir/objects1.rsp +build/test/CMakeFiles/test.shift_right.dir/progress.make +build/test/CMakeFiles/tests.dir/DependInfo.cmake +build/test/CMakeFiles/tests.dir/build.make +build/test/CMakeFiles/tests.dir/cmake_clean.cmake +build/test/CMakeFiles/tests.dir/progress.make +build/test/CTestTestfile.cmake +build/test/Makefile +build/test/cmake_install.cmake +build/test/translation_unit_one.cpp +build/test/translation_unit_two.cpp +build/CMakeCache.txt +build/CMakeFiles/3.5.2/CMakeCXXCompiler.cmake +build/CMakeFiles/3.5.2/CMakeDetermineCompilerABI_CXX.bin +build/CMakeFiles/3.5.2/CMakeRCCompiler.cmake +build/CMakeFiles/3.5.2/CMakeSystem.cmake +build/CMakeFiles/3.5.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +build/CMakeFiles/CMakeDirectoryInformation.cmake +build/CMakeFiles/CMakeRuleHashes.txt +build/CMakeFiles/Makefile.cmake +build/benchmark/CMakeFiles/travis_compiler_slug.dir/DependInfo.cmake +build/benchmark/CMakeFiles/travis_compiler_slug.dir/build.make +build/benchmark/CMakeFiles/travis_compiler_slug.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/travis_compiler_slug.dir/depend.internal +build/benchmark/CMakeFiles/travis_compiler_slug.dir/depend.make +build/benchmark/CMakeFiles/travis_compiler_slug.dir/progress.make +build/benchmark/CMakeFiles/travis_config_slug.dir/DependInfo.cmake +build/benchmark/CMakeFiles/travis_config_slug.dir/build.make +build/benchmark/CMakeFiles/travis_config_slug.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/travis_config_slug.dir/progress.make +build/CMakeFiles/Progress/10 +build/CMakeFiles/Progress/11 +build/CMakeFiles/Progress/12 +build/CMakeFiles/Progress/13 +build/CMakeFiles/Progress/8 +build/CMakeFiles/Progress/9 +build/benchmark/CMakeFiles/bench.bench_test_1.dir/DependInfo.cmake +build/benchmark/CMakeFiles/bench.bench_test_1.dir/build.make +build/benchmark/CMakeFiles/bench.bench_test_1.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/bench.bench_test_1.dir/depend.make +build/benchmark/CMakeFiles/bench.bench_test_1.dir/flags.make +build/benchmark/CMakeFiles/bench.bench_test_1.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/bench.bench_test_1.dir/link.txt +build/benchmark/CMakeFiles/bench.bench_test_1.dir/linklibs.rsp +build/benchmark/CMakeFiles/bench.bench_test_1.dir/objects1.rsp +build/benchmark/CMakeFiles/bench.bench_test_1.dir/progress.make +build/benchmark/CMakeFiles/bench.bench_test_2.dir/DependInfo.cmake +build/benchmark/CMakeFiles/bench.bench_test_2.dir/build.make +build/benchmark/CMakeFiles/bench.bench_test_2.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/bench.bench_test_2.dir/depend.make +build/benchmark/CMakeFiles/bench.bench_test_2.dir/flags.make +build/benchmark/CMakeFiles/bench.bench_test_2.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/bench.bench_test_2.dir/link.txt +build/benchmark/CMakeFiles/bench.bench_test_2.dir/linklibs.rsp +build/benchmark/CMakeFiles/bench.bench_test_2.dir/objects1.rsp +build/benchmark/CMakeFiles/bench.bench_test_2.dir/progress.make +build/benchmark/CMakeFiles/bench.bench_test_3.dir/DependInfo.cmake +build/benchmark/CMakeFiles/bench.bench_test_3.dir/build.make +build/benchmark/CMakeFiles/bench.bench_test_3.dir/cmake_clean.cmake +build/benchmark/CMakeFiles/bench.bench_test_3.dir/depend.make +build/benchmark/CMakeFiles/bench.bench_test_3.dir/flags.make +build/benchmark/CMakeFiles/bench.bench_test_3.dir/includes_CXX.rsp +build/benchmark/CMakeFiles/bench.bench_test_3.dir/link.txt +build/benchmark/CMakeFiles/bench.bench_test_3.dir/linklibs.rsp +build/benchmark/CMakeFiles/bench.bench_test_3.dir/objects1.rsp +build/benchmark/CMakeFiles/bench.bench_test_3.dir/progress.make +build/test/CMakeFiles/test.multiple.definitions.dir/CXX.includecache +build/test/CMakeFiles/test.multiple.definitions.dir/depend.internal +build/test/CMakeFiles/test.multiple.definitions.dir/objects.a +build/test/CMakeFiles/test.shift_right.dir/CXX.includecache +build/test/CMakeFiles/test.shift_right.dir/depend.internal +build/test/CMakeFiles/test.shift_right.dir/objects.a +build/test/CMakeFiles/test.statistics.dir/CXX.includecache +build/test/CMakeFiles/test.statistics.dir/DependInfo.cmake +build/test/CMakeFiles/test.statistics.dir/build.make +build/test/CMakeFiles/test.statistics.dir/cmake_clean.cmake +build/test/CMakeFiles/test.statistics.dir/depend.internal +build/test/CMakeFiles/test.statistics.dir/depend.make +build/test/CMakeFiles/test.statistics.dir/flags.make +build/test/CMakeFiles/test.statistics.dir/includes_CXX.rsp +build/test/CMakeFiles/test.statistics.dir/link.txt +build/test/CMakeFiles/test.statistics.dir/linklibs.rsp +build/test/CMakeFiles/test.statistics.dir/objects.a +build/test/CMakeFiles/test.statistics.dir/objects1.rsp +build/test/CMakeFiles/test.statistics.dir/progress.make +build/test/CMakeFiles/tests.dir/depend.internal +build/test/CMakeFiles/tests.dir/depend.make +build/test/Testing/Temporary/CTestCostData.txt +include/tao/algorithm/type_attributes_test.cpp +build/benchmark/bench.bench_test_1 +build/benchmark/bench.bench_test_2 +build/benchmark/bench.bench_test_3 +build/benchmark/CMakeFiles/bench.bench_test_1.dir/CXX.includecache +build/benchmark/CMakeFiles/bench.bench_test_1.dir/depend.internal +build/benchmark/CMakeFiles/bench.bench_test_2.dir/CXX.includecache +build/benchmark/CMakeFiles/bench.bench_test_2.dir/depend.internal +build/benchmark/CMakeFiles/bench.bench_test_3.dir/CXX.includecache +build/benchmark/CMakeFiles/bench.bench_test_3.dir/depend.internal +build/CMakeFiles/CMakeOutput.log +build/CMakeFiles/3.4.3/CMakeCXXCompiler.cmake +build/CMakeFiles/3.4.3/CMakeDetermineCompilerABI_CXX.bin +build/CMakeFiles/3.4.3/CMakeSystem.cmake +build/CMakeFiles/3.4.3/CompilerIdCXX/CMakeCXXCompilerId.cpp +build/test/test.multiple.definitions +build/test/test.shift_right +build/test/test.statistics +build/test/Testing/Temporary/LastTest.log + +conaninfo.txt + +.vscode/ + +test/a.out + +build/ diff --git a/.travis.yml b/.travis.yml index 43e0ef0..aaf39d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,144 +1,81 @@ -# Tao.Algorithm # -# Copyright Fernando Pelliccioni 2016 +# Copyright (c) 2016-2021 Fernando Pelliccioni developers (see AUTHORS) # -# Distributed under the Boost Software License, Version 1.0. (See accompanying -# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -language: cpp -sudo: false - -matrix: - include: - # clang-3.5 - - env: CLANG_VERSION=3.5 CXX_FLAGS="-std=c++11" BUILD_TYPE=Debug - os: linux - addons: &clang35 - apt: - packages: - - clang-3.5 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.5 - - - env: CLANG_VERSION=3.5 CXX_FLAGS="-std=c++11" BUILD_TYPE=Release - os: linux - addons: *clang35 - - - env: CLANG_VERSION=3.5 CXX_FLAGS="-std=c++14" BUILD_TYPE=Debug - os: linux - addons: *clang35 - - - env: CLANG_VERSION=3.5 CXX_FLAGS="-std=c++14" BUILD_TYPE=Release - os: linux - addons: *clang35 - - # clang-3.6 - - env: CLANG_VERSION=3.6 CXX_FLAGS="-std=c++11" BUILD_TYPE=Debug - os: linux - addons: &clang36 - apt: - packages: - - clang-3.6 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 - - - env: CLANG_VERSION=3.6 CXX_FLAGS="-std=c++11" BUILD_TYPE=Release - os: linux - addons: *clang36 - - - env: CLANG_VERSION=3.6 CXX_FLAGS="-std=c++14" BUILD_TYPE=Debug - os: linux - addons: *clang36 - - - env: CLANG_VERSION=3.6 CXX_FLAGS="-std=c++14" BUILD_TYPE=Release - os: linux - addons: *clang36 - - # gcc-4.9 - - env: GCC_VERSION=4.9 CXX_FLAGS="-std=c++11" BUILD_TYPE=Debug - os: linux - addons: &gcc49 - apt: - packages: - - g++-4.9 - sources: - - ubuntu-toolchain-r-test - - - env: GCC_VERSION=4.9 CXX_FLAGS="-std=c++11" BUILD_TYPE=Release - os: linux - addons: *gcc49 - - - env: GCC_VERSION=4.9 CXX_FLAGS="-std=c++1y" BUILD_TYPE=Debug - os: linux - addons: *gcc49 - - - env: GCC_VERSION=4.9 CXX_FLAGS="-std=c++1y" BUILD_TYPE=Release - os: linux - addons: *gcc49 - - # gcc-5 - - env: GCC_VERSION=5 CXX_FLAGS="-std=c++11" BUILD_TYPE=Debug - os: linux - addons: &gcc5 - apt: - packages: - - g++-5 - sources: - - ubuntu-toolchain-r-test - - - env: GCC_VERSION=5 CXX_FLAGS="-std=c++11" BUILD_TYPE=Release - os: linux - addons: *gcc5 - - - env: GCC_VERSION=5 CXX_FLAGS="-std=c++14" BUILD_TYPE=Debug - os: linux - addons: *gcc5 - - - env: GCC_VERSION=5 CXX_FLAGS="-std=c++14" BUILD_TYPE=Release - os: linux - addons: *gcc5 - - # Xcode 7 - - env: CXX_FLAGS="-std=c++11" BUILD_TYPE=Debug - os: osx - osx_image: xcode7 - addons: &xcode7 - - - env: CXX_FLAGS="-std=c++11" BUILD_TYPE=Release - os: osx - osx_image: xcode7 - addons: *xcode7 - - - env: CXX_FLAGS="-std=c++14" BUILD_TYPE=Release - os: osx - osx_image: xcode7 - addons: *xcode7 - - - env: CXX_FLAGS="-std=c++14" BUILD_TYPE=Release - os: osx - osx_image: xcode7 - addons: *xcode7 branches: only: - - master - - develop + - master + # - dev + +env: + global: + # - CONAN_REFERENCE: "algorithm/0.1" + # - CONAN_USERNAME: "fpelliccioni" + # - CONAN_LOGIN_USERNAME: "fpelliccioni" + # - CONAN_CHANNEL: "stable" + # - CONAN_UPLOAD: "https://taocpp.jfrog.io/artifactory/api/conan/tao" + - TAO_VERSION_MAJOR: "0" + - TAO_VERSION_MINOR: "1" + + +linux: &linux + os: linux + sudo: required + language: python + python: "3.7" + services: + - docker + +# osx: &osx +# os: osx +# language: generic -before_install: - - if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi - - if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi - - - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew install cmake; fi +matrix: + include: + - <<: *linux + env: CONAN_GCC_VERSIONS=9 CONAN_DOCKER_IMAGE=conanio/gcc9 install: - - mkdir build - - cd build - - export CXX_FLAGS="${CXX_FLAGS} -Wall -Wextra -Werror" - - cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" .. - -script: make tests -k + - cd ${TRAVIS_BUILD_DIR} + - chmod +x .travis/install.sh + - ./.travis/install.sh + +script: + - cd ${TRAVIS_BUILD_DIR} + + - git rev-list --count master + - git fetch --unshallow + - git fetch origin master:master + - git rev-list --count master + + - chmod +x .travis/run.sh + - ./.travis/run.sh + +# Upload Alias + + - | + cd ${TRAVIS_BUILD_DIR} + echo $TRAVIS_REPO_SLUG + REPO_NAME=$(echo $TRAVIS_REPO_SLUG| cut -d'/' -f 2) + echo $REPO_NAME + + - eval $(python ci_utils/set_envvars_and_files.py) + #TODO(fernando): configure the remote and user using environment variables + # - conan remote add upload_repo https://taocpp.jfrog.io/artifactory/api/conan/tao + # - conan remote list + - conan user + # - conan user ${CONAN_LOGIN_USERNAME} -r upload_repo -p ${CONAN_PASSWORD} + # - conan user + - echo "conan alias ${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL} ${REPO_NAME}/${TAO_CONAN_VERSION}@tao/${TAO_CONAN_CHANNEL}" + - conan alias "${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL}" "${REPO_NAME}/${TAO_CONAN_VERSION}@tao/${TAO_CONAN_CHANNEL}" + - echo "conan upload ${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL} --all -r upload_repo" + - conan upload "${REPO_NAME}/0.1.X@tao/${TAO_CONAN_CHANNEL}" --all -r upload_repo + + +# notifications: +# email: false +# webhooks: +# urls: https://webhooks.gitter.im/e/a19dd2b03bf676d2b622 +# on_success: change +# on_failure: always -notifications: - email: false \ No newline at end of file diff --git a/.travis/install.sh b/.travis/install.sh new file mode 100644 index 0000000..9da0265 --- /dev/null +++ b/.travis/install.sh @@ -0,0 +1,25 @@ +#!/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_package_tools + +conan user diff --git a/.travis/run.sh b/.travis/run.sh new file mode 100644 index 0000000..0a3488e --- /dev/null +++ b/.travis/run.sh @@ -0,0 +1,13 @@ +#!/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 95fdf3a..a042934 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,57 @@ # Tao.Algorithm # -# Copyright Fernando Pelliccioni 2016 -# -# Distributed under the Boost Software License, Version 1.0. (See accompanying -# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# Copyright (c) 2016-2021 Fernando Pelliccioni. +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. project(Tao.Algorithm CXX) -cmake_minimum_required(VERSION 2.8) +# cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) +# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# add_compile_options(-std=c++14) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + + +############################################################################## +# Setup custom functions to ease the creation of targets +############################################################################## +# taocpp_algorithm_target_name_for( [ext]) +# +# Return the target name associated to a source file. If the path of the +# source file relative from the root of Algorithm is `path/to/source/file.ext`, +# the target name associated to it will be `path.to.source.file`. +# +# The extension of the file should be specified as a last argument. If no +# extension is specified, the `.cpp` extension is assumed. +function(taocpp_algorithm_target_name_for out file) + if (NOT ARGV2) + # message("IF ARGV2: " "${ARGV2}") + set(_extension ".cpp") + else() + # message("ELSE ARGV2: " "${ARGV2}") + set(_extension "${ARGV2}") + endif() + + # file(RELATIVE_PATH _relative ${Boost.Hana_SOURCE_DIR} ${file}) + file(RELATIVE_PATH _relative ${CMAKE_CURRENT_SOURCE_DIR} ${file}) + message("_relative: " ${_relative}) + + string(REPLACE "${_extension}" "" _name ${_relative}) + message("_name: " ${_name}) + string(REGEX REPLACE "/" "." _name ${_name}) + message("_name: " ${_name}) + set(${out} "${_name}" PARENT_SCOPE) + + message("out: " ${out}) +endfunction() + + include_directories(include) + +add_subdirectory(benchmark) add_subdirectory(test) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 457bee2..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,60 +0,0 @@ -# How to contribute - -Contributions are always very much appreciated. However, to make sure the -process of accepting patches goes smoothly for everyone (especially for -the maintainer), you should try to follow these few simple guidelines when -you contribute: - -1. Fork the repository. -2. Create a new branch based on the `develop` branch (`git checkout -b your_branch develop`). - If your contribution is a bug fix, you should name your branch `bugfix/xxx`; - for a feature, it should be `feature/xxx`. Otherwise, just use your good - judgment. Consistent naming of branches is appreciated since it makes the - output of `git branch` easier to understand with a single glance. -3. Do your modifications on that branch. Except for special cases, your - contribution should include proper unit tests and documentation. Also, - please try to follow the style guide below. -4. Make sure your modifications did not break anything by building and - running the tests: - - ```shell - make check - ``` -5. Commit your changes. Your commit message should start with a one line - short description of the modifications, with the details and explanations - of your modifications following in subsequent paragraphs or bullet points. - Please limit your lines to about 78 characters in commit messages, since - it makes the output easier to read in `git log`. Also, starting your commit - message with a tag describing the nature of the commit is nice, since it - makes the commit history easier to skim through. For commits that do not - change any functionality (e.g. refactoring or fixing typos), the `[NFC]` - tag (No Functionality Change) can be used. Here's an example of an - acceptable commit message: - ``` - [Searchable] Refactor the interface - - - Rename elem to contains - - Rename subset to is_subset, and make is_subset applicable in infix notation - - Add the at_key method - - operator[] is now bound to at_key instead of find - ``` - When applicable, please squash adjacent _wip_ commits into a single - _logical_ commit. If your contribution has several logical commits, - it's fine. -6. Push the changes to your fork (`git push origin your_branch`). -7. Open a pull request against Tao-Cpp's `develop` branch (not against `master`). - I will do my best to respond in a timely manner. I might discuss your patch - and suggest some modifications, or I might amend your patch myself and ask - you for feedback. You will always be given proper credit. - - -## Style guide - -I'm not going to write an exhaustive style guide, but here are a couple of -points you should watch out for: -- Indent using 4 spaces. -- Do not leave trailing white spaces at the end of lines, and no more than a - single newline at the end of a source file. -- Tao-Cpp's `#include`s go first, then a blank line and system headers. - `#include`s within each block should be sorted in alphabetical order. -- Use your own judgment and stick to the style of the surrounding code. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index a559f5c..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,25 +0,0 @@ -Copyright 2016 Fernando Pelliccioni - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index e2e5747..fbde077 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,34 @@ Tao.Algorithm ============= -[![GitHub version](https://badge.fury.io/gh/tao-cpp%2Falgorithm.svg)](https://badge.fury.io/gh/tao-cpp%2Falgorithm) + +[![Standard](https://img.shields.io/badge/c%2B%2B-98/11/14/17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) + + + +![GitHub version][badge.Version] + + +![Gitter Chat][badge.Gitter] + + + > C++11/14/17 Algorithms Library ## Introduction ## -**Tao.Algorithm** is a **C++11/14/17** library which contains a collection of general purpose algorithms. +**Tao.Algorithm** is a **C++17** library which contains a collection of general purpose algorithms. ## Overview @@ -26,25 +41,12 @@ int main() { ## Documentation You can browse the documentation online at http://tao-cpp.github.io/algorithm. -## Project organization - - -## Related material - - -## Contributing -Please see [CONTRIBUTING.md](CONTRIBUTING.md). - - -## License -Please see [LICENSE.md](LICENSE.md). - - -## Releasing - - - + +[badge.Version]: https://badge.fury.io/gh/tao-cpp%2Falgorithm.svg +[badge.Travis]: https://travis-ci.org/tao-cpp/algorithm.svg?branch=master +[badge.Appveyor]: https://ci.appveyor.com/api/projects/status/github/tao-cpp/algorithm?svg=true&branch=master +[badge.Codeclimate]: https://codeclimate.com/github/tao-cpp/algorithm/badges/gpa.svg [badge.Gitter]: https://img.shields.io/badge/gitter-join%20chat-blue.svg [badge.Wandbox]: https://img.shields.io/badge/try%20it-online-blue.svg [C++Now]: http://cppnow.org diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt new file mode 100644 index 0000000..c47a919 --- /dev/null +++ b/benchmark/CMakeLists.txt @@ -0,0 +1,175 @@ +# Tao.Algorithm +# +# Copyright (c) 2016-2021 Fernando Pelliccioni. +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + + +############################################################################## +# Required packages, gems and caveats +############################################################################## + +# find_package( PythonInterp 2.7 REQUIRED ) +find_package(PythonInterp 2.7 REQUIRED) +# if(NOT ${PYTHONINTERP_FOUND}) +# message(WARNING "Python >= 2.7 was not found; the benchmarks will be unavailable.") +# return() +# endif() + +# find_package(Ruby 2.1) +# if(NOT ${RUBY_FOUND}) +# message(WARNING "Ruby >= 2.1 was not found; the benchmarks will be unavailable.") +# return() +# endif() + +# # Check for the 'ruby-progressbar' and 'tilt' gems +# execute_process(COMMAND ${RUBY_EXECUTABLE} -r ruby-progressbar -r tilt -e "" +# RESULT_VARIABLE __TAOCPP_ALGORITHM_MISSING_GEMS +# OUTPUT_QUIET ERROR_QUIET) +# if(${__TAOCPP_ALGORITHM_MISSING_GEMS}) +# message(WARNING +# "The 'ruby-progressbar' and/or 'tilt' gems were not found; " +# "the benchmarks will be unavailable." +# "Use `gem install ruby-progressbar tilt` to install the missing gems.") +# return() +# endif() + + +############################################################################## + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_custom_target(benchmarks COMMENT "Generate all the benchmarks.") + +# add_custom_target(travis_compiler_slug USES_TERMINAL +# COMMAND ${CMAKE_COMMAND} -E echo "travis_compiler_slug: $") +# add_custom_target(travis_config_slug USES_TERMINAL +# COMMAND ${CMAKE_COMMAND} -E echo "travis_config_slug: $>") + + +file(GLOB_RECURSE TAO_ALGORITHM_BENCHMARKS + RELATIVE ${CMAKE_CURRENT_LIST_DIR} + *.cpp) + + +# message(${TAO_ALGORITHM_BENCHMARKS}) + +# add_executable(bench_median_of_3X +# ../src/benchmark/instrumented.cpp +# inst_median_of_3.cpp +# ) + +# add_executable(bench_median_of_5 +# ../src/benchmark/instrumented.cpp +# inst_median_of_5.cpp +# ) + +# add_executable(bench_median_of_7 +# ../src/benchmark/instrumented.cpp +# inst_median_of_7.cpp +# ) + + +# add_dependencies(benchmarks bench_median_of_3X) +# add_dependencies(benchmarks bench_median_of_5) +# add_dependencies(benchmarks bench_median_of_7) + +foreach(file IN LISTS TAO_ALGORITHM_BENCHMARKS) + string(REGEX REPLACE "\\.cpp$" "" name ${file}) + string(REGEX REPLACE "/" "." name ${name}) + + # message(${name}) + + # add_executable(bench.${name} EXCLUDE_FROM_ALL ${name}.cpp) + add_executable(bench.${name} ${name}.cpp ../src/benchmark/instrumented.cpp) + # add_test(NAME bench.${name} COMMAND bench.${name}) + add_dependencies(benchmarks bench.${name}) + + + + # boost_hana_target_name_for(target ${benchmark} ".erb.json") + # get_filename_component(directory "${benchmark}" DIRECTORY) + # file(GLOB cpp_files ${directory}/*.erb.cpp) + # configure_file("${benchmark}" "${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json" @ONLY) + + # file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp "") + # add_executable(${target}.measure EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp) + # set_target_properties(${target}.measure PROPERTIES RULE_LAUNCH_COMPILE "${CMAKE_CURRENT_BINARY_DIR}/measure.rb") + # set_property(TARGET ${target}.measure APPEND PROPERTY INCLUDE_DIRECTORIES "${directory}") + # add_custom_target(${target}.measure.run COMMAND ${target}.measure) + + # add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.json" + # COMMAND ${RUBY_EXECUTABLE} -r tilt -r ${CMAKE_CURRENT_BINARY_DIR}/measure.rb + # -e "MEASURE_FILE = '${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp'" + # -e "MEASURE_TARGET = '${target}.measure'" + # -e "json = Tilt::ERBTemplate.new('${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json').render" + # -e "File.open('${CMAKE_CURRENT_BINARY_DIR}/${target}.json', 'w') { |f| f.write(json) } " + # WORKING_DIRECTORY ${directory} + # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json ${cpp_files} + # VERBATIM USES_TERMINAL + # COMMENT "Generating dataset for ${target}" + # ) + + # add_custom_target(${target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.json") + # add_dependencies(benchmarks ${target}) +endforeach() + + + + + + + + + + + + +# enable_testing() + +# add_custom_target(benchmarks ALL +# COMMAND ${CMAKE_CTEST_COMMAND} -C Release --output-on-failure -R "bench.+" +# COMMENT "Build and run all the benchmarks." +# # DEPENDS ${UNIT_TEST_TARGETS} +# ) + +# function(tao_algorithm_add_test name) +# message("name1: " ${name}) + +# add_executable(bench.${name} EXCLUDE_FROM_ALL ${name}.cpp) +# # add_test(NAME bench.${name} COMMAND bench.${name}) +# add_dependencies(benchmarks bench.${name}) +# message("name2: " ${name}) + +# # add_custom_command( +# # OUTPUT out.${name} +# # COMMAND bench.${name} +# # COMMENT "..." +# # VERBATIM +# # ) + +# # add_custom_command( +# # TARGET benchmarks +# # COMMENT "Run tests" +# # POST_BUILD COMMAND bench.${name} +# # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# # ) + +# # message("name3: " ${name}) + + +# # set(UNIT_TEST_TARGETS ${UNIT_TEST_TARGETS} ${name} PARENT_SCOPE) + +# # message("UNIT_TEST_TARGETS: " ${UNIT_TEST_TARGETS}) + +# endfunction() + +# file(GLOB_RECURSE TAO_ALGORITHM_TEST_SOURCES +# RELATIVE ${CMAKE_CURRENT_LIST_DIR} +# "*.cpp") + +# foreach(file IN LISTS TAO_ALGORITHM_TEST_SOURCES) +# string(REGEX REPLACE "\\.cpp$" "" name ${file}) +# string(REGEX REPLACE "/" "." name ${name}) +# tao_algorithm_add_test(${name}) +# endforeach() diff --git a/benchmark/_OLD_CMakeLists.txt b/benchmark/_OLD_CMakeLists.txt new file mode 100644 index 0000000..aeaa262 --- /dev/null +++ b/benchmark/_OLD_CMakeLists.txt @@ -0,0 +1,111 @@ +# Tao.Algorithm +# +# Copyright (c) 2016-2021 Fernando Pelliccioni. +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +############################################################################## +# Required packages, gems and caveats +############################################################################## +find_package(Ruby 2.1) + +# message(WARNING ${RUBY_VERSION}) +# if(NOT ${RUBY_FOUND}) + +message(${RUBY_EXECUTABLE}) +# message(WARNING NOT ${RUBY_VERSION}) + + +# if(${RUBY_VERSION} > 2.1.0) +if(NOT ${RUBY_VERSION} MATCHES "2.2.0") + message(WARNING "Ruby >= 2.1 was not found; the benchmarks will be unavailable.") + return() +endif() + +# Check for the 'ruby-progressbar' and 'tilt' gems +execute_process(COMMAND ${RUBY_EXECUTABLE} -r ruby-progressbar -r tilt -e "" + RESULT_VARIABLE __TAOCPP_ALGORITHM_MISSING_GEMS + OUTPUT_QUIET ERROR_QUIET) +if(${__TAOCPP_ALGORITHM_MISSING_GEMS}) + message(WARNING + "The 'ruby-progressbar' and/or 'tilt' gems were not found; " + "the benchmarks will be unavailable." + "Use `gem install ruby-progressbar tilt` to install the missing gems.") + return() +endif() + +# # Check for the MPL11 library, which can be measured in some benchmarks +# find_package(MPL11) +# if (MPL11_FOUND) +# include_directories(${MPL11_INCLUDE_DIR}) +# endif() + +# Check for the Meta library, which can be measured in some benchmarks +# find_package(Meta) +# if (Meta_FOUND) +# include_directories(${Meta_INCLUDE_DIR}) +# endif() + +# boost_hana_append_flag(BOOST_HANA_HAS_FTEMPLATE_DEPTH -ftemplate-depth=-1) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +# message(${CMAKE_CURRENT_SOURCE_DIR}) + +############################################################################## +# Configure the measure.rb script +############################################################################## +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/measure.in.rb #input + ${CMAKE_CURRENT_BINARY_DIR}/measure.rb #output + @ONLY) + +############################################################################## +# Add the benchmarks +############################################################################## +add_custom_target(benchmarks COMMENT "Generate all the benchmarks.") + +add_custom_target(travis_compiler_slug USES_TERMINAL + COMMAND ${CMAKE_COMMAND} -E echo "travis_compiler_slug: $") +add_custom_target(travis_config_slug USES_TERMINAL + COMMAND ${CMAKE_COMMAND} -E echo "travis_config_slug: $>") + + +file(GLOB_RECURSE TAOCPP_ALGORITHM_BENCHMARKS *.erb.json) + +message(${TAOCPP_ALGORITHM_BENCHMARKS}) + +foreach(benchmark IN LISTS TAOCPP_ALGORITHM_BENCHMARKS) + taocpp_algorithm_target_name_for(target ${benchmark} ".erb.json") + message("benchmark 1: " ${benchmark}) + message("target 1: " ${target}) + + get_filename_component(directory "${benchmark}" DIRECTORY) + message(${directory}) + file(GLOB cpp_files ${directory}/*.erb.cpp) + + message(${cpp_files}) + message(${CMAKE_CURRENT_BINARY_DIR}) + + + configure_file("${benchmark}" "${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json" @ONLY) + + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp "") + add_executable(${target}.measure EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp) + set_target_properties(${target}.measure PROPERTIES RULE_LAUNCH_COMPILE "${CMAKE_CURRENT_BINARY_DIR}/measure.rb") + set_property(TARGET ${target}.measure APPEND PROPERTY INCLUDE_DIRECTORIES "${directory}") + add_custom_target(${target}.measure.run COMMAND ${target}.measure) + + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.json" + COMMAND ${RUBY_EXECUTABLE} -r tilt -r ${CMAKE_CURRENT_BINARY_DIR}/measure.rb + -e "MEASURE_FILE = '${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp'" + -e "MEASURE_TARGET = '${target}.measure'" + -e "json = Tilt::ERBTemplate.new('${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json').render" + -e "File.open('${CMAKE_CURRENT_BINARY_DIR}/${target}.json', 'w') { |f| f.write(json) } " + WORKING_DIRECTORY ${directory} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json ${cpp_files} + VERBATIM USES_TERMINAL + COMMENT "Generating dataset for ${target}" + ) + + add_custom_target(${target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.json") + add_dependencies(benchmarks ${target}) +endforeach() diff --git a/benchmark/bench_test_1.cpp b/benchmark/bench_test_1.cpp new file mode 100644 index 0000000..d859b7f --- /dev/null +++ b/benchmark/bench_test_1.cpp @@ -0,0 +1,241 @@ +// Copyright (c) 2016-2021 Fernando Pelliccioni. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + + + +// mkdir build +// cd build +// cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-std=c++14" .. +// make tests +// make benchmarks + + +#include + +#include "measurements.hpp" +#include +#include +#include +#include + +#include +#include +#include + +using namespace std; + + + +template +void measure_and_print_shift_right(C const& copy, N n) { + using tao::algorithm::shift_right; + + C data; + + auto t = measure_nullary<1000>( + [&]() {data = copy;}, + [&]() {return shift_right(begin(data), end(data), n);}); + + cout << '\t' << '\t' + << n << ";" + << get<0>(t) << ";" + << get<1>(t) << ";" + << get<2>(t) << endl; +} + + +// template +// void measure_and_print_shift_right(C const& copy) { +// using tao::algorithm::shift_right; + +// auto cat = iterator_category_str>(); +// C data; + +// auto size = std::distance(begin(copy), end(copy)); + +// for (size_t i{0}; i < size; ++i) { +// auto t = measure_nullary<1000>( +// [&]() {data = copy;}, +// [&]() {return shift_right(begin(data), end(data), i);}); + +// cout << "shift_right ;" << cat << ";" +// << i << ";" +// << data.size() << ";" +// << get<0>(t) << ";" +// << get<1>(t) << ";" +// << get<2>(t) << endl; +// } +// } + + +template +void measure_and_print_shift_right(C const& copy) { + auto size = std::distance(begin(copy), end(copy)); + + measure_and_print_shift_right(copy, 0); + measure_and_print_shift_right(copy, 1); + measure_and_print_shift_right(copy, size / 4); + measure_and_print_shift_right(copy, size / 2); + measure_and_print_shift_right(copy, size * 3 / 4); + measure_and_print_shift_right(copy, size); +} + + +template +void print(C const& c) { + for (auto const& x : c) { + cout << x << ", "; + } + cout << '\n'; +} + + +/* +Categorías (ortogonales) a medir: + + - Algoritmo (sort, rotate, shift, binary_search) + - Tipo de Contenedor (IteratorCategory: forward, bidirectional, random_access,...) + - Tamaño del elemento (value_type: int32_t, int64_t) + - Tamaño del contenedor + - COSAS A MEDIR ESPECÍFICAS DEL ALGORITMO (ej: en shift_right hay un n). +*/ + + + + + + +template > class Cont, Procedure P> +void run_mearurements_generic(std::string const& algo_name, size_t min_size, size_t max_size, P p) { + + using random_eng_t = random_int_generator; + random_eng_t eng; + + // auto cat = iterator_category_str(data_random_access); + auto cat = iterator_category_str>>(); + auto type_name = builtin_type_name(); + + + cout << algo_name << ";" + << cat << ";" + << type_name << ";" + << endl; + + + size_t array_size = min_size; + while (array_size <= max_size) { + + auto cont = random_container_creator(array_size, eng); + + cout << '\t' + << "data size: " << array_size << ";" + << endl; + + + p(cont); + + array_size *= 2; + } +} + + + +template