Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ROpenCVLite
Type: Package
Title: Helper Package for Installing OpenCV with R
Version: 4.90.2
Date: 2024-08-01
Version: 4.110.0
Date: 2025-05-01
Authors@R: c(
person("Simon", "Garnier", email = "garnier@njit.edu", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-3886-3974")),
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ROpenCVLite 4.110.0

## New features

* Upgrades package to OpenCV 4.11.0.

## Minor improvements and fixes

* Fixes issue with CMake 4.

---

# ROpenCVLite 4.90.2

## New features
Expand Down
95 changes: 56 additions & 39 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#'
#' @examples
#' \dontrun{
#' defaultOpenCVPath()
#' defaultOpenCVPath()
#' }
#'
#' @export
Expand All @@ -23,15 +23,16 @@ defaultOpenCVPath <- function() {
config <- list()

config$arch <- unname(Sys.info()["machine"])
if (!grepl("64", config$arch))
if (!grepl("64", config$arch)) {
stop("Unsupported CPU architecture.")
}

config$os_type <- .Platform$OS.type

if (config$os_type == "windows") {
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$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")
rtools <- .findRtools()
Expand Down Expand Up @@ -94,34 +95,36 @@ defaultOpenCVPath <- function() {
paste0(
'"', config$cmake_path, '"',
' -G "Unix Makefiles"',
' -Wno-dev',
" -Wno-dev",
' -DCMAKE_C_COMPILER="', config$gcc_path, '"',
' -DCMAKE_CXX_COMPILER="', config$gpp_path, '"',
switch(config$os_type,
windows = paste0(' -DCMAKE_RC_COMPILER="', config$windres_path, '"',
' -DOpenCV_ARCH=x64',
' -DOpenCV_RUNTIME=mingw',
' -DBUILD_SHARED_LIBS=ON',
' -DCPU_DISPATCH=SSE4_1,SSE4_2,FP16,AV')
windows = paste0(
' -DCMAKE_RC_COMPILER="', config$windres_path, '"',
" -DOpenCV_ARCH=x64",
" -DOpenCV_RUNTIME=mingw",
" -DBUILD_SHARED_LIBS=ON",
" -DCPU_DISPATCH=SSE4_1,SSE4_2,FP16,AV"
)
),
' -DCMAKE_MAKE_PROGRAM="', config$make_path, '"',
' -DCMAKE_CXX_STANDARD=11',
' -DENABLE_PRECOMPILED_HEADERS=OFF',
' -DOPENCV_EXTRA_MODULES_PATH=', config$contrib_dir,
' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc,wechat_qrcode',
' -DOPENCV_GENERATE_PKGCONFIG=ON',
' -DWITH_OPENMP=ON',
' -DWITH_TBB=ON',
' -DWITH_EIGEN=ON',
' -DWITH_LAPACK=ON',
' -DBUILD_opencv_world=OFF',
' -DBUILD_opencv_contrib_world=OFF',
' -DBUILD_PERF_TESTS=OFF',
' -DBUILD_TESTS=OFF',
" -DCMAKE_CXX_STANDARD=11",
" -DENABLE_PRECOMPILED_HEADERS=OFF",
" -DOPENCV_EXTRA_MODULES_PATH=", config$contrib_dir,
" -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc,wechat_qrcode",
" -DOPENCV_GENERATE_PKGCONFIG=ON",
" -DWITH_OPENMP=ON",
" -DWITH_TBB=ON",
" -DWITH_EIGEN=ON",
" -DWITH_LAPACK=ON",
" -DBUILD_opencv_world=OFF",
" -DBUILD_opencv_contrib_world=OFF",
" -DBUILD_PERF_TESTS=OFF",
" -DBUILD_TESTS=OFF",
' -DCMAKE_C_FLAGS_RELEASE="-fstack-protector-strong"',
' -DCMAKE_CXX_FLAGS_RELEASE="-fstack-protector-strong"',
' -DINSTALL_CREATE_DISTRIB=ON',
' -DCMAKE_BUILD_TYPE=RELEASE',
" -DINSTALL_CREATE_DISTRIB=ON",
" -DCMAKE_BUILD_TYPE=RELEASE",
' -DCMAKE_INSTALL_PREFIX="', config$install_path, '"',
' -B"', config$build_dir, '"',
' -H"', config$source_dir, '"'
Expand Down Expand Up @@ -149,15 +152,13 @@ defaultOpenCVPath <- function() {
#'
#' @examples
#' \dontrun{
#' installOpenCV()
#' installOpenCV()
#' }
#'
#' @export
installOpenCV <- function(install_path = defaultOpenCVPath(), batch = FALSE) {
install <- 0
pkg_version <- paste0(
strsplit(as.character(utils::packageVersion("ROpenCVLite")), "")[[1]][c(1, 3, 4)],
collapse = ".")
pkg_version <- "4.11.0"

if (interactive()) {
if (isOpenCVInstalled()) {
Expand All @@ -166,16 +167,19 @@ installOpenCV <- function(install_path = defaultOpenCVPath(), batch = FALSE) {
if (pkg_version == cv_version) {
install <- utils::menu(
c("yes", "no"),
title = "OpenCV is already installed on this system. Would you like to reinstall it now? This will take several minutes.")
title = "OpenCV is already installed on this system. Would you like to reinstall it now? This will take several minutes."
)
} else {
install <- utils::menu(
c("yes", "no"),
title = "A new version of OpenCV is available. Would you like to install it now? This will take several minutes.")
title = "A new version of OpenCV is available. Would you like to install it now? This will take several minutes."
)
}
} else {
install <- utils::menu(
c("yes", "no"),
title = "OpenCV is not installed on this system. Would you like to install it now? This will take several minutes.")
title = "OpenCV is not installed on this system. Would you like to install it now? This will take several minutes."
)
}
} else {
if (batch) {
Expand All @@ -186,8 +190,9 @@ installOpenCV <- function(install_path = defaultOpenCVPath(), batch = FALSE) {
}
}

if (!isCmakeInstalled())
if (!isCmakeInstalled()) {
install <- 0
}

if (install == 1) {
config <- .configure(normalizePath(install_path, mustWork = FALSE), pkg_version)
Expand Down Expand Up @@ -225,15 +230,26 @@ installOpenCV <- function(install_path = defaultOpenCVPath(), batch = FALSE) {
insert <- c(
'# set CMAKE_INSTALL_NAME_DIR if CMAKE_INSTALL_PREFIX isn\'t default value of "/usr/local"',
'if(UNIX AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")',
' set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)',
" set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)",
'# message ("setting CMAKE_INSTALL_NAME_DIR: ${CMAKE_INSTALL_NAME_DIR}")',
'endif()',
''
"endif()",
""
)
writeLines(
c(tmp[1:ix], insert, tmp[(ix + 1):length(tmp)]),
paste0(config$source_dir, "cmake/OpenCVModule.cmake")
)
writeLines(c(tmp[1:ix], insert, tmp[(ix + 1):length(tmp)]),
paste0(config$source_dir, "cmake/OpenCVModule.cmake"))
}

# To be removed once the CMake 4 issue is resolved in the next OpenCV release
tmp <- readLines(paste0(config$source_dir, "cmake/OpenCVGenPkgconfig.cmake"))
ix <- which(grepl("cmake_minimum_required", tmp))
insert <- "cmake_minimum_required(VERSION 3.5)"
writeLines(
c(tmp[1:(ix - 1)], insert, tmp[(ix + 1):length(tmp)]),
paste0(config$source_dir, "cmake/OpenCVGenPkgconfig.cmake")
)

dir.create(config$build_dir, showWarnings = FALSE)
system(.cmake(config))
system(paste0(config$make_path, " -j", parallel::detectCores(), " -C ", config$build_dir))
Expand All @@ -257,15 +273,16 @@ installOpenCV <- function(install_path = defaultOpenCVPath(), batch = FALSE) {
#'
#' @examples
#' \dontrun{
#' installOpenCV()
#' installOpenCV()
#' }
#'
#' @export
removeOpenCV <- function() {
if (isOpenCVInstalled()) {
uninstall <- utils::menu(
c("yes", "no"),
title = "Would you like to completely remove OpenCV from your R installation? You can reinstall it at any time by using the installOpenCV() function.")
title = "Would you like to completely remove OpenCV from your R installation? You can reinstall it at any time by using the installOpenCV() function."
)
print(uninstall)

if (uninstall == 1) {
Expand Down
11 changes: 3 additions & 8 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
## Test environments

* local M1 OS X 14.5, R 4.0.5, 4.1.3, 4.2.3, 4.3.2, 4.4.1, R devel
* local Windows 10, R 4.0.5, 4.1.3, 4.2.3, 4.3.2, 4.4.1, R devel
* local Windows 11, R 4.0.5, 4.1.3, 4.2.3, 4.3.2, 4.4.1, R devel
* local Ubuntu 24.04, R 4.0.5, 4.1.3, 4.2.3, 4.3.2, 4.4.1, R devel
* local M4 OS X 14.5, R 4.1.3, 4.2.3, 4.3.2, 4.4.3, 4.5, R devel
* local Windows 11, R R 4.1.3, 4.2.3, 4.3.2, 4.4.3, 4.5, R devel
* local Ubuntu 24.04, R 4.1.3, 4.2.3, 4.3.2, 4.4.3, 4.5, R devel
* Github Actions "windows-latest (release)"
* Github Actions "macOS-latest (release)"
* Github Actions "ubuntu-latest (release)"
* Github Actions "ubuntu-latest (devel)"
* Github Actions "ubuntu-latest (oldrel-1)"
* r-hub ubuntu-latest on GitHub
* r-hub macos-13 on GitHub
* r-hub macos-latest on GitHub
* r-hub windows-latest on GitHub
* win-builder.r-project.org

## R CMD check results
Expand Down
68 changes: 26 additions & 42 deletions docs/404.html

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

Loading
Loading