-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
230 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: On Release | ||
|
||
# By default, a workflow only has read permissions. | ||
# Add the needed permission to write release assets | ||
permissions: | ||
contents: write | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
name: Add Release Assets | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Amalgamate single-file poolstl.hpp | ||
run: ./create_amalgamates.sh | ||
working-directory: tools | ||
|
||
- name: Upload poolstl.hpp | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./tools/poolstl.hpp | ||
asset_name: poolstl.hpp | ||
asset_content_type: text/plain | ||
|
||
# - name: Upload poolstl_nopool.hpp | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ github.event.release.upload_url }} | ||
# asset_path: ./tools/poolstl_nopool.hpp | ||
# asset_name: poolstl_nopool.hpp | ||
# asset_content_type: text/plain |
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
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Amalgamate multiple header files into one. | ||
""" | ||
import argparse | ||
from pathlib import Path | ||
import sys | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument("root", type=Path, | ||
help="Root header file.") | ||
|
||
parser.add_argument("-o", "--output", type=Path, default=None, nargs='?', | ||
help="Path to write output to.") | ||
|
||
parser.add_argument("-H", "--header", type=Path, default=None, nargs='?', | ||
help="Header to use instead of the one in the root file.") | ||
|
||
parser.add_argument("-e", "--exclude", type=Path, default=[], nargs='*', action='extend', | ||
help="Include files to pretend are already included.") | ||
|
||
return parser.parse_args() | ||
|
||
|
||
seen_includes = set() | ||
|
||
|
||
def process_file(out, path: Path, drop_header=False): | ||
in_header = True | ||
base = path.parent | ||
out.write("\n") | ||
with path.open("r") as infile: | ||
for line in infile.readlines(): | ||
if in_header and drop_header: | ||
if line.startswith("#"): | ||
in_header = False | ||
else: | ||
continue | ||
|
||
if line.startswith("#include"): | ||
_, inc = line.split() | ||
incpath = base / inc[1:-1] | ||
|
||
if incpath in seen_includes: | ||
continue | ||
|
||
seen_includes.add(incpath) | ||
|
||
if inc.startswith('"'): | ||
process_file(out, incpath, drop_header=True) | ||
continue | ||
|
||
out.write(line) | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
|
||
for e in args.exclude: | ||
seen_includes.add(e) | ||
|
||
out = sys.stdout if not args.output else args.output.open("w") | ||
|
||
if args.header: | ||
out.write(args.header.read_text()) | ||
|
||
process_file(out, args.root, drop_header=bool(args.header)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause OR MIT OR BSL-1.0 | ||
/** | ||
* @brief Thread pool-based implementation of parallel standard library algorithms. Single-file version. | ||
* @see https://github.com/alugowski/poolSTL | ||
* @author Adam Lugowski | ||
* @copyright Copyright (C) 2023 Adam Lugowski. | ||
* Licensed under any of the following open-source licenses: | ||
* BSD-2-Clause license, MIT license, Boost Software License 1.0 | ||
* | ||
* | ||
* BSD-2-Clause license: | ||
* | ||
* Copyright (C) 2023 Adam Lugowski | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* | ||
* | ||
* MIT License: | ||
* | ||
* Copyright (c) 2023 Adam Lugowski | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* 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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
* | ||
* | ||
* Boost Software License 1.0: | ||
* | ||
* 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. | ||
*/ |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
python amalgamate.py ../include/poolstl/poolstl.hpp --header amalgamate_header.hpp -o poolstl.hpp | ||
|
||
# create a version that excludes the thread pool | ||
python amalgamate.py ../include/poolstl/poolstl.hpp --header amalgamate_header.hpp -o poolstl_nopool.hpp -e ../include/poolstl/internal/task_thread_pool.hpp | ||
|