Skip to content

Commit 743b419

Browse files
Support building v0.6.3, v1.0.0.beta1 and v1.0.0 and bump version to 0.10.0 #189
2 parents 4c457ea + e8fd18d commit 743b419

8 files changed

Lines changed: 36 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
- cron: '0 2 * * *'
1010

1111
env:
12-
osqp_TAG: v0.6.3
1312
vcpkg_robotology_TAG: v0.0.3
1413
Catch2_TAG: v3.8.0
1514
# Overwrite the VCPKG_INSTALLATION_ROOT env variable defined by GitHub Actions to point to our vcpkg
@@ -18,12 +17,13 @@ env:
1817
# Test with different operating systems
1918
jobs:
2019
build:
21-
name: '[${{ matrix.os }}@${{ matrix.build_type }}] [float:${{ matrix.float }}]'
20+
name: '[${{ matrix.os }}@${{ matrix.build_type }}@${{ matrix.osqp_TAG }}] [float:${{ matrix.float }}]'
2221
runs-on: ${{ matrix.os }}
2322
strategy:
2423
matrix:
2524
build_type: [Debug, Release]
2625
os: [ubuntu-latest, windows-latest]
26+
osqp_TAG: ["v0.6.3", "v1.0.0.beta1", "v1.0.0"]
2727
float: [ON, OFF]
2828
fail-fast: false
2929

@@ -75,15 +75,15 @@ jobs:
7575
uses: actions/cache@v4
7676
with:
7777
path: ${{ github.workspace }}/install/deps
78-
key: source-deps-${{ runner.os }}-${{ matrix.build_type }}-use-float-${{ matrix.float }}-vcpkg-robotology-${{ env.vcpkg_robotology_TAG }}-osqp-${{ env.osqp_TAG }}-catch2-${{ env.Catch2_TAG }}
78+
key: source-deps-${{ runner.os }}-${{ matrix.build_type }}-use-float-${{ matrix.float }}-vcpkg-robotology-${{ env.vcpkg_robotology_TAG }}-osqp-${{ matrix.osqp_TAG }}-catch2-${{ env.Catch2_TAG }}
7979

8080
- name: Source-based Dependencies [Windows]
8181
if: steps.cache-source-deps.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
8282
shell: bash
8383
run: |
8484
# osqp
8585
cd ${GITHUB_WORKSPACE}
86-
git clone --recursive -b ${osqp_TAG} https://github.com/oxfordcontrol/osqp
86+
git clone --recursive -b ${{ matrix.osqp_TAG }} https://github.com/oxfordcontrol/osqp
8787
cd osqp
8888
mkdir -p build
8989
cd build
@@ -99,7 +99,7 @@ jobs:
9999
run: |
100100
# osqp
101101
cd ${GITHUB_WORKSPACE}
102-
git clone --recursive -b ${osqp_TAG} https://github.com/oxfordcontrol/osqp
102+
git clone --recursive -b ${{ matrix.osqp_TAG }} https://github.com/oxfordcontrol/osqp
103103
cd osqp
104104
mkdir -p build
105105
cd build
@@ -144,17 +144,6 @@ jobs:
144144
-DBUILD_TESTING:BOOL=ON \
145145
-DOSQPEIGEN_RUN_Valgrind_tests:BOOL=ON ..
146146
147-
- name: Configure [macOS]
148-
if: matrix.os == 'macOS-latest'
149-
shell: bash
150-
run: |
151-
mkdir -p build
152-
cd build
153-
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \
154-
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
155-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
156-
-DBUILD_TESTING:BOOL=ON ..
157-
158147
- name: Build
159148
shell: bash
160149
run: |

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CopyPolicy: Released under the terms of the BSD 3-clause license
33

44
# Set cmake minimum version
5-
cmake_minimum_required(VERSION 3.8)
5+
cmake_minimum_required(VERSION 3.8...3.30)
66

77
# Extract version numbers from package.xml
88
# Based on code by DART (BSD-2-license)
@@ -116,6 +116,9 @@ target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC osqp::osqp Eigen3::Eigen)
116116
if(OSQP_IS_V1)
117117
target_compile_definitions(${LIBRARY_TARGET_NAME} PUBLIC OSQP_EIGEN_OSQP_IS_V1)
118118
endif()
119+
if(OSQP_IS_V1_FINAL)
120+
target_compile_definitions(${LIBRARY_TARGET_NAME} PUBLIC OSQP_EIGEN_OSQP_IS_V1_FINAL)
121+
endif()
119122

120123
add_library(OsqpEigen::OsqpEigen ALIAS OsqpEigen)
121124

cmake/OsqpEigenDependencies.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ include(OsqpEigenFindOptionalDependencies)
1111
## Required Dependencies
1212
find_package(Eigen3 3.2.92 REQUIRED)
1313
find_package(osqp REQUIRED)
14+
15+
# OSQP_IS_V1 (and OSQP_EIGEN_OSQP_IS_V1) is defined for v1.0.0.beta1 and v1.0.0 (and later)
1416
if(NOT DEFINED OSQP_IS_V1)
15-
try_compile(OSQP_IS_V1 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/try-osqp.cpp LINK_LIBRARIES osqp::osqp)
17+
try_compile(OSQP_IS_V1 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/try-osqp-v1.cpp LINK_LIBRARIES osqp::osqp)
18+
endif()
19+
20+
# OSQP_IS_V1 (and OSQP_EIGEN_OSQP_IS_V1) is defined only for v1.0.0 (and later)
21+
if(NOT DEFINED OSQP_IS_V1_FINAL)
22+
try_compile(OSQP_IS_V1_FINAL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/try-osqp-v1-final.cpp LINK_LIBRARIES osqp::osqp)
1623
endif()
1724

25+
1826
#---------------------------------------------
1927
## Optional Dependencies
2028
find_package(Catch2 3.0.1 QUIET)

cmake/try-osqp-v1-final.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <osqp_api_functions.h>
2+
3+
int main()
4+
{
5+
// This function is only available in OSQP >= 1.0.0
6+
OSQPCscMatrix_set_data(nullptr, 0, 0, 0, nullptr, 0, 0);
7+
return 0;
8+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is only available on OSQP >= 1.0.0
1+
// This file is only available on OSQP >= 1.0.0.beta1
22
#include <osqp_api_functions.h>
33

44
int main()

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = osqp-eigen
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.9.0
41+
PROJECT_NUMBER = 0.10.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

include/OsqpEigen/Compat.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ inline OSQPCscMatrix* spalloc(OSQPInt m,
8686
M_nnz = nzmax;
8787
}
8888

89-
csc_set_data(M, m, n, M_nnz, M_x, M_i, M_p);
89+
#ifdef OSQP_EIGEN_OSQP_IS_V1_FINAL
90+
#define OSQPEigen_OSQPCscMatrix_set_data OSQPCscMatrix_set_data
91+
#else
92+
#define OSQPEigen_OSQPCscMatrix_set_data csc_set_data
93+
#endif
94+
95+
OSQPEigen_OSQPCscMatrix_set_data(M, m, n, M_nnz, M_x, M_i, M_p);
9096

9197
return M;
9298
}

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<package format="3">
33
<name>osqp-eigen</name>
4-
<version>0.9.0</version>
4+
<version>0.10.0</version>
55
<description>Simple Eigen-C++ wrapper for OSQP library</description>
66
<maintainer email="tbd@tbd.tbd">tbd</maintainer>
77

0 commit comments

Comments
 (0)