Skip to content

Commit

Permalink
Merge pull request #41 from osqp/cmake_fixes_for_cran
Browse files Browse the repository at this point in the history
Fix issues 39 and 40.
  • Loading branch information
bnaras authored Jun 8, 2024
2 parents 4e8ef64 + c2c59cd commit c46603e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ src/osqp_sources/docs
src/osqp_sources/site
src/osqp_sources/tests
src/osqp_sources/lin_sys/direct/qdldl/qdldl_sources/tests

^configure$
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.2
Date: 2023-10-19
Version: 0.6.3.3
Date: 2024-06-07
Authors@R: c(
person("Bartolomeo", "Stellato", role = c("aut", "ctb", "cph"),
email = "bartolomeo.stellato@gmail.com"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ 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"')

## We don't use CMAKE anymore, so not needed
## Fix CMakeLists.txt
replace_lines("osqp_sources/include/CMakeLists.txt", 12, ' "${CMAKE_CURRENT_SOURCE_DIR}/osqp_proj.h"',
comment_prefix = "#")
## 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 = "#")
## replace_lines("osqp_sources/lin_sys/direct/qdldl/qdldl_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)',
## comment_prefix = "#")

replace_lines("osqp_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)',
comment_prefix = "#")
## replace_lines("osqp_sources/CMakeLists.txt", 2, 'cmake_minimum_required (VERSION 3.5)',
## 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")

## 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='#')

## replace_lines("osqp_sources/configure/cmake/FindR.cmake", 11, 'find_program(R_EXEC NAMES R R.exe PATHS ${R_HOME}/bin)',
## comment_prefix='#')


5 changes: 2 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
OSQP_LIB_TARGET_DIR=./lib
OSQP_INCLUDE_TARGET_DIR=./include/osqp/
OSQP_INCLUDE_TARGET_DIR=./include/osqp
OSQP_STATIC_LIB=$(OSQP_LIB_TARGET_DIR)/libosqp.a

OSQP_FLAGS=-DR_LANG=TRUE

PKG_CXXFLAGS=-I$(OSQP_INCLUDE_TARGET_DIR)
PKG_LIBS=-L$(OSQP_LIB_TARGET_DIR) -losqp

FIXES_SCRIPT=../inst/58f00bd_fixes/make_fixes.R
FIXES_SCRIPT=../inst/0dd00a57_fixes/make_fixes.R

ROBJECTS=osqp_solve_interface.o RcppExports.o
OBJECTS=$(ROBJECTS)
Expand All @@ -30,7 +30,6 @@ $(OSQP_STATIC_LIB):
# a go at building the static library here.
echo "Making fixes to osqp_sources for CRAN"
$(R_HOME)/bin/Rscript $(FIXES_SCRIPT)
echo "No cmake? I will try via osqp/Makefile"
cd osqp; \
$(MAKE) all CC="$(CC)" \
OSQP_FLAGS="$(OSQP_FLAGS)" \
Expand Down
3 changes: 1 addition & 2 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OSQP_FLAGS=-DR_LANG=TRUE
PKG_CXXFLAGS=-I$(OSQP_INCLUDE_TARGET_DIR)
PKG_LIBS=-L$(OSQP_LIB_TARGET_DIR) -losqp

FIXES_SCRIPT=../inst/58f00bd_fixes/make_fixes.R
FIXES_SCRIPT=../inst/0dd00a57_fixes/make_fixes.R

ROBJECTS=osqp_solve_interface.o RcppExports.o
OBJECTS=$(ROBJECTS)
Expand All @@ -30,7 +30,6 @@ $(OSQP_STATIC_LIB):
# a go at building the static library here.
echo "Making fixes to osqp_sources for CRAN"
$(R_HOME)/bin$(R_ARCH_BIN)/Rscript $(FIXES_SCRIPT)
echo "No cmake? I will try via osqp/Makefile"
cd osqp; \
$(MAKE) all CC="$(CC)" \
OSQP_FLAGS="$(OSQP_FLAGS)" \
Expand Down

0 comments on commit c46603e

Please sign in to comment.