From 6ae32d0704fcc914dabdba27277b4beb6a9129dd Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Thu, 5 Oct 2023 12:51:53 -0700 Subject: [PATCH 1/5] CMAKE fixes for CRAN This branch contains some fixes CRAN wants us to make per Writing R Extensions manual. We will update the master in due course with these patches. --- DESCRIPTION | 2 +- NEWS.md | 9 +++++++++ configure | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f06539f..016ccfb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osqp Title: Quadratic Programming Solver using the 'OSQP' Library -Version: 0.6.3.1 +Version: 0.6.3.2 Date: 2023-10-03 Authors@R: c( person("Bartolomeo", "Stellato", role = c("aut", "ctb", "cph"), diff --git a/NEWS.md b/NEWS.md index c1fbe10..e3b7ffd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +# Version 0.6.3.2 + +* CMAKE file fixes per R-exts + +# Version 0.6.3.1 + +* Bug fix: typo in sparse coercion routines (`dgCMatrix` where + `dtCMatrix` should be). + # Version 0.6.3 * Sync up to version [0.6.3 of OSQP release](https://github.com/osqp/osqp/releases/tag/v0.6.3) diff --git a/configure b/configure index c727d45..262a617 100755 --- a/configure +++ b/configure @@ -31,7 +31,9 @@ if [ -x "$(command -v cmake)" ]; then cd src/osqp_sources mkdir -p build cd build - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ .. + CFLAGS="${CPPFLAGS} ${CFLAGS}" + CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}" + cmake -DR_HOME="${R_HOME}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ .. cmake --build . --target install cd .. rm -rf build/ From 897a791556fba0500852e3af90bfcc6a9e7b588f Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Thu, 5 Oct 2023 13:17:59 -0700 Subject: [PATCH 2/5] Update make_fixes.R --- inst/58f00bd_fixes/make_fixes.R | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/inst/58f00bd_fixes/make_fixes.R b/inst/58f00bd_fixes/make_fixes.R index 09de8f0..91d5226 100644 --- a/inst/58f00bd_fixes/make_fixes.R +++ b/inst/58f00bd_fixes/make_fixes.R @@ -46,23 +46,28 @@ replace_lines(path = "osqp_sources/lin_sys/direct/qdldl/qdldl_sources/examples/e ## Rename proj.h to osqp_proj.h and edit files that use it. file.rename(from = "osqp_sources/include/proj.h", to = "osqp_sources/include/osqp_proj.h") -## Fix CMakeLists.txt -replace_lines("osqp_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)', - comment_prefix = "#") +## Fix auxil.c +replace_lines("osqp_sources/src/auxil.c", 3, '#include "osqp_proj.h"') + +## Fix polish.c +replace_lines("osqp_sources/src/polish.c", 7, '#include "osqp_proj.h"') + +## Fix proj.c +replace_lines("osqp_sources/src/proj.c", 1, '#include "osqp_proj.h"') +## Fix CMakeLists.txt replace_lines("osqp_sources/include/CMakeLists.txt", 12, ' "${CMAKE_CURRENT_SOURCE_DIR}/osqp_proj.h"', comment_prefix = "#") replace_lines("osqp_sources/lin_sys/direct/qdldl/qdldl_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)', comment_prefix = "#") -## Fix auxil.c -replace_lines("osqp_sources/src/auxil.c", 3, '#include "osqp_proj.h"') +replace_lines("osqp_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)', + comment_prefix = "#") -## Fix polish.c -replace_lines("osqp_sources/src/polish.c", 7, '#include "osqp_proj.h"') +## Drop lines 242-255 as they are not needed +lines <- readLines("osqp_sources/CMakeLists.txt")[-(242:255)] +writeLines(lines, "osqp_sources/CMakeLists.txt") -## Fix proj.c -replace_lines("osqp_sources/src/proj.c", 1, '#include "osqp_proj.h"') From 2d545d00e2c0f8bc92deaafba2f0b1be840ba47a Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Thu, 19 Oct 2023 11:02:46 -0700 Subject: [PATCH 3/5] Update DESCRIPTION --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 016ccfb..9006e46 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: osqp Title: Quadratic Programming Solver using the 'OSQP' Library Version: 0.6.3.2 -Date: 2023-10-03 +Date: 2023-10-19 Authors@R: c( person("Bartolomeo", "Stellato", role = c("aut", "ctb", "cph"), email = "bartolomeo.stellato@gmail.com"), From becd81fd19211339c445974b31b2edcadec6c6cb Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Thu, 19 Oct 2023 11:14:25 -0700 Subject: [PATCH 4/5] Update configure --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 262a617..23f7ce8 100755 --- a/configure +++ b/configure @@ -32,7 +32,9 @@ if [ -x "$(command -v cmake)" ]; then mkdir -p build cd build CFLAGS="${CPPFLAGS} ${CFLAGS}" - CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}" + CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}" + echo "CFLAGS are ${CFLAGS}" + echo "CXXFLAGS are ${CFLAGS}" cmake -DR_HOME="${R_HOME}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ .. cmake --build . --target install cd .. From cb60f603730ace6393d67dff3ffc8d37e2b8dd4e Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Thu, 19 Oct 2023 17:48:21 -0700 Subject: [PATCH 5/5] Fix for findR.cmake module --- configure | 4 ---- inst/58f00bd_fixes/make_fixes.R | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 23f7ce8..9716aa4 100755 --- a/configure +++ b/configure @@ -31,10 +31,6 @@ if [ -x "$(command -v cmake)" ]; then cd src/osqp_sources mkdir -p build cd build - CFLAGS="${CPPFLAGS} ${CFLAGS}" - CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}" - echo "CFLAGS are ${CFLAGS}" - echo "CXXFLAGS are ${CFLAGS}" cmake -DR_HOME="${R_HOME}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ .. cmake --build . --target install cd .. diff --git a/inst/58f00bd_fixes/make_fixes.R b/inst/58f00bd_fixes/make_fixes.R index 91d5226..42f8d15 100644 --- a/inst/58f00bd_fixes/make_fixes.R +++ b/inst/58f00bd_fixes/make_fixes.R @@ -66,8 +66,11 @@ replace_lines("osqp_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION comment_prefix = "#") ## Drop lines 242-255 as they are not needed -lines <- readLines("osqp_sources/CMakeLists.txt")[-(242:255)] -writeLines(lines, "osqp_sources/CMakeLists.txt") +## lines <- readLines("osqp_sources/CMakeLists.txt")[-(242:255)] +##writeLines(lines, "osqp_sources/CMakeLists.txt") +## Replace findR.cmake +replace_lines("osqp_sources/configure/cmake/FindR.cmake", 11, 'find_program(R_EXEC NAMES R R.exe PATHS ${R_HOME}/bin)', + comment_prefix='#')