-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace manual threads with parallel for_each
After reading about thread pools in "C++ Concurrency in Action", the previous approach was rudimentary and very likely buggy. It should be easier and safer to rely on the standard algorithms. The CMAKE_OSX_DEPLOYMENT_TARGET became necessary with the inclusion of experimental-library, otherwise the following warning appeared: ld: warning: object file (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc++experimental.a[arm64][3](libdispatch.cpp.o)) was built for newer 'macOS' version (15.2) than being linked (15.0)
- Loading branch information
1 parent
d26604e
commit 74fe8ab
Showing
2 changed files
with
17 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET 15.2) | ||
|
||
# Export compile commands for tools like clang-tidy | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Parallel algorithms support for Clang 17+ and operating systems with libc++ | ||
# Primary source: | ||
# https://libcxx.llvm.org/UserDocumentation.html#enabling-experimental-c-library-features | ||
# Found via https://github.com/Stellarium/stellarium/pull/3902/files via | ||
# https://github.com/Stellarium/stellarium/pull/3902 via | ||
# https://github.com/llvm/llvm-project/issues/57898 | ||
if((${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 16.0) | ||
AND (APPLE OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexperimental-library") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters