Skip to content

Commit e66e23a

Browse files
committed
[Base] Initialize project
0 parents  commit e66e23a

36 files changed

+4356
-0
lines changed

.clang-format

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
BasedOnStyle: Microsoft
3+
UseTab: Never
4+
IndentWidth: 4
5+
ColumnLimit: 100
6+
---
7+
Language: Cpp
8+
PointerAlignment: Left
9+
DerivePointerAlignment: false
10+
AllowShortFunctionsOnASingleLine: All
11+
AlignAfterOpenBracket: BlockIndent
12+
AlignEscapedNewlines: Left
13+
BreakBeforeBraces: Attach
14+
BreakAfterAttributes: Always
15+
AlwaysBreakTemplateDeclarations: Yes
16+
AlwaysBreakBeforeMultilineStrings: true
17+
SortIncludes: CaseInsensitive
18+
InsertNewlineAtEOF: true
19+
---

.clang-tidy

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
Checks: |-
3+
clang-diagnostic-*
4+
clang-analyzer-*,
5+
cppcoreguidelines-*,-cppcoreguidelines-avoid-magic-numbers
6+
modernize-*,
7+
WarningsAsErrors: ''
8+
FormatStyle: file
9+
HeaderFilterRegex: ''
10+
CheckOptions:
11+
- key: cert-dcl16-c.NewSuffixes
12+
value: L;LL;LU;LLU
13+
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
14+
value: 0
15+
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
16+
value: 1
17+
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
18+
value: 1
19+
- key: google-readability-braces-around-statements.ShortStatementLines
20+
value: 1
21+
- key: google-readability-function-size.StatementThreshold
22+
value: 800
23+
- key: google-readability-namespace-comments.ShortNamespaceLines
24+
value: 10
25+
- key: google-readability-namespace-comments.SpacesBeforeComments
26+
value: 2
27+
- key: modernize-loop-convert.MaxCopySize
28+
value: 16
29+
- key: modernize-loop-convert.MinConfidence
30+
value: reasonable
31+
- key: modernize-loop-convert.NamingStyle
32+
value: CamelCase
33+
- key: modernize-pass-by-value.IncludeStyle
34+
value: llvm
35+
- key: modernize-replace-auto-ptr.IncludeStyle
36+
value: llvm
37+
- key: modernize-use-nullptr.NullMacros
38+
value: NULL
39+
...

.github/ISSUE_TEMPLATE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## *Who* is the bug affecting?
2+
<!-- Ex. All supervisors, Sally Supervisor, Level 1 CCs -->
3+
4+
## *What* is affected by this bug?
5+
<!-- Ex. supervision, sending messages, texter profiles -->
6+
7+
## *When* does this occur?
8+
<!-- Ex. After ending a conversation, every night at 3pm, when I sign off -->
9+
10+
## *Where* on the platform does it happen?
11+
<!-- Ex. In the a Supervisor chat box, on the conversation profile page, on the two-factor screen -->
12+
13+
14+
## *How* do we replicate the issue?
15+
<!-- Please be specific as possible. Use dashes (-) or numbers (1.) to create a list of steps -->
16+
17+
18+
## Expected behavior (i.e. solution)
19+
<!-- What should have happened? -->
20+
21+
22+
## Other Comments

.github/PULL_REQUEST_TEMPLATE.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
<!--- Describe your changes in detail -->
5+
6+
## Motivation and Context
7+
<!--- Why is this change required? What problem does it solve? -->
8+
<!--- If it fixes an open issue, please link to the issue here. -->
9+
10+
## How has this been tested?
11+
<!--- Please describe in detail how you tested your changes. -->
12+
<!--- Include details of your testing environment, tests ran to see how -->
13+
<!--- your change affects other areas of the code, etc. -->
14+
15+
## Screenshots (if appropriate):
16+
17+
## Types of changes
18+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
19+
- [ ] Bug fix (non-breaking change which fixes an issue)
20+
- [ ] New feature (non-breaking change which adds functionality)
21+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
22+
23+
## Checklist:
24+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
25+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
26+
- [ ] My code follows the code style of this project.
27+
- [ ] My change requires a change to the documentation.
28+
- [ ] I have updated the documentation accordingly.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: clang-format Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
formatting-check:
7+
name: Formatting Check
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Run clang-format style check for C/C++ programs.
14+
uses: jidicula/clang-format-action@v4.11.0
15+
with:
16+
clang-format-version: '16'

.github/workflows/gcc.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: gcc
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
PLATFORM_NAME: gcc-linux_x64
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Get Date
20+
id: get-date
21+
run: |
22+
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
23+
shell: bash
24+
25+
- name: Install latest CMake and Ninja
26+
id: install-cmake
27+
uses: lukka/get-cmake@latest
28+
29+
- name: Cache Outputs
30+
id: cache-outputs
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
${{github.workspace}}/out
35+
${{github.workspace}}/third_party
36+
key: ${{runner.os}}-${{steps.get-date.outputs.date}}
37+
restore-keys: |
38+
${{runner.os}}-
39+
40+
- name: Run CMake consuming CMakePresets.json
41+
uses: lukka/run-cmake@v10
42+
with:
43+
configurePreset: ${{env.PLATFORM_NAME}}
44+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER=gcc-13', '-DCMAKE_CXX_COMPILER=g++-13']"
45+
buildPreset: ${{env.PLATFORM_NAME}}
46+
buildPresetAdditionalArgs: "[]"
47+
testPreset: ${{env.PLATFORM_NAME}}
48+
testPresetAdditionalArgs: "[]"

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CMakePresets.json File
2+
CMakeUserPresets.json
3+
4+
# Build Directory
5+
out/
6+
build/
7+
8+
# third-party dependencies
9+
third_party/
10+
11+
# Vscode Configuration
12+
.vscode/
13+
14+
# Clangd Cache
15+
.cache/
16+
17+
# Youcompleteme Configuration
18+
.ycm_extra_conf.py
19+
20+
# Force Include Conf
21+
!conf/**

CMakeLists.txt

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
cmake_minimum_required(VERSION 3.26.4)
2+
3+
project(modern-osqp-cpp
4+
LANGUAGES
5+
C
6+
CXX
7+
)
8+
9+
set(CMAKE_C_STANDARD 17)
10+
set(CMAKE_C_STANDARD_REQUIRED True)
11+
set(CMAKE_CXX_STANDARD 20)
12+
set(CMAKE_CXX_STANDARD_REQUIRED True)
13+
14+
set(CMAKE_C_FLAGS_DEBUG "-Og -g")
15+
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
16+
17+
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
18+
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
19+
20+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
21+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
22+
23+
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
24+
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
25+
26+
set(CMAKE_COMPILE_WARNING_AS_ERROR True)
27+
28+
add_compile_options(
29+
-pipe
30+
-fno-plt
31+
-fexceptions
32+
-fstack-clash-protection
33+
-fcf-protection
34+
-Wall
35+
-Wextra
36+
-Wpedantic
37+
-Wno-unused-parameter
38+
)
39+
40+
set(CPM_SOURCE_CACHE third_party)
41+
set(CPM_USE_LOCAL_PACKAGES True)
42+
43+
add_compile_definitions(
44+
SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE
45+
DOCTEST_CONFIG_SUPER_FAST_ASSERTS
46+
)
47+
48+
include(CTest)
49+
enable_testing()
50+
51+
include(cmake/CPM.cmake)
52+
include(cmake/third_party.cmake)
53+
include(cmake/utils.cmake)
54+
55+
include_directories(${PROJECT_SOURCE_DIR}/src)
56+
57+
add_subdirectory(src)
58+
add_subdirectory(tests)

CMakePresets.json

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"version": 8,
3+
"configurePresets": [
4+
{
5+
"name": "base_configure",
6+
"displayName": "Base Configure",
7+
"description": "Base configuration for all presets",
8+
"generator": "Ninja",
9+
"binaryDir": "${sourceDir}/out/build/${presetName}",
10+
"installDir": "${sourceDir}/out/install/${presetName}",
11+
"cacheVariables": {
12+
"CMAKE_EXPORT_COMPILE_COMMANDS": true
13+
}
14+
},
15+
{
16+
"name": "gcc-linux_x64",
17+
"displayName": "GCC 13.2.1 x86_64-pc-linux-gnu",
18+
"description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
19+
"inherits": [
20+
"base_configure"
21+
],
22+
"cacheVariables": {
23+
"CMAKE_C_COMPILER": "/usr/bin/gcc",
24+
"CMAKE_CXX_COMPILER": "/usr/bin/g++",
25+
"CMAKE_C_FLAGS": "-march=native -Wp,-D_FORTIFY_SOURCE=2",
26+
"CMAKE_CXX_FLAGS": "-march=native -Wp,-D_FORTIFY_SOURCE=2",
27+
"CMAKE_BUILD_TYPE": "Release"
28+
}
29+
},
30+
{
31+
"name": "clang-linux_x64",
32+
"displayName": "Clang 16.0.6 x86_64-pc-linux-gnu",
33+
"description": "Using compilers: C = /usr/bin/clang, CXX = /usr/bin/clang++",
34+
"inherits": [
35+
"base_configure"
36+
],
37+
"cacheVariables": {
38+
"CMAKE_C_COMPILER": "/usr/bin/clang",
39+
"CMAKE_CXX_COMPILER": "/usr/bin/clang++",
40+
"CMAKE_C_FLAGS": "-march=native -Wp,-D_FORTIFY_SOURCE=2",
41+
"CMAKE_CXX_FLAGS": "-march=native -Wp,-D_FORTIFY_SOURCE=2",
42+
"CMAKE_BUILD_TYPE": "Release"
43+
}
44+
}
45+
],
46+
"buildPresets": [
47+
{
48+
"name": "base_build",
49+
"displayName": "Base Build",
50+
"configurePreset": "base_configure",
51+
"targets": "all",
52+
"jobs": 0
53+
},
54+
{
55+
"name": "gcc-linux_x64",
56+
"displayName": "GCC 13.2.1 x86_64-pc-linux-gnu",
57+
"configurePreset": "gcc-linux_x64",
58+
"inheritConfigureEnvironment": true,
59+
"inherits": [
60+
"base_build"
61+
]
62+
},
63+
{
64+
"name": "clang-linux_x64",
65+
"displayName": "Clang 16.0.6 x86_64-pc-linux-gnu",
66+
"configurePreset": "clang-linux_x64",
67+
"inheritConfigureEnvironment": true,
68+
"inherits": [
69+
"base_build"
70+
]
71+
}
72+
],
73+
"testPresets": [
74+
{
75+
"name": "base_test",
76+
"displayName": "Base Test",
77+
"configurePreset": "base_configure",
78+
"output": {
79+
"outputOnFailure": true
80+
},
81+
"execution": {
82+
"jobs": 0
83+
}
84+
},
85+
{
86+
"name": "gcc-linux_x64",
87+
"displayName": "GCC 13.2.1 x86_64-pc-linux-gnu",
88+
"configurePreset": "gcc-linux_x64",
89+
"inheritConfigureEnvironment": true,
90+
"inherits": [
91+
"base_test"
92+
]
93+
},
94+
{
95+
"name": "clang-linux_x64",
96+
"displayName": "Clang 16.0.6 x86_64-pc-linux-gnu",
97+
"configurePreset": "clang-linux_x64",
98+
"inheritConfigureEnvironment": true,
99+
"inherits": [
100+
"base_test"
101+
]
102+
}
103+
]
104+
}

LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Houchen Li
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)