Skip to content

Commit

Permalink
try and update the makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jul 19, 2024
1 parent ab4ee9b commit 6b6cf71
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 6 deletions.
71 changes: 71 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions bindings_ffi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bindings_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ crate-type = ["lib", "cdylib", "staticlib"]
env_logger = "0.11.3"
futures = "0.3.28"
log = { version = "0.4", features = ["std"] }
rusqlite = { version = "0.31.0", features = ["bundled"] }
thiserror = "1.0"
thread-id = "4.2.1"
tokio = { version = "1.28.1", features = ["macros"] }
Expand Down
20 changes: 14 additions & 6 deletions bindings_ffi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PROJECT_NAME = xmtpv3
# Simulator config
ARCHS_IOS = x86_64-apple-ios aarch64-apple-ios-sim
ARCHS_MAC = x86_64-apple-darwin aarch64-apple-darwin
# Not used
# ARCHS_MACCATALYST = x86_64-apple-ios-macabi aarch64-apple-ios-macabi
LIB=libxmtpv3.a
JAR_DIR=$(shell pwd)/tests/jar
SQLCIPHER_DIR=$(shell pwd)/sqlcipher
SQLCIPHER_LIB=$(SQLCIPHER_DIR)/.libs/libsqlcipher.a
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT_HASH=$(shell git log -1 --pretty=format:"%h")
GIT_COMMIT_DATE=$(shell TZ=UTC git log -1 --date=iso-local --pretty=format:"%ad")
Expand All @@ -28,22 +28,30 @@ download-toolchains:
rustup target add $(ARCHS_MAC)
rustup target add aarch64-apple-ios

download-sqlcipher:
git clone https://github.com/sqlcipher/sqlcipher.git $(SQLCIPHER_DIR)

build-sqlcipher:
cd $(SQLCIPHER_DIR) && \
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" && \
make

all: framework

libxmtp-version:
echo "Version: $(GIT_COMMIT_HASH)\nBranch: $(GIT_BRANCH)\nDate: $(GIT_COMMIT_DATE)" > libxmtp-version.txt

$(ARCHS_IOS): %:
$(ARCHS_IOS): %: build-sqlcipher
cross build --target $@ --target-dir ./target --release --no-default-features
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)

$(ARCHS_MAC): %:
$(ARCHS_MAC): %: build-sqlcipher
cross build --target $@ --target-dir ./target --release --no-default-features
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)

aarch64-apple-ios:
aarch64-apple-ios: build-sqlcipher
cross build --target $@ --target-dir ./target --release
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)
Expand Down Expand Up @@ -85,4 +93,4 @@ swift: libxmtp-version

swiftlocal: libxmtpv3.a swift framework

.PHONY: $(ARCHS_IOS) $(ARCHS_MAC) framework all aarch64-apple-ios install-jar echo-jar download-toolchains swift lipo
.PHONY: $(ARCHS_IOS) $(ARCHS_MAC) framework all aarch64-apple-ios install-jar echo-jar download-toolchains swift lipo download-sqlcipher build-sqlcipher
Loading

0 comments on commit 6b6cf71

Please sign in to comment.