Skip to content

Commit 6ec802b

Browse files
sleepdefic1tfaustbrian
authored andcommitted
chore: move packages out of source (#156)
1 parent b7ae092 commit 6ec802b

29 files changed

Lines changed: 558 additions & 178 deletions

.github/workflows/test.yml

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,51 @@ on:
88
types: [ready_for_review, synchronize, opened] # fix: synchronize triggers builds for PR merges with the base branch, currently causes duplicate builds as synchronize is treated the same as push for everything besides merges
99

1010
jobs:
11-
arduino-default:
11+
arduino:
1212
runs-on: ubuntu-latest
1313

1414
steps:
1515
- uses: actions/checkout@v1
1616
- name: Make scripts executable
1717
run: sudo chmod -R +x ./.github/workflows/test/*.sh
18-
- name: Install
18+
- name: Install Dependencies
1919
run: ./.github/workflows/test/install_arduino.sh
20-
- name: Build
20+
- name: Build Arduino Sketch
2121
run: ./.github/workflows/test/script_arduino.sh
2222

23-
linux-default:
23+
platformio:
2424
runs-on: ubuntu-latest
2525

2626
steps:
2727
- uses: actions/checkout@v1
28-
- name: Make scripts executable
29-
run: sudo chmod -R +x ./.github/workflows/test/*.sh
30-
- name: Install
31-
run: ./.github/workflows/test/install_platform_io.sh
32-
- name: Empty Git Submodule Folders
28+
- name: Install Dependencies
3329
run: |
34-
rm -rf ./src/lib/{ArduinoJson/*,BIP66/*,uECC/*}
35-
rm -rf ./test/lib/googletest/*
30+
sudo pip install -U platformio
31+
platformio update
3632
- name: Build
37-
run: ./.github/workflows/test/script_platform_io.sh
33+
run: |
34+
platformio run
35+
platformio run -d ./test
3836
3937
linux-gcc7:
4038
runs-on: ubuntu-latest
4139

4240
steps:
4341
- uses: actions/checkout@v1
44-
- name: Install dependencies
42+
- name: Install Dependencies
4543
run: |
4644
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
4745
sudo apt-get update
4846
sudo apt-get -y install g++-7 gcc-7 lcov
4947
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
5048
sudo update-alternatives --config gcc
51-
- name: Make scripts executable
52-
run: sudo chmod -R +x ./.github/workflows/test/*.sh
5349
- name: Build
54-
run: ./.github/workflows/test/script_desktop.sh
55-
env:
56-
CC: gcc-7
57-
CXX: g++-7
50+
run: |
51+
mkdir build && cd build
52+
cmake -DCMAKE_BUILD_TYPE=Coverage -DUNIT_TEST=ON ..
53+
cmake --build .
54+
- name: Run Tests
55+
run: ./build/test/ark_cpp_crypto_tests
5856
- name: Codecov upload
5957
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
6058

@@ -63,7 +61,7 @@ jobs:
6361

6462
steps:
6563
- uses: actions/checkout@v1
66-
- name: Install dependencies
64+
- name: Install Dependencies
6765
run: |
6866
sudo apt-get update
6967
sudo apt install liblldb-5.0-dev python-lldb-5.0 lcov
@@ -75,33 +73,32 @@ jobs:
7573
- name: Make scripts executable
7674
run: sudo chmod -R +x ./.github/workflows/test/*.sh
7775
- name: Build
78-
run: ./.github/workflows/test/script_desktop.sh
79-
env:
80-
CC: clang-5.0
81-
CXX: clang++-5.0
76+
run: |
77+
mkdir build && cd build
78+
cmake -DUNIT_TEST=ON ..
79+
cmake --build .
80+
- name: Run Tests
81+
run: ./build/test/ark_cpp_crypto_tests
8282
- name: Clang Tidy
8383
run: ./.github/workflows/test/clang_tidy.sh
84-
env:
85-
CC: clang-5.0
86-
CXX: clang++-5.0
8784
- name: Clang Format
8885
run: ./.github/workflows/test/clang_format.sh
89-
env:
90-
CC: clang-5.0
91-
CXX: clang++-5.0
9286

9387
macOS:
9488
runs-on: macOS-latest
9589

9690
steps:
9791
- uses: actions/checkout@v1
9892
- run: COMPILER=clang++
99-
- name: Install dependencies
100-
run: brew install cmake lcov
101-
- name: Make scripts executable
102-
run: sudo chmod -R +x ./.github/workflows/test/*.sh
93+
- name: Install Dependencies
94+
run: brew install cmake
10395
- name: Build
104-
run: ./.github/workflows/test/script_desktop.sh
96+
run: |
97+
mkdir build && cd build
98+
cmake -DUNIT_TEST=ON ..
99+
cmake --build .
100+
- name: Run Tests
101+
run: ./build/test/ark_cpp_crypto_tests
105102

106103
windows:
107104
runs-on: windows-2016
@@ -113,12 +110,10 @@ jobs:
113110
- uses: actions/checkout@v1
114111
- name: Setup MSBuild.exe
115112
uses: warrenbuckley/Setup-MSBuild@v1
116-
- name: Install
117-
run: git submodule update --init --recursive
118113
- name: CMake
119-
run: cmake -G "Visual Studio 15 2017 Win64" .
114+
run: cmake -D UNIT_TEST=ON -G "Visual Studio 15 2017 Win64" .
120115
- name: Build Solution
121116
shell: cmd
122-
run: msbuild "%GITHUB_WORKSPACE%\Ark-Cpp-Crypto.sln"
123-
- name: Test
124-
run: call "%GITHUB_WORKSPACE%\test\Debug\Ark-Cpp-Crypto-tests"
117+
run: msbuild "%GITHUB_WORKSPACE%\ark_cpp_crypto.sln"
118+
- name: Run Tests
119+
run: call "%GITHUB_WORKSPACE%\test\Debug\ark_cpp_crypto_tests"

.github/workflows/test/clang_format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -ex
22

3-
grep -nr '\s$' src test examples .gitignore .gitmodules 2>&1 > /dev/null
3+
grep -nr '\s$' src test .gitignore 2>&1 > /dev/null
44
if $?; then
55
echo Trailing whitespace found, aborting
66
exit 1

.github/workflows/test/clang_tidy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# run clang tidy
4-
cmake -DENABLE_CLANG_TIDY=ON .
4+
cmake -DENABLE_CLANG_TIDY=ON -DUNIT_TEST=ON .
55
make tidy > output.txt
66
#if [[ -n $(grep "warning: " output.txt) ]] || [[ -n $(grep "error: " output.txt) ]]; then
77
# for now only fail the test on errors. Change this as project matures

.github/workflows/test/script_desktop.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/test/script_platform_io.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
/lib/
1414
/bin/
1515
build
16-
/src/Ark-Cpp-Crypto-lib.vcxproj.filters
17-
/src/Ark-Cpp-Crypto-lib.vcxproj
18-
/src/Ark-Cpp-Crypto-lib.sln
16+
/src/ark_cpp_crypto.vcxproj.filters
17+
/src/ark_cpp_crypto.vcxproj
18+
/src/ark_cpp_crypto.sln
1919
/src/ALL_BUILD.vcxproj.filters
2020
/src/ALL_BUILD.vcxproj
2121
/test/NightlyMemoryCheck.vcxproj.filters
@@ -26,17 +26,17 @@ build
2626
/test/Experimental.vcxproj
2727
/test/Continuous.vcxproj.filters
2828
/test/Continuous.vcxproj
29-
/test/Ark-Cpp-Crypto-tests.vcxproj.filters
30-
/test/Ark-Cpp-Crypto-tests.vcxproj
31-
/test/Ark-Cpp-Crypto-tests.sln
29+
/test/ark_cpp_crypto_tests.vcxproj.filters
30+
/test/ark_cpp_crypto_tests.vcxproj
31+
/test/ark_cpp_crypto_tests.sln
3232
/test/ALL_BUILD.vcxproj.filters
3333
/test/ALL_BUILD.vcxproj
3434
/test/INSTALL.vcxproj.filters
3535
/test/INSTALL.vcxproj
3636
/Win32
3737
/ZERO_CHECK.vcxproj.filters
3838
/ZERO_CHECK.vcxproj
39-
/Ark-Cpp-Crypto.sln
39+
/ark_cpp_crypto.sln
4040
/ALL_BUILD.vcxproj.filters
4141
/ALL_BUILD.vcxproj
4242
/src/INSTALL.vcxproj.filters

.gitmodules

Lines changed: 0 additions & 12 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2424
- improved PlatformIO configuration ([#101])
2525
- improved formatting and maintainability ([#98])
2626
- improved Slots implementations ([#92])
27+
- moved external libraries out of source tree ([#156])
2728

2829
### Fixed
2930
- fixed Transaction Json numeric serialization ([#103])
@@ -117,4 +118,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
117118
[#120]: https://github.com/ArkEcosystem/cpp-crypto/pull/120
118119
[#121]: https://github.com/ArkEcosystem/cpp-crypto/pull/121
119120
[#133]: https://github.com/ArkEcosystem/cpp-crypto/pull/133
121+
[#156]: https://github.com/ArkEcosystem/cpp-crypto/pull/156
120122
[Unreleased]: https://github.com/ArkEcosystem/cpp-crypto/compare/0.6.0...develop

CMakeLists.txt

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1+
12
cmake_minimum_required(VERSION 3.2)
2-
project(Ark-Cpp-Crypto)
3+
4+
project(ark_cpp_crypto)
5+
6+
# ------------------------------------------------------------------------------
7+
# Set the Environment Variables
8+
# ------------------------------------------------------------------------------
39

410
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
511
set(CMAKE_CXX_STANDARD 11)
612

713
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
14+
set(EXTERNAL_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/extern)
815

916
if (MSVC)
1017
add_definitions(
1118
-D_CRT_SECURE_NO_WARNINGS
1219
-D_SCL_SECURE_NO_WARNINGS
13-
-DNOMINMAX
14-
)
20+
-DNOMINMAX)
21+
1522
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
1623
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
1724
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
1825
else()
1926
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
2027
endif()
2128

22-
# clone submodules
23-
execute_process(
24-
COMMAND git submodule update --init --recursive
25-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
26-
)
29+
# ------------------------------------------------------------------------------
2730

2831
# ------------------------------------------------------------------------------
2932
# Clang Tidy
@@ -43,16 +46,35 @@ if(ENABLE_CLANG_TIDY)
4346

4447
list(APPEND RUN_CLANG_TIDY_BIN_ARGS
4548
-clang-tidy-binary ${CLANG_TIDY_BIN}
46-
-checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*
47-
)
48-
49-
add_custom_target(
50-
tidy
51-
COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
52-
COMMENT "running clang tidy"
53-
)
49+
-checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*)
50+
51+
add_custom_target(tidy
52+
COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
53+
COMMENT "running clang tidy")
5454
endif()
5555

56+
# ------------------------------------------------------------------------------
57+
58+
# ------------------------------------------------------------------------------
59+
# Add the ARK C++ Crypto Library Subdirectory
60+
# ------------------------------------------------------------------------------
61+
5662
add_subdirectory(src)
57-
add_subdirectory(test)
5863

64+
# ------------------------------------------------------------------------------
65+
66+
# ------------------------------------------------------------------------------
67+
# Add the ARK C++ Crypto Test Subdirectory
68+
#
69+
# Disabled by default.
70+
#
71+
# Use `cmake -DUNIT_TEST=ON .` to enable Test building.
72+
# ------------------------------------------------------------------------------
73+
74+
option(UNIT_TEST "Tests disabled by default" OFF)
75+
76+
if(UNIT_TEST)
77+
add_subdirectory(test)
78+
endif()
79+
80+
# ------------------------------------------------------------------------------

build.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
12
rmdir /S /Q build
23
mkdir build
34
cd build
5+
46
cmake ..
57
cmake --build .
8+
69
cd ..

0 commit comments

Comments
 (0)