Page MenuHomePhorge

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/.gitignore b/.gitignore
index b0f4d82..7a7fb23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,13 @@
/target
Cargo.lock
python/__pycache__
python/tests/__pycache__
javascript/node_modules
javascript/yarn-error.log
javascript/yarn.lock
cpp/account-test
cpp/session-test
cpp/sas-test
cpp/group-session-test
+cpp/objects
.ccls-cache
diff --git a/cpp/Makefile b/cpp/Makefile
index 9987f50..9f4c93b 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -1,64 +1,54 @@
+all: rust-lib dynamic-lib
+
+.PHONY: all rust-lib dynamic-lib test
+
+BUILD_TYPE := debug
+ifeq ($(BUILD_TYPE), release)
+CARGO_ARGS = --release
+else
+CARGO_ARGS =
+endif
+VERSION = 0.1.0
+SOVERSION = 1
+AR = ar
+CXX = c++
+LN = ln
+
rust-lib:
- cargo build
+ cargo build $(CARGO_ARGS)
+
+dynamic-lib: rust-lib
+ rm -rf objects && \
+ mkdir objects && \
+ cd objects && \
+ $(AR) x ../../target/$(BUILD_TYPE)/libvodozemac.a && \
+ $(CXX) *.o -shared -o ../../target/$(BUILD_TYPE)/libvodozemac.so.$(VERSION) && \
+ $(LN) -sfv libvodozemac.so.$(VERSION) ../../target/$(BUILD_TYPE)/libvodozemac.so.$(SOVERSION) && \
+ $(LN) -sfv libvodozemac.so.$(SOVERSION) ../../target/$(BUILD_TYPE)/libvodozemac.so
+
+TEST_CXXFLAGS = -Wall -g -pthread -std=c++17 -lgtest_main \
+ -lgtest -lolm -lboost_json -lpthread -I ../target/cxxbridge \
+ -L ../target/$(BUILD_TYPE)/ -l vodozemac -ldl -Wl,-rpath,../target/$(BUILD_TYPE)
-account-test: rust-lib tests/account.cpp
- g++ \
- -Wall -g \
- -pthread -std=c++17 \
- tests/account.cpp \
- -lgtest_main -lgtest \
- -lolm -lboost_json \
- -lpthread \
- -I ../target/cxxbridge \
- -L ../target/debug/ \
- -l vodozemac \
- -ldl \
- -o account-test
+account-test: dynamic-lib tests/account.cpp
+ $(CXX) $(TEST_CXXFLAGS) \
+ tests/account.cpp -o account-test
-session-test: rust-lib tests/session.cpp
- g++ \
- -Wall -g \
- -pthread -std=c++17 \
- tests/session.cpp \
- -lgtest_main -lgtest \
- -lolm -lboost_json \
- -lpthread \
- -I ../target/cxxbridge \
- -L ../target/debug/ \
- -l vodozemac \
- -ldl \
- -o session-test
+session-test: dynamic-lib tests/session.cpp
+ $(CXX) $(TEST_CXXFLAGS) \
+ tests/session.cpp -o session-test
-sas-test: rust-lib tests/sas.cpp
- g++ \
- -Wall -g \
- -pthread -std=c++17 \
- tests/sas.cpp \
- -lgtest_main -lgtest \
- -lpthread \
- -I ../target/cxxbridge \
- -L ../target/debug/ \
- -l vodozemac \
- -ldl \
- -o sas-test
+sas-test: dynamic-lib tests/sas.cpp
+ $(CXX) $(TEST_CXXFLAGS) \
+ tests/sas.cpp -o sas-test
-group-session-test: rust-lib tests/group_session.cpp
- g++ \
- -Wall -g \
- -pthread -std=c++17 \
- tests/group_session.cpp \
- -lgtest_main -lgtest \
- -lolm -lboost_json \
- -lpthread \
- -I ../target/cxxbridge \
- -L ../target/debug/ \
- -l vodozemac \
- -ldl \
- -o group-session-test
+group-session-test: dynamic-lib tests/group_session.cpp
+ $(CXX) $(TEST_CXXFLAGS) \
+ tests/group_session.cpp -o group-session-test
test: account-test session-test sas-test group-session-test
./account-test --gtest_color=yes
./session-test --gtest_color=yes
./sas-test --gtest_color=yes
./group-session-test --gtest_color=yes

File Metadata

Mime Type
text/x-diff
Expires
Thu, Oct 8, 8:22 PM (11 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1783349
Default Alt Text
(3 KB)

Event Timeline