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

fix: support Rust 1.65 #280

Merged
merged 10 commits into from
Jul 2, 2023
Merged
1 change: 1 addition & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
shell: bash
run: |
echo "RPOLARS_ALL_FEATURES=true" >>$GITHUB_ENV
echo "RPOLARS_PROFILE=release-optimized" >>$GITHUB_ENV

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

env:
RPOLARS_ALL_FEATURES: "true"
RPOLARS_PROFILE: release-optimized

jobs:
documentation:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrency:

env:
RPOLARS_ALL_FEATURES: "true"
RPOLARS_PROFILE: release-optimized

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ requirements-rs:
.PHONY: build
build: ## Compile polars R package with all features and generate Rd files
export RPOLARS_ALL_FEATURES=true \
&& export RPOLARS_PROFILE=release-optimized \
&& Rscript -e 'if (!(require(arrow)&&require(nanoarrow))) warning("could not load arrow/nanoarrow, igonore changes to nanoarrow.Rd"); rextendr::document()'

.PHONY: all
Expand Down
11 changes: 6 additions & 5 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
BUILD_COMMAND = cargo build --lib --release --manifest-path="$(RPOLARS_RUST_SOURCE)/Cargo.toml"
BUILD_COMMAND = cargo build --lib --profile $(RPOLARS_PROFILE) --manifest-path="$(RPOLARS_RUST_SOURCE)/Cargo.toml"
RPOLARS_PROFILE ?= release

LIBDIR = ./rust/target/release
LIBDIR = ./rust/target/$(RPOLARS_PROFILE)
STATLIB = $(LIBDIR)/libr_polars.a
PKG_LIBS = -L$(LIBDIR) -lr_polars
RPOLARS_RUST_SOURCE ?= ./rust
RPOLARS_CARGO_CLEAN_DEPS ?= nope
rpolars_ext_binary = "$(RPOLARS_RUST_SOURCE)/target/release/libr_polars.a"
rpolars_ext_binary = "$(RPOLARS_RUST_SOURCE)/target/$(RPOLARS_PROFILE)/libr_polars.a"

all: C_clean

Expand All @@ -21,9 +22,9 @@ $(STATLIB):
echo "file is there: "; \
else \
echo "no, file is NOT there: "; \
mkdir -p ./rust/target/release ; \
mkdir -p ./rust/target/$(RPOLARS_PROFILE) ; \
echo "trying to symlink in $(rpolars_ext_binary)"; \
ln -s $(rpolars_ext_binary) ./rust/target/release/libr_polars.a ; \
ln -s $(rpolars_ext_binary) ./rust/target/$(RPOLARS_PROFILE)/libr_polars.a ; \
fi

if [ "${RPOLARS_CARGO_CLEAN_DEPS}" == "true" ]; then \
Expand Down
7 changes: 4 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
BUILD_COMMAND = cargo build --target=$(TARGET) --lib --release --manifest-path="$(RPOLARS_RUST_SOURCE)/Cargo.toml"
BUILD_COMMAND = cargo build --target=$(TARGET) --lib --profile $(RPOLARS_PROFILE) --manifest-path="$(RPOLARS_RUST_SOURCE)/Cargo.toml"
RPOLARS_PROFILE ?= release

TARGET_DIR = ./rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
LIBDIR = $(TARGET_DIR)/$(TARGET)/$(RPOLARS_PROFILE)
STATLIB = $(LIBDIR)/libr_polars.a
PKG_LIBS = -L$(LIBDIR) -lr_polars -lws2_32 -ladvapi32 -luserenv -lbcrypt -lole32 -lntdll -lpsapi -liphlpapi -lpdh -lpowrprof -loleaut32 -lnetapi32 -lsecur32 -t
RPOLARS_RUST_SOURCE ?= ./rust
RPOLARS_CARGO_CLEAN_DEPS ?= nope
rpolars_ext_binary = "$(RPOLARS_RUST_SOURCE)/target/$(TARGET)/release/libr_polars.a"
rpolars_ext_binary = "$(RPOLARS_RUST_SOURCE)/target/$(TARGET)/$(RPOLARS_PROFILE)/libr_polars.a"

all: C_clean

Expand Down
19 changes: 12 additions & 7 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = 'r-polars' # r-polars
version = '0.1.0' # this version no is not used
name = 'r-polars' # r-polars
version = '0.1.0' # this version no is not used
edition = '2021'
rust-version = "1.66"
rust-version = "1.65"

[lib]
crate-type = ['staticlib']
Expand All @@ -19,11 +19,19 @@ mimalloc = { version = "0.1.34", default-features = false }
[target.'cfg(all(target_os = "linux", not(use_mimalloc)))'.dependencies]
jemallocator = { version = "0.5.0", features = ["disable_initial_exec_tls"] }


# use opt-level = 1 for argminmax package unless profile is profile.release-optimized for to support Rust < 1.66
[profile.release-optimized]
inherits = "release"
[profile.release.package.argminmax]
opt-level = 1
[profile.release-optimized.package.argminmax]
opt-level = 3

[dependencies]
extendr-api = { git = "https://github.com/rpolars/extendr", branch = "pr473_553_555_566", default-features = false, features = [
"result_list",
] }
#extendr-api = {path = "../../../extendr/extendr-api", default-features = false, features= ["result_list"]}

flume = "0.10.14"
state = "0.5.3"
Expand All @@ -35,9 +43,6 @@ indenter = "0.3.3"
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "e973f6386a28f16136fb8ba5a737103f95911861", default_features = false }


#try to trigger new hashFiles hash value


#features copied from node-polars
[dependencies.polars]
features = [
Expand Down