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

Firefly v3 implementation with template support and utilities #15

Merged
merged 2 commits into from
Oct 5, 2024
Merged
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
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BasedOnStyle: LLVM
ColumnLimit: 120
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: false
AfterClass: false
AlwaysBreakTemplateDeclarations: Yes
AllowShortFunctionsOnASingleLine: Empty
8 changes: 8 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

Checks: 'clang-diagnostic-*,clang-analyzer-*'
HeaderFileExtensions:
- hpp
ImplementationFileExtensions:
- cpp

Binary file added .github/apt-sources/ubuntu-archive-keyring.gpg
Binary file not shown.
44 changes: 44 additions & 0 deletions .github/apt-sources/ubuntu.sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

## Ubuntu distribution repository
##
## The following settings can be adjusted to configure which packages to use from Ubuntu.
## Mirror your choices (except for URIs and Suites) in the security section below to
## ensure timely security updates.
##
## Types: Append deb-src to enable the fetching of source package.
## URIs: A URL to the repository (you may add multiple URLs)
## Suites: The following additional suites can be configured
## <name>-updates - Major bug fix updates produced after the final release of the
## distribution.
## <name>-backports - software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
## Components: Aside from main, the following components can be added to the list
## restricted - Software that may not be under a free license, or protected by patents.
## universe - Community maintained packages. Software in this repository receives maintenance
## from volunteers in the Ubuntu community, or a 10 year security maintenance
## commitment from Canonical when an Ubuntu Pro subscription is attached.
## multiverse - Community maintained of restricted. Software from this repository is
## ENTIRELY UNSUPPORTED by the Ubuntu team, and may not be under a free
## licence. Please satisfy yourself as to your rights to use the software.
## Also, please note that software in multiverse WILL NOT receive any
## review or updates from the Ubuntu security team.
##
## See the sources.list(5) manual page for further settings.
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

## Ubuntu security updates. Aside from URIs and Suites,
## this should mirror your choices in the previous section.
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
26 changes: 9 additions & 17 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Deploy docs

on:
push:
branches: ["master"]
release:
types: published
workflow_dispatch:

permissions:
Expand All @@ -21,28 +21,20 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
submodules: true
- name: Install doxygen
run: |
- run: |
sudo apt install graphviz -y
wget https://github.com/doxygen/doxygen/releases/download/Release_1_9_7/doxygen-1.9.7.linux.bin.tar.gz
tar xf doxygen-1.9.7.linux.bin.tar.gz
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Pre-processing README.md
run: |
sed -i 's|\(tests/CMakeLists\.txt#L5\)|https://github.com/tbhaxor/firefly/blob/master/\1|' README.md
- name: Build documentation
- uses: actions/configure-pages@v3
- name: build documentation
run: |
./doxygen-1.9.7/bin/doxygen
touch docs/html/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
- uses: actions/upload-pages-artifact@v2
with:
path: 'docs/html'
- name: Deploy to GitHub Pages
path: "docs/html"
- uses: actions/deploy-pages@v2
id: deployment
uses: actions/deploy-pages@v2
124 changes: 20 additions & 104 deletions .github/workflows/unit_testing.yaml
Original file line number Diff line number Diff line change
@@ -1,124 +1,40 @@
name: Unit Testing

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize]

jobs:
ensure_tests:
name: Ensure No Missing Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout repository
- run: |
./scripts/test_generator.sh
name: Run test generator script

unit_test_gcc_linux:
name: Linux (GCC=v${{ matrix.version }}, Double=${{ matrix.double-precision }})
needs: [ ensure_tests ]
unit_test_gcc:
strategy:
matrix:
version: [9, 10, 11, 12, 13]
double-precision: [ON, OFF]
version: [13, 14]
runs-on: ubuntu-latest
env:
CC: gcc-${{ matrix.version }}
CXX: g++-${{ matrix.version }}
steps:
- uses: actions/checkout@v3
name: Checkout repository
- uses: egor-tensin/[email protected]
name: Install GCC
with:
version: ${{ matrix.version }}
- run: |
cmake -Bbuild -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_DOUBLE_PRECISION=${{ matrix.double-precision }} -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
name: Configure and build binaries
sudo cp .github/apt-sources/ubuntu.sources /etc/apt/sources.list.d/
sudo cp .github/apt-sources/ubuntu-archive-keyring.gpg /usr/share/keyrings/ubuntu-archive-keyring.gpg
sudo apt update
sudo apt install build-essential gcc-${{ matrix.version }} g++-${{ matrix.version }} -y
- run: |
ctest --output-on-failure
name: Run tests
working-directory: build/tests

unit_test_llvm_linux:
name: Linux (LLVM=v${{ matrix.version }}, Double=${{ matrix.double-precision }})
needs: [ ensure_tests ]
cmake -Bbuild -DCMAKE_C_COMPILER=gcc-${{ matrix.version }} -DCMAKE_CXX_COMPILER=g++-${{ matrix.version }} -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
- run: ctest --test-dir build/tests --output-on-failure

unit_test_llvm:
strategy:
matrix:
version: [11, 12, 13, 14, 15, 16]
double-precision: [ON, OFF]
version: [16, 17, 18]
runs-on: ubuntu-latest
env:
CC: clang-${{ matrix.version }}
CXX: clang++-${{ matrix.version }}
steps:
- uses: actions/checkout@v3
name: Checkout repository
- uses: egor-tensin/[email protected]
name: Install LLVM
with:
version: ${{ matrix.version }}
- run: |
cmake -Bbuild -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_DOUBLE_PRECISION=${{ matrix.double-precision }} -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
name: Configure and build binaries
- run: |
ctest --output-on-failure
name: Run tests
working-directory: build/tests

unit_test_gcc_macos:
name: MacOS (GCC=v${{ matrix.version }}, Double=${{ matrix.double-precision }})
needs: [ ensure_tests ]
strategy:
matrix:
version: [10, 11, 12, 13]
double-precision: [ON, OFF]
runs-on: macos-latest
env:
CC: gcc-${{ matrix.version }}
CXX: g++-${{ matrix.version }}
steps:
- uses: actions/checkout@v3
name: Checkout repository
- run: |
brew install gcc@${{ matrix.version }}
name: Install GCC
- run: |
cmake -Bbuild -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_DOUBLE_PRECISION=${{ matrix.double-precision }} -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
name: Configure and build binaries
- run: |
ctest --output-on-failure
name: Run tests
working-directory: build/tests

unit_test_llvm_macos:
name: MacOS (LLVM=v${{ matrix.version }}, Double=${{ matrix.double-precision }})
needs: [ ensure_tests ]
strategy:
matrix:
version: [12, 13, 14, 15, 16]
double-precision: [ON, OFF]
runs-on: macos-latest
env:
CC: /usr/local/opt/llvm@${{ matrix.version }}/bin/clang
CXX: /usr/local/opt/llvm@${{ matrix.version }}/bin/clang++
steps:
- uses: actions/checkout@v3
name: Checkout repository
- run: |
brew install llvm@${{ matrix.version }}
name: Install LLVM
- run: |
cmake -Bbuild -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_DOUBLE_PRECISION=${{ matrix.double-precision }} -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
name: Configure and build binaries
sudo cp .github/apt-sources/ubuntu.sources /etc/apt/sources.list.d/
sudo cp .github/apt-sources/ubuntu-archive-keyring.gpg /usr/share/keyrings/ubuntu-archive-keyring.gpg
sudo apt update
sudo apt install build-essential clang-${{ matrix.version }} -y
- run: |
ctest --output-on-failure
name: Run tests
working-directory: build/tests
cmake -Bbuild -DCMAKE_C_COMPILER=clang-${{ matrix.version }} -DCMAKE_CXX_COMPILER=clang++-${{ matrix.version }} -DFirefly_ENABLE_TESTS=ON -DFirefly_ENABLE_EXAMPLES=ON
cmake --build build
- run: ctest --test-dir build/tests --output-on-failure
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _deps

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
Expand Down
33 changes: 0 additions & 33 deletions .vscode/settings.json

This file was deleted.

24 changes: 6 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
cmake_minimum_required(VERSION 3.10)

project(firefly)
set(PROJECT_VERSION 2.1.0)
set(CMAKE_CXX_STANDARD 17)

set(PROJECT_VERSION 3.0.0)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

cmake_policy(SET CMP0135 NEW)
cmake_policy(SET CMP0076 NEW)

option(Firefly_ENABLE_DOUBLE_PRECISION "Whether or not to enable double precision. If this is false, float will be used." ON)
option(Firefly_ENABLE_EXAMPLES "Whether or not to enable examples" OFF)
option(Firefly_ENABLE_TESTS "Whether or not to enable tests" OFF)

if (${Firefly_ENABLE_DOUBLE_PRECISION})
add_definitions(-DDOUBLE_PRECISION=1)
endif()

include_directories(headers)


add_library(${PROJECT_NAME} SHARED)

if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror)
endif()

add_subdirectory(src)
add_library(${PROJECT_NAME} INTERFACE)

if (${Firefly_ENABLE_EXAMPLES})
message(STATUS "Enabling examples build")
Expand All @@ -50,5 +39,4 @@ if (${Firefly_ENABLE_TESTS})
add_subdirectory(tests)
endif()

install(TARGETS ${PROJECT_NAME})
install(DIRECTORY headers/ DESTINATION include)
Loading
Loading