Skip to content

Commit

Permalink
Merge branch 'test' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Nov 2, 2023
2 parents e2a80b5 + 39fcd57 commit a1f5b3d
Show file tree
Hide file tree
Showing 61 changed files with 13,448 additions and 13,796 deletions.
71 changes: 71 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'true'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: 'true'
ColumnLimit: '100'
CompactNamespaces: 'true'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
ConstructorInitializerIndentWidth: '8'
ContinuationIndentWidth: '2'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
FixNamespaceComments: 'true'
IncludeBlocks: Merge
IndentCaseLabels: 'true'
IndentPPDirectives: AfterHash
IndentWidth: '4'
IndentWrappedFunctionNames: 'false'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: All
PointerAlignment: Right
SortIncludes: 'false'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '1'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Always
AccessModifierOffset: -4
...
7 changes: 6 additions & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ jobs:
pretty: "LibRapid_Windows-Latest_MSVC_C++23"

steps:
- name: Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1.8.7
with:
theme: "dark"

- name: Checkout LibRapid
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -693,7 +698,7 @@ jobs:
name: Trigger Documentation Build
needs: [ compile, build-docs, quodona, code-coverage ]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
if: github.event_name == 'push'
steps:
- name: Checkout LibRapid
uses: actions/checkout@v4
Expand Down
66 changes: 46 additions & 20 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ jobs:
# pythonType: "pp"

steps:
- name: Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1.8.7
with:
theme: "dark"

- name: Checkout LibRapid
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -284,28 +289,30 @@ jobs:
run: pip install -r requirements.txt

- name: Install XCode
if: matrix.os == 'macos-latest'
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1.5.1
with:
xcode-version: latest

# This doesn't work for some reason
# - name: Install Clang
# if: matrix.os == 'macos-latest'
# uses: KyleMayes/install-llvm-action@v1
# with:
# version: "15.0"
# directory: "./llvm"
# env: on

- name: Install Clang
if: matrix.os == 'macos-latest'
if: runner.os == 'macOS'
run: |
rm -f '/usr/local/bin/2to3*'
brew install llvm libomp
- name: Install Clang
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1
with:
version: '15.0'
directory: ${RUNNER_TOOL_CACHE}
env: on

- name: Build Wheels
if: runner.os == 'macOS'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
CIBW_ARCHS: all
Expand All @@ -321,15 +328,15 @@ jobs:
LIBRAPID_GET_FFTW: OFF
CC: /usr/local/opt/llvm/bin/clang
CXX: /usr/local/opt/llvm/bin/clang++
# CC: $(brew --prefix llvm)/bin/clang
# CXX: $(brew --prefix llvm)/bin/clang++
CIBW_ENVIRONMENT: CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
CMAKE_C_COMPILER: /usr/local/opt/llvm/bin/clang
CMAKE_CXX_COMPILER: /usr/local/opt/llvm/bin/clang++

- name: Build Wheels
if: runner.os == 'Windows'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Build Wheels
if: runner.os != 'macOS'
env:
CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
CIBW_ARCHS: all
Expand All @@ -342,10 +349,29 @@ jobs:
GITHUB_ACTIONS: ON
LIBRAPID_GET_BLAS: ON
LIBRAPID_GET_FFTW: OFF
CC: ${RUNNER_TOOL_CACHE}/llvm/bin/clang
CXX: ${RUNNER_TOOL_CACHE}/llvm/bin/clang++
CIBW_ENVIRONMENT: CC=${RUNNER_TOOL_CACHE}/llvm/bin/clang CXX=${RUNNER_TOOL_CACHE}/llvm/bin/clang++
CMAKE_C_COMPILER: ${RUNNER_TOOL_CACHE}/llvm/bin/clang
CMAKE_CXX_COMPILER: ${RUNNER_TOOL_CACHE}/llvm/bin/clang++

- name: Build Wheels
if: runner.os == 'Linux'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.pythonType }}${{ matrix.pythonVersion }}-${{ matrix.platformID }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BUILD_VERBOSITY: 1
CMAKE_BUILD_PARALLEL_LEVEL: 1
GITHUB_ACTIONS: ON
LIBRAPID_GET_BLAS: ON
LIBRAPID_GET_FFTW: OFF

- name: Store Artifacts
uses: actions/upload-artifact@v3
Expand All @@ -359,7 +385,7 @@ jobs:

steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -392,7 +418,7 @@ jobs:

steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -545,7 +571,7 @@ jobs:
#
# steps:
# - name: Checkout LibRapid
# uses: actions/checkout@v3
# uses: actions/checkout@v4
# with:
# submodules: recursive
#
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ librapid/librapid.egg-info
librapid/bindings/python/generated

dist/
librapid/bindings/generators/*.hpp
librapid/bindings/generators/*.cpp

*.pyc
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ formats: all
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "mambaforge-22.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
75 changes: 44 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmake_policy(SET CMP0077 NEW)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS "[ LIBRAPID ] LibRapid is a top-level project. Using C++23")
set(CMAKE_CXX_STANDARD 23)
message(STATUS "[ LIBRAPID ] Building ${CMAKE_BUILD_TYPE}")
endif ()

# LibRapid requires C++20 or later
Expand Down Expand Up @@ -83,11 +84,28 @@ file(GLOB_RECURSE LIBRAPID_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/cxxblas/*.cxx" # Source files
)

# Extract system information
set(IS_LINUX OFF)
set(IS_MACOS OFF)
set(IS_WINDOWS OFF)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(IS_LINUX ON)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(IS_MACOS ON)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(IS_WINDOWS ON)

# Disable shared libraries, since they just cause problems on Windows
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
endif ()

if (${SKBUILD})
message(STATUS "[ LIBRAPID ] Building for Python")
set(module_name "_librapid")

set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
set(LIBRAPID_QUIET ON) # Disable warnings for a cleaner output.

message(STATUS "[ LIBRAPID ] Cloning PyBind11")
FetchContent_Declare(
Expand Down Expand Up @@ -117,51 +135,63 @@ if (${SKBUILD})
# Enable BLAS
if (NOT ${LIBRAPID_NO_BLAS})
set(LIBRAPID_USE_BLAS ON)
endif()
endif ()

# Get BLAS if the environment variable is set
if ($ENV{LIBRAPID_GET_BLAS})
set(LIBRAPID_GET_BLAS ON)
endif()
endif ()

# Use fast math if the environment variable is set
if ($ENV{LIBRAPID_FAST_MATH})
set(LIBRAPID_FAST_MATH ON)
endif()
endif ()

# Get FFTW if the environment variable is set
if ($ENV{LIBRAPID_GET_FFTW})
set(LIBRAPID_GET_FFTW ON)
endif()
endif ()

# Use CUDA/OpenCL only when not inside GitHub Actions
if (NOT $ENV{GITHUB_ACTIONS})
set(LIBRAPID_USE_CUDA ON)
set(LIBRAPID_USE_OPENCL ON)
endif()
set(LIBRAPID_NATIVE_ARCH ON)
else()
set(LIBRAPID_NO_ALWAYS_INLINE ON) # Reduce compile memory
endif ()

set(LIBRAPID_USE_OMP ON)
set(LIBRAPID_OPTIMISE_SMALL_ARRAYS OFF)

# Disable multiprec
set(LIBRAPID_USE_MULTIPREC OFF)
set(LIBRAPID_GET_MULTIPREC OFF)


file(GLOB_RECURSE PYTHON_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.hpp" # Header files
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.cpp" # Source files
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.hpp" # Header files
"${CMAKE_CURRENT_SOURCE_DIR}/librapid/bindings/python/*.cpp" # Source files
)

pybind11_add_module(
${module_name} MODULE
${module_name} MODULE

${LIBRAPID_SOURCES}
${PYTHON_SOURCES}
${LIBRAPID_SOURCES}
${PYTHON_SOURCES}
)

target_compile_definitions(${module_name} PUBLIC
LIBRAPID_PYTHON
LIBRAPID_NO_ALWAYS_INLINE
WIN32_LEAN_AND_MEAN
)
install(TARGETS ${module_name} DESTINATION .)
else()
else ()
set(module_name "librapid")
add_library(${module_name} STATIC ${LIBRAPID_SOURCES})
endif()
add_library(${module_name} STATIC ${LIBRAPID_SOURCES}
librapid/include/librapid/core/log.hpp)
endif ()

# clang-format off
target_compile_definitions(${module_name} PUBLIC LIBRAPID_MAJOR=${LIBRAPID_MAJOR})
Expand All @@ -177,23 +207,6 @@ if (LIBRAPID_USE_PRECOMPILED_HEADER)
target_precompile_headers(${module_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/librapid/include/librapid/core/librapidPch.hpp")
endif ()

# Extract system information
set(IS_LINUX OFF)
set(IS_MACOS OFF)
set(IS_WINDOWS OFF)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(IS_LINUX ON)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(IS_MACOS ON)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(IS_WINDOWS ON)

# Disable shared libraries, since they just cause problems on Windows
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
endif ()

if (MINGW)
message(FATAL_ERROR "LibRapid does not compile with MinGW. Please use MSVC or Clang instead.")
endif ()
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<img src="https://raw.githubusercontent.com/LibRapid/librapid_extras/master/branding/LibRapid_light.png">
</picture>

![C++ Version](https://img.shields.io/badge/C++-20/23-purple.svg?style=flat&logo=c%2B%2B) ![License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat) [![Discord](https://img.shields.io/discord/848914274105557043?color=blue&label=Discord&logo=Discord)](https://discord.gg/cGxTFTgCAC)
![C++ Version](https://img.shields.io/badge/C++-20/23-purple.svg?style=flat&logo=c%2B%2B) ![License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat) [![Discord](https://img.shields.io/discord/848914274105557043?color=blue&label=Discord&logo=Discord)](https://discord.gg/cGxTFTgCAC)![PyPI - Downloads](https://img.shields.io/pypi/dm/librapid?label=PyPI%20Downloads&link=https%3A%2F%2Fpypi.org%2Fproject%2Flibrapid%2F)


---

Expand Down
Loading

0 comments on commit a1f5b3d

Please sign in to comment.