Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies + remove obsolete ones #123

Merged
merged 8 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 125
DerivePointerAlignment: false
PointerAlignment: Right
22 changes: 22 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Checks: "-*,
clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-init-variables,
google-runtime-int,
google-readability-avoid-underscore-in-googletest-name,
misc-*,
performance-*,
portability-*,
readability-*,
-misc-no-recursion,
-readability-function-cognitive-complexity"
WarningsAsErrors: "*"
CheckOptions:
- key: readability-identifier-length.MinimumVariableNameLength
value: 2
- key: readability-identifier-length.MinimumParameterNameLength
value: 2
- key: readability-identifier-length.MinimumLoopCounterNameLength
value: 1
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
value: true
16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/sonarcloud.yml

This file was deleted.

77 changes: 29 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,55 +47,36 @@
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

\cmake-build-debug
\.idea/
/tmp/
/deps/nano2-sdk/

# Created by cmake
googletest-download/
googletest-src/
googletest-build/
CMakeFiles/
CMakeCache.txt
unittests
*.cmake
Testing/
cmake-build-fuzz/

# Others
/cmake-build-debug/
/cmake-build-fuzz/
\.idea
/app/bin/
/app/debug/
/app/obj/

\deps/*
!\deps/nanos-secure-sdk
!\deps/nanox-secure-sdk
!\deps/ledger-zxlib
!\deps/tinycbor
!\deps/tinycbor-ledger
!\deps/BLAKE

app/src/glyphs.c

app/src/glyphs.h
/build
.vscode/dryrun.log
.vscode/targets.log

##########################

tests_zemu/.yarn/*
tests_zemu/!.yarn/patches
tests_zemu/!.yarn/releases
tests_zemu/!.yarn/plugins
tests_zemu/!.yarn/sdks
tests_zemu/!.yarn/versions
tests_zemu/.pnp.*
#########################

.vscode
.idea

node_modules
fuzz/corpora

!build/.gitkeep


build/*
cmake-build-debug
app/build/*
.DS_Store

tests_zemu/snapshots-tmp
tests_zemu/yarn.lock
tests_tools/target
fuzz-*.log
/fuzz/corpora

.vscode/
tests_zemu/yarn.lock
/scan-build

tests_zemu/bun.lockb
17 changes: 1 addition & 16 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
[submodule "deps/nanos-secure-sdk"]
path = deps/nanos-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanox-secure-sdk"]
path = deps/nanox-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/Zondax/ledger-zxlib.git
[submodule "deps/stax-secure-sdk"]
path = deps/stax-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk
[submodule "deps/ledger-secure-sdk"]
path = deps/ledger-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk
url = https://github.com/Zondax/ledger-zxlib.git
17 changes: 0 additions & 17 deletions .sonarcloud.properties

This file was deleted.

82 changes: 60 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,33 @@
#* See the License for the specific language governing permissions and
#* limitations under the License.
#********************************************************************************
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.28)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
LOCAL
)

project(ledger-cosmos VERSION 0.0.0)
enable_testing()
if(CMAKE_GENERATOR MATCHES "Ninja")
message(FATAL_ERROR "This project does not support the Ninja generator. "
"Please use Unix Makefiles or another supported generator. "
"This error is typical in CLion. In this case, switch to generator Unix Makefiles.")
endif()

########################################################

project(ledger-spacemesh VERSION 0.0.0)

set(CMAKE_CXX_STANDARD 17)
cmake_policy(SET CMP0025 NEW)
set(CMAKE_CXX_STANDARD 11)
cmake_policy(SET CMP0144 NEW)

set(HUNTER_STATUS_DEBUG ON)
set(HUNTER_TLS_VERIFY OFF)

enable_testing()

option(ENABLE_FUZZING "Build with fuzzing instrumentation and build fuzz targets" OFF)
option(ENABLE_COVERAGE "Build with source code coverage instrumentation" OFF)
option(ENABLE_SANITIZERS "Build with ASAN and UBSAN" OFF)
Expand All @@ -42,8 +52,10 @@ add_definitions(-DAPP_STANDARD)

hunter_add_package(fmt)
find_package(fmt CONFIG REQUIRED)

hunter_add_package(jsoncpp)
find_package(jsoncpp CONFIG REQUIRED)

hunter_add_package(GTest)
find_package(GTest CONFIG REQUIRED)

Expand All @@ -66,9 +78,9 @@ if(ENABLE_FUZZING)
endif()
else()
message(FATAL_ERROR
"You are using an unsupported compiler! Fuzzing only works with Clang 10.\n"
"Unsupported compiler! Fuzzing requires Clang 10.\n"
"1. Install clang-10 \n"
"2. Pass -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10")
"2. Use -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10")
endif()

string(APPEND CMAKE_C_FLAGS " -fsanitize=fuzzer-no-link")
Expand All @@ -88,12 +100,37 @@ if(ENABLE_SANITIZERS)
string(APPEND CMAKE_LINKER_FLAGS " -fsanitize=address,undefined -fsanitize-recover=address,undefined")
endif()

set (RETRIEVE_MAJOR_CMD
"cat ${CMAKE_CURRENT_SOURCE_DIR}/app/Makefile.version | grep APPVERSION_M | cut -b 14- | tr -d '\n'"
)
set (RETRIEVE_MINOR_CMD
"cat ${CMAKE_CURRENT_SOURCE_DIR}/app/Makefile.version | grep APPVERSION_N | cut -b 14- | tr -d '\n'"
)
execute_process(
COMMAND bash "-c" ${RETRIEVE_MAJOR_CMD}
RESULT_VARIABLE MAJOR_RESULT
OUTPUT_VARIABLE MAJOR_VERSION
)
execute_process(
COMMAND bash "-c" ${RETRIEVE_MINOR_CMD}
RESULT_VARIABLE MINOR_RESULT
OUTPUT_VARIABLE MINOR_VERSION
)

message(STATUS "LEDGER_MAJOR_VERSION [${MAJOR_RESULT}]: ${MAJOR_VERSION}" )
message(STATUS "LEDGER_MINOR_VERSION [${MINOR_RESULT}]: ${MINOR_VERSION}" )

add_definitions(
-DLEDGER_MAJOR_VERSION=${MAJOR_VERSION}
-DLEDGER_MINOR_VERSION=${MINOR_VERSION}
)

string(APPEND CMAKE_CXX_FLAGS " -fsanitize=address -fno-omit-frame-pointer")
string(APPEND CMAKE_LINKER_FLAGS " -fsanitize=address -fno-omit-frame-pointer")

##############################################################
##############################################################
# static libs
# Static Libraries
file(GLOB_RECURSE JSMN_SRC
${CMAKE_CURRENT_SOURCE_DIR}/deps/jsmn/src/jsmn.c
)
Expand Down Expand Up @@ -142,20 +179,35 @@ target_include_directories(app_lib PUBLIC
target_link_libraries(app_lib PUBLIC)

##############################################################
# Fuzz Targets
if(ENABLE_FUZZING)
set(FUZZ_TARGETS
parser_parse
parser_message_parse
)

foreach(target ${FUZZ_TARGETS})
add_executable(fuzz-${target} ${CMAKE_CURRENT_SOURCE_DIR}/fuzz/${target}.cpp)
target_link_libraries(fuzz-${target} PRIVATE app_lib)
target_link_options(fuzz-${target} PRIVATE "-fsanitize=fuzzer")
endforeach()
else()
##############################################################
# Tests
file(GLOB_RECURSE TESTS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp)

add_executable(unittests ${TESTS_SRC})
target_include_directories(unittests PRIVATE
${gtest_SOURCE_DIR}/include
${gmock_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/deps/jsmn/src
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src
)

target_link_libraries(unittests PRIVATE
GTest::gtest_main
app_lib
GTest::gtest_main
fmt::fmt
JsonCpp::JsonCpp)

Expand All @@ -164,18 +216,4 @@ add_compile_definitions(APP_TESTING=1)
add_compile_definitions(COMPILE_TEXTUAL=1)
add_test(NAME unittests COMMAND unittests)
set_tests_properties(unittests PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)

##############################################################
##############################################################
# Fuzz Targets
if(ENABLE_FUZZING)
set(FUZZ_TARGETS
parser_parse
)

foreach(target ${FUZZ_TARGETS})
add_executable(fuzz-${target} ${CMAKE_CURRENT_SOURCE_DIR}/fuzz/${target}.cpp)
target_link_libraries(fuzz-${target} PRIVATE app_lib)
target_link_options(fuzz-${target} PRIVATE "-fsanitize=fuzzer")
endforeach()
endif()
3 changes: 2 additions & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ APPVERSION_M=2
# This is the `spec_version` field of `Runtime`
APPVERSION_N=35
# This is the patch version of this release
APPVERSION_P=24
APPVERSION_P=25

1 change: 0 additions & 1 deletion deps/ledger-secure-sdk
Submodule ledger-secure-sdk deleted from b46b4b
Loading
Loading