Skip to content

Commit

Permalink
Fix check note and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmgarnier committed Dec 31, 2023
1 parent 1a9d71d commit 589c97c
Show file tree
Hide file tree
Showing 12 changed files with 333 additions and 179 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## New features

* Upgrade to OpenCV 4.9.0.
* Upgrade package to OpenCV 4.9.0.
* Remove support for R < 4.0.0.

## Minor improvements and fixes
Expand Down
8 changes: 4 additions & 4 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ defaultOpenCVPath <- function() {
config$os_type <- .Platform$OS.type

if (config$os_type == "windows") {
config$install_path <- shortPathName(install_path)
config$pkg_path <- shortPathName(find.package("ROpenCVLite"))
config$install_path <- utils::shortPathName(install_path)
config$pkg_path <- utils::shortPathName(find.package("ROpenCVLite"))
config$os <- gsub("\r", "", gsub("Caption=", "", system('wmic os get Caption,CSDVersion /value', intern = TRUE)[3]))
config$core <- paste0("https://github.com/opencv/opencv/archive/", version, ".tar.gz")
config$contrib <- paste0("https://github.com/opencv/opencv_contrib/archive/", version, ".tar.gz")
config$rtools_path <- shortPathName(pkgbuild::rtools_path()[1])
config$rtools_path <- utils::shortPathName(pkgbuild::rtools_path()[1])

if (is.null(config$rtools_path))
stop("Rtools is missing.")
Expand All @@ -49,7 +49,7 @@ defaultOpenCVPath <- function() {
stop("Unsupported Rtools version.")

if (config$rtools_version < "4.2") {
config$cmake_path <- shortPathName(system("where cmake.exe", intern = TRUE))
config$cmake_path <- utils::shortPathName(system("where cmake.exe", intern = TRUE))

if (length(config$cmake_path) > 1) {
v <- sapply(config$cmake_path, function(cmake) gsub("cmake version ", "", system(paste0(cmake, " --version"), intern = TRUE)[1]))
Expand Down
4 changes: 3 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

## R CMD check results

There were no ERRORs or WARNINGs.
* Version jumps in minor (submitted: 4.90.0, existing: 4.80.1)

This is normal. The package numbering scheme is based on the OpenCV version number.

## Downstream dependencies

Expand Down
191 changes: 129 additions & 62 deletions docs/articles/install.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/articles/usage.html

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

2 changes: 1 addition & 1 deletion docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pkgdown_sha: ~
articles:
install: install.html
usage: usage.html
last_built: 2023-12-30T19:46Z
last_built: 2023-12-31T07:35Z
urls:
reference: https://swarm-lab.github.io/ROpenCVLite/reference
article: https://swarm-lab.github.io/ROpenCVLite/articles
Expand Down
4 changes: 2 additions & 2 deletions vignettes/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# if (!require("installr"))
# install.packages("installr")
#
# installr::install.CMake()
# installr::install.Rtools()

## ----eval=FALSE---------------------------------------------------------------
# if (!require("installr"))
# install.packages("installr")
#
# installr::install.Rtools()
# installr::install.CMake()

## ----eval=FALSE---------------------------------------------------------------
# install.packages("devtools")
Expand Down
117 changes: 79 additions & 38 deletions vignettes/install.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Installing [`ROpenCVLite`](https://github.com/swarm-lab/ROpenCVLite) should go
smoothly on all major operating systems (Mac, Windows, and most major Linux
distributions). There are a few steps to follow before installing the package
itself in order to prepare all the necessary external (i.e. non-R) dependencies
for [`OpenCV`](https://opencv.org/).
for [`OpenCV`](https://opencv.org/). You should also make sure that your R
version is 4.0 or higher. Support for older versions of R has been removed.

All installation steps are described below.

Expand All @@ -31,79 +32,120 @@ All installation steps are described below.

### 1.1 - Windows

Before installing `ROpenCVLite`, you will need to install the latest versions of
[`CMake`](https://cmake.org/) and [`Rtools`](https://cran.r-project.org/bin/windows/Rtools/).
Before installing `ROpenCVLite`, you will need to install
[`Rtools`](https://cran.r-project.org/bin/windows/Rtools/) and
[`CMake`](https://cmake.org/).

#### 1.1.1 - Cmake
#### 1.1.1 - Rtools

+ **Option 1**
You will need to install the version of `Rtools` that corresponds to your version
of R. You can check your version of R by typing `R.version` in the R console.

Use the [`winget`](https://learn.microsoft.com/en-us/windows/package-manager/winget/)
utility to install `Cmake` from the terminal/PowerShell:
+ If your R version starts with 4.0 or 4.1, you will need to install `Rtools40`.
+ If your R version starts with 4.2, you will need to install `Rtools42`.
+ If your R version starts with 4.3 or 4.4 (devel), you will need to install `Rtools43`.

```{powershell eval=FALSE}
winget install cmake
```
There are multiple ways to install `Rtools` on Windows:

+ **Option 2**
##### **Option 1**

Use the convenience function provided by the `installr` library:

```{r eval=FALSE}
if (!require("installr"))
install.packages("installr")
installr::install.CMake()
installr::install.Rtools()
```

During the installation process, make sure to tell the installer to add `CMake`
to your "PATH".
*Note:* If you install `Rtools40`, make sure to tell the installer to add `Rtools`
to your "PATH" during the installation process. This is not required anymore
with `Rtools42` and `Rtools43`.

+ **Option 3**
##### **Option 2**

Download the `CMake` installer for Windows at
[https://cmake.org/download/](https://cmake.org/download/). Make sure to tell
the installer to add `CMake` to your "PATH".
If you have the [`rig`](https://github.com/r-lib/rig) utility installed on your
computer, you can install `Rtools` from a terminal running PowerShell:

#### 1.1.2 - Rtools
```{powershell eval=FALSE}
# For Rtools40
rig add rtools40
+ **Option 1**
# For Rtools42
rig add rtools42
# For Rtools43
rig add rtools43
```

Use the [`winget`](https://learn.microsoft.com/en-us/windows/package-manager/winget/)
utility to install `Cmake` from the terminal/PowerShell:
##### **Option 3**

If you have the [`winget`](https://learn.microsoft.com/en-us/windows/package-manager/)
utility installed on your computer, you can install `Rtools` from a terminal
running PowerShell:

```{powershell eval=FALSE}
winget install RProject.Rtools
```

+ **Option 2**
*Note:* Only `Rtools42` seems to be available through `winget` at the moment.

##### **Option 4**

You can manually download `Rtools` at
[https://cran.r-project.org/bin/windows/Rtools/](https://cran.r-project.org/bin/windows/Rtools/).

*Note:* If you install `Rtools40`, make sure to tell the installer to add `Rtools`
to your "PATH" during the installation process. This is not required anymore
with `Rtools42` and `Rtools43`.

#### 1.1.1 - Cmake

Installing `Cmake` is only required if your R version starts with 4.0 or 4.1 and,
therefore, you have installed `Rtools40`. For newer versions of R, `Cmake` is
included in `Rtools42` and `Rtools43` and you can skip this step.

Any version of `Cmake` 3.24 or higher should work. There are multiple ways to
install `Cmake` on Windows:

##### **Option 1**

Use the convenience function provided by the `installr` library:

```{r eval=FALSE}
if (!require("installr"))
install.packages("installr")
installr::install.Rtools()
installr::install.CMake()
```

During the installation process, make sure to tell the installer to add `Rtools`
During the installation process, make sure to tell the installer to add `CMake`
to your "PATH".

+ **Option 3**
##### **Option 2**

Download the latest "recommended" version of `Rtools` at
[https://cran.r-project.org/bin/windows/Rtools/](https://cran.r-project.org/bin/windows/Rtools/).
Make sure to tell the installer to add `Rtools` to your "PATH".
If you have the [`winget`](https://learn.microsoft.com/en-us/windows/package-manager/)
utility installed on your computer, you can install `Cmake` from a terminal
running PowerShell:

```{powershell eval=FALSE}
winget install cmake
```

##### **Option 3**

You can manually download the CMake` installer for Windows at
[https://cmake.org/download/](https://cmake.org/download/). Make sure to tell
the installer to add `CMake` to your "PATH" during the installation process.

---

### 1.2 - Mac

Before installing `ROpenCVLite`, you will need to install the latest version of
[`CMake`](https://cmake.org/).
[`CMake`](https://cmake.org/). There are multiple ways to install `Cmake` on Mac:

+ **Option 1**
##### **Option 1**

If you have [`homebrew`](https://brew.sh/) installed, run the following command
in your terminal:
Expand All @@ -112,7 +154,7 @@ in your terminal:
brew install cmake
```

+ **Option 2**
##### **Option 2**

If you have [`MacPorts`](https://www.macports.org/) installed, run the following
command in your terminal:
Expand All @@ -121,7 +163,7 @@ command in your terminal:
sudo port install cmake
```

+ **Option 3**
##### **Option 3**

Go to [https://cmake.org/download/](https://cmake.org/download/). Scroll down
until you reach the "Latest Release" section. Download the installer for Mac OS
Expand All @@ -145,14 +187,14 @@ Before installing `ROpenCVLite`, you will need to install the latest version of
+ **Option 1**

Use your distribution's package management system. For instance on Ubuntu-like
systems, you can install Cmake by typing the following command in your terminal:
systems, you can install `Cmake` by typing the following command in your terminal:

```bash
sudo apt install cmake
```

Other distributions will have different package managers. Refer to the
documentation of your distribution for finding the proper way to install Cmake
documentation of your distribution for finding the proper way to install `Cmake`
on your system.

+ **Option 2**
Expand Down Expand Up @@ -182,8 +224,7 @@ You can install `ROpenCVLite` from CRAN as follows:
install.packages("ROpenCVLite")
```

Or you can install the latest latest development version (not recommended) as
follows:
Or you can install the latest development version (not recommended) as follows:

```{r eval=FALSE}
devtools::install_github("swarm-lab/ROpenCVLite")
Expand All @@ -206,5 +247,5 @@ as follows:
ROpenCVLite::installOpenCV()
```

`ROpenCVLite` will also automatically detect when a new version of OpenCV is
`ROpenCVLite` will also automatically detect when a new version of `OpenCV` is
available and will offer to update it for you.
Loading

0 comments on commit 589c97c

Please sign in to comment.