Skip to content
Merged
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
384e48f
Use separate directory for build
sitaowang1998 Jun 8, 2025
ca3967a
Copy the folder instead of symlink
sitaowang1998 Jun 9, 2025
c70d154
Merge generate and build task; Use checksum to skip tasks
sitaowang1998 Jun 9, 2025
0d49309
Fix path
sitaowang1998 Jun 9, 2025
b5ad554
Fix typo
sitaowang1998 Jun 9, 2025
fe92a80
Use checksum to skip generate; Merge build and install and separate c…
sitaowang1998 Jun 9, 2025
5b0b96c
Fix index
sitaowang1998 Jun 9, 2025
d3775b3
Remove install checksum
sitaowang1998 Jun 9, 2025
96fc539
Remove install checksum
sitaowang1998 Jun 9, 2025
f6a856a
Fix docstring
sitaowang1998 Jun 9, 2025
5f680a4
Fix docstring
sitaowang1998 Jun 9, 2025
c57bf19
Remove use of dir
sitaowang1998 Jun 10, 2025
24c5176
Improve docstring
sitaowang1998 Jun 11, 2025
3651df2
Improve docstring
sitaowang1998 Jun 11, 2025
008fdc4
Use GENERATE_CHECKSUM_FILE instead of GENERATE_CHECKSUM
sitaowang1998 Jun 11, 2025
7271b9d
Rename BUILD_ARGS to BUILD_AND_INSTALL_ARGS
sitaowang1998 Jun 11, 2025
3df61e4
Move cmake step into build-and-install
sitaowang1998 Jun 11, 2025
e01262d
Improve docstring for build-and-install
sitaowang1998 Jun 11, 2025
037a814
Remove duplicate argument in docstring
sitaowang1998 Jun 11, 2025
65c4c60
Fix cmake
sitaowang1998 Jun 11, 2025
9786089
Copy directory without creating target directory
sitaowang1998 Jun 11, 2025
72b2964
Fix docstring
sitaowang1998 Jun 11, 2025
4311d99
Fix argument mismatch
sitaowang1998 Jun 11, 2025
e146d53
Fix docstring
sitaowang1998 Jun 11, 2025
409ffde
Merge branch 'boost-build' of github.com:sitaowang1998/yscope-dev-uti…
sitaowang1998 Jun 11, 2025
339c013
Fix default args
sitaowang1998 Jun 11, 2025
0ad5cba
Fix docstring
sitaowang1998 Jun 11, 2025
7f073d1
Apply suggestions from code review
davidlion Jun 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 76 additions & 69 deletions exports/taskfiles/utils/boost.yaml
Original file line number Diff line number Diff line change
@@ -1,128 +1,126 @@
version: "3"

includes:
checksum: "checksum.yaml"
remote: "remote.yaml"

set: ["u", "pipefail"]
shopt: ["globstar"]

tasks:
# Runs the bootstrap.sh generate step in the given source directory. Boost only supports
# in-source generation and building.
# Copy the source directory into the generate directory. Runs the `bootstrap.sh` script to
# generate `b2` and `project-config.jam` files.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
#
# @param {string} SOURCE_DIR Project source directory.
# @param {string} GENERATE_DIR Directory in which to generate the build files.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# @param {string} GENERATE_CHECKSUM Checksum file of the `GENERATE_DIR` directory.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string[]} TARGETS Target libraries to build.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command.
generate:
internal: true
dir: "{{.SOURCE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
requires:
vars: ["SOURCE_DIR", "INSTALL_PREFIX", "TARGETS"]
vars: ["SOURCE_DIR", "GENERATE_DIR", "GENERATE_CHECKSUM", "INSTALL_PREFIX", "TARGETS"]
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
sources:
- "{{.SOURCE_DIR}}/**/*"
generates:
- "{{.GENERATE_CHECKSUM}}"
deps:
- task: "checksum:validate"
vars:
CHECKSUM_FILE: "{{.GENERATE_CHECKSUM}}"
INCLUDE_PATTERNS:
- "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
cmds:
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
rm -rf "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
mkdir -p "{{.GENERATE_DIR}}"
- >-
cp -R "{{.SOURCE_DIR}}"/* "{{.GENERATE_DIR}}/"
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
- >-
pushd "{{.GENERATE_DIR}}";
Comment thread
sitaowang1998 marked this conversation as resolved.
./bootstrap.sh
--prefix="{{.INSTALL_PREFIX}}"
--exec-prefix="{{.INSTALL_PREFIX}}"
--with-libraries={{(join "," .TARGETS)}}
{{- range .EXTRA_ARGS}}
"{{.}}"
{{- end}}
{{- end}};
popd
- task: "checksum:compute"
vars:
CHECKSUM_FILE: "{{.GENERATE_CHECKSUM}}"
INCLUDE_PATTERNS:
- "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.

# Runs the b2 build step for boost. The caller must have previously called `generate` on
# `SOURCE_DIR` for this task to succeed.
# `SOURCE_DIR` to produce the `GENERATE_DIR` for this task to succeed.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
#
# @param {string} SOURCE_DIR Directory containing the boost source.
# @param {string} GENERATE_DIR Directory containing the boost source and build files.
# @param {string} BUILD_DIR Directory in which to build the project.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the
# default is the number of cores.
build:
build-and-install:
internal: true
dir: "{{.SOURCE_DIR}}"
dir: "{{.GENERATE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
Comment thread
sitaowang1998 marked this conversation as resolved.
JOBS: >-
Comment thread
sitaowang1998 marked this conversation as resolved.
{{default "" .JOBS}}
requires:
vars: ["SOURCE_DIR"]
vars: ["GENERATE_DIR", "BUILD_DIR", "INSTALL_PREFIX"]
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
cmds:
- >-
./b2
install
--build-dir="{{.BUILD_DIR}}"
{{- range .EXTRA_ARGS}}
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
"{{.}}"
{{- end}}
{{- if .JOBS}}
"-j{{.JOBS}}"
{{- end}}

# Runs the b2 install step for boost. The caller must have previously called `build` on
# `SOURCE_DIR` for this task to succeed. If `CMAKE_SETTINGS_DIR` is set, a settings file will be
# created in that directory, containing a `boost_ROOT` CMake variable that points to
# `INSTALL_PREFIX`.
#
# @param {string} SOURCE_DIR Directory containing the boost source.
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command.
install:
internal: true
dir: "{{.SOURCE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
INSTALL_PREFIX: >-
{{default "" .INSTALL_PREFIX}}
CMAKE_SETTINGS_DIR: >-
{{default "" .CMAKE_SETTINGS_DIR}}
requires:
vars: ["SOURCE_DIR", "INSTALL_PREFIX"]
cmds:
- >-
./b2
install
{{- range .EXTRA_ARGS}}
"{{.}}"
{{- end}}
- >-
{{- if .CMAKE_SETTINGS_DIR}}
echo "set(Boost_ROOT
\"{{.INSTALL_PREFIX}}\"
CACHE PATH
\"Package root for boost.\"
)" >> "{{.CMAKE_SETTINGS_DIR}}/boost.cmake"
{{- end}}
# Downloads boost from `URL` and installs boost.
#
# General parameters
# @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory to store the install and src
# @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory to store the src, build and install
# directories inside.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar
# file.
# @param {string} [BUILD_DIR={{.WORK_DIR}}/boost-build] Directory in which to build the project.
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
#
# Download parameters
# @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against.
# @param {string} URL
#
# Boost generate parameters
# @param {string} [GENERATE_DIR={{.WORK_DIR}}/boost-generate] Directory in which to generate the
# project build files.
# @param {string} [GENERATE_CHECKSUM={{.WORK_DIR}}/boost-generate.md5] Checksum file of the
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# generate directory.
# @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/boost-install] Path prefix of where the project
# should be installed.
# @param {string[]} [TARGETS] Target libraries to build.
# @param {string[]} [GEN_ARGS] Any additional arguments to pass to the generate command.
#
# Boost build parameters
# Boost build-and-install parameters
# @param {string} [BUILD_DIR={{.WORK_DIR}}/boost-build] Directory in which to build the project.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the
# default is the number of cores.
# @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the build command.
# @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the build and install
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# command.
#
# Boost install parameters
# @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the install command.
# Boost cmake parameters
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
download-and-install:
Expand All @@ -136,22 +134,26 @@ tasks:
{{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}}

# Boost generate parameters
GENERATE_DIR: >-
{{default (printf "%s/boost-generate" .WORK_DIR) .GENERATE_DIR}}
GENERATE_CHECKSUM: >-
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
{{default (printf "%s/boost-generate.md5" .WORK_DIR) .GENERATE_CHECKSUM}}
INSTALL_PREFIX: >-
{{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}}
TARGETS:
ref: "default (list) .TARGETS"
GEN_ARGS:
ref: "default (list) .GEN_ARGS"
GENERATE_ARGS:
ref: "default (list) .GENERATE_ARGS"

Comment thread
sitaowang1998 marked this conversation as resolved.
# Boost build parameters
# Boost build-and-install parameters
BUILD_DIR: >-
{{default (printf "%s/boost-build" .WORK_DIR) .BUILD_DIR}}
BUILD_ARGS:
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
ref: "default (list) .BUILD_ARGS"
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
JOBS: >-
Comment thread
sitaowang1998 marked this conversation as resolved.
{{default "" .JOBS}}

# Boost install parameters
INSTALL_ARGS:
ref: "default (list) .INSTALL_ARGS"
# Boost cmake parameters
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
CMAKE_SETTINGS_DIR: >-
{{default "" .CMAKE_SETTINGS_DIR}}
requires:
Expand All @@ -166,21 +168,26 @@ tasks:
- task: "generate"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
GENERATE_DIR: "{{.GENERATE_DIR}}"
GENERATE_CHECKSUM: "{{.GENERATE_CHECKSUM}}"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
TARGETS:
ref: ".TARGETS"
EXTRA_ARGS:
ref: ".GEN_ARGS"
- task: "build"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
JOBS: "{{.JOBS}}"
EXTRA_ARGS:
ref: ".BUILD_ARGS"
- task: "install"
ref: ".GENERATE_ARGS"
- task: "build-and-install"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
GENERATE_DIR: "{{.GENERATE_DIR}}"
BUILD_DIR: "{{.BUILD_DIR}}"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"
EXTRA_ARGS:
ref: ".INSTALL_ARGS"
ref: ".BUILD_ARGS"
JOBS: "{{.JOBS}}"
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
{{- if .CMAKE_SETTINGS_DIR}}
echo "set(Boost_ROOT
\"{{.INSTALL_PREFIX}}\"
CACHE PATH
\"Package root for boost.\"
)" >> "{{.CMAKE_SETTINGS_DIR}}/boost.cmake"
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
{{- end}}
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated
Comment thread
sitaowang1998 marked this conversation as resolved.
Outdated