Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a7fe4a8
Init github actions
Harrm Oct 22, 2021
fff9232
Give shell scripts permission to run
Harrm Oct 22, 2021
7dbaac7
Add build dir env var
Harrm Oct 22, 2021
79e2ba0
Fix hunter link and hash
Harrm Oct 22, 2021
5310a69
Fix hunter link and hash
Harrm Oct 22, 2021
c452d79
Fix hunter link and hash
Harrm Oct 22, 2021
7220212
Fix <span> to <gsl/span> in hexutil.cpp
Harrm Oct 22, 2021
48f9af8
Fix <span> to <gsl/span>
Harrm Oct 22, 2021
f80046b
Add enable_testing()
Harrm Oct 22, 2021
fa61fb1
Enable BUILD_TESTS for CI
Harrm Oct 22, 2021
2347f24
Enable BUILD_TESTS for CI
Harrm Oct 22, 2021
cfec2c5
Enable BUILD_TESTS for CI
Harrm Oct 22, 2021
dd177f6
fix testing
Harrm Oct 22, 2021
d326b68
Fix testing in build.sh
Harrm Oct 22, 2021
5966a34
Fix typo in build.sh
Harrm Oct 23, 2021
a2df27e
Get rid of redundant xargs
Harrm Oct 23, 2021
5adea7c
Fixing clang-tidy
Harrm Oct 23, 2021
9eac1f5
Fix comments in encode_append
Harrm Oct 25, 2021
7c6de30
Fix conflict with master
Harrm Oct 25, 2021
d464fa1
Enclose outcome:: in scale:: namespace
Harrm Oct 27, 2021
9195604
Replace boost optional to std optional
Harrm Nov 1, 2021
c4682f8
add scale codecs for enums
Harrm Nov 2, 2021
226f95d
Fix tests
Harrm Nov 2, 2021
375eeb8
Trying to fix tests on linux
Harrm Nov 2, 2021
f1b891f
Trying to fix tests on linux
Harrm Nov 2, 2021
5d3a67f
Trying to fix tests on linux
Harrm Nov 2, 2021
7d7dcd0
Trying to fix tests on linux
Harrm Nov 2, 2021
381c246
Trying to fix tests on linux
Harrm Nov 2, 2021
7419034
Fix indents and typos
Harrm Nov 2, 2021
2d02507
Fix indents and typos
Harrm Nov 2, 2021
c9f6355
Merge pull request #1 from soramitsu/fix/kagome-compatibility
Harrm Nov 2, 2021
7321c21
Trying to fix the enums
Harrm Nov 3, 2021
4192208
Remove typos
Harrm Nov 3, 2021
e3dbab1
Fixing enum tests
Harrm Nov 3, 2021
65beb24
Fixing enum tests
Harrm Nov 3, 2021
ada4c72
Fixing enums
Harrm Nov 3, 2021
8871736
Fixed enum test
Harrm Nov 3, 2021
56a7144
Fixed enum test
Harrm Nov 3, 2021
0202f7e
Fix operators for enums to allows custom overloads
Harrm Nov 3, 2021
68997ad
Fix typo
Harrm Nov 3, 2021
dba011a
Boost, stop it
Harrm Nov 3, 2021
280fba7
A little improvement for enum validation
Harrm Nov 4, 2021
011a5cd
Fix typo
Harrm Nov 4, 2021
63e272e
fix build for gcc'
Harrm Nov 4, 2021
8a3e405
Extract enum traits to a separate header
Harrm Nov 4, 2021
ec17a4b
Fix header include
Harrm Nov 4, 2021
f5efd37
Fix header include
Harrm Nov 4, 2021
b502bd8
Update CMakeLists.txt
Harrm Nov 5, 2021
221dcca
Update fixed_width_integer.hpp
Harrm Nov 5, 2021
d103231
Update CMakeLists.txt
Harrm Nov 5, 2021
a598834
Update CMakeLists.txt
Harrm Nov 5, 2021
71d5bff
Update CMakeLists.txt
Harrm Nov 5, 2021
0d5490d
Format
Harrm Nov 7, 2021
5d9161a
Merge branch 'feature/enum-codecs' of github.com:soramitsu/scale-code…
Harrm Nov 7, 2021
c55e98f
Merge pull request #2 from soramitsu/feature/enum-codecs
Harrm Nov 7, 2021
c2858f4
Update CMakeLists.txt
Harrm Nov 9, 2021
0f1ba36
Turn off HUNTER_STATUS_DEBUG
Harrm Nov 9, 2021
e741c2e
Fix vec append for lengths more than 2^14 (#5)
Feb 11, 2022
b7a8f7f
Coding-of-any-collections (#6)
GaroRobe Apr 29, 2022
394517e
BitVec (#11)
turuslan Sep 13, 2022
9263204
Feature: size limited container and nullopt (#13)
xDimon Oct 27, 2022
b2af924
Update hunter (#17)
kamilsa Apr 10, 2023
46e2695
Update for C++20 (#18)
xDimon Oct 26, 2023
3f0a581
check input size before allocation (#21)
turuslan Dec 5, 2023
88f6129
(ubsan) decode integer (#22)
turuslan Dec 7, 2023
bd457d4
refactor (for qtils) (#20)
turuslan Jan 29, 2024
961e7ac
qtils outcome (#25)
turuslan May 29, 2024
aa8bf45
vcpkg (#26)
turuslan Aug 8, 2024
3b0960c
refactor test outcome (#27)
turuslan Aug 20, 2024
e1a3c7a
[audit] decode redundant compact encoding (#28)
turuslan Oct 16, 2024
7a5e8a7
Feature: custom config for coding and jam-codec compatibility (#29)
xDimon Dec 9, 2024
6b39217
Feature: seal definitions to auto-generated file (#30)
xDimon Dec 10, 2024
b2558d5
Feature: vcpkg compatibility (#31)
xDimon Jan 23, 2025
db00369
Feature: support for coding of aggregates (#32)
xDimon Feb 10, 2025
8b2a0c5
Remake SCALE (#33)
xDimon Feb 24, 2025
2d0e502
Add sanitizer options
Harrm Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,30 @@ env:

jobs:
MacOS:
runs-on: macos-latest
runs-on: macos-15
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ github.job }}-${{ env.CACHE_VERSION }}
- name: build
env:
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
run: ./scripts/build.sh

Linux:
strategy:
fail-fast: false
matrix:
options:
- name: "Linux: gcc-9"
run: ./scripts/build.sh -DCMAKE_CXX_COMPIILER=g++-9
- name: "Linux: clang-10"
run: ./scripts/build.sh -DCMAKE_CXX_COMPILER=clang++-10
- name: "Linux: gcc"
run: ./scripts/build.sh -DCMAKE_CXX_COMPILER=g++
- name: "Linux: clang"
run: ./scripts/build.sh -DCMAKE_CXX_COMPILER=clang++
name: "${{ matrix.options.name }}"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ github.job }}-${{ matrix.options.name }}-${{ env.CACHE_VERSION }}
Expand All @@ -52,13 +50,13 @@ jobs:

clang-tidy:
name: "Linux: clang-tidy"
runs-on: ubuntu-latest
container: soramitsu/kagome-dev:2-minideb
runs-on: ubuntu-24.04
container: qdrvm/kagome-dev@sha256:2d70246c32418a3dd45c246d3f5c2dd99bdafde145b903271849affe476c4cfc
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ github.job }}-${{ env.CACHE_VERSION }}
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build
.vscode
.idea
cmake-build-*/
**/build/
**/build-*/
**/cmake-build-*/
Testing
119 changes: 100 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,62 +1,143 @@
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# Copyright Quadrivium LLC
# All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required(VERSION 3.12)

include(${CMAKE_CURRENT_LIST_DIR}/cmake/HunterGate.cmake)
set(HUNTER_STATUS_DEBUG ON)
HunterGate(
URL https://github.com/soramitsu/soramitsu-hunter/archive/9ca72322e8d9de70d360dc7f371b223d32999123.zip
SHA1 37cc1150526fb9c5dcf197f918e5d9aab611823f
)
option(JAM_COMPATIBLE "Build compatible with JAM-codec" OFF)
option(CUSTOM_CONFIG_SUPPORT "Support custom config of coder" OFF)
option(BUILD_TESTS "Whether to include the test suite in build" OFF)

option(SCALE_ASAN "Build with address sanitizer" OFF)
option(SCALE_UBSAN "Build with undefined behavior sanitizer" OFF)
option(SCALE_TSAN "Build with thread sanitizer" OFF)

set(MAX_AGGREGATE_FIELDS 20 CACHE STRING "Max number of aggregates fields (1..1000); for generation")

if (PACKAGE_MANAGER)
if(PACKAGE_MANAGER NOT MATCHES "^(hunter|vcpkg)$")
message(FATAL_ERROR "PACKAGE_MANAGER must be set to 'hunter', 'vcpkg' or isn't set")
endif ()
else ()
set(PACKAGE_MANAGER "hunter")
if (CMAKE_TOOLCHAIN_FILE)
get_filename_component(ACTUAL_NAME ${CMAKE_TOOLCHAIN_FILE} NAME)
if(ACTUAL_NAME STREQUAL "vcpkg.cmake")
message(STATUS "vcpkg will be used because vcpkg.cmake has found")
set(PACKAGE_MANAGER "vcpkg")
endif ()
endif ()
endif ()
message(STATUS "Selected package manager: ${PACKAGE_MANAGER}")

if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27")
cmake_policy(SET CMP0144 NEW)
endif ()

if (PACKAGE_MANAGER STREQUAL "hunter")
include("cmake/Hunter/init.cmake")
endif ()

if(BUILD_TESTS)
if (PACKAGE_MANAGER STREQUAL "vcpkg")
list(APPEND VCPKG_MANIFEST_FEATURES scale-tests)
endif()
endif()

project(Scale CXX)
project(Scale LANGUAGES CXX VERSION 2.0.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

option(BUILD_TESTS "Whether to include the test suite in build" OFF)
if (PACKAGE_MANAGER STREQUAL "hunter")
hunter_add_package(Boost)
find_package(Boost)
else()
find_package(Boost CONFIG REQUIRED COMPONENTS endian multiprecision)
endif ()

if (PACKAGE_MANAGER STREQUAL "hunter")
hunter_add_package(qtils)
endif ()
find_package(qtils CONFIG REQUIRED)

hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
SET(JAM_COMPATIBILITY_ENABLED "${JAM_COMPATIBLE}")
set(CUSTOM_CONFIG_ENABLED "${CUSTOM_CONFIG_SUPPORT}")
configure_file("${CMAKE_SOURCE_DIR}/include/scale/definitions.hpp.in" "${CMAKE_BINARY_DIR}/include/scale/definitions.hpp")

hunter_add_package(Microsoft.GSL)
find_package(Microsoft.GSL CONFIG REQUIRED)
if (SCALE_ASAN)
add_compile_options(-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer)
endif()
if (SCALE_UBSAN)
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=undefined -fno-omit-frame-pointer)
endif()
if (SCALE_TSAN)
add_compile_options(-fsanitize=thread -fno-omit-frame-pointer)
add_link_options(-fsanitize=thread -fno-omit-frame-pointer)
endif()

add_subdirectory(src)

if (BUILD_TESTS)
enable_testing()
add_subdirectory(test ${CMAKE_BINARY_DIR}/tests_bin)
endif()
add_subdirectory(test ${CMAKE_BINARY_DIR}/test_bin)
endif ()

###############################################################################
# INSTALLATION
###############################################################################

include(GNUInstallDirs)

install(TARGETS scale buffer scale_encode_append EXPORT scaleConfig
install(TARGETS scale EXPORT scaleConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
)
)

install(TARGETS scale_append EXPORT scaleConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
)

install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include/scale
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp"
)
install(
DIRECTORY ${CMAKE_BINARY_DIR}/include/scale
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/scaleConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/scaleConfigVersion.cmake
DESTINATION share/scale
)

install(
EXPORT scaleConfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scale
DESTINATION share/scale
NAMESPACE scale::
)
Loading