Skip to content

Commit

Permalink
Merge pull request #37 from osqp/cmake_fixes_for_cran
Browse files Browse the repository at this point in the history
Cmake fixes for cran
  • Loading branch information
bnaras authored Oct 20, 2023
2 parents 0867b78 + cb60f60 commit 4e8ef64
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: osqp
Title: Quadratic Programming Solver using the 'OSQP' Library
Version: 0.6.3.1
Date: 2023-10-03
Version: 0.6.3.2
Date: 2023-10-19
Authors@R: c(
person("Bartolomeo", "Stellato", role = c("aut", "ctb", "cph"),
email = "[email protected]"),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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=../../ ..
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/
Expand Down
26 changes: 17 additions & 9 deletions inst/58f00bd_fixes/make_fixes.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,31 @@ 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"')
## 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='#')


0 comments on commit 4e8ef64

Please sign in to comment.