Skip to content

Commit

Permalink
Merge branch 'merge-main-01-08-2023' into GH-37-update-for-if
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 8, 2024
2 parents e28a8ee + 4cab488 commit 6a5be27
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ jobs:
with:
owner: AntelopeIO
repo: leap
file: 'leap-dev.*(x86_64|amd64).deb'
file: 'leap-dev.*ubuntu22\.04_amd64.deb'
target: '${{steps.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(steps.versions.outputs.leap-dev-prerelease)}}
artifact-name: leap-dev-ubuntu20-amd64
artifact-name: leap-dev-ubuntu22-amd64
container-package: experimental-binaries
- name: Install packages
run: |
sudo apt-get update && sudo apt-get upgrade -y
sudo apt install ./*.deb
sudo apt-get install cmake
rm ./*.deb
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src
- name: Build & Test
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ option(SYSTEM_CONFIGURABLE_WASM_LIMITS
option(SYSTEM_BLOCKCHAIN_PARAMETERS
"Enables use of the host functions activated by the BLOCKCHAIN_PARAMETERS protocol feature" ON)

option(SYSTEM_ENABLE_LEAP_VERSION_CHECK
"Enables a configure-time check that the version of Leap's tester library is compatible with this project's unit tests" ON)

option(SYSTEM_ENABLE_CDT_VERSION_CHECK
"Enables a configure-time check that the version of CDT is compatible with this project's contracts" ON)

ExternalProject_Add(
contracts_project
SOURCE_DIR ${CMAKE_SOURCE_DIR}/contracts
Expand Down
34 changes: 18 additions & 16 deletions contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ set(CDT_VERSION_SOFT_MAX "4.0")
# set(CDT_VERSION_HARD_MAX "")

# Check the version of CDT
set(VERSION_MATCH_ERROR_MSG "")
CDT_CHECK_VERSION(VERSION_OUTPUT "${CDT_VERSION}" "${CDT_VERSION_MIN}" "${CDT_VERSION_SOFT_MAX}"
"${CDT_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG)
if(VERSION_OUTPUT STREQUAL "MATCH")
message(STATUS "Using CDT version ${CDT_VERSION}")
elseif(VERSION_OUTPUT STREQUAL "WARN")
message(
WARNING
"Using CDT version ${CDT_VERSION} even though it exceeds the maximum supported version of ${CDT_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use CDT version ${CDT_VERSION_SOFT_MAX}.x"
)
else() # INVALID OR MISMATCH
message(
FATAL_ERROR
"Found CDT version ${CDT_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use CDT version ${CDT_VERSION_SOFT_MAX}.x"
)
endif(VERSION_OUTPUT STREQUAL "MATCH")
if(SYSTEM_ENABLE_CDT_VERSION_CHECK)
set(VERSION_MATCH_ERROR_MSG "")
CDT_CHECK_VERSION(VERSION_OUTPUT "${CDT_VERSION}" "${CDT_VERSION_MIN}" "${CDT_VERSION_SOFT_MAX}"
"${CDT_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG)
if(VERSION_OUTPUT STREQUAL "MATCH")
message(STATUS "Using CDT version ${CDT_VERSION}")
elseif(VERSION_OUTPUT STREQUAL "WARN")
message(
WARNING
"Using CDT version ${CDT_VERSION} even though it exceeds the maximum supported version of ${CDT_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use CDT version ${CDT_VERSION_SOFT_MAX}.x"
)
else() # INVALID OR MISMATCH
message(
FATAL_ERROR
"Found CDT version ${CDT_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use CDT version ${CDT_VERSION_SOFT_MAX}.x"
)
endif(VERSION_OUTPUT STREQUAL "MATCH")
endif()

set(ICON_BASE_URL "https://raw.githubusercontent.com/AntelopeIO/reference-contracts/main/contracts/icons")

Expand Down
34 changes: 18 additions & 16 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ set(EOSIO_VERSION_SOFT_MAX "5.0")
find_package(leap)

# Check the version of Leap
set(VERSION_MATCH_ERROR_MSG "")
eosio_check_version(VERSION_OUTPUT "${EOSIO_VERSION}" "${EOSIO_VERSION_MIN}" "${EOSIO_VERSION_SOFT_MAX}"
"${EOSIO_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG)
if(VERSION_OUTPUT STREQUAL "MATCH")
message(STATUS "Using Leap version ${EOSIO_VERSION}")
elseif(VERSION_OUTPUT STREQUAL "WARN")
message(
WARNING
"Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x"
)
else() # INVALID OR MISMATCH
message(
FATAL_ERROR
"Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x"
)
endif(VERSION_OUTPUT STREQUAL "MATCH")
if(SYSTEM_ENABLE_LEAP_VERSION_CHECK)
set(VERSION_MATCH_ERROR_MSG "")
eosio_check_version(VERSION_OUTPUT "${EOSIO_VERSION}" "${EOSIO_VERSION_MIN}" "${EOSIO_VERSION_SOFT_MAX}"
"${EOSIO_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG)
if(VERSION_OUTPUT STREQUAL "MATCH")
message(STATUS "Using Leap version ${EOSIO_VERSION}")
elseif(VERSION_OUTPUT STREQUAL "WARN")
message(
WARNING
"Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x"
)
else() # INVALID OR MISMATCH
message(
FATAL_ERROR
"Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x"
)
endif(VERSION_OUTPUT STREQUAL "MATCH")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/contracts.hpp)

Expand Down

0 comments on commit 6a5be27

Please sign in to comment.