Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #20

Merged
merged 10 commits into from
Sep 5, 2024
Merged

Dev #20

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@
-readability-uppercase-literal-suffix,
-readability-braces-around-statements,
-bugprone-easily-swappable-parameters,
-bugprone-unchecked-optional-access,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-missing-std-forward,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-avoid-non-const-global-variables,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-const-correctness,
-misc-use-anonymous-namespace
-misc-use-anonymous-namespace,
-misc-include-cleaner
# Also check the header files
Expand Down
15 changes: 15 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "CodeQL config"

queries:
- uses: security-and-quality

query-filters:
- exclude:
id: cpp/include-non-header
- exclude:
id: cpp/undisciplined-multiple-inheritance
- exclude:
id: cpp/unused-static-variable
- exclude:
id: cpp/missing-return

21 changes: 9 additions & 12 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ jobs:
core-guidelines:
name: core-guidelines-check
runs-on: windows-2022
# Disabled because of an internal compiler error in reference_lines.cpp
if: false

defaults:
run:
Expand Down Expand Up @@ -37,24 +35,23 @@ jobs:
#############################################################################################################

clang-analyzers:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
tool: [
{ name: iwyu, cmake-flag: CMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu;-Xiwyu;--mapping_file=../.iwyu-mappings" },
{ name: clang-tidy, cmake-flag: CMAKE_CXX_CLANG_TIDY="clang-tidy" },
{ name: cppcheck, cmake-flag: CMAKE_CXX_CPPCHECK="cppcheck;--version;--verbose;--report-progress;--enable=all;--error-exitcode=1;--std=c++20;--suppressions-list=../.cppcheck-supressions" }
]
include:
- pkgs: clang-15 clang-tools-15 clang-tidy-15 iwyu cppcheck
cxx: clang++-15
- pkgs: clang-18 clang-tools-18 clang-tidy-18 iwyu cppcheck
cxx: clang++-18

defaults:
run:
working-directory: ${{ github.workspace }}/build

name: ${{ matrix.tool.name }}
name: ${{ matrix.tool.name }} (${{ matrix.cxx }})

steps:
- name: checkout-repo
Expand All @@ -79,15 +76,15 @@ jobs:
#############################################################################################################

codeql:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
include:
- pkgs: clang-15
cxx: clang++-15
- pkgs: clang-18
cxx: clang++-18

name: codeql
name: codeql (${{ matrix.cxx }})

defaults:
run:
Expand All @@ -104,7 +101,7 @@ jobs:
uses: github/codeql-action/init@v3
with:
languages: cpp
queries: security-and-quality
config-file: ${{ github.workspace }}/.github/codeql/codeql-config.yml

- name: setup-build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
update-docs:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
defaults:
run:
working-directory: ${{ github.workspace }}
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: ubuntu:24.04
strategy:
fail-fast: false
matrix:
common-pkgs: [ git cmake ]
build-type: [ Release, RelWithDebInfo ]
compiler: [
{ cxx: g++-11, pkgs: g++-11 },
{ cxx: g++-12, pkgs: g++-12 },
{ cxx: g++-13, pkgs: g++-13 },
{ cxx: clang++-14, pkgs: clang-14 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04 },
{ cxx: g++-14, pkgs: g++-14 },
{ cxx: clang++-15, pkgs: clang-15 },
{ cxx: clang++-16, pkgs: clang-16 },
{ cxx: clang++-17, pkgs: clang-17 },
{ cxx: clang++-18, pkgs: clang-18 },
]

defaults:
Expand All @@ -28,17 +34,17 @@ jobs:
uses: actions/checkout@v4

- name: setup-compiler
run: sudo apt update && sudo apt install --allow-downgrades -y ${{ matrix.compiler.pkgs }}
run: apt update && apt install --allow-downgrades -y ${{ matrix.common-pkgs }} ${{ matrix.compiler.pkgs }}

- name: setup-catch
env:
CXX: ${{ matrix.compiler.cxx }}
run: sudo bash ../tools/install_catch.sh
run: bash ../tools/install_catch.sh

- name: setup-build
env:
CXX: ${{ matrix.compiler.cxx }}
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_USE_WERROR=ON -DGAPP_USE_LTO=ON
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_USE_WERROR=ON -DGAPP_USE_LTO=ON -DGAPP_CXX_FLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS"

- name: build
run: cmake --build . --parallel 8
Expand All @@ -47,4 +53,4 @@ jobs:
run: ctest --output-on-failure --schedule-random

- name: install
run: sudo cmake --install .
run: cmake --install .
24 changes: 8 additions & 16 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@ on: [push, pull_request]

jobs:
build:
runs-on: macos-13
runs-on: macos-14
strategy:
fail-fast: false
matrix:
build-type: [ Release, RelWithDebInfo ]
compiler: [
{ cxx: g++-11, pkgs: gcc@11, extra-flags: "-undefined dynamic_lookup" },
{ cxx: g++-12, pkgs: gcc@12, extra-flags: "-undefined dynamic_lookup" },
{ cxx: g++-13, pkgs: gcc@13, extra-flags: "-undefined dynamic_lookup -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread" },
{
cxx: $(brew --prefix llvm@14)/bin/clang++,
pkgs: llvm@14 gcc@11,
extra-flags: "-femulated-tls -stdlib=libstdc++ -stdlib++-isystem $(brew --prefix gcc@11)/include/c++/11 -cxx-isystem $(brew --prefix gcc@11)/include/c++/11/x86_64-apple-darwin22",
linker-flags: "-L$(brew --prefix gcc@11)/lib/gcc/11"
},
{ cxx: g++-11, pkgs: gcc@11, extra-flags: "-undefined dynamic_lookup -Wno-psabi" },
{ cxx: g++-12, pkgs: gcc@12, extra-flags: "-undefined dynamic_lookup -Wno-psabi" },
{ cxx: g++-13, pkgs: gcc@13, extra-flags: "-undefined dynamic_lookup -Wno-psabi" },
{ cxx: g++-14, pkgs: gcc@14, extra-flags: "-undefined dynamic_lookup -Wno-psabi" },
{
cxx: $(brew --prefix llvm@15)/bin/clang++,
pkgs: llvm@15 gcc@12,
extra-flags: "-femulated-tls -stdlib=libstdc++ -stdlib++-isystem $(brew --prefix gcc@12)/include/c++/12 -cxx-isystem $(brew --prefix gcc@12)/include/c++/12/x86_64-apple-darwin22",
linker-flags: "-L$(brew --prefix gcc@12)/lib/gcc/12"
pkgs: llvm@15 gcc@11,
extra-flags: "-femulated-tls -stdlib=libstdc++ -stdlib++-isystem $(brew --prefix gcc@11)/include/c++/11 -cxx-isystem $(brew --prefix gcc@11)/include/c++/11/aarch64-apple-darwin23",
linker-flags: "-L$(brew --prefix gcc@11)/lib/gcc/11"
}
]

Expand All @@ -40,9 +35,6 @@ jobs:
- name: setup-compiler
run: brew update && brew install ${{ matrix.compiler.pkgs }}

- name: setup-xcode
run: sudo xcode-select -switch /Applications/Xcode_15.1.app

- name: setup-catch
run: sudo bash ../tools/install_catch.sh -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sanitizer: [ address, undefined, thread ]
include:
- cxx: clang++-15
pkgs: clang-15 llvm-15
- cxx: clang++-18
pkgs: clang-18 llvm-18

env:
ASAN_OPTIONS: check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:detect_leaks=1
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
build-type: [ Release, RelWithDebInfo ]
platform: [ x64, Win32 ]
generator: [ "Visual Studio 17 2022" ]
compiler: [ v143, ClangCL ]
compiler: [
{ name: msvc, toolset: v143 },
{ name: clang, toolset: ClangCL }
]
build-shared: [ "ON", "OFF" ]
exclude:
- platform: Win32
Expand All @@ -23,7 +26,7 @@ jobs:
run:
working-directory: ${{ github.workspace }}/build

name: ${{ matrix.compiler }}-${{ matrix.platform }}, ${{ matrix.build-type }}, Shared=${{ matrix.build-shared }}
name: ${{ matrix.compiler.name }}-${{ matrix.platform }}, ${{ matrix.build-type }}, Shared=${{ matrix.build-shared }}


steps:
Expand All @@ -36,14 +39,14 @@ jobs:
- name: setup-catch
env:
CMAKE_GENERATOR: ${{ matrix.generator }}
CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler }}
CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler.toolset }}
CMAKE_GENERATOR_PLATFORM: ${{ matrix.platform }}
run: bash ../tools/install_catch.sh

- name: setup-build
env:
CMAKE_GENERATOR: ${{ matrix.generator }}
CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler }}
CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler.toolset }}
CMAKE_GENERATOR_PLATFORM: ${{ matrix.platform }}
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=${{ matrix.build-shared }} -DGAPP_USE_WERROR=ON -DGAPP_USE_LTO=ON

Expand Down
26 changes: 0 additions & 26 deletions .iwyu-mappings

This file was deleted.

5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,16 @@ else() # GNU style compiler interface

# gcc specific options
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(GAPP_WARN_FLAGS "${GAPP_WARN_FLAGS} -Wlogical-op")
# -Warray-bounds, -Wstringop-overflow, -Wstringop-overread are regular false positives since g++-12
set(GAPP_WARN_FLAGS "${GAPP_WARN_FLAGS} -Wlogical-op -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread")
endif()
# clang specific options
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(GAPP_OPT_FLAGS "${GAPP_OPT_FLAGS}")
endif()

set(CMAKE_CXX_FLAGS "${GAPP_CXX_FLAGS} ${GAPP_WARN_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-Og")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS")
set(CMAKE_CXX_FLAGS_RELEASE "-g -DNDEBUG ${GAPP_OPT_FLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g ${GAPP_OPT_FLAGS}")
endif()
Expand Down
3 changes: 2 additions & 1 deletion CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"variables": [
{
"name": "CMAKE_CXX_CLANG_TIDY",
"value": "clang-tidy"
"value": "clang-tidy",
"type": "STRING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The maximum of sin(x) in [0.0, 3.14] is at x = 1.57079

The following are needed for building and using the library:

- C++20 compiler (gcc 11.0, clang 14.0, msvc 14.30 or later)
- C++20 compiler (gcc 11.0, clang 15.0, msvc 14.30 or later)
- CMake 3.21 or later
- Catch2 3.3 or later (optional, only needed for the tests)

Expand Down
6 changes: 4 additions & 2 deletions core-guidelines.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
<!-- Disable rules that are too noisy/not helpful. -->
<Rule Id="C26493" Action="None" /> <!-- Don't use C-style casts. -->
<Rule Id="C26496" Action="None" /> <!-- The variable 'xyz' is assigned only once, mark it as const. -->
<Rule Id="C26814" Action="None" /> <!-- The const variable 'xyz' can be computed at compile time. Use constexpr. -->
<Rule Id="C26814" Action="None" /> <!-- The const variable 'xyz' can be computed at compile time. Use constexpr. -->
<Rule Id="C26812" Action="None" /> <!-- Prefer 'enum class' over 'enum'. -->
<Rule Id="C26455" Action="None" /> <!-- Default constructor should not throw. Declare it 'noexcept'. -->
<Rule Id="C26455" Action="None" /> <!-- Default constructor should not throw. Declare it 'noexcept'. -->
<Rule Id="C26440" Action="None" /> <!-- Function can be declared noexcept. -->
<Rule Id="C26447" Action="None" /> <!-- Function declared as noexcept calls potentially throwing function. -->

<!-- Enable useful rules that are off by default. -->
<Rule Id="C26815" Action="Warning" /> <!-- The pointer is dangling because it points at a temporary instance that was destroyed. -->
Expand Down
2 changes: 1 addition & 1 deletion docs/api/Doxyfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Doxyfile 1.9.1
# Doxyfile 1.9.1

#---------------------------------------------------------------------------
# Project related configuration options
Expand Down
15 changes: 14 additions & 1 deletion docs/api/core/fitness_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,17 @@ class FitnessFunctionBase
:project: gapp
:members:
:protected-members:
:private-members:
:private-members:


class FitnessFunctionInfo
---------------------------------------------------

.. code-block::

#include <core/fitness_function.hpp>

.. doxygenclass:: gapp::FitnessFunctionInfo
:project: gapp
:members:
:protected-members:
2 changes: 1 addition & 1 deletion docs/api/generate_api_docs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh

echo -e "Generating API documentation...\n"

Expand Down
Loading
Loading