-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bf93513
Showing
26 changed files
with
964 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
^rinfa\.Rproj$ | ||
^\.Rproj\.user$ | ||
^LICENSE\.md$ | ||
^README\.Rmd$ | ||
^cran-comments\.md$ | ||
^src/\.cargo$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
.Rdata | ||
.httr-oauth | ||
.DS_Store | ||
.quarto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Package: rinfa | ||
Title: Rust bindings for tidymodels | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person("Simon", "Couch", , "[email protected]", role = c("aut", "cre")) | ||
Description: Rust bindings for tidymodels | ||
License: MIT + file LICENSE | ||
Suggests: | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1 | ||
Config/rextendr/version: 0.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2024 | ||
COPYRIGHT HOLDER: rinfa authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2024 rinfa authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(fit_linear_reg_linfa) | ||
export(hello_world) | ||
export(predict_linear_reg_linfa) | ||
useDynLib(rinfa, .registration = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by extendr: Do not edit by hand | ||
|
||
# nolint start | ||
|
||
# | ||
# This file was created with the following call: | ||
# .Call("wrap__make_rinfa_wrappers", use_symbols = TRUE, package_name = "rinfa") | ||
|
||
#' @docType package | ||
#' @usage NULL | ||
#' @useDynLib rinfa, .registration = TRUE | ||
NULL | ||
|
||
#' Fit a linear regression model and return a pointer to it. | ||
#' @export | ||
fit_linear_reg_linfa <- function() .Call(wrap__fit_linear_reg_linfa) | ||
|
||
#' Given a pointer to a model and data, return predictions from the model. | ||
#' @export | ||
predict_linear_reg_linfa <- function(pointer) .Call(wrap__predict_linear_reg_linfa, pointer) | ||
|
||
#' Return string `"Hello world!"` to R. | ||
#' @export | ||
hello_world <- function() .Call(wrap__hello_world) | ||
|
||
|
||
# nolint end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
output: github_document | ||
--- | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
fig.path = "man/figures/README-", | ||
out.width = "100%" | ||
) | ||
``` | ||
|
||
# rinfa | ||
|
||
<!-- badges: start --> | ||
[](https://lifecycle.r-lib.org/articles/stages.html#experimental) | ||
[](https://CRAN.R-project.org/package=rinfa) | ||
<!-- badges: end --> | ||
|
||
The goal of rinfa is to provide Rust bindings for parsnip model specifications. | ||
|
||
## Installation | ||
|
||
You can install the development version of rinfa from [GitHub](https://github.com/) with: | ||
|
||
``` r | ||
# install.packages("devtools") | ||
devtools::install_github("simonpcouch/rinfa") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
# rinfa | ||
|
||
<!-- badges: start --> | ||
|
||
[](https://lifecycle.r-lib.org/articles/stages.html#experimental) | ||
[](https://CRAN.R-project.org/package=rinfa) | ||
<!-- badges: end --> | ||
|
||
The goal of rinfa is to provide Rust bindings for parsnip model | ||
specifications. | ||
|
||
## Installation | ||
|
||
You can install the development version of rinfa from | ||
[GitHub](https://github.com/) with: | ||
|
||
``` r | ||
# install.packages("devtools") | ||
devtools::install_github("simonpcouch/rinfa") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## R CMD check results | ||
|
||
0 errors | 0 warnings | 1 note | ||
|
||
* This is a new release. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
LineEndingConversion: Posix | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.o | ||
*.so | ||
*.dll | ||
target | ||
.cargo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
TARGET_DIR = ./rust/target | ||
LIBDIR = $(TARGET_DIR)/release | ||
STATLIB = $(LIBDIR)/librinfa.a | ||
PKG_LIBS = -L$(LIBDIR) -lrinfa | ||
|
||
all: C_clean | ||
|
||
$(SHLIB): $(STATLIB) | ||
|
||
CARGOTMP = $(CURDIR)/.cargo | ||
|
||
$(STATLIB): | ||
# In some environments, ~/.cargo/bin might not be included in PATH, so we need | ||
# to set it here to ensure cargo can be invoked. It is appended to PATH and | ||
# therefore is only used if cargo is absent from the user's PATH. | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
export CARGO_HOME=$(CARGOTMP); \ | ||
fi && \ | ||
export PATH="$(PATH):$(HOME)/.cargo/bin" && \ | ||
cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
rm -Rf $(CARGOTMP) && \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
fi | ||
|
||
C_clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
|
||
clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Rtools42 doesn't have the linker in the location that cargo expects, so we | ||
# need to overwrite it via configuration. | ||
CARGO_LINKER = x86_64-w64-mingw32.static.posix-gcc.exe | ||
|
||
include Makevars.win |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu | ||
|
||
TARGET_DIR = ./rust/target | ||
LIBDIR = $(TARGET_DIR)/$(TARGET)/release | ||
STATLIB = $(LIBDIR)/librinfa.a | ||
PKG_LIBS = -L$(LIBDIR) -lrinfa -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll | ||
|
||
all: C_clean | ||
|
||
$(SHLIB): $(STATLIB) | ||
|
||
CARGOTMP = $(CURDIR)/.cargo | ||
|
||
$(STATLIB): | ||
mkdir -p $(TARGET_DIR)/libgcc_mock | ||
# `rustc` adds `-lgcc_eh` flags to the compiler, but Rtools' GCC doesn't have | ||
# `libgcc_eh` due to the compilation settings. So, in order to please the | ||
# compiler, we need to add empty `libgcc_eh` to the library search paths. | ||
# | ||
# For more details, please refer to | ||
# https://github.com/r-windows/rtools-packages/blob/2407b23f1e0925bbb20a4162c963600105236318/mingw-w64-gcc/PKGBUILD#L313-L316 | ||
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a | ||
|
||
# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2 | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
export CARGO_HOME=$(CARGOTMP); \ | ||
fi && \ | ||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ | ||
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ | ||
cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
rm -Rf $(CARGOTMP) && \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
fi | ||
|
||
C_clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
|
||
clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// We need to forward routine registration from C to Rust | ||
// to avoid the linker removing the static library. | ||
|
||
void R_init_rinfa_extendr(void *dll); | ||
|
||
void R_init_rinfa(void *dll) { | ||
R_init_rinfa_extendr(dll); | ||
} |
Oops, something went wrong.