Skip to content

Commit 8aa7ece

Browse files
Merge pull request #2 from robotology/master
Merge from main repo
2 parents fe34491 + 4c457ea commit 8aa7ece

38 files changed

+6530
-1475
lines changed

.clang-format

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: WebKit
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: false
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: true
29+
AfterObjCDeclaration: false
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
SplitEmptyFunction: true
36+
SplitEmptyRecord: true
37+
SplitEmptyNamespace: true
38+
BreakBeforeBinaryOperators: All
39+
BreakBeforeBraces: Custom
40+
BreakBeforeInheritanceComma: false
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializersBeforeComma: true
43+
BreakConstructorInitializers: BeforeComma
44+
BreakAfterJavaFieldAnnotations: false
45+
BreakStringLiterals: true
46+
ColumnLimit: 100
47+
CommentPragmas: '^ IWYU pragma:'
48+
CompactNamespaces: false
49+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
50+
ConstructorInitializerIndentWidth: 4
51+
ContinuationIndentWidth: 4
52+
Cpp11BracedListStyle: true
53+
DerivePointerAlignment: false
54+
DisableFormat: false
55+
ExperimentalAutoDetectBinPacking: false
56+
FixNamespaceComments: true
57+
ForEachMacros:
58+
- foreach
59+
- Q_FOREACH
60+
- BOOST_FOREACH
61+
IncludeCategories:
62+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
63+
Priority: 2
64+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
65+
Priority: 3
66+
- Regex: '.*'
67+
Priority: 1
68+
IncludeIsMainRegex: '(Test)?$'
69+
IndentCaseLabels: false
70+
IndentWidth: 4
71+
IndentWrappedFunctionNames: false
72+
JavaScriptQuotes: Leave
73+
JavaScriptWrapImports: true
74+
KeepEmptyLinesAtTheStartOfBlocks: true
75+
MacroBlockBegin: ''
76+
MacroBlockEnd: ''
77+
MaxEmptyLinesToKeep: 1
78+
NamespaceIndentation: None
79+
ObjCBlockIndentWidth: 4
80+
ObjCSpaceAfterProperty: true
81+
ObjCSpaceBeforeProtocolList: true
82+
PenaltyBreakAssignment: 10
83+
PenaltyBreakBeforeFirstCallParameter: 1000
84+
PenaltyBreakComment: 10
85+
PenaltyBreakString: 10
86+
PenaltyExcessCharacter: 100
87+
PenaltyReturnTypeOnItsOwnLine: 5
88+
PointerAlignment: Left
89+
ReflowComments: true
90+
SortIncludes: true
91+
SortUsingDeclarations: true
92+
SpaceAfterCStyleCast: false
93+
SpaceAfterTemplateKeyword: true
94+
SpaceBeforeAssignmentOperators: true
95+
SpaceBeforeParens: ControlStatements
96+
SpaceInEmptyParentheses: false
97+
SpacesBeforeTrailingComments: 1
98+
SpacesInAngles: false
99+
SpacesInContainerLiterals: true
100+
SpacesInCStyleCastParentheses: false
101+
SpacesInParentheses: false
102+
SpacesInSquareBrackets: false
103+
Standard: Cpp11
104+
TabWidth: 4
105+
UseTab: Never

.github/workflows/ci.yml

+6-11
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
- cron: '0 2 * * *'
1010

1111
env:
12-
osqp_TAG: v0.6.2
12+
osqp_TAG: v0.6.3
1313
vcpkg_robotology_TAG: v0.0.3
14-
Catch2_TAG: v2.12.1
14+
Catch2_TAG: v3.8.0
1515
# Overwrite the VCPKG_INSTALLATION_ROOT env variable defined by GitHub Actions to point to our vcpkg
1616
VCPKG_INSTALLATION_ROOT: C:\robotology\vcpkg
1717

@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
build_type: [Debug, Release]
26-
os: [ubuntu-latest, macOS-latest, windows-latest]
26+
os: [ubuntu-latest, windows-latest]
2727
float: [ON, OFF]
2828
fail-fast: false
2929

@@ -64,11 +64,6 @@ jobs:
6464
cd C:/robotology/vcpkg
6565
./vcpkg.exe install --triplet x64-windows catch2
6666
67-
- name: Dependencies [macOS]
68-
if: matrix.os == 'macOS-latest'
69-
run: |
70-
brew install eigen
71-
7267
- name: Dependencies [Ubuntu]
7368
if: matrix.os == 'ubuntu-latest'
7469
run: |
@@ -77,7 +72,7 @@ jobs:
7772
7873
- name: Cache Source-based Dependencies
7974
id: cache-source-deps
80-
uses: actions/cache@v1
75+
uses: actions/cache@v4
8176
with:
8277
path: ${{ github.workspace }}/install/deps
8378
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 }}
@@ -98,8 +93,8 @@ jobs:
9893
9994
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
10095
101-
- name: Source-based Dependencies [Ubuntu/macOS]
102-
if: steps.cache-source-deps.outputs.cache-hit != 'true' && (matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest')
96+
- name: Source-based Dependencies [Ubuntu]
97+
if: steps.cache-source-deps.outputs.cache-hit != 'true' && (matrix.os == 'ubuntu-latest')
10398
shell: bash
10499
run: |
105100
# osqp

.github/workflows/gh-pages.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
python3 ${GITHUB_WORKSPACE}/m.css/documentation/doxygen.py conf.py
3939
4040
- name: Archive artifacts
41-
uses: actions/upload-artifact@v2
41+
uses: actions/upload-artifact@v4
4242
with:
4343
name: site
4444
path: docs/site
@@ -48,7 +48,7 @@ jobs:
4848
needs: [build]
4949
steps:
5050
- name: Download artifacts
51-
uses: actions/download-artifact@v2
51+
uses: actions/download-artifact@v4.1.7
5252
with:
5353
name: site
5454
path: site

.github/workflows/test-pixi.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Run tests with pixi
2+
3+
on:
4+
# on demand
5+
workflow_dispatch:
6+
inputs:
7+
delete_pixi_lock:
8+
description: 'If true, delete pixi.lock, to test against the latest version of dependencies.'
9+
required: true
10+
default: 'false'
11+
pull_request:
12+
schedule:
13+
# * is a special character in YAML so you have to quote this string
14+
# Execute a "nightly" build twice a week 2 AM UTC
15+
- cron: '0 2 * * 2,5'
16+
17+
jobs:
18+
pixi-test:
19+
name: '[pixi:${{ matrix.os }}]'
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [
25+
ubuntu-24.04,
26+
macos-latest,
27+
windows-2019
28+
]
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
# On periodic jobs and when delete_pixi_lock option is true, delete the pixi.lock to check that the project compiles with latest version of dependencies
33+
- name: Delete pixi.lock on scheduled jobs or if delete_pixi_lock is true
34+
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.delete_pixi_lock == 'true')
35+
shell: bash
36+
run: |
37+
rm pixi.lock
38+
39+
40+
# To use valgrind even with conda/pixi we still need to install libc6-dbg via apt on Debian-based distros
41+
# See https://github.com/robotology/osqp-eigen/pull/171#issuecomment-2458149581
42+
- name: Install libc6-dbg
43+
if: contains(matrix.os, 'ubuntu')
44+
run: |
45+
sudo apt-get install libc6-dbg
46+
47+
- name: Set up pixi
48+
uses: prefix-dev/[email protected]
49+
50+
- name: Print pixi info
51+
run: pixi info
52+
53+
- name: Build and test the project
54+
run: pixi run test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update lockfiles
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: 0 5 1 * *
11+
12+
jobs:
13+
pixi-update:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up pixi
19+
uses: prefix-dev/[email protected]
20+
with:
21+
run-install: false
22+
23+
- name: Install pixi-diff-to-markdown
24+
run: pixi global install pixi-diff-to-markdown
25+
26+
- name: Update lockfiles
27+
run: |
28+
set -o pipefail
29+
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
30+
31+
- name: Create pull request
32+
uses: peter-evans/create-pull-request@v6
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
commit-message: Update pixi lockfile
36+
title: Update pixi lockfile
37+
body-path: diff.md
38+
branch: update-pixi
39+
base: main
40+
labels: pixi
41+
delete-branch: true
42+
add-paths: pixi.lock

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ tramp
1111
#build
1212
/build/
1313
*.user
14+
.build
15+
.pixi

CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(OsqpEigen_VERSION "${OsqpEigen_MAJOR_VERSION}.${OsqpEigen_MINOR_VERSION}.${O
1717
# Set project version
1818
project(OsqpEigen VERSION ${OsqpEigen_VERSION})
1919

20-
# ouptut paths
20+
# output paths
2121
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
2222
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
2323
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
@@ -78,7 +78,7 @@ include(OsqpEigenDependencies)
7878
if(NOT CMAKE_CONFIGURATION_TYPES)
7979
if(NOT CMAKE_BUILD_TYPE)
8080
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
81-
"Choose the type of build, recommanded options are: Debug or Release" FORCE)
81+
"Choose the type of build, recommended options are: Debug or Release" FORCE)
8282
endif()
8383
set(OSQPEIGEN_BUILD_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
8484
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${OSQPEIGEN_BUILD_TYPES})
@@ -103,13 +103,19 @@ set(${LIBRARY_TARGET_NAME}_HDR
103103
include/OsqpEigen/Settings.hpp
104104
include/OsqpEigen/Solver.hpp
105105
include/OsqpEigen/Solver.tpp
106+
include/OsqpEigen/Compat.hpp
106107
include/OsqpEigen/Debug.hpp)
107108

108109
add_library(${LIBRARY_TARGET_NAME} ${${LIBRARY_TARGET_NAME}_SRC} ${${LIBRARY_TARGET_NAME}_HDR})
109110
target_include_directories(${LIBRARY_TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
110111
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
111112

113+
ADD_WARNINGS_CONFIGURATION_TO_TARGETS(PRIVATE TARGETS ${LIBRARY_TARGET_NAME})
114+
112115
target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC osqp::osqp Eigen3::Eigen)
116+
if(OSQP_IS_V1)
117+
target_compile_definitions(${LIBRARY_TARGET_NAME} PUBLIC OSQP_EIGEN_OSQP_IS_V1)
118+
endif()
113119

114120
add_library(OsqpEigen::OsqpEigen ALIAS OsqpEigen)
115121

cmake/AddOsqpEigenUnitTest.cmake

+1-8
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ if (OSQPEIGEN_RUN_Valgrind_tests)
2727
separate_arguments(MEMCHECK_COMMAND_COMPLETE)
2828
endif()
2929

30-
if (OSQPEIGEN_COMPILE_tests)
31-
configure_file(cmake/Catch2Main.cpp.in ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
32-
add_library(CatchTestMain ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
33-
target_link_libraries(CatchTestMain PUBLIC Catch2::Catch2)
34-
endif()
35-
36-
3730
function(add_osqpeigen_test)
3831

3932
if(OSQPEIGEN_COMPILE_tests)
@@ -57,7 +50,7 @@ function(add_osqpeigen_test)
5750
add_executable(${targetname}
5851
"${unit_test_files}")
5952

60-
target_link_libraries(${targetname} PRIVATE CatchTestMain ${${prefix}_LINKS})
53+
target_link_libraries(${targetname} PRIVATE Catch2::Catch2WithMain ${${prefix}_LINKS})
6154
target_compile_definitions(${targetname} PRIVATE CATCH_CONFIG_FAST_COMPILE CATCH_CONFIG_DISABLE_MATCHERS)
6255
target_compile_features(${targetname} PUBLIC cxx_std_14)
6356

cmake/Catch2Main.cpp.in

-9
This file was deleted.

cmake/InstallBasicPackageFiles.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function generates 3 files:
4444
If neither ``UPPERCASE_FILENAMES`` nor ``LOWERCASE_FILENAMES`` is
4545
set, a file ``<Name>Config.cmake.in`` or
4646
``<name>-config.cmake.in`` is searched, and the convention
47-
is chosed according to the file found. If no file was found, the
47+
is chosen according to the file found. If no file was found, the
4848
uppercase convention is used.
4949
5050
The ``DEPENDENCIES`` argument can be used to set a list of dependencies
@@ -585,7 +585,7 @@ ${_compatibility_vars}
585585
endforeach()
586586

587587

588-
# <Name>ConfigVersion.cmake file (same for build tree and intall)
588+
# <Name>ConfigVersion.cmake file (same for build tree and install)
589589
write_basic_package_version_file("${_IBPF_EXPORT_DESTINATION}/${_version_filename}"
590590
VERSION ${_IBPF_VERSION}
591591
COMPATIBILITY ${_IBPF_COMPATIBILITY}

cmake/OsqpEigenDependencies.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ include(OsqpEigenFindOptionalDependencies)
1111
## Required Dependencies
1212
find_package(Eigen3 3.2.92 REQUIRED)
1313
find_package(osqp REQUIRED)
14+
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)
16+
endif()
1417

1518
#---------------------------------------------
1619
## Optional Dependencies
17-
find_package(Catch2 QUIET)
20+
find_package(Catch2 3.0.1 QUIET)
1821
checkandset_optional_dependency(Catch2)
1922

2023
find_package(VALGRIND QUIET)

cmake/try-osqp.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file is only available on OSQP >= 1.0.0
2+
#include <osqp_api_functions.h>
3+
4+
int main()
5+
{
6+
return 0;
7+
}

0 commit comments

Comments
 (0)