Skip to content

Commit

Permalink
Merge commit '95c2f65073c366a3621e304adc066b7e675cf907' into catchup/…
Browse files Browse the repository at this point in the history
…main_from_long_lived_blastwjb_95c2f65073c366a3621e304adc066b7e675cf907
  • Loading branch information
AmineKhaldi committed Jun 20, 2023
2 parents f1d860c + 95c2f65 commit a0cf978
Show file tree
Hide file tree
Showing 41 changed files with 1,427 additions and 4,049 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ jobs:
- name: Mac OS build C++ and test
if: startsWith(matrix.os, 'macos')
run: |
ls -l
export MACOSX_DEPLOYMENT_TARGET=10.14
mkdir -p build
ls -l build
cd build
cmake ../
cmake --build . -- -j 6
Expand Down
33 changes: 19 additions & 14 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches:
- main
tags:
- '**'
release:
types: [published]
pull_request:
branches:
- '**'
Expand Down Expand Up @@ -45,25 +45,25 @@ jobs:
cibw-build: 'cp37-*'
manylinux:
arm: manylinux2014
intel: manylinux2010
intel: manylinux2014
matrix: '3.7'
- major-dot-minor: '3.8'
cibw-build: 'cp38-*'
manylinux:
arm: manylinux2014
intel: manylinux2010
intel: manylinux2014
matrix: '3.8'
- major-dot-minor: '3.9'
cibw-build: 'cp39-*'
manylinux:
arm: manylinux2014
intel: manylinux2010
intel: manylinux2014
matrix: '3.9'
- major-dot-minor: '3.10'
cibw-build: 'cp310-*'
manylinux:
arm: manylinux2014
intel: manylinux2010
intel: manylinux2014
matrix: '3.10'
- major-dot-minor: '3.11'
cibw-build: 'cp311-*'
Expand Down Expand Up @@ -112,6 +112,11 @@ jobs:
with:
fetch-depth: 0

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: chia-network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}
Expand Down Expand Up @@ -139,18 +144,13 @@ jobs:
&& curl -L https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-`uname -m`.sh > cmake.sh
&& yes | sh cmake.sh | cat
&& rm -f /usr/bin/cmake
&& curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | tar x --lzip
&& cp contrib/gmp-patch-6.2.1/longlong.h gmp-6.2.1/
&& cp contrib/gmp-patch-6.2.1/compat.c gmp-6.2.1/
&& cd gmp-6.2.1 && ./configure --enable-fat
&& make && make install && cd .. && rm -rf gmp-6.2.1
&& cmake --version
&& uname -a
CIBW_BEFORE_BUILD_LINUX: >
python -m pip install --upgrade pip
CIBW_ARCHS_MACOS: ${{ matrix.os.cibw-archs-macos[matrix.arch.matrix] }}
CIBW_BEFORE_ALL_MACOS: >
brew install gmp boost cmake
brew install cmake
CIBW_BEFORE_BUILD_MACOS: >
python -m pip install --upgrade pip
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=10.14"
Expand Down Expand Up @@ -193,6 +193,11 @@ jobs:
with:
fetch-depth: 0

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}
Expand Down Expand Up @@ -303,15 +308,15 @@ jobs:
run: pip install twine

- name: Publish distribution to PyPI
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
if: env.RELEASE == 'true' && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

- name: Publish distribution to Test PyPI
if: steps.check_secrets.outputs.HAS_SECRET
if: env.PRE_RELEASE == 'true' && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/js-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches:
- main
tags:
- '**'
release:
types: [published]
pull_request:
branches:
- '**'
Expand All @@ -23,6 +23,11 @@ jobs:
with:
fetch-depth: 0

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -46,7 +51,7 @@ jobs:
run: ./js_build.sh

- name: Publish
if: startsWith(github.ref, 'refs/tags/')
if: env.FULL_RELEASE == 'true'
working-directory: ${{ github.workspace }}/js_build/js-bindings
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/relic-nightly.yml

This file was deleted.

Empty file modified .github/workflows/stale-issue.yml
100755 → 100644
Empty file.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ main
.o
obj/
src/*.o
contrib/relic/CTestTestfile.cmake
contrib/relic/bench/CTestTestfile.cmake
contrib/relic/bin
contrib/relic/include/relic_conf.h
contrib/relic/test/CTestTestfile.cmake
contrib/gmp-6.1.2/

.idea
.vscode
Expand Down
132 changes: 14 additions & 118 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ endif()

project(BLS)

if(MSVC)
enable_language(ASM_MASM)
else()
enable_language(ASM)
endif()

set(BUILD_BLS_PYTHON_BINDINGS "1" CACHE STRING "")
set(BUILD_BLS_TESTS "1" CACHE STRING "")
set(BUILD_BLS_BENCHMARKS "1" CACHE STRING "")
Expand All @@ -33,6 +39,7 @@ include(FetchContent)

FetchContent_Declare(Sodium
GIT_REPOSITORY https://github.com/AmineKhaldi/libsodium-cmake.git

# Latest commit at the moment this was added here
# Anchored to libsodium v1.0.18
GIT_TAG f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65
Expand All @@ -42,128 +49,17 @@ set(SODIUM_DISABLE_TESTS "on" CACHE STRING "")
set(SODIUM_CHIA_MINIMAL "on" CACHE STRING "")
FetchContent_MakeAvailable(Sodium)

if(DEFINED ENV{RELIC_MAIN})
set(RELIC_GIT_TAG "origin/main")
set(RELIC_REPOSITORY "https://github.com/relic-toolkit/relic.git")
else()
# This is currently anchored to upstream aecdcae7956f542fbee2392c1f0feb0a8ac41dc5
set(RELIC_GIT_TAG "2a4ed8ded3a9a5ac5e39f3877f357264b2e16f11")
set(RELIC_REPOSITORY "https://github.com/Chia-Network/relic.git")
endif()
set(BLST_GIT_TAG "a8cd361c9f671577aeab3f074098443af92a53fc")
set(BLST_REPOSITORY "https://github.com/supranational/blst")

message(STATUS "Relic will be built from: ${RELIC_GIT_TAG} and repository ${RELIC_REPOSITORY}")
message(STATUS "blst will be built from: ${BLST_GIT_TAG} and repository ${BLST_REPOSITORY}")

FetchContent_Declare(
relic
GIT_REPOSITORY ${RELIC_REPOSITORY}
GIT_TAG ${RELIC_GIT_TAG}
blst
GIT_REPOSITORY ${BLST_REPOSITORY}
GIT_TAG ${BLST_GIT_TAG}
)

# Relic related options

set(STBIN "off" CACHE STRING "Relic - Build static binaries")

if(MSVC)
set(ARITH "gmp" CACHE STRING "")
# We'll be using our custom MPIR build instead of GMP for MSVC builds
FetchContent_Declare(
chia_mpir
GIT_REPOSITORY https://github.com/Chia-Network/mpir_gc_x64.git
GIT_SHALLOW true
)
FetchContent_MakeAvailable(chia_mpir)
set(MPIR_INCLUDE_DIR ${chia_mpir_SOURCE_DIR} CACHE STRING "")
set(MPIR_IMPLIB "${chia_mpir_SOURCE_DIR}/mpir.lib" CACHE STRING "")
else()
find_package(gmp)
if(GMP_FOUND)
message(STATUS "Found libgmp")
set(ARITH "gmp" CACHE STRING "")
else()
set(ARITH "easy" CACHE STRING "")
endif()
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
else()
set(WSIZE "64" CACHE STRING "Relic - Processor word size")
endif()

if(EMSCRIPTEN)
# emscripten needs arch set to be none since it can't compile assembly
set(ARCH "" CACHE STRING "")
# emscripten is a 32 bit compiler
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(TIMER "ANSI" CACHE STRING "")
set(MULTI "OPENMP" CACHE STRING "")
else()
set(TIMER "CYCLE" CACHE STRING "")
set(MULTI "PTHREAD" CACHE STRING "")
endif()

set(CHECK "off" CACHE STRING "")
set(VERBS "off" CACHE STRING "")
set(ALLOC "AUTO" CACHE STRING "")
set(SHLIB "off" CACHE STRING "")
set(DOCUM "off" CACHE STRING "")
set(FP_PRIME "381" CACHE STRING "Relic - Prime modulus size")

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "off" CACHE STRING "")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(SEED "WCGR" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
else()
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
endif()

if(DEFINED ENV{RELIC_MAIN})
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;JMPDS;SLIDE" CACHE STRING "")
if(MSVC)
set(CFLAGS "" CACHE STRING "")
else()
set(CFLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
else()
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" CACHE STRING "")
if(MSVC)
set(COMP_FLAGS "" CACHE STRING "")
else()
set(COMP_FLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
endif()

set(FP_PMERS "off" CACHE STRING "")
set(FPX_METHD "INTEG;INTEG;LAZYR" CACHE STRING "")
set(EP_PLAIN "off" CACHE STRING "")
set(EP_SUPER "off" CACHE STRING "")
# Disable relic tests and benchmarks
set(TESTS "0" CACHE STRING "Relic - Number of times each test is ran")
set(BENCH "0" CACHE STRING "Relic - Number of times each benchmark is ran")

set(QUIET "on" CACHE STRING "Relic - Build with printing disabled")

set(PP_EXT "LAZYR" CACHE STRING "")
set(PP_METHD "LAZYR;OATEP" CACHE STRING "")

FetchContent_MakeAvailable(relic)

function(handle_mpir_dlls _target)
file(GLOB chia_mpir_dlls ${chia_mpir_SOURCE_DIR}/*.dll)
foreach(mpir_dll IN LISTS chia_mpir_dlls)
add_custom_command(
TARGET ${_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${mpir_dll} $<TARGET_FILE_DIR:${_target}>
)
endforeach()
endfunction()
FetchContent_MakeAvailable(blst)

add_subdirectory(src)

Expand Down
Loading

0 comments on commit a0cf978

Please sign in to comment.