File tree 5 files changed +102
-21
lines changed
5 files changed +102
-21
lines changed Original file line number Diff line number Diff line change 40
40
cp ./LICENSE build
41
41
cp ./CHANGELOG.md build
42
42
cd build
43
+ install_name_tool -id @rpath/libplay_cpp_sdk.dylib ./lib/libplay_cpp_sdk.dylib
44
+ otool -L ./lib/libplay_cpp_sdk.dylib
43
45
tar zcvf ../play_cpp_sdk_${PLATFORM}.tar.gz *
44
46
cd ..
45
47
shasum -a 256 *.tar.gz > "checksums-$PLATFORM.txt"
Original file line number Diff line number Diff line change
1
+ name : Mac Build Test CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - release/**
8
+ paths-ignore :
9
+ - README.md
10
+ tags :
11
+ - " v*.*.*"
12
+ pull_request :
13
+ paths-ignore :
14
+ - README.md
15
+
16
+ jobs :
17
+ mac-test :
18
+ runs-on : macos-11
19
+ steps :
20
+ - uses : actions/checkout@v2
21
+ with :
22
+ submodules : recursive
23
+
24
+ - name : Add target x86_64-apple-darwin
25
+ run : rustup target add x86_64-apple-darwin
26
+
27
+ - name : Build play-cpp-sdk library
28
+ run : ./checkmac.sh && cargo build --package play-cpp-sdk --release --target x86_64-apple-darwin
29
+
30
+ - name : Build demo project
31
+ working-directory : demo
32
+ run : make x86_64_build_test
33
+
34
+
Original file line number Diff line number Diff line change @@ -54,14 +54,9 @@ The following build events are included in the project file:
54
54
git clone https://github.com/crypto-com/play-cpp-sdk.git
55
55
` ` `
56
56
2. Unzip the archive file into ` demo` folder
57
- 3. Copy the dynamic library to ` /usr/local/lib`
58
- ` ` ` sh
59
- cd demo
60
- cp lib/libplay_cpp_sdk.dylib /usr/local/lib
61
- ` ` `
62
- 4. Under ` demo` folder and build the ` demo` project
57
+ 3. Under ` demo` folder and build the ` demo` project
63
58
` ` ` sh
64
- make
59
+ make x86_64_build
65
60
` ` `
66
61
67
62
# ## Linux
Original file line number Diff line number Diff line change @@ -53,9 +53,17 @@ dynamic: easywsclient.o
53
53
$(FLAGS ) \
54
54
-L lib \
55
55
56
- x86_64_build : prepare_x86_64 easywsclient.o.x86_64
56
+ # test whether dylib loading correctly
57
+ x86_64_test_dylib :
58
+ ./demo test
59
+
60
+ x86_64_build : x86_64_build_static x86_64_build_dynamic
61
+
62
+ x86_64_build_test :x86_64_build_dynamic x86_64_test_dylib
63
+
64
+ x86_64_build_static : prepare_x86_64 easywsclient.o.x86_64
57
65
arch -x86_64 \
58
- g++ -o demo \
66
+ g++ -o demostatic \
59
67
easywsclient.o \
60
68
main.cc \
61
69
chainmain.cc \
@@ -65,6 +73,35 @@ x86_64_build: prepare_x86_64 easywsclient.o.x86_64
65
73
-std=c++14 \
66
74
$(FLAGS )
67
75
76
+ # use -rpath option to add the path to the dynamic library loading path
77
+ # -rpath lib in gcc or
78
+ # install_name_tool -add_rpath @executable_path/lib ./demo
79
+ # in mac, to use DYLD_LIBRARY_PATH, it is normalized to use $rpath in dylib
80
+ x86_64_build_dynamic : prepare_x86_64 easywsclient.o.x86_64
81
+ install_name_tool -id @rpath/libplay_cpp_sdk.dylib ./lib/libplay_cpp_sdk.dylib
82
+ otool -L ./lib/libplay_cpp_sdk.dylib
83
+ arch -x86_64 \
84
+ g++ -o demo \
85
+ easywsclient.o \
86
+ main.cc \
87
+ chainmain.cc \
88
+ cronos.cc \
89
+ extra.cc \
90
+ ./include/walletconnectcallback.cc \
91
+ ./include/nft.cc \
92
+ ./include/pay.cc \
93
+ ./include/defi-wallet-core-cpp/src/contract.rs.cc \
94
+ ./include/defi-wallet-core-cpp/src/core.cc \
95
+ ./include/defi-wallet-core-cpp/src/nft.rs.cc \
96
+ ./include/defi-wallet-core-cpp/src/uint.rs.cc \
97
+ ./include/extra-cpp-bindings/src/lib.rs.cc \
98
+ lib/libplay_cpp_sdk.dylib \
99
+ lib/libcxxbridge1.a \
100
+ -std=c++14 \
101
+ -rpath lib \
102
+ $(FLAGS )
103
+
104
+
68
105
run_static :
69
106
. ./.env && ./demostatic
70
107
Original file line number Diff line number Diff line change 17
17
#include < thread>
18
18
19
19
int main (int argc, char *argv[]) {
20
- try {
21
- chainmain_process (); // chain-main
22
- test_chainmain_nft (); // chainmain nft tests
23
- test_login (); // decentralized login
24
- cronos_process (); // cronos
25
- test_cronos_testnet (); // cronos testnet
26
- } catch (const rust::cxxbridge1::Error &e) {
27
- // Use `Assertion failed`, the same as `assert` function
20
+ if (argc >= 2 ) {
21
+ if (" test" == std::string (argv[1 ])) {
22
+ // check wheter calling works
23
+ try {
24
+ test_login ();
25
+ std::cout<<" OK" <<std::endl;
26
+ } catch (const std::exception &e) {
28
27
std::cout << " Assertion failed: " << e.what () << std::endl;
28
+ }
29
+ return 0 ;
29
30
}
31
+ }
30
32
31
- test_interval ();
33
+ try {
34
+ chainmain_process (); // chain-main
35
+ test_chainmain_nft (); // chainmain nft tests
36
+ test_login (); // decentralized login
37
+ cronos_process (); // cronos
38
+ test_cronos_testnet (); // cronos testnet
39
+ } catch (const rust::cxxbridge1::Error &e) {
40
+ // Use `Assertion failed`, the same as `assert` function
41
+ std::cout << " Assertion failed: " << e.what () << std::endl;
42
+ }
32
43
33
- test_blackscout_cronoscan ();
34
- test_wallet_connect ();
44
+ test_interval ();
35
45
36
- return 0 ;
46
+ test_blackscout_cronoscan ();
47
+ test_wallet_connect ();
48
+
49
+ return 0 ;
37
50
}
You can’t perform that action at this time.
0 commit comments