Skip to content

Commit

Permalink
Add Boost.Atomic dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lackhole committed Feb 26, 2025
1 parent 2703553 commit 438cb89
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[submodule "third_party/boost_1_86_0/libs/config"]
path = third_party/boost_1_86_0/libs/config
url = https://github.com/boostorg/config
[submodule "third_party/boost_1_86_0/libs/predef"]
path = third_party/boost_1_86_0/libs/predef
url = https://github.com/boostorg/predef
[submodule "third_party/boost_1_86_0/libs/preprocessor"]
path = third_party/boost_1_86_0/libs/preprocessor
url = https://github.com/boostorg/preprocessor
[submodule "third_party/boost_1_86_0/libs/winapi"]
path = third_party/boost_1_86_0/libs/winapi
url = https://github.com/boostorg/winapi
[submodule "third_party/boost_1_86_0/libs/assert"]
path = third_party/boost_1_86_0/libs/assert
url = https://github.com/boostorg/assert
[submodule "third_party/boost_1_86_0/libs/core"]
path = third_party/boost_1_86_0/libs/core
url = https://github.com/boostorg/core
[submodule "third_party/boost_1_86_0/libs/static_assert"]
path = third_party/boost_1_86_0/libs/static_assert
url = https://github.com/boostorg/static_assert
[submodule "third_party/boost_1_86_0/libs/throw_exception"]
path = third_party/boost_1_86_0/libs/throw_exception
url = https://github.com/boostorg/throw_exception
[submodule "third_party/boost_1_86_0/libs/align"]
path = third_party/boost_1_86_0/libs/align
url = https://github.com/boostorg/align
[submodule "third_party/boost_1_86_0/libs/type_traits"]
path = third_party/boost_1_86_0/libs/type_traits
url = https://github.com/boostorg/type_traits
[submodule "third_party/boost_1_86_0/libs/atomic"]
path = third_party/boost_1_86_0/libs/atomic
url = https://github.com/boostorg/atomic
32 changes: 32 additions & 0 deletions cmake/FindBoost.Atomic.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
if (PREVIEW_USE_SYSTEM_BOOST)
if ("${PREVIEW_BOOST_PATH}" STREQUAL "")
find_package(Boost REQUIRED COMPONENTS atomic)
else ()
find_package(Boost REQUIRED COMPONENTS atomic PATHS "${PREVIEW_BOOST_PATH}")
endif ()
else()
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/config"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/config")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/predef"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/predef")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/preprocessor"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/preprocessor")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/assert"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/assert")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/static_assert"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/static_assert")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/throw_exception"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/throw_exception")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/core"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/core")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/align"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/align")
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/type_traits"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/type_traits")
if (WIN32)
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/winapi"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/winapi")
endif ()
add_subdirectory("${PREVIEW_THIRD_PARTY_DIR}/boost_1_86_0/libs/atomic"
"${CMAKE_CURRENT_BINARY_DIR}/_deps/boost/atomic")
endif ()
17 changes: 17 additions & 0 deletions third_party/BOOST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Boost dependencies

Since C++20 `preview::atomic` uses `std::atomic` by default, but
`boost::atomic` is used before C++20. There are some several options to adjust Boost settings:

***`PREVIEW_USE_BOOST_ATOMIC`***
* Always use `boost::atomic` instead of `std::atomic`.
* Default: `OFF` if compiler provides C++20 `std::atomic`, `ON` otherwise.
* Note: This doesn't check C++ version(i.e., latest AppleClang provides C++20 atomic before C++20)

***`PREVIEW_USE_SYSTEM_BOOST`***
* Use system Boost library instead of bundled Boost.
* Default: `OFF`

***`PREVIEW_BOOST_PATH`***
* Path to Boost library. It will try to find Boost library from system paths if not set.
* Default: Empty string
23 changes: 23 additions & 0 deletions third_party/boost_1_86_0/LICENSE_1_0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/align
Submodule align added at 5ad7df
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/assert
Submodule assert added at 242fdf
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/atomic
Submodule atomic added at fbdb5f
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/config
Submodule config added at 2bd6f0
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/core
Submodule core added at 622476
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/predef
Submodule predef added at 9aca7f
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/preprocessor
Submodule preprocessor added at c4ea7e
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/static_assert
Submodule static_assert added at ba72d3
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/throw_exception
Submodule throw_exception added at 6ff2e5
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/type_traits
Submodule type_traits added at cc6fc3
1 change: 1 addition & 0 deletions third_party/boost_1_86_0/libs/winapi
Submodule winapi added at c5fb9c

0 comments on commit 438cb89

Please sign in to comment.