Skip to content
Merged
88 changes: 88 additions & 0 deletions .github/workflows/ci_modular_io_system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI - IO and system modules

on: [push, pull_request]

env:
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
CTEST_PARALLEL_LEVEL: "2"
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"

jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain:
- {compiler: gcc, version: 14}
build: [cmake]
with_ansi: [On, Off]
with_io: [On, Off]
with_logger: [On, Off]
with_stringlist: [On, Off]
with_system: [On, Off]
env:
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: 3.x

- name: Install fypp
run: pip install --upgrade fypp ninja

- name: Setup Fortran compiler
uses: fortran-lang/[email protected]
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

# Build and test with built-in BLAS and LAPACK
- name: Configure with CMake
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
cmake -Wdev -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MAXIMUM_RANK:String=4
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DFIND_BLAS:STRING=FALSE
-DSTDLIB_ANSI:STRING=${{ matrix.with_ansi }}
-DSTDLIB_IO:STRING=${{ matrix.with_io }}
-DSTDLIB_LOGGER:STRING=${{ matrix.with_logger }}
-DSTDLIB_STRINGLIST:STRING=${{ matrix.with_stringlist }}
-DSTDLIB_SYSTEM:STRING=${{ matrix.with_system }}
-S . -B ${{ env.BUILD_DIR }}

- name: Build and compile
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --parallel

- name: catch build fail
if: ${{ failure() && contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1

- name: test
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
ctest
--test-dir ${{ env.BUILD_DIR }}
--parallel
--output-on-failure
--no-tests=error

- name: Install project
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --install ${{ env.BUILD_DIR }}
86 changes: 86 additions & 0 deletions .github/workflows/ci_modular_math.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI - Mathematical modules

on: [push, pull_request]

env:
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
CTEST_PARALLEL_LEVEL: "2"
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"

jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain:
- {compiler: gcc, version: 14}
build: [cmake]
with_linalg_iterative: [On, Off]
with_quadrature: [On, Off]
with_specialmatrices: [On, Off]
with_stats: [On, Off]
env:
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: 3.x

- name: Install fypp
run: pip install --upgrade fypp ninja

- name: Setup Fortran compiler
uses: fortran-lang/[email protected]
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

# Build and test with built-in BLAS and LAPACK
- name: Configure with CMake
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
cmake -Wdev -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MAXIMUM_RANK:String=4
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DFIND_BLAS:STRING=FALSE
-DSTDLIB_LINALG_ITERATIVE:STRING=${{ matrix.with_linalg_iterative }}
-DSTDLIB_QUADRATURE:STRING=${{ matrix.with_quadrature }}
-DSTDLIB_SPECIALMATRICES:STRING=${{ matrix.with_specialmatrices }}
-DSTDLIB_STATS:STRING=${{ matrix.with_stats }}
-S . -B ${{ env.BUILD_DIR }}

- name: Build and compile
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --parallel

- name: catch build fail
if: ${{ failure() && contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1

- name: test
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
ctest
--test-dir ${{ env.BUILD_DIR }}
--parallel
--output-on-failure
--no-tests=error

- name: Install project
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --install ${{ env.BUILD_DIR }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci_modular
name: CI - Utilities modules

on: [push, pull_request]

Expand All @@ -23,10 +23,8 @@ jobs:
toolchain:
- {compiler: gcc, version: 14}
build: [cmake]
with_ansi: [On, Off]
with_bitset: [On, Off]
with_hashmaps: [On, Off]
with_stats: [On, Off]
env:
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}

Expand Down Expand Up @@ -58,10 +56,8 @@ jobs:
-DCMAKE_MAXIMUM_RANK:String=4
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DFIND_BLAS:STRING=FALSE
-DSTDLIB_ANSI:STRING=${{ matrix.with_ansi }}
-DSTDLIB_BITSET:STRING=${{ matrix.with_bitset }}
-DSTDLIB_HASHMAPS:STRING=${{ matrix.with_hashmaps }}
-DSTDLIB_STATS:STRING=${{ matrix.with_stats }}
-S . -B ${{ env.BUILD_DIR }}

- name: Build and compile
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ endif()
check_modular("ANSI")
check_modular("BITSETS")
check_modular("HASHMAPS")
check_modular("IO")
check_modular("LINALG_ITERATIVE")
check_modular("LOGGER")
check_modular("QUADRATURE")
check_modular("SPECIALMATRICES")
check_modular("STRINGLIST")
check_modular("STATS")
check_modular("SYSTEM")

option(FIND_BLAS "Find external BLAS and LAPACK" ON)

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,14 @@ The table below lists all *C preprocessing* macros and flags currently used by `
| `STDLIB_EXTERNAL_BLAS_I64` | Links against an external BLAS with ILP64 (64-bit integer) interfaces. Usually paired with `STDLIB_EXTERNAL_LAPACK_I64`. |
| `STDLIB_EXTERNAL_LAPACK_I64` | Links against an external LAPACK with ILP64 (64-bit integer) interfaces. |
| `STDLIB_HASHMAPS` | Enables compilation of the `stdlib_hashmaps` module when set to 1 (default). Set via CMake with `-DSTDLIB_HASHMAPS=On/Off`. |
| `STDLIB_IO` | Enables compilation of the `stdlib_io` module when set to 1 (default). Set via CMake with `-DSTDLIB_IO=On/Off`. |
| `STDLIB_LINALG_ITERATIVE` | Enables compilation of the `stdlib_linalg_iterative_solvers` module when set to 1 (default). Set via CMake with `-DSTDLIB_LINALG_ITERATIVE=On/Off`. |
| `STDLIB_LOGGER` | Enables compilation of the `stdlib_logger` module when set to 1 (default). Set via CMake with `-DSTDLIB_LOGGER=On/Off`. |
| `STDLIB_QUADRATURE` | Enables compilation of the `stdlib_quadrature` module when set to 1 (default). Set via CMake with `-DSTDLIB_QUADRATURE=On/Off`. |
| `STDLIB_SPECIALMATRICES` | Enables compilation of the `stdlib_specialmatrices` module when set to 1 (default). Set via CMake with `-DSTDLIB_SPECIALMATRICES=On/Off`. |
| `STDLIB_STATS` | Enables compilation of the `stdlib_stats` module when set to 1 (default). Set via CMake with `-DSTDLIB_STATS=On/Off`. |
| `STDLIB_STRINGLIST` | Enables compilation of the `stdlib_stringlist` module when set to 1 (default). Set via CMake with `-DSTDLIB_STRINGLIST=On/Off`. |
| `STDLIB_SYSTEM` | Enables compilation of the `stdlib_system` module when set to 1 (default). Set via CMake with `-DSTDLIB_SYSTEM=On/Off`. |

## Using stdlib in your project

Expand Down
24 changes: 18 additions & 6 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,37 @@ if (STDLIB_HASHMAPS)
endif()
add_subdirectory(hash_procedures)
add_subdirectory(intrinsics)
add_subdirectory(io)
if (STDLIB_IO)
add_subdirectory(io)
endif()
add_subdirectory(linalg)
add_subdirectory(logger)
if (STDLIB_LOGGER)
add_subdirectory(logger)
endif()
add_subdirectory(math)
add_subdirectory(optval)
add_subdirectory(quadrature)
if (STDLIB_QUADRATURE)
add_subdirectory(quadrature)
endif()
add_subdirectory(selection)
add_subdirectory(sorting)
add_subdirectory(specialfunctions_gamma)
add_subdirectory(specialmatrices)
if (STDLIB_SPECIALMATRICES)
add_subdirectory(specialmatrices)
endif()
if (STDLIB_STATS)
add_subdirectory(stats)
add_subdirectory(stats_distribution_exponential)
add_subdirectory(stats_distribution_normal)
add_subdirectory(stats_distribution_uniform)
add_subdirectory(random)
endif()
add_subdirectory(stringlist_type)
if (STDLIB_STRINGLIST)
add_subdirectory(stringlist_type)
endif()
add_subdirectory(strings)
add_subdirectory(string_type)
add_subdirectory(system)
if (STDLIB_SYSTEM)
add_subdirectory(system)
endif()
add_subdirectory(version)
12 changes: 7 additions & 5 deletions example/linalg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ ADD_EXAMPLE(get_norm)
ADD_EXAMPLE(solve1)
ADD_EXAMPLE(solve2)
ADD_EXAMPLE(solve3)
ADD_EXAMPLE(solve_bicgstab)
ADD_EXAMPLE(solve_bicgstab_wilkinson)
ADD_EXAMPLE(solve_cg)
ADD_EXAMPLE(solve_pcg)
ADD_EXAMPLE(solve_custom)
if (STDLIB_LINALG_ITERATIVE)
ADD_EXAMPLE(solve_bicgstab)
ADD_EXAMPLE(solve_bicgstab_wilkinson)
ADD_EXAMPLE(solve_cg)
ADD_EXAMPLE(solve_pcg)
ADD_EXAMPLE(solve_custom)
endif()
ADD_EXAMPLE(sparse_from_ijv)
ADD_EXAMPLE(sparse_data_accessors)
ADD_EXAMPLE(sparse_spmv)
Expand Down
35 changes: 35 additions & 0 deletions include/macros.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,41 @@
#define STDLIB_HASHMAPS 1
#endif

!Default: compile the io module
#if !defined STDLIB_IO
#define STDLIB_IO 1
#endif

!Default: compile the linalg_iterative module
#if !defined STDLIB_LINALG_ITERATIVE
#define STDLIB_LINALG_ITERATIVE 1
#endif

!Default: compile the logger module
#if !defined STDLIB_LOGGER
#define STDLIB_LOGGER 1
#endif

!Default: compile the quadrature module
#if !defined STDLIB_QUADRATURE
#define STDLIB_QUADRATURE 1
#endif

!Default: compile the specialmatrices module
#if !defined STDLIB_SPECIALMATRICES
#define STDLIB_SPECIALMATRICES 1
#endif

!Default: compile the stringlist module
#if !defined STDLIB_STRINGLIST
#define STDLIB_STRINGLIST 1
#endif

!Default: compile the system module
#if !defined STDLIB_SYSTEM
#define STDLIB_SYSTEM 1
#endif

!Default: compile the stats module
#if !defined STDLIB_STATS
#define STDLIB_STATS 1
Expand Down
21 changes: 7 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ add_subdirectory(hash)
ADD_SUBDIR(hashmaps)

add_subdirectory(intrinsics)
add_subdirectory(io)
ADD_SUBDIR(io)

add_subdirectory(lapack)
add_subdirectory(lapack_extended)
add_subdirectory(linalg_core)
add_subdirectory(linalg_iterative)
ADD_SUBDIR(linalg_iterative)
add_subdirectory(linalg)
add_subdirectory(logger)
ADD_SUBDIR(logger)
add_subdirectory(math)
add_subdirectory(quadrature)
ADD_SUBDIR(quadrature)
add_subdirectory(selection)
add_subdirectory(sorting)
add_subdirectory(specialfunctions)
add_subdirectory(specialmatrices)
add_subdirectory(stringlist)
ADD_SUBDIR(specialmatrices)
ADD_SUBDIR(stringlist)
add_subdirectory(strings)
add_subdirectory(system)
ADD_SUBDIR(system)

ADD_SUBDIR(stats)

Expand All @@ -61,20 +61,13 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
${PROJECT_NAME}_core
${PROJECT_NAME}_hash
${PROJECT_NAME}_intrinsics
${PROJECT_NAME}_io
${PROJECT_NAME}_linalg_core
${PROJECT_NAME}_linalg_iterative
${PROJECT_NAME}_linalg
${PROJECT_NAME}_logger
${PROJECT_NAME}_math
${PROJECT_NAME}_quadrature
${PROJECT_NAME}_selection
${PROJECT_NAME}_specialfunctions
${PROJECT_NAME}_specialmatrices
${PROJECT_NAME}_sorting
${PROJECT_NAME}_stringlist
${PROJECT_NAME}_strings
${PROJECT_NAME}_system
${PROJECT_NAME}_blas ${PROJECT_NAME}_lapack ${PROJECT_NAME}_lapack_extended
${PROJECT_NAME}_sparse
${OPTIONAL_LIB}
Expand Down
Loading
Loading