Skip to content

Commit

Permalink
Merge branch 'main' into sean-parent/await-docs-update
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-parent committed Jan 25, 2025
2 parents 0f5569c + d80dacd commit 65bb949
Show file tree
Hide file tree
Showing 551 changed files with 2,385 additions and 1,053 deletions.
3 changes: 1 addition & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CheckOptions:
- key: misc-include-cleaner.IgnoreHeaders
value: >
boost/test/.*;
__chrono/.*;
boost/multiprecision/.*
__chrono/.*
HeaderFilterRegex: "^.*\/stlab\/.*$"
# WarningsAsErrors: "*"
4 changes: 2 additions & 2 deletions .github/workflows/jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
uses: ruby/setup-ruby@v1.213.0
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
ruby-version: '3.4.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
Expand Down
40 changes: 19 additions & 21 deletions .github/workflows/stlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
rm '/usr/local/bin/python3.12'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/python3.12-config'
brew install boost
brew install ninja
shell: bash

Expand All @@ -55,26 +54,25 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
sudo apt-get install -y libboost-all-dev
shell: bash

- name: Install dependencies // Windows
if: ${{ startsWith(matrix.config.os, 'windows') }}
run: |
choco install --yes ninja
vcpkg install boost-test:x64-windows boost-multiprecision:x64-windows
# - name: Install dependencies // Windows
# if: ${{ startsWith(matrix.config.os, 'windows') }}
# run: |
# choco install --yes ninja
# vcpkg install boost-test:x64-windows boost-multiprecision:x64-windows
# vcpkg install boost:x64-windows
# dotnet add package boost --version 1.85.0
# choco install --yes boost-msvc-14.3
shell: cmd
# shell: cmd

- name: Install dependencies // Linux Emscripten
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
git clone --depth 1 --recurse-submodules --shallow-submodules --jobs=8 https://github.com/boostorg/boost.git $HOME/boost
# git clone --depth 1 --recurse-submodules --shallow-submodules --jobs=8 https://github.com/boostorg/boost.git $HOME/boost
git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
pushd $HOME/emsdk
Expand Down Expand Up @@ -102,18 +100,18 @@ jobs:
echo "CC=clang-${{matrix.config.version}}" >> $GITHUB_ENV
echo "CXX=clang++-${{matrix.config.version}}" >> $GITHUB_ENV
- name: Compile Boost // Emscripten
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash -l {0}
run: |
mkdir -p ../build-boost
cmake -S $HOME/boost -B ../build-boost -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-builtins" \
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake \
-DBOOST_INCLUDE_LIBRARIES="multiprecision;test"
# - name: Compile Boost // Emscripten
# if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
# shell: bash -l {0}
# run: |
# mkdir -p ../build-boost
# cmake -S $HOME/boost -B ../build-boost -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \
# -DCMAKE_CXX_FLAGS="-Wno-deprecated-builtins" \
# -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake \
# -DBOOST_INCLUDE_LIBRARIES="multiprecision;test"

cmake --build ../build-boost
cmake --install ../build-boost
# cmake --build ../build-boost
# cmake --install ../build-boost

- name: Configure // Unix !Emscripten
if: ${{ (startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')) && !startsWith(matrix.config.compiler, 'emscripten') }}
Expand All @@ -136,7 +134,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir ..\build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=20 -DBoost_USE_STATIC_LIBS=TRUE -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=20
- name: Build // Unix
if: ${{ startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos') }}
Expand Down
2 changes: 1 addition & 1 deletion .hyde-config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hyde-src-root": "stlab",
"hyde-src-root": "stlab/include",
"hyde-yaml-dir": "docs/libraries",
"clang_flags": [
"-std=c++20",
Expand Down
158 changes: 64 additions & 94 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,56 +1,61 @@
cmake_minimum_required( VERSION 3.23 )
cmake_minimum_required(VERSION 3.23)

project( stlab VERSION 1.7.1 LANGUAGES CXX )
project(stlab VERSION 1.7.1 LANGUAGES CXX)

list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" )
include( CTest )
include( CMakeDependentOption )
include( StlabUtil )
# Set the default C++ language version
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package( Boost 1.74.0 OPTIONAL_COMPONENTS unit_test_framework )
find_package( libdispatch )
find_package( Qt5 QUIET COMPONENTS Core )
find_package( Qt6 QUIET COMPONENTS Core )
find_package( Threads )
# Set the default build type to Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(CMakeDependentOption)
include(StlabUtil)
# CTest must be included at the top level for tests to be found.
include(CTest)

find_package(libdispatch)
find_package(Qt5 QUIET COMPONENTS Core)
find_package(Qt6 QUIET COMPONENTS Core)
find_package(Threads)

cmake_dependent_option( stlab.coverage
cmake_dependent_option(stlab.coverage
"Enable binary instrumentation to collect test coverage information in the DEBUG configuration"
OFF PROJECT_IS_TOP_LEVEL OFF )
OFF PROJECT_IS_TOP_LEVEL OFF)

stlab_check_disfunctional_coroutines(STLAB_DEFAULT_NO_STD_COROUTINES)
option( STLAB_NO_STD_COROUTINES "Suppress usage of standard coroutines. Useful for non-conforming compilers." ${STLAB_DEFAULT_NO_STD_COROUTINES} )
option(STLAB_NO_STD_COROUTINES "Suppress usage of standard coroutines. Useful for non-conforming compilers." ${STLAB_DEFAULT_NO_STD_COROUTINES})
stlab_detect_thread_system(STLAB_DEFAULT_THREAD_SYSTEM)
set( STLAB_THREAD_SYSTEM ${STLAB_DEFAULT_THREAD_SYSTEM} CACHE STRING "Thread system to use (win32|pthread|pthread-emscripten|pthread-apple|none)")
set(STLAB_THREAD_SYSTEM ${STLAB_DEFAULT_THREAD_SYSTEM} CACHE STRING "Thread system to use (win32|pthread|pthread-emscripten|pthread-apple|none)")

stlab_detect_task_system(STLAB_DEFAULT_TASK_SYSTEM)
set(STLAB_TASK_SYSTEM ${STLAB_DEFAULT_TASK_SYSTEM} CACHE STRING "Task system to use (portable|libdispatch|windows).")

stlab_detect_main_executor(STLAB_DEFAULT_MAIN_EXECUTOR)
set(STLAB_MAIN_EXECUTOR ${STLAB_DEFAULT_MAIN_EXECUTOR} CACHE STRING "Main executor to use (qt5|qt6|libdispatch|emscripten|none).")

if( BUILD_TESTING AND NOT Boost_unit_test_framework_FOUND )
message( SEND_ERROR "BUILD_TESTING is enabled, but an installation of Boost.Test was not found." )
endif()

if( (NOT STLAB_THREAD_SYSTEM STREQUAL "none") AND NOT Threads_FOUND )
message( SEND_ERROR "STLAB_THREAD_SYSTEM is not \"none\", but a thread system was not found." )
if((NOT STLAB_THREAD_SYSTEM STREQUAL "none") AND NOT Threads_FOUND)
message(SEND_ERROR "STLAB_THREAD_SYSTEM is not \"none\", but a thread system was not found.")
endif()

if( (STLAB_TASK_SYSTEM STREQUAL "libdispatch") AND NOT libdispatch_FOUND )
message( SEND_ERROR "STLAB_TASK_SYSTEM is set to \"libdispatch\", but a libdispatch installation was not found." )
if((STLAB_TASK_SYSTEM STREQUAL "libdispatch") AND NOT libdispatch_FOUND)
message(SEND_ERROR "STLAB_TASK_SYSTEM is set to \"libdispatch\", but a libdispatch installation was not found.")
endif()

if( (STLAB_MAIN_EXECUTOR STREQUAL "libdispatch") AND NOT libdispatch_FOUND )
message( SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"libdispatch\", but a libdispatch installation was not found." )
if((STLAB_MAIN_EXECUTOR STREQUAL "libdispatch") AND NOT libdispatch_FOUND)
message(SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"libdispatch\", but a libdispatch installation was not found.")
endif()

if( (STLAB_MAIN_EXECUTOR STREQUAL "qt5") AND NOT Qt5Core_FOUND )
message( SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"qt5\", but a Qt5 installation was not found." )
if((STLAB_MAIN_EXECUTOR STREQUAL "qt5") AND NOT Qt5Core_FOUND)
message(SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"qt5\", but a Qt5 installation was not found.")
endif()

if( (STLAB_MAIN_EXECUTOR STREQUAL "qt6") AND NOT Qt6Core_FOUND )
message( SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"qt6\", but a Qt6 installation was not found." )
if((STLAB_MAIN_EXECUTOR STREQUAL "qt6") AND NOT Qt6Core_FOUND)
message(SEND_ERROR "STLAB_MAIN_EXECUTOR is set to \"qt6\", but a Qt6 installation was not found.")
endif()

#
Expand All @@ -59,18 +64,18 @@ endif()
# transitively to linking targets. In our case, this ammounts to an include
# directory, compile flags, linking flags, and links to system libraries.
#
add_library( stlab INTERFACE )
add_library( stlab::stlab ALIAS stlab )
add_library(stlab INTERFACE)
add_library(stlab::stlab ALIAS stlab)

#
# The include directory for stlab can be expected to vary between build
# and installaion. Here we use a CMake generator expression to dispatch
# on how the configuration under which this library is being consumed.
#
target_include_directories( stlab INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<INSTALL_INTERFACE:include> )
target_include_directories(stlab INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>/include
$<INSTALL_INTERFACE:include>)

#
# Several definitions are specified for the microsoft compiler. These have
Expand All @@ -79,75 +84,40 @@ target_include_directories( stlab INTERFACE
# + NOMINMAX
# disable the `min` and `max` macros defined in the windows.h header
#
target_compile_definitions( stlab INTERFACE $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX> )
target_compile_definitions(stlab INTERFACE $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX>)

add_subdirectory( stlab )
add_subdirectory(include/stlab)

if ( NOT STLAB_THREAD_SYSTEM STREQUAL "none" )
target_link_libraries( stlab INTERFACE Threads::Threads )
if(NOT STLAB_THREAD_SYSTEM STREQUAL "none")
target_link_libraries(stlab INTERFACE Threads::Threads)
endif()

if (STLAB_TASK_SYSTEM STREQUAL "libdispatch")
if(STLAB_TASK_SYSTEM STREQUAL "libdispatch")
target_link_libraries(stlab INTERFACE libdispatch::libdispatch)
endif()

if (STLAB_MAIN_EXECUTOR STREQUAL "libdispatch")
if(STLAB_MAIN_EXECUTOR STREQUAL "libdispatch")
target_link_libraries(stlab INTERFACE libdispatch::libdispatch)
elseif (STLAB_MAIN_EXECUTOR STREQUAL "qt5")
target_link_libraries( stlab INTERFACE Qt5::Core )
elseif (STLAB_MAIN_EXECUTOR STREQUAL "qt6")
target_link_libraries( stlab INTERFACE Qt6::Core )
elseif(STLAB_MAIN_EXECUTOR STREQUAL "qt5")
target_link_libraries(stlab INTERFACE Qt5::Core)
elseif(STLAB_MAIN_EXECUTOR STREQUAL "qt6")
target_link_libraries(stlab INTERFACE Qt6::Core)
endif()

message(STATUS "stlab: Disable Coroutines: ${STLAB_DEFAULT_NO_STD_COROUTINES}")
message(STATUS "stlab: Thread System: ${STLAB_THREAD_SYSTEM}")
message(STATUS "stlab: Task System: ${STLAB_TASK_SYSTEM}")
message(STATUS "stlab: Main Executor: ${STLAB_MAIN_EXECUTOR}")

if ( BUILD_TESTING )
include( stlab/development )

#
# Establish a convenience target to encapsulate the properties common to the
# stlab tests and establish an alias for uniformity.
#
add_library( testing INTERFACE )
add_library( stlab::testing ALIAS testing )

#
# CMake targets linking to the stlab::testing target will (transitively)
# link to the Boost::unit_test_framework and to stlab::stlab target.
#
target_link_libraries( testing INTERFACE
Boost::unit_test_framework
stlab::development
stlab::stlab )

#
# Linking to the Boost unit test framework requires an additional
# preprocessor definition when the unit test compiled resources are
# provided by a shared library rather than a static library.
#

if (NOT Boost_USE_STATIC_LIBS)
target_compile_definitions( testing INTERFACE BOOST_TEST_DYN_LINK=1)
endif()

add_subdirectory( test )
if(BUILD_TESTING)
add_subdirectory(test)
endif()

include( CMakePackageConfigHelpers ) # provides `write_basic_package_version_file`

#
# We generate a CMake version file for later installation to be consumed by
# CMake's `find_package` intrinsic. Here we specify a semantic version
# convention, i.e., backwards compatability can be assumed within a Major
# version.
#
include(CMakePackageConfigHelpers) # provides `write_basic_package_version_file`
write_basic_package_version_file(
"${stlab_BINARY_DIR}/stlabConfigVersion.cmake"
VERSION ${stlab_VERSION}
COMPATIBILITY SameMajorVersion )
COMPATIBILITY SameMajorVersion)

#
# As a header-only library, there are no target components to be installed
Expand All @@ -170,10 +140,10 @@ install(
# This file is included by (and installed with) the cmake/CMakeConfig.cmake file
# under version control.
#
install( EXPORT stlabTargets
install(EXPORT stlabTargets
FILE stlabTargets.cmake
NAMESPACE stlab::
DESTINATION share/cmake/stlab )
DESTINATION share/cmake/stlab)

#
# Install the CMake configuration files to the `share/cmake/stlab` subdirectory
Expand All @@ -185,11 +155,11 @@ install( EXPORT stlabTargets
configure_file(
"${stlab_SOURCE_DIR}/cmake/stlabConfig.cmake.in"
"${stlab_BINARY_DIR}/stlabConfig.cmake"
@ONLY )
install( FILES
@ONLY)
install(FILES
"${stlab_BINARY_DIR}/stlabConfig.cmake"
"${stlab_BINARY_DIR}/stlabConfigVersion.cmake"
DESTINATION share/cmake/stlab )
DESTINATION share/cmake/stlab)

#
# Rudimentary CPack support.
Expand All @@ -216,8 +186,8 @@ install( FILES
#
# See `cpack --help` or the CPack documentation for more information.
#
include( InstallRequiredSystemLibraries )
set( CPACK_PACKAGE_VENDOR "Adobe Software Technology Lab" )
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
set( CMAKE_PROJECT_HOMEPAGE_URL "https://stlab.cc/libraries/" )
include( CPack )
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VENDOR "Adobe Software Technology Lab")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CMAKE_PROJECT_HOMEPAGE_URL "https://stlab.cc/libraries/")
include(CPack)
Loading

0 comments on commit 65bb949

Please sign in to comment.